15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Writing Text Editors In Windows

Spencer Jones -- Spencer@azure.com
Thursday, August 29, 1996

Environment: VC++ 4.1 and Windows NT 3.51

Does anyone no of a good reference book or some sample code for writing
text editors in windows environments. It seems as though most people
just assume a CEdit or CRichEditCtrl base class for the view will be
adequate so no literature is available.

I am writing a text editor from scratch and having some difficulties
with update speeds. In particular the text flashes when resizing the
window. A re-draw does only re-draw the visible area and entering text
only updates the current line. But in some cases I find I have to update
the whole of the view such as deleting past the start of a line or
inserting a carriage return in the middle of the view. These then cause
the visible text to flick as they are re-drawn.

Thanx in advance

--
Spencer Jones ( http://www.azure.com/~spencer)
Chief Software Developer
Azure Limited




Sterling Kuo -- shortk@public1.ptt.js.cn
Sunday, September 01, 1996

[Mini-digest: 2 responses]

Hi, Spencer!
I am also writing a editor in my OCX project, just like this: 

CMyWnd : public CWnd    :-(

I write this from scratch because my editor have two type of objects:
TCHAR and graphic objects.

here are some tips may help you:

1. Use memory dc instead of directly draw on pDC OnDraw
offers, draw everything on memory dc and then use BitBlt copy
it to pDC.

2 When invalidate update rectangle, be sure to :
	InvalidateRect(rcUpdate,FALSE) -  don't erase back ground.
in my implementation, I always update whole client area, and draw lines
in client area, it works fine!

sorry for my poor English...
 
Environment VC++ 4.0 NT 3.51 Windows95

***********************************************************
                              Sterling Kuo
                            NanKing China
                    shortk@public1.ptt.js.cn
***********************************************************
----------
> From: Spencer Jones 
> To: 'MFC List' 
> Subject: Writing Text Editors In Windows
> Date: Thursday, August 29, 1996 4:34 PM
> 
> Environment: VC++ 4.1 and Windows NT 3.51
> 
> Does anyone no of a good reference book or some sample
code for writing
> text editors in windows environments. It seems as though
most people
> just assume a CEdit or CRichEditCtrl base class for the
view will be
> adequate so no literature is available.
> 
> I am writing a text editor from scratch and having some
difficulties
> with update speeds. In particular the text flashes when
resizing the
> window. A re-draw does only re-draw the visible area and
entering text
> only updates the current line. But in some cases I find I
have to update
> the whole of the view such as deleting past the start of
a line or
> inserting a carriage return in the middle of the view.
These then cause
> the visible text to flick as they are re-drawn.
> 
> Thanx in advance
> 
> --
> Spencer Jones ( http://www.azure.com/~spencer)
> Chief Software Developer
> Azure Limited
> 
-----From: Friedrich Hotz 

There is a good discussion of update/redraw strategies in Petzold's
book. Though it is all API abd C based, you should be able to learn
enough to use the approach there in MFC / C++ environment as well.




Frank Clark -- Frank_Clark@msn.com
Tuesday, September 03, 1996

I'm also doing something similar, but have found no need to use a memory dc 
and BitBlt.

I do all of the updating in OnPaint and update only the lines required.

The key to eliminating the flicker is NOT to erase the background (as Sterling 
Kuo suggested).
Just be sure that your drawing routine clears any area of the window that does 
not contain
text.

Frank Clark




| Вернуться в корень Архива |