home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 26
/
CD_ASCQ_26_1295.iso
/
vrac
/
tvme30.zip
/
HISTORY.DOC
< prev
next >
Wrap
Text File
|
1995-08-02
|
42KB
|
780 lines
TVMEditor Library History
=========================
** Turbo Vision 1.03 Users:
** ------------------------
** Please see the notes on 03/07/94 regarding a bug fix to the Turbo
** Vision file TGROUP.CPP. The bug fix is required so that
** TVMFileEditor::valid() can work properly. Also look at TVBC4BUG.DOC.
** These bugs have been fixed in Turbo Vision 2.0.
**
** Turbo Vision 2.0 Users:
** -----------------------
** Please see the notes on 06/25/94 regarding a bug fix to the Turbo
** Vision file TSTATUSL.CPP and on 07/29/94 for a bug fix to the Turbo
** Vision file TEVENT.CPP. The bug fixes are required so that TVMEditor
** will work properly. If you have access to CompuServe, download
** TV2BUG.ZIP from library 11 of the BCPPDOS forum which contains a list
** of known Turbo Vision 2.0 bugs and their patches.
**
** BC++ 4.0/4.02 32-BIT COMPILER WARNING:
** --------------------------------------
** Be careful when using any optimization (-O type options) with the
** BC++ 4.0/4.02 32-bit compiler. It tends to generate some bad code
** or take hours to compile under certain situations when those options are
** used. If you experience problems when compiling 32 bit applications,
** insure that all optimizations are turned off (i.e. use -Od as the last
** command line switch or turn them all off via the Optimizations section
** of the Local Options dialog in the IDE) and try again. The BC++ 4.5
** release apparently fixes these problem. Use -DOPT32 with the TVMEditor
** make files to include the optimizations and generate optimized code.
Version 3.00
------------
Thanks to Marc Brouillette, Clifford Pecota, and David Bench for the
bug reports. Thanks to Marc Brouillette, Clifford Pecota, and Hycel
Taylor for the suggestions on new features. Special thanks to Mike
Lucek and Collaborator Systems for their many suggestions for
improvements to the editor and word wrapping code and also for helping
me find the bugs in the new features.
08/02/95 - Version 3.00 released.
07/22/95 - Updated the documentation. The information in this file has
been shortened and you should refer to the manual which is
current and contains complete details on all items prior to
this date.
06/27/95 - Fixed cursor positioning problem when overwrite blocks was
enabled. Altered cmTextStart and cmTextEnd to place the cursor
at the start of the line and end of the line respectively instead
of maintaining the column position.
06/14/95 - Fixed auto wrap so that the indentation is properly retained
and the cursor is positioned correctly when there is an indent
on the wrapped portion containing the cursor. Note that
Trailing Spaces may need to be enabled to retain the indent
when blank lines are encountered.
06/09/95 - Added 'ushort TVMEditor::getSelectedText(char *buffer, ushort
len, char LineTerm, Boolean *NotDone)' to retrieve the
selected text block from an editor. Also added 'ushort
TVMEditor::getSelectedTextSize(char LineTerm)' which returns
the size of the selected text block.
05/27/95 - Added cmForceReformat event that can be broadcast to force a
reformat of the editors/memos. The editors/memos do not clear
the event so it will be passed to all active editor objects.
Fixed TVMMemo to adjust right margin properly when left boundary
is not zero.
05/24/95 - Fixed some more problems with the new auto wrap/hard return
features. Fixed insertAtCursor() to recognize CR/LFs. Renamed
the DIAGNOSTICS flag to TVME_DIAG to avoid naming conflicts.
04/28/95 - Added 'static char EOLMarker' to the TVMEditor class. Set
this character to the one you want wrapPara() to use when
determining if a line should not be lengthened. By default
it is '\xFF'. For a usage example and an idea of what this
does, compile the demo with the switch '-DAUTOEOL'.
04/25/95 - Altered TVMMemo::LoadMemo() to use the default line terminator
as set in the constructor or via setLineTerminator() if one is
not found in the text. This function now returns True under
all circumstances.
04/12/95 - Altered the demo to allow use of CSH 1.00 (Color Syntax
Highlighter Library). See DEMO.MAK for details on how
to include it in the build.
Fixed cmPrintBlock and cmWriteBlock so that they respected the
block's column start and end positions.
04/04/95 - Fixed a bug in TVMEditor::setState() that caused a failure to
track ownership of the buffer when two memo fields or a file
editor and a memo field were sharing a buffer.
03/23/95 - Added two more new option bits. efNonPersistentBlocks and
efAllowOverwrite which combine to form efOverwriteBlocks.
These options allow the editor to use non-persistent and, if
selected, overwriteable blocks. If non-persistent blocks are
enabled and overwriteable blocks are disabled, inserting text,
deleting text, or moving the cursor will simply deselect any
currently highlighted block. Alternately, efAllowOverwrite
can be enabled along with efNonPersistentBlocks to delete the
selected block under those conditions. Overwriteable blocks
are not possible with persistent blocks because you can move
the cursor away from the block. Inserting text in that case
would delete the block and insert the new text at the wrong
location (this behaviour conforms to the way the BC++ 3.1 IDE
uses these options).
**NOTE: This has caused another renumbering of the efXXXX
constants. Alter any option dialog box code you are
using to reflect these changes (see BLDRSC.CPP).
02/26/95 - Added Boolean TVMEditor::insertAtCursor(const char *text).
This can be used to insert characters at the cursor's current
location. It returns True if the insertion was successful
or False if it failed. Text is inserted one character at a time
so that wrapping can occur if necessary.
02/25/95 - Added 'long getTextSize(void)' to the TVMEditor and
TVirtualMemory classes. Each returns the total number of
characters in the editor buffer. The difference between the
two is that TVMEditor::getTextSize() will account for the
extra carriage return on each line when the efUseLFOnly
option bit is not set.
Added the cmResizeReformat broadcast event. This event
should be broadcast after cmTile and cmCascade so that all
open editors can reformat themselves if they have their Wrap
on Resize option bit enabled. Derived edit windows may also
need to issue this event to their editors when cmZoom is
seen. TVMEditWindow does this automatically. Examples:
case cmTile: // Tile current windows
deskTop->tile(deskTop->getExtent());
// Tell all editors to Reformat on Resize if they need to.
message(deskTop, evBroadcast, cmResizeReformat, NULL);
break;
case cmCascade: // Cascade current windows
deskTop->cascade(deskTop->getExtent());
// Tell all editors to Reformat on Resize if they need to.
message(deskTop, evBroadcast, cmResizeReformat, NULL);
break;
TVMEditWindow::handleEvent() code:
// Tell the editor to Reformat on Resize if necessary.
if(event.what == evCommand && event.message.command == cmZoom)
{
TWindow::handleEvent(event);
message(editor, evBroadcast, cmResizeReformat, NULL);
}
else
TWindow::handleEvent(event);
02/18/95 - Fixed TVMMemo::LoadMemo() so that it refreshes the editor's
local line buffer and the display when new information is
loaded.
01/07/95 - Received BC++ 4.5 and tested the updated 32-bit compiler with
the code optimizations. I found out that EBX can by used
like EDI and ESI by the BC++ 4.xx compilers and should be
preserved by any 32-bit assembler modules that use it.
UNIQNAME.ASM, DPMIDESC.ASM, and SCANBKWD.ASM were altered to
save and restore the (E)BX register. BC++ 4.5 tends to
favour EBX for the 'this' pointer whereas BC++ 4.0/4.02
tended to favour EDI.
BLDRSC.CPP, TVEDIT1.CPP, TVMINDIC.CPP, TVMEDWIN.CPP, and
TVMEDSTR.CPP required the addition of #define
Uses_TStreamableClass prior to #include <tv.h>. I think this
is because BC++ 4.5 has tightened up the language rules once
again and requires TStreamableClass to have its class
definition processed.
Altered the make files to allow optimizations in the build
for 32-bit protected mode versions. Use '-DOPT32' to enable
them. So far, no problems have been experienced with BC++
4.5's use of the code optimizations in question. This option
should *NOT* be used with BC++ 4.02 or less however..
12/07/94 - Added the default TV 2.0 DPMI module definition file
(TV20DPMI.DEF) to the DEMO.MAK build. See TV2BUGS.ZIP for
details on why this should be used for all TV 2.0 DPMI
applications.
12/04/94 - Added Signs of Life calls in the wrapPara() function and altered
the demo handler to include it. Also modified the terminating
slDone calls so that it sets sl_Type to slDone to prevent problems
if Signs of Life are subsequently disabled. For wrapPara(), the
caller must start and end Signs of Life. This is because
wrapPara() may return sooner than the caller wants due to the
wrapping rules.
11/28/94 - Added cmAutoWrapMode (Default: ^OM) and cmWrapOnResize (Default:
^OR) as commands to change the associated editor modes. Note
that toggling Auto Wrap mode on and off via the keyboard will NOT
toggle normal wrap mode on and off. It just defines slightly
different rules when performing word wrapping. These options
turned out better than expected, so I have moved their option
bits into a position where they are also considered to be local
options. Please note that this has resulted in a renumbering of
the efXXXX and cmXXXX constants.
The 'W' flag on TVMIndicator was altered to display a lowercase
'w' when Auto Wrap Mode is disabled and an uppercase 'W' when
Auto Wrap Mode is enabled.
efSetROonLoad is now one of the default global options and I have
set the default right margin to 72 as I've found that I use that
value more often than 76.
Altered SWAPVMEM.CPP so that it can be compiled by users who
do not have TASM 4.0. The #pragma inline is for my debugging
purposes only.
11/27/94 - The minimum conventional memory buffer size has been reduced to
1K. The TVMMemo constructor has been altered to use 1K as its
default for the bufSizeInK parameter. This makes the memo fields
as memory efficient as possible. Page size is set to the maximum
line length whenever a bufSizeInK value less than 4 is specified.
You can also use buffers smaller than 4K for editors at the cost
of performance.
11/11/94 - Fixed a bug in wrapPara() that caused loss of spaces when hard
tabs where present in a line. Also altered the code slightly to
prevent redundant putLineLRU() calls. This greatly reduces its
use of virtual memory when no wrapping is really needed. This is
most noticeable when using the Wrap On Resize feature.
Fixed a bug in the auto wrap function that caused several
anomalies in cursor movement when auto wrapping was enabled.
Changed TVMMemo::RetrieveMemo so that it insures the last edited
line is saved. If TVMMemo::valid() was not used, it sometimes
missed the last edits if the cursor didn't leave the line.
11/02/94 - Changed VMEMPAGESIZE in TVIRTMEM.H to 65537L for DPMI16 and
DPMI32. 65536L caused GlobalReAlloc() to GPF. This is a bug in
the 16-bit RTM.EXE. It worked fine in 32-bit protected mode.
Borland is aware of the problem.
10/25/94 - Fixed incorrect usage of '||' instead of '&&' in
TVMMemo::setLineTerminator().
Added support for BC++ 3.1 with Turbo Vision 2.0 in the make
files. Download B31TV2.ZIP from library 11 of the BCPPDOS forum
on CompuServe for full information on how to compile the TV 2.0
library for use with the BC++ 3.1 compiler.
10/03/94 - Support for automatic word wrapping has been added. To use it,
the efAutoWrap bit must be enabled. Auto wrapping may use a lot
of virtual memory if undo/redo is enabled. If virtual memory is
at a premium, you might want to consider turning off undo/redo
when auto wrapping is enabled.
To support the new efAutoWrap option bit, I have added the
function void TVMEditor::doAutoWrap(void). It is called after
each of the cmDelXXXX commands and from the insertChar()
function.
09/28/94 - The efReadOnly and efSetROonLoad bits are now considered "other
options" and appear after the global option bits. These bits are
available for your use, but probably should not be user
modifiable via a dialog box. They are in the demo program's
Default Editor Options dialog box so that you can see the effects
of having these bits turned on or off. The most likely use of
these bits is to turn them on in the application's start-up code
and leave them on. The editors will inherit and use them like
the other local options.
Added void TVMEditor::reformatAll(void) as a means to support the
new efWrapOnResize option bit. It performs an unconditional
reformat of the entire document. Please be aware that unlike a
dedicated file viewer, TVMEditor is not designed to handle this
sort of thing by default. As noted in the documentation, if
text is formatted in specific ways, it may reformat too much or
not enough. It is generally best used on small Read Only files
or memos consisting of text formatted into paragraphs. Refer to
the documentation on the auto wrapping, wrap on resize, and
EOLMarker options for information that will help you in the event
that you wish to use the Wrap On Resize feature.
09/25/94 - Added a 'Boolean releaseMem' parameter to the doneBuffer()
functions. By default, it is True. This will allow the
deleteLineInfo() function to release all virtual memory back to
the system for use by other editors. If you wish to retain the
purged information for undo/redo purposes, pass this new
parameter as False.
Reassigned the MemoryCheck values and added a TVMAutoDetect
definition. If set to TVMAutoDetect, the virtual memory system
will decide at runtime whether to use EMS or XMS based on which
is more abundant. If both EMS and XMS are available in equal
amounts, XMS will be favoured. The default value for MemoryCheck
is now TVMAutoDetect.
The virtual memory system has been altered by moving the EMS/XMS
detection code into a separate function. This made it easier to
implement TVMAutoDetect support and also the ability to query the
system as to how much of each type of memory is free. New
functions (only present in the real mode library):
static void TVirtualMemory::detectMemory(void);
static void TVirtualMemory::queryFree(long *EMS, long *XMS);
The THeapViewer class for the demo has been updated so that the
real mode version displays free EMS and XMS memory amounts too.
E=EMS, X=XMS, C=Conventional memory. All amounts are in K-bytes.
09/24/94 - Fixed a bug in the TVirtualMemory class that resulted in a page
occasionally swapping out before it was supposed to due to
priority deadlocks when manipulating megabyte-sized blocks.
Due to the abysmally slow speed when cutting and pasting
megabyte-sized blocks of text, I have optimized the virtual
memory system. The bottleneck was in the way it handled line
information. By optimizing those operations, shifting huge
blocks of text around is up to 30 to 40 times faster with this
release. Performance may degrade slightly over time, especially
when undo/redo is enabled, but it never gets anywhere near as
slow as the prior versions.
To prevent the editors from retaining virtual memory that they no
longer require when undo/redo is turned off, the function 'void
TVirtualMemory::resetVirtualMemory()' was added. It is called by
deleteLineInfo() when the entire contents is deleted. It simply
releases all allocated virtual memory, removes any swap file it
may be using, and resets all virtual memory variables to their
initial state. This makes the editors more efficient because
they will return all unused memory to the system for re-use
instead of holding it indefinitely when it may never be re-used.
This is especially true when dealing with subsequent clipboard
operations or after a call to TVMEditor::doneBuffer().
09/14/94 - Altered TVMFileEditor to make use of the new efSetROonLoad bit.
If set and a Read Only file is loaded into the editor, the Read
Only bit is automatically turned on so that it can't be edited.
Version 2.00
------------
Thanks to John Gilbert, Hycel Taylor, Ronnie Wulfsohn, Mark Pinnuck, and
Christopher Pope for pointing out a couple of potential problems, bugs, and
oversights. Thanks to Borland for finally releasing an updated Turbo Vision
and a protected mode compiler.
Starting with this version I have decided to drop the library only
registrations and go with a single, full source registration. Over 90% of
prior registrations were for the full source version. Also, due to the two
compiler and two Turbo Vision versions, attempting to manage and generate
all the different registration types and library types became cumbersome.
The source code can be used to generate a library for any compiler/Turbo
Vision combination via conditional compilation. I have also switched over
to using make files to simplify the build process due to the various types
of library that can now be generated. Using make files allows the creation
of various forms of the library by simply specifying some command line
switches. Read the header comments in the make files. They will give you
all the necessary details.
07/31/93 - Version 2.00 released.
07/29/94 - Updated the documentation.
*** This bug fix pertains only to Turbo Vision 2.0 users ***
Tracked down a bug in TEVENT.CPP. In 32-bit protected mode,
calls to the Win32 console functions fill in the
event.mouse.controlKeyState data member. When using real mode or
16-bit protected mode, this data member is not filled in with any
value. The garbage value in it causes unpredictable results if
you try to make use of it. Here is the fix:
In TEVENT.CPP, lines 105-107 in TEventQueue::getMouseEvent() are:
ev.mouse.eventFlags = 0;
if( ev.mouse.buttons == 0 && lastMouse.buttons != 0 )
Change them to:
ev.mouse.eventFlags = 0;
#if !defined(__FLAT__) // BUG FIX
ev.mouse.controlKeyState = THardwareInfo::getShiftState();
#endif
if( ev.mouse.buttons == 0 && lastMouse.buttons != 0 )
******************************************************************
07/24/94 - Added 'Boolean TVMMemo::setLineTerminator(char lTerm)' to the
TVMMemo class. Pass it '\x0', '\r' (for "\r\n"), or '\n' to set
the line terminator type. This is useful for buffers that are
(or could be) blank when constructed and executed. By default,
such memo fields default to using '\r' (CR+LF) as the line
terminator.
Added code to create a low memory descriptor to access the BIOS
keyboard flags. If you define your own descriptor to access the
BIOS keyboard flags directly as I just did, *DON'T* use TV's
kbXXXXX constants as bit masks for CAPS, NumLock, etc. In the
flat memory model it uses the constants from WINCON.H which don't
match up to the real and 16 bit mode constants. Either define
your own constants to match the others or use literal values
instead. Don't ask how long it took me to figure that one out.
Added the function 'void AllocateDescriptor(void)' to the
library. The TVMEditor constructor calls it to allocate a
descriptor used in accessing the BIOS keyboard flags and to
register an exit function that will free it when the program
ends. On subsequent calls, it will simply return. To go with
this a new static data member was added:
static unsigned short TVMEditor::lowMemDesc;
This is public and you are free to use it so that your own code
can access the BIOS etc. If you use it prior to instantiating an
editor, call AllocateDescriptor() to establish its value.
07/07/94 - Added a private data member 'static short MaxAllocatedPages' and
public access functions 'static void setMaxAllocation(long
maxBytes)' and 'static void getMaxAllocation(void)' to the
TVirtualMemory class. These can be used to set or get the
maximum number of bytes (tracked internally as pages) that can be
allocated by an instance of the class before disk swapping is
forced. This prevents one editor from consuming all available
memory.
Got the 32 bit assembler versions of unique_name(), scanFwd(),
and scanBkwd() working. Note that in scanBkwd(), the 'short
SearchLen' parameter was changed to 'int SearchLen' to make the
prototypes the same for the 16 and 32 bit versions. The 32 bit
version pushes a 32 bit int on the stack instead of a 16 bit
short probably due to the return value of strlen() being used in
there somewhere (?). Anyway, the type change keeps it working
properly in either version.
Fixed up the heap viewer code a little so that it displays a more
accurate total of the free memory available in 32 bit protected
mode.
07/05/94 - Added 'inline void setDefaultMessage(const char *msg)' to the
TVMEditor class to allow setting of the indicator message from a
source external to the TVMEditor class or one derived from it.
06/30/94 - Scrapped the 16/32 bit DPMI virtual memory class that I wrote
earlier and started again. Now the class works in a similar
fashion to the EMS/XMS version (SWAPVMEM.CPP is replaced by
SWAPDPMI.CPP) but uses the abundant supply of conventional memory
before swapping to disk. My knowledge of protected mode memory
allocation is limited right now, so this may change again later
when I understand protected mode programming better.
06/25/94 - *** This bug fix pertains only to Turbo Vision 2.0 users ***
Tracked down a bug in TSTATUSL.CPP when a status line object is
stored in a resource file using 32 bit protected mode. The size
difference for 'int' (32 bits long) and 'short' (16 bits long)
causes the application to crash when reading it back in. Here's
how to fix it:
In TStatusLine::readItems(), line 267 is: int key, cmd;
Change it to: ushort key, cmd;
In TStatusLine::readDefs(), line 287 is: int min, max;
Change it to: ushort min, max;
*****************************************************************
XY block marking required changes to the hasSelection() function.
These changes are to insure proper detection of a marked block
but now prevent it from being an inline function. Therefore, it
was moved to TVMEDIT1.CPP and only the prototype exists in
TVMEDIT.H.
06/24/94 - Start Block (^KB) and End Block (^KK) can now be used to alter
the starting or ending point of a marked block. This provides an
effective block extension method if you ever start or stop the
block in the wrong place (shift-clicking the mouse can also be
used (noted below) but it works in a slightly different manner).
Note that if you hit ^KB (start block) at a position after the
end point, the old block will be unselected and a new block
started. If you hit ^KK (end block) at a position prior to the
start point, the request is ignored.
The persistent marked block was a little too persistent in
nature. Therefore, the TVMEditor::adjustBlock() function was
added and other necessary code was added to some existing
functions so that as text is edited, the block start and end
points are adjusted to maintain their proper position whenever
possible.
06/21/94 - Added conditional compilation for 32 bit inline assembler code to
TVMEDIT1.CPP and TVMINDIC.CPP. This caused the compiler to crash
or give odd errors when it recompiled via assembler. The 32 bit
assembler code was then replaced with straight C code or
__emit()__ statements for when the library is compiled for the
flat memory model. 32 bit inline assembler does work in other
modules though. Possible compiler bug? Problems seems to be
related to the streamable stuff in the generated assembler
source.
Added a cmReSynch command that the TVMFileEditor class will
recognize as an evBroadcast event. When received, it will check
the date and time stamp of its associated file on disk (if one
exists). If the date and/or time stamp is different, it will
call the editorDialog() function with a value of edReSynch and a
pointer to the filename. You can make the editorDialog()
function query the user as to whether or not the file should be
reloaded or simply return cmYes to force a reload. Not handling
the event or returning a value other than cmYes will prevent the
file from being reloaded.
06/20/94 - Finally had some time to finish changing the line-only block
marking to XY (column + row) marking to mimic the original
TEditor classes. To this end, 'short selStartC' and 'short
selEndC' (start line column and end line column) where added to
the TVMEditor class. A 'Boolean isSelecting' parameter was also
added to the TVMEditor::moveChar() and TVMEditor::moveWord()
functions too. In those functions, and TVMEditor::moveLine() as
well, it is set to default to False if unspecified in the
function call. Two extra smXXXXX constants (smMouse and smLine)
were added to TVMEDIT.H to signal that the mouse is being used to
mark a block of text. smLine indicates that the starting point
was double clicked to select whole lines as the mouse is dragged.
Note that this change significantly alters the way blocks of text
are selected. The block selection now mimics that of the
original TEditor in that it can start and end on any column
within a line. This includes the ability for a block of text to
start and end on the same line (i.e. to highlight a single word
or a few characters). Clicking the mouse anywhere within the
text will move the cursor to the new location as before, but will
also cause any currently selected block of text to become
unselected and mark the new cursor location as the start of the
selected text. Dragging the mouse will extend the block. Double
clicking the starting point will allow you to select whole lines
as you drag the mouse up or down. A block can also be extended
by shift-clicking (hold down either shift key and click the mouse
in the new location).
Be aware that the commands that worked on whole lines before
such as Paragraph Reformat, Indent Lines, Unindent Lines, Center
Lines, and Align Text will still use only with whole lines
regardless of where the block starts or ends.
05/29/94 - Added a new data member to the GlobalEditorOptions structure:
char PrintDevice[MAXPATH]. By default, it is set to LPT1, but it
can be changed to LPT2, COM1, COM2, a filename, etc. This allows
the default TVMFileEditor::PrintBuffer() function to be a little
more flexible by allowing the user to specify the output device.
It was also altered to use low level, unbuffered, binary writes
so that it stops printing when there is an error and ESC is
pressed in the critical error handler. fprintf() didn't always
do this properly because it buffered the output.
05/26/94 - Changed all occurances of 'near' to _NEAR, 'far' to _FAR, and
'huge' to _HUGE so that the code is compatible with 32 bit DPMI
which uses a flat memory model (doesn't use or need near, far,
and huge).
05/25/94 - Improved the performance of TVMFileEditor's read and write
functions by using an adjustable buffer. It shouldn't be quite
so slow on large files now. However, do note that unlike most
editors, the text is moved through a small conventional memory
buffer instead of being allowed to utilize all available memory
for storage.
Started adding the necessary alterations to make the library TV
1.03, TV 2.0, and DPMI compatible.
05/20/94 - Due to several requests and my own forgetfulness as to why I ever
made it protected in the first place, 'LocalEditorOptions Opts'
is now a public member of TVMEditor. This makes it a whole lot
easier to directly alter the tab size, indent size, and right
margin value without going through a user dialog or derived
class.
Combined the following functions:
void TVMEditor::forceUpLow(long from, long to, ushort cmnd);
void TVMEditor::toggleCase(long from, long to);
void TVMEditor::indentLines(long from, long to);
void TVMEditor::unindentLines(long from, long to);
void TVMEditor::centerLines(long from, long to);
void TVMEditor::alignText(long from, long to);
into one function:
void TVMEditor::alterText(long from, long to, ushort cmnd);
The basic logic flow of the above functions was identical and it
made more sense to combine them in light of the modifications for
"Signs Of Life" (see below) and impending changes to implement XY
block marking. Otherwise there would have been a lot of
unnecessary code duplication. It also allows for a user hook to
alter blocks of text in ways other than cmForceUpper,
cmForceLower, cmToggleCase, cmIndentBlock, cmUnindentBlock,
cmCenterLines, and cmAlignText. If the 'cmnd' parameter is not
one of those, the editorDialog() function is called with a value
of edAlterText followed by the command, a pointer to the line's
text, and starting and ending columns values which denote what
part of the line should be affected by the command. If the
editorDialog() function returns cmCancel, nothing is changed. If
it returns cmOK, then the altered text is stored. This makes the
editor more extensible.
Signs Of Life
-------------
General additions for the "Signs of Life" modification:
// These are the different states that the signsOfLife() function can be
// called to handle.
enum SignsOfLife { slInitiate, slReporting, slHide, slShow, slDone };
// Signs of Life handler definitions
typedef void (*TVMSignsOfLife)(SignsOfLife, ushort, long, long);
void VMdefSignsOfLife(SignsOfLife, ushort, long, long);
The GlobalEditorOptions structure contains these two extra
fields:
// Signs of Life.
// These two values indicate when signs of life should be issued by
// the editor. What this means is that after initThreshold lines,
// the editor will place a call to the signsOfLife() function to let
// the user know it is still working and hasn't locked up. After that,
// it will place a call to it every reportInterval lines.
short initThreshold;
short reportInterval;
The TVMEditor class now contains an additional static pointer
member (like it does for editorDialog).
static TVMSignsOfLife _NEAR signsOfLife; // Signs of Life function.
For complete details on how this all works, read the manual
sections on Signs of Life and for the above items. Also look at
the demo program in TVEDIT3.CPP. It has a simple but functional
example.
05/19/94 - Added to TVMEditor : virtual void doneBuffer(void)
Added to TVMFileEditor: virtual void doneBuffer(Boolean reloadFile)
I missed this one from the original TEditor classes. See the
manual for full details and also the reference to cmReSynch in
the 06/21/94 notes.
05/09/94 - Added one new function to the library in general and added two
new functions to the TVMEditor class (see manual for details):
char *unique_name(char *s);
void TVMEditor::setSelect(short fromX, long fromY, short toX,
long toY, Boolean goTop = False);
void TVMEditor::putCursorAt(short x, long y, Boolean center = False);
Finally made TVirtualMemory::MemoryCheck's default value
TVMXMSFirst to look for XMS before EMS. In most cases, it is
more readily available than EMS memory.
05/06/94 - Fixed a bug in TVMMemo::LoadMemo() that caused a single line
terminated by a NULL to be ignored. Please note that for single
lines like this, the LineTerminator setting used when retrieving
the text will be set to the NULL character. If you want lines of
text to be terminated with a line feed or carriage return+line
feed upon retrieval and it is possible that only a single NULL
terminated line may be inserted to start with, be sure to append
such character(s) to the end of the text before loading the memo
field.
04/08/94 - Made the TVMEditor::setXIndex() and TVMEditor::setScrIndex()
virtual. These two functions are used to synchronize the screen
cursor and text insertion point. They were made virtual to allow
the embedding of special codes in the text. Overriding these
functions allows you to skip past them and maintain a proper
cursor position.
04/06/94 - Made the TVMEditor::drawLines() function virtual. This is the
function that does the real screen updates and will need to
be overridden in derived classes that alter the drawing mechanism.
03/31/94 - Added a new private data member and an access function to the
TVMIndicator class: const char *DefaultMsg and
inline void TVMIndicator::setDefaultMessage(const char *msg);
03/28/94 - Added preprocessor directives to TVIRTMEM.H so that string.h
got included if it hadn't been done already. This is because
some inline functions in it use strcpy().
Altered TVMIndicator::draw() slightly to suppress the display of
the modification indicator when in Read Only mode so that it
doesn't show up when text is being altered by an external source
on purpose (i.e. a terminal object with scrollback).
Version 1.10
------------
Thanks to Randy at Safari Software for the suggestion to merge the
separate EMS and XMS versions into one library that would handle either type
based on what was available at runtime. Thanks to David Bench and Chris
Abdelmalek for reporting a couple of bugs and other problems that are now
fixed.
03/10/94 - Version 1.10 released.
03/07/94 - *** This bug fix now pertains only to Turbo Vision 1.03 users ***
After looking for a bug in the TVMFileEditor class, it was
discovered that a bug fix is needed in Turbo Vision's TGROUP.CPP.
As it stands, the call to messageBox() in the doEditDialog()
function prompting to save an altered or untitled file changes
the value of a static local variable in TGROUP.CPP because the
message dialog box calls its valid() function before closing.
Subsequent calls to any valid() function after that (i.e. other
modified or untitled editors) result in the "command" parameter
containing the value returned by the messageBox() function, not
the cmQuit command that should be there. This causes the valid()
function of the other editors (or other objects) to perform
incorrectly. Here's what to do:
In TGROUP.CPP, lines 503 to 514 are:
static ushort cmd;
Boolean isInvalid( TView *p, void * )
{
return Boolean( !p->valid( cmd ) );
}
Boolean TGroup::valid( ushort command )
{
cmd = command;
return Boolean( firstThat( isInvalid, 0 ) == 0 );
}
Change them to:
// !! static ushort cmd; // COMMENT OUT OR DELETE THIS LINE.
Boolean isInvalid( TView *p, void *commandP )
{
return Boolean( !p->valid( *(ushort *)commandP ) );
}
Boolean TGroup::valid( ushort command )
{
// Pass a pointer to the command, DON'T use a static variable.
return Boolean( firstThat( isInvalid, &command ) == 0 );
}
This fix and many others can be found in the files KVBUGS.ZIP,
TVBUGS.ZIP, and SYSFIX.ZIP in library 11 of the BCPPDOS forum.
One thing to note, I think there are two copies of TVBUGS.ZIP in
the library, one is 3K the other 13K in size. You will want the
one that is 13K. You may need to go in and retrieve it manually
instead of letting an automated navigator program go after it.
Once you apply the above patch to the TGROUP.CPP source file and
rebuild the TV.LIB library, a recompiled TVEDIT or other
application will work as advertised. My library already
contained the above fix with the initial release so I was not
aware of the problem until a user reported it.
*****************************************************************
Added a TVirtualMemory::Broadcast() member function to handle
events that should be broadcast to all owners of a shared buffer.
02/28/94 - Added the TVirtualMemory::MemoryCheck data member to the
virtual memory class to allow the setting of a user
preference regarding EMS/XMS usage. This is only accessible
from the registered version. The supplied demo executable
does demonstrate this ability though (See Options | Start-Up
Options).
Merged the low level XMS function code into the EMS functions to
form one library that uses either EMS or XMS based on what is
available and takes into account the user's preference for memory
type.
Version 1.00
------------
02/18/94 - Version 1.00 released.