Subject: Re: commit: Modeless Word Count for gtk.
From: Martin Sevior (email@example.com)
Date: Thu May 25 2000 - 01:32:16 CDT
On Wed, 24 May 2000, Paul Cubbage wrote:
> > The timer->stop() removes the timer from the gtk list of timers. The
> > timer->set(... ) adds it with the new time interval.
> I'm not down in the code anymore so please excuse my question if it
> seems ignorant:
> Is there a potential problem in that "an aready running timer" is
> running for a reason? Could
> stop a valid process/timer?
Coming direct from the code. You construct a timer like this
GR_Graphics * pG = NULL;
m_pAutoUpdateWC = UT_Timer::static_constructor(autoupdateWC,this,pG);
Where m_pAutoUpdateWC is the pointer the timer class thus contructed. It
contains a callback function autoupdateWC, which is written like this:
void AP_UnixDialog_WordCount::autoupdateWC(UT_Timer * pTimer)
// this is a static callback method and does not have a 'this' pointer.
AP_UnixDialog_WordCount * pDialog = (AP_UnixDialog_WordCount *)
At this point the pDialog pointer can access any member of the class
containing m_pAutoUpdateWC. You start and stop the timer which invokes
autoupdateWC with the commands:
So the start and stop methods only operate on the specific timer we've
created. The stop() function removes the timer previously started in the
gtk timer list. If the timer is not currently running there is code
that detects and deals with this. The Timer class assumes only one timer
However the "set(imilliseconds)" method, which is invoked via:
Actually adds a new timer which executes every imilliseconds to the gtk
timer list. If the timer is already running it doesn't remove the timer
first. I don't believe that this is what is wanted and it would be a 3
line fix to the ut_Unixtimer.cpp file to add this behaviour.
Does anyony have objections to me making this change?
This archive was generated by hypermail 2b25 : Thu May 25 2000 - 01:32:54 CDT