Example #1
0
void RunCount(UInt32 start_tik)
{
    UInt32 tik,dtik;
    run=1;
    while(run==1) {
	tik = TimGetTicks();
	dtik = tik - start_tik;
	drawCount(dtik);

	// call this periodically to hold off auto off  
	if (stopWatchPrefs.disableAutoOff) EvtResetAutoOffTimer();

	// delay one tenth of a sec (.09 acksherly to be sly)
	SysTaskDelay((90 * SysTicksPerSecond())/1000);
	// within loop call SysHandleEvent to
	//  give system opportunity to break in? 
	// /opt/palmdev/sdk-5/include/Core/UI/Event.h
	{ 
	    UInt16 err;
	    EventType e;
	    EvtGetEvent(&e, 0);
	    if (! SysHandleEvent (&e))
		if (! MenuHandleEvent (NULL, &e, &err))
		    if (! ApplicationHandleEvent (&e))
			FrmDispatchEvent (&e);
	}
    }

}
Example #2
0
void PediaMainForm::handleLookupFinished(const EventType& event)
{
    setControlsState(true);
    const LookupFinishedEventData& data=reinterpret_cast<const LookupFinishedEventData&>(event.data);
    switch (data.outcome)
    {
        case data.outcomeArticleBody:
            updateAfterLookup();
            break;

        case data.outcomeList:
            Application::popupForm(searchResultsForm);
            break;

        case data.outcomeDatabaseSwitched:
            // recalc about info and show about screen
            setDisplayMode(showAbout);            
            termInputField_.replace("");
            update();
            break;

        case data.outcomeAvailableLangs:
            assert(!app().preferences().availableLangs.empty());
            if (app().preferences().availableLangs.empty())
            {
                // this shouldn't happen but if it does, we want to break
                // to avoid infinite loop (changeDatabase() will issue request
                // to get available langs whose result we handle here
                break;
            }
            changeDatabase();
            break;

        case data.outcomeNotFound:
            termInputField_.select();
            // No break is intentional.

        default:
            update();
    }

    LookupManager* lookupManager=app().getLookupManager();
    assert(lookupManager);
    lookupManager->handleLookupFinishedInForm(data);

    if (app().inStressMode())
    {
        EvtResetAutoOffTimer();
        randomArticle();
    }        
}