Project Notes for BSEDIT

Regarding original code
-----------------------

The orginal source code was intended for dialog editor DLG.EXE (see web uso.free.fr), it being the best example of an Allegro GUI editor that I could find.

1. Potential Bug in dlg edit code in function register_proc_set()

Firstly does ANSI C++ always copy old contents to new location with realloc()?
Code is trusting realloc() not to use a new location or that it will transfer data if it does: should test and transfer old data if necessary.

MEMORY LEAK: If the new set is not a child, the child MENU created is not freed.

2. Note really a bug, more it's a trap for lazy programmers. The original dlgedit.c code has a commented "break" after case MSG_CHAR in xedit_proc(), which, if accidently uncommented, causes a failure for any control keys using xedit_proc. (IT TOOK ME TWO DAYS TO SPOT THE DIFFERENCE BETWEEN WORKING AND BUGGY CODE.)

Conversion to C++
-----------------

Warning:Using the C++ function "new" in d_edit_proc seems to show no respect for memory allocated using "new". Need to use malloc instead or redefine "new".

Any Allegro GUI arrays need to have the dp field type specified; if trying to pass a char* to dp which is type void* will cause an error in C++ compilation using DJGPP.

A number of functions have been removed from the dedit.c (now called bscedit.cpp) to allow different programs to share common source more easily.
Other parts, such as alcolor.cpp contain classes which can be inherited for true Object Oriented Programming.

New Functions
-------------

Most functionality remains the same as dlg.exe with the exception of the following:

- a file called config.cfg contains text which configers the program: at this stage just the video mode;
- the program uses a home grown colour palette which can be viewed both in GUI color selections (which the BGUI2 procedures dutifully egnor) and an EGA color selector which chooses the colors for an array that is referenced by the defined names WHITE,RED etc;
- there are 3 modes of use: Edit, Paste and new object chosen from the NEW menu item.  I must make the paste option fade when the clipboard is empty.
- under Edit mode, objects may be drag selected (using the CTRL or SHIFT keys), individually selected and moved or stretched.
- under paste mode, the clipboard contents are pasted according to the origin of the first object.
- the only new object in this template program is a dummy square.
- the EditList under the Selection menu item is a bit more powerful and hopeflly a bit more user friendly (but that is probably a subjective option).

All objects are referenced by a linked list class in order to minimise memory shuffling and accidental misreferencing during editing and use virtual inheritance to simplified the manipulation of different types of objects.


