Conceptual problem with doc/view 
Author Message
 Conceptual problem with doc/view

I'm new to MFC and document/view-architecture. My problem
might be easy so solve for you.

I'm planning an editor for a special document markup
language, similar to an html-editor, except that it's not
about html. Like an html-document, my documents contain text
and tags that assign certain properties (e.g. formatting) to
parts of the text. I want the user to be able to edit the
document source (with tags) as well as preview the document
as it looks like when the properties specified by the tags
are applied. For my purposes, the rich text format is fully
sufficient to handle formatting of the preview, so i decided
to establish my doc and view classes based on CRichEditDoc
and CRichEditView. Theoreticaly, I have one document, and
two views (source and preview).

Now my problem is this:
As RichEditDoc and RichEditView are linked so closely, I
would have to modify the document in order to switch between
source-view and preview. I.e., remove my tags from the
stream, apply the formatting to the text surrounded by the
tags, and all the way back in the other direction. But this
somehow misses the basic idea of separation of document and
view.
My natural reasoning tells me: handle the source text in a
simple edit control, then parse it and store the information
in a suitable object. Write a member-function for this
object that displays the preview in a rich-edit control. But
the document/view-architecture now makes confusing what
seemed simple to me in the beginning.

Maybe you can point me in the right direction.

TIA,
Bernd Liebermann



Mon, 28 Jul 2003 05:26:51 GMT  
 Conceptual problem with doc/view

Quote:

> I'm new to mfc and document/view-architecture. My problem
> might be easy so solve for you.

> I'm planning an editor for a special document markup
> language, similar to an html-editor, except that it's not
> about html. Like an html-document, my documents contain text
> and tags that assign certain properties (e.g. formatting) to
> parts of the text. I want the user to be able to edit the
> document source (with tags) as well as preview the document
> as it looks like when the properties specified by the tags
> are applied. For my purposes, the rich text format is fully
> sufficient to handle formatting of the preview, so i decided
> to establish my doc and view classes based on CRichEditDoc
> and CRichEditView. Theoreticaly, I have one document, and
> two views (source and preview).

> Now my problem is this:
> As RichEditDoc and RichEditView are linked so closely, I
> would have to modify the document in order to switch between
> source-view and preview. I.e., remove my tags from the
> stream, apply the formatting to the text surrounded by the
> tags, and all the way back in the other direction. But this
> somehow misses the basic idea of separation of document and
> view.
> My natural reasoning tells me: handle the source text in a
> simple edit control, then parse it and store the information
> in a suitable object. Write a member-function for this
> object that displays the preview in a rich-edit control. But
> the document/view-architecture now makes confusing what
> seemed simple to me in the beginning.

> Maybe you can point me in the right direction.

> TIA,
> Bernd Liebermann

It is confusing because the rich edit control (and the edit control too) are
general purpose components that exist in Windows independently of MFC and its
doc/view structure.  They are not part of MFC, although MFC contains classes to
use them.  The edit controls happen to do (for free) what most applications have
to do for themselves in the document class.

--
Scott McPhillips [VC++ MVP]



Mon, 28 Jul 2003 09:43:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with ICON for doc using doc/view.

2. Getting 2nd Doc/View data from 1st Doc/View

3. Problems in view switching in Explorer style MFC Doc/View

4. File->New in doc/view doesn't clear doc file name

5. Doc/View, multiple threads updating the doc

6. Getting a pointer to the DOC view frame in the DOC

7. Getting a pointer to the DOC view frame in the DOC

8. doc/view, int problem

9. serialize problem in DOC/VIEW

10. printing graphics without standard doc/view problem

11. doc/view problem

 

 
Powered by phpBB® Forum Software