News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

need a tutorial on creating a text editor.

Started by xanatose, December 12, 2005, 05:21:14 PM

Previous topic - Next topic

xanatose

Does anyone know where can I find a tutorial on creating asimple  text editor.

I mean without using windows controls, with topics like how to handle undo, structures used for text editing etc, etc. My purpose is learning.

Tried google, but too many hits. But must are subclasing an edit control or using a third party library. None of what I have seen explain the theory behind,

So I wonder if anyone have found a link that explain this.

Thanks for your time.

Tedd

Wow, this is gonna be a nice learning experience.
I'm not sure where you're going to find any tutorials on it though. Your best bet would be to look for 'old' stuff (ie. DOS) and extract the 'good' parts. Most of the stuff on structures is going to be general, and so not aimed at any particular subject (apart from contrived examples.)

I would suggest you just try some stuff, and come up with your own ideas. Then you'll find that you need a way to '.........' - at which point you'll be able to look for something specific.

(As an example of how not to implement undo - the old windows edit control kept a full copy of the previous contents, and so undo-ing just consisted of swapping the current contents with the saved previous version. Of course there are many smarter ways to do it.)
No snowflake in an avalanche feels responsible.

Mincho Georgiev

I've really got something for you, but for to my great regret it seem that site is OFF
anyway ,you can try it and if it's really off, you can send me a private message with your e-mail,
i promise to send you the entire tutorial serres + the sources. it's CPP tutorial OOP ,but after all
is pure win32 programming and i'm sure that you would'n have problem with that.

www.catch22.net



ramguru

I agree with shaka_zulu, these tut series rock (I'm tracking all the news in j.brown's site aswell). All web is full of gems. This isn't the first time when catch22.net is down, I believe this won't last very long...

ramguru


Mincho Georgiev

Hi there, ramguru!
It's really petty ,but james still workin' on Tut's 8,9... (that's what i heard)
The last time i've visit the 'catch' ,they wasn't ready yet.
I don't like unusless talk, but i've planned in future to write a complete series (MASM) creating
Source editing component (with many improvements) but i'll need more vacant time for that
(i hope soon, who knows)...

Mincho Georgiev


Mincho Georgiev

Let's not forget "The Craft of text editing" - that's something that evey editor's programmer should read:

http://www.finseth.com/craft/

Mincho Georgiev

:) gues what, here's the 8th - the site is on !


[attachment deleted by admin]

ramguru


Mincho Georgiev

:) I hope we answered the xanatose's question the best way


see you soon, ramguru  :U

ramguru

Quote from: xanatose on December 12, 2005, 05:21:14 PM
Does anyone know where can I find a tutorial on creating asimple  text editor.

I mean without using windows controls, with topics like how to handle undo, structures used for text editing etc, etc. My purpose is learning.

Tried google, but too many hits. But must are subclasing an edit control or using a third party library. None of what I have seen explain the theory behind,

So I wonder if anyone have found a link that explain this.

Thanks for your time.

I tried once to write an edit control without any primal knowledge or concepts, all by myself...but I have to say that was to much for me...(then... not now  :lol ).
First of all you ask yourself why does it flicker so much (even worse case than notepad)... OK you finally figure it out:
1. ExtTextOut instead of DrawText
2. .if uMsg==WM_ERASEBKGND return 1...
3. ScrollWindowEx...
Second thought: "how to set scrollbars correctly ?". Here are two choices: 1) horizontal fixed, vertical adjusted according to text (like in RadAsm, Scintilla) 2) horizontal, vertical adjusted according to text (almost like notepad if we don't pay attention to some bugs). OK you decided, but believe me it isn't a piece of cake to implement it...
3rd thought: "now I have an editor that crashes on each key down - good start. How about implementing a delete key (again: pay attention to scrollbars (max h string, max v string), to buffer (allocate, reallocate)...)"
Final thought: "after 2 years of development I've finally created an edit control that is able to load 64Kb file, of course I hope to cope with syntax hilighting and folding in only 6 months, besides I'm so experienced now. Two more years and I'll implement unicode support - yes, that was quick"

IMO there is no sense to invent invented, we have Scintilla, all good IDE's are based on it or even use it. Of cource, it supports only UTF-8 but it's enough for full-featured edit control... I dare to say that you even don't imagine how powerfull is scintilla, and it will be much more in feature.
The biggest dicovery I made (with scintilla) was XPM ( folding or other symbols - icons in text format ), that look like this:

fold00  db "/* XPM */",13,10
db "static char * icon[]= {",13,10
db 22h,"11 16 4 1",22h,",",13,10
db 22h," c #FFFFFF",22h,",",13,10
db 22h,"+ c #000000",22h,",",13,10
db 22h,"- c #555555",22h,",",13,10
db 22h,"O c #888888",22h,",",13,10
db 22h,"           ",22h,",",13,10
db 22h,"           ",22h,",",13,10
db 22h,"  O-----O  ",22h,",",13,10
db 22h," O       O ",22h,",",13,10
db 22h,"O    +    O",22h,",",13,10
db 22h,"-    +    -",22h,",",13,10
db 22h,"-    +    -",22h,",",13,10
db 22h,"- +++++++ -",22h,",",13,10
db 22h,"-    +    -",22h,",",13,10
db 22h,"-    +    -",22h,",",13,10
db 22h,"O    +    O",22h,",",13,10
db 22h," O       O ",22h,",",13,10
db 22h,"  O-----O  ",22h,",",13,10
db 22h,"           ",22h,",",13,10
db 22h,"           ",22h,",",13,10
db 22h,"           ",22h,"};",0



MichaelW

#13
This is not a tutorial, but it might be useful just the same.

KetilO did an edit custom control, wrapped in a more or less complete editor app:

http://www.masm32.com/board/index.php?topic=58.0

Edit: Updated link
eschew obfuscation

Mincho Georgiev

I have on my mind something else ,but it can kill a newbie, anyway is one of my favorites: FASM IDE's source code. There Thomazc did it  very well with all the
features (even with no stack frame for no procedure :))
RaEdit and CodeHiC (WinAsm) are one of the best editing controls.
If there is someone,looking for a real source of real OOP implemented editing component, a should say Scintilla !!!
As a matter of fact i'm writing my sources using Notepad++(Scintilla based),witch now have a Assembler syntax highlightning (it last).