Hi,
ok, i would like to make a simple text editor in which the user can enter large blocks of text, save and load, how would i go about starting this sort of thing?
any help would be appreicated
thanks
DimensionX
Hi,
ok, i would like to make a simple text editor in which the user can enter large blocks of text, save and load, how would i go about starting this sort of thing?
any help would be appreicated
thanks
DimensionX
maybe char[1000][5000]???
If your using windows just create a child control ( is that possible )...
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu
That question is not very easy to answer. It depends a lot on what kind of features your editor should have.
For a simple solution you could just read in the text line by line and save the lines in an array ( navigation in the text would be very fast insertion and deletion of text would involve lot of copying ).
If you would use a linked list you would be doing a lot of iterating the list to find the current line of text.
For both of this solutions ( array or list ) you would have to write a lot of similar code twice. One set of operations for insertion-mode and one for overwrite-mode.
One interesting solution I have seen involves just a char buffer. This buffer is split into two areas. All the text before the current working point is kept at the beginning of the buffer. The text after the current working point is at kept at the end of the buffer. You have to have a variable to keep track of the gapsize ( that is the buffersize - textsize ).
In this solution there is only a small difference in code depending on insert or overwrite-mode. Either you decrease the gapsize if a character is typed ( insert-mode ) or you don't ( overwrite-mode ).
If you change the current working-point you have to update the two bufferareas but that is just one simple memmove operation. The disadvantage of this approach is that changing the workingpoint involves counting linebreaks.
Kurt
Last edited by ZuK; 11-27-2005 at 05:46 AM.
hi again,
well...the eventual idea is that on save every character will be switched with something else (preset in code) i.e.
a = 10
b = 110
c = 1110
d = 11110
and so on...
and the idea is that on open it'll do the opposite, basically it'll count the number of 1's untill the 0 (0 being the termination) and lookup what that character is supposed to be and replace it accordingly so that the person can read the message when they're writing it and when they've opened it using the application only.
i just thought it might be a good idea to ask how to do the basic part of it first
DimensionX
Last edited by DimensionX; 11-27-2005 at 09:16 PM.