[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: kword typing is sloooow
From: David Faure <david () mandrakesoft ! com>
Date: 2001-06-28 15:56:48
[Download RAW message or body]
On Thursday 28 June 2001 16:28, aleXXX wrote:
> Hi,
>
> now since my text is getting longer (nearly 20 pages now), I noticed that
> when typing something at the first pages, my CPU goes to 100% and typing gets
> really slow. Probably kword updates the formatting of the whole document
> after each character ?
Almost (it does this "in the background", but with a 0 timer, which is too short
when you're typing a lot) - but only what needs to be formatted (see below).
> Can this be optimized ?
Yes - I didn't finish merging the stuff from qtextedit, which slows down the
background formatting while typing.
Done now, please test the attached patch.
> Maybe updating only the
> current line and if there is a line break the whiole document ?
That's already the case. Paragraphs are invalidated when necessary.
In doubt, add a debug output in QTextParag::format() (after the test for
invalid) to see which paragraphs are formatted at what time :)
--
David FAURE, david@mandrakesoft.com, faure@kde.org
http://perso.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
["kword.diff" (text/x-diff)]
? autocorrect
? kwtextparag.cc.debugoutput
? templates/Wordprocessing/TeX article.kwd
Index: kwtextframeset.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwtextframeset.cc,v
retrieving revision 1.333
diff -u -p -r1.333 kwtextframeset.cc
--- kwtextframeset.cc 2001/06/28 12:16:42 1.333
+++ kwtextframeset.cc 2001/06/28 16:46:58
@@ -3132,6 +3132,17 @@ void KWTextFrameSet::removeHighlight()
emit repaintChanged( this );
}
+void KWTextFrameSet::typingStarted()
+{
+ changeIntervalTimer->stop();
+ interval = 10;
+}
+
+void KWTextFrameSet::typingDone()
+{
+ changeIntervalTimer->start( 100, TRUE );
+}
+
#ifndef NDEBUG
void KWTextFrameSet::printRTDebug( int info )
{
@@ -3198,11 +3209,7 @@ void KWTextFrameSetEdit::terminate()
void KWTextFrameSetEdit::keyPressEvent( QKeyEvent * e )
{
-#if 0
- // TODO Move to KWTextFrameSet
- changeIntervalTimer->stop();
- interval = 10;
-#endif
+ textFrameSet()->typingStarted();
/* bool selChanged = FALSE;
for ( int i = 1; i < textDocument()->numSelections(); ++i )
@@ -3368,7 +3375,7 @@ void KWTextFrameSetEdit::keyPressEvent(
if ( clearUndoRedoInfo ) {
textFrameSet()->clearUndoRedoInfo();
}
- // TODO changeIntervalTimer->start( 100, TRUE );
+ textFrameSet()->typingDone();
}
void KWTextFrameSetEdit::moveCursor( CursorAction action, bool select )
Index: kwtextframeset.h
===================================================================
RCS file: /home/kde/koffice/kword/kwtextframeset.h,v
retrieving revision 1.113
diff -u -p -r1.113 kwtextframeset.h
--- kwtextframeset.h 2001/06/25 15:49:42 1.113
+++ kwtextframeset.h 2001/06/28 16:47:04
@@ -230,6 +230,9 @@ public:
void emitHideCursor() { emit hideCursor(); }
void emitShowCursor() { emit showCursor(); }
+ void typingStarted();
+ void typingDone();
+
public slots:
void formatMore();
_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.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