Re: [Libreoffice] [PATCH] try to correct some timers in sc + question

2010-11-23 Thread Kohei Yoshida
Hi Julien,

On Sat, 2010-11-20 at 01:19 +0100, Julien Nabet wrote:
> Hello,
> 
> Here's a try to correct some timers in scmod.cxx.
> Here's what I did and why.
> 
> 1) In IMPL_LINK( ScModule, SpellTimerHdl, Timer*, EMPTYARG )
> I just added aSpellTimer.Stop() when there's neither input from keyboard 
> nor ContinueOnlineSpelling.
> + I changed the function to have 1 return only.
> 
> 2) In IMPL_LINK( ScModule, IdleHandler, Timer*, EMPTYARG )
> I removed all the things with bSpell since it seems that 
> ContinueOnlineSpelling is managed by SpellTimerHdl
> I'd like to add a stop but i'd like first to understand what's the use 
> of all the SC_IDLE_STEP, SC_IDLE_MAX, nIdleCount...
> 
> I repeat, this patch is just a try. If I'm all wrong, sorry for the 
> noise and please, explain my mistakes.

Well, I applaud your attempt to challenge this rather difficult task,
and sorry it took me so long to get back to you.

I took a closer look at this issue, and while I don't yet have a
complete picture of how this can be fixed, I can at least see that the
problem is not with the spell check timer, but the idle timer.  The
spell check timer itself actually turns itself off rather nicely after
it does what it needs.  The idle timer, OTOH, keeps on running pretty
much forever.  I guess my previous comment about the spell check timer
may have given you the wrong impression.  Sorry about that.

So, let's not change the spell check timer since it doesn't look broken,
and let's focus on fixing the idle timer itself.

Thanks!

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [PATCH] try to correct some timers in sc + question

2010-11-19 Thread Julien Nabet

Hello,

Here's a try to correct some timers in scmod.cxx.
Here's what I did and why.

1) In IMPL_LINK( ScModule, SpellTimerHdl, Timer*, EMPTYARG )
I just added aSpellTimer.Stop() when there's neither input from keyboard 
nor ContinueOnlineSpelling.

+ I changed the function to have 1 return only.

2) In IMPL_LINK( ScModule, IdleHandler, Timer*, EMPTYARG )
I removed all the things with bSpell since it seems that 
ContinueOnlineSpelling is managed by SpellTimerHdl
I'd like to add a stop but i'd like first to understand what's the use 
of all the SC_IDLE_STEP, SC_IDLE_MAX, nIdleCount...


I repeat, this patch is just a try. If I'm all wrong, sorry for the 
noise and please, explain my mistakes.


Julien.

(just in case what I did is ok, license is as usual LGPLv3+ / MPL)
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 1bc98b5..1f164e9 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1912,11 +1912,8 @@ IMPL_LINK( ScModule, IdleHandler, Timer*, EMPTYARG )
 
 BOOL bLinks = pDoc->IdleCheckLinks();
 BOOL bWidth = pDoc->IdleCalcTextWidth();
-BOOL bSpell = pDoc->ContinueOnlineSpelling();
-if ( bSpell )
-aSpellTimer.Start();   // da 
ist noch was
 
-bMore = bLinks || bWidth || bSpell;// ueberhaupt 
noch was?
+bMore = bLinks || bWidth;  // ueberhaupt noch was?
 
 // While calculating a Basic formula, a paint event may have 
occured,
 // so check the bNeedsRepaint flags for this document's views
@@ -1956,15 +1953,27 @@ IMPL_LINK( ScModule, SpellTimerHdl, Timer*, EMPTYARG )
 if ( Application::AnyInput( INPUT_KEYBOARD ) )
 {
 aSpellTimer.Start();
-return 0;  // dann spaeter 
wieder...
 }
-
-ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() );
-if ( pDocSh )
+else
 {
-ScDocument* pDoc = pDocSh->GetDocument();
-if ( pDoc->ContinueOnlineSpelling() )
-aSpellTimer.Start();
+
+ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() );
+if ( pDocSh )
+{
+ScDocument* pDoc = pDocSh->GetDocument();
+if ( pDoc->ContinueOnlineSpelling() )
+{
+aSpellTimer.Start();
+}
+else
+{
+aSpellTimer.Stop();
+}
+}
+else 
+{
+aSpellTimer.Stop();
+}
 }
 return 0;
 }
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice