[Libreoffice] timers in calc

David Tardon dtardon at redhat.com
Wed Nov 24 23:21:31 PST 2010


On Wed, Nov 24, 2010 at 11:37:53PM +0100, Julien Nabet wrote:
> 
> You said that aSpellTimer is only restarted in SpellTimerHdl but i
> saw line 1915 in the function IMPL_LINK( ScModule, IdleHandler,
> Timer*, EMPTYARG )
> BOOL bSpell = pDoc->ContinueOnlineSpelling();
> if ( bSpell )
>     aSpellTimer.Start();                                        //
> da ist noch was

What I meant was "restarted during run of the handler". I wanted to show
the difference between the two timers: the idle timer is restarted
_always_, but the spell timer may or may not be restarted, depending on
circumstances. Of course the timer may be started from another place,
otherwise it wouldn't be possible to run it again once it stopped.

> 
> Is it normal we find a Start calling of aSpellTimer in IMPL_LINK of
> IdleHandler ?

The spell timer must be restarted when there is something new to check
spelling of. I suppose it's done from idle timer because it's
convenient: the idle timer is always running and it's in one place.

> 
> For the rest, i understand that aIdleTimer is always started because
> of this following line at the end of this same function, there's an
> unconditionnal :
> aIdleTimer.Start();
> 
> It could help if we had the english translation of german comments
> (i know there's currently an "easy task" for this and that it must
> be quite tedious to translate all the comments) but could someone
> just translate this ?
> // ueberhaupt noch was?
> and above all, this ?
> //      SC_IDLE_COUNT mal mit initialem Timeout, dann hochzaehlen
> 
> 
> Perhaps just an idea for this timer. If it should be started only if
> there's something to do, i'd move these lines :
>     aIdleTimer.Start();
>     return 0;
> 
> at the end of the block :
> if ( bMore )
> 

That would mean the timer runs while there is something to do, then
stops and is never started again, which is obviously wrong. The timer
will have to be started from other parts of code, when the "right"
conditions are recreated (or maybe just started unconditionally; it
will stop immediately if there is nothing to do, anyway). Don't ask me
what the "other parts" are; I don't know that .-)

As for the spell timer, the right place to restart it could be
ScInputHandler::KeyInput or ScTabViewShell::KeyInput.

D.


More information about the LibreOffice mailing list