[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: questions regarding QTextDocument behaviour
From:       Pierre Stirnweiss <pierre.stirnweiss () t-online ! de>
Date:       2008-11-30 8:01:31
Message-ID: 200811300901.31602.pierre.stirnweiss () t-online ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Saturday 29 November 2008 23:43:41 Pierre Stirnweiss wrote:
>
> Yes, there is another command on the stack (with the caption "Text", which
> seems to indicate at least one action is not parented). I am pretty sure
> that I also experienced the addition of two "text" command on top of the
> "key Press" one. On the other hand, a formatting command seems to be
> parented to the text command, which to my mind it shouldn't.
>
> I will have a further look tomorrow.

Ok, here is the deal:
- for the insert paragraph thingie. when keying some text, a "macro command" 
is opened. Then on pressing "enter", a call to 
KoTextSelectionHandler:nextParagraph is made. This in turn call for opening a 
macro (call ignored because one is already opened). Several stuff is made (new 
block created, style applied,..), each are commands that get parented 
correctly. But then, the nextParagraph method calls for stopMacro which end 
the "macro command". On returning to the TextTool, a further setBlockFormat is 
done for the text direction stuff. This one is not parented, hence two different 
undo commands for the single "carriage return" action.

- for the formatting ignored, the same mechanism is at work, on keying text, a 
macro command is opened, when formatting is called, the startMacro from the 
formatting action is ignored because one is already opened and all formatting 
actions are parented in the key press one.

This is what I propose:
- keeping the idea of "macro command" which parents any subsequent "undo 
command" created after undoCommandAdded signal, I would like to avoid having 
"opened command" at the end of a user action. This is as far as I have seen so 
far only the case for text keying. I think we could use the merging facility 
in that case. That would make things clearer. I will try an implementation, 
and commit if it compiles/work with correct behavior.

- then, I would like to group everything that is related to a user action in 
one place. For example, I don't see why a new paragraph action (this is just 
one example, I am pretty sure there are others) is half made in the 
TextSelectionHandler and in the TextTool. This is confusing and a hell to 
debug.


- as a side note. I personally think that a "new paragraph" action should be 
separated from the keying of the previous paragraph. The use case I am 
thinking of is the one of this e-mail.
1) I write stuff about my findings about the paragraph
2) I start a new paragraph about my findings about the formatting.

If I am not happy about what I wrote about the formatting, I would like that a 
press to undo remove my last block only, leaving the first paragraph alone.
One could even consider that the end of a sentence could constitute a 
"breaking" point as far as grouping of text keying is concerned.

Thanks for sharing thoughts,

Pierre

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" \
content="1" /><style type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; \
font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">On Saturday 29 November 2008 23:43:41 Pierre Stirnweiss wrote:</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt;</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Yes, there is another \
command on the stack (with the caption "Text", which</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; seems to indicate at least one action is not \
parented). I am pretty sure</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; that I also experienced the addition of two "text" command on \
top of the</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; "key \
Press" one. On the other hand, a formatting command seems to be</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; parented to the text \
command, which to my mind it shouldn't.</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt;</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; I will have a further look tomorrow.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Ok, here is the deal:</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">- for the insert paragraph \
thingie. when keying some text, a "macro command" is opened. Then on pressing \
"enter", a call to KoTextSelectionHandler:nextParagraph is made. This in turn call \
for opening a macro (call ignored because one is already opened). Several stuff is \
made (new block created, style applied,..), each are commands that get parented \
correctly. But then, the nextParagraph method calls for stopMacro which end the \
"macro command". On returning to the TextTool, a further setBlockFormat is done for \
the text direction stuff. This one is not parented, hence two different undo commands \
for the single "carriage return" action.</p> <p style="-qt-paragraph-type:empty; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">- for the formatting ignored, \
the same mechanism is at work, on keying text, a macro command is opened, when \
formatting is called, the startMacro from the formatting action is ignored because \
one is already opened and all formatting actions are parented in the key press \
one.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"></p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">This is what I propose:</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">- keeping the idea of "macro command" which \
parents any subsequent "undo command" created after undoCommandAdded signal, I would \
like to avoid having "opened command" at the end of a user action. This is as far as \
I have seen so far only the case for text keying. I think we could use the merging \
facility in that case. That would make things clearer. I will try an implementation, \
and commit if it compiles/work with correct behavior.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">- then, I would like to group \
everything that is related to a user action in one place. For example, I don't see \
why a new paragraph action (this is just one example, I am pretty sure there are \
others) is half made in the TextSelectionHandler and in the TextTool. This is \
confusing and a hell to debug.</p> <p style="-qt-paragraph-type:empty; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">- as a side note. I \
personally think that a "new paragraph" action should be separated from the keying of \
the previous paragraph. The use case I am thinking of is the one of this e-mail.</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">1) I write stuff about my \
findings about the paragraph</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">2) I start a new paragraph about my findings about the \
formatting.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"></p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">If I am not happy about what I wrote about the \
formatting, I would like that a press to undo remove my last block only, leaving the \
first paragraph alone.</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">One could even consider that the end of a sentence could \
constitute a "breaking" point as far as grouping of text keying is concerned.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Thanks for sharing \
thoughts,</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"></p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">Pierre</p></body></html>



_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic