Ejemplo n.º 1
0
void ChameleonMScreen::keyPressEvent(QKeyEvent *key)
{
    seen_key_press = KNI_TRUE;


#if ENABLE_MULTIPLE_ISOLATES
    if (key->key() == Qt::Key_F12||
        key->key() == Qt::Key_Home) {
        /* F12 to display the foreground selector */
        if (!key->isAutoRepeat()) {
            MidpEvent evt;
            MIDP_EVENT_INITIALIZE(evt);
            evt.type = SELECT_FOREGROUND_EVENT;
            evt.intParam1 = 0;
            midpStoreEventAndSignalAms(evt);
        }
#ifdef QT_KEYPAD_MODE
    } else if (key->key() == Qt::Key_Flip) {
#else
    } else if (key->key() == Qt::Key_F4) {
#endif
        if (!key->isAutoRepeat()) {
            MidpEvent evt;
            MIDP_EVENT_INITIALIZE(evt);
            evt.type = SELECT_FOREGROUND_EVENT;
            evt.intParam1 = 1;
            midpStoreEventAndSignalAms(evt);
        }
    }
#else
    /* F12 pause or activate all Java apps */
    if ((key->key() == Qt::Key_F12 || key->key() == Qt::Key_Home) &&
        !key->isAutoRepeat()) {
        pauseAll();
    }
#endif

    else {
        MidpEvent evt;
        MIDP_EVENT_INITIALIZE(evt);

        if ((evt.CHR = mapKey(key)) != KEYMAP_KEY_INVALID) {
            if (evt.CHR == KEYMAP_KEY_SCREEN_ROT) {
                evt.type = ROTATION_EVENT;
            } else {
                evt.type = MIDP_KEY_EVENT;
            }
            evt.ACTION = key->isAutoRepeat() ? 
                KEYMAP_STATE_REPEATED : KEYMAP_STATE_PRESSED;
            midpStoreEventAndSignalForeground(evt);
        }
    }
}
Ejemplo n.º 2
0
void ramActorsScene::onValueChanged(ofxUIEventArgs &e)
{
	const string name = e.widget->getName();
	
    if (name == "Load Recorded File")
    {
        ofxUIButton *button = (ofxUIButton *)e.widget;
        
        if (button->getValue())
        {
            ofFileDialogResult result = ofSystemLoadDialog("Load recorded *.tsv file.", false, "");
            if (result.bSuccess)
                loadFile(result.getPath());
        }
    }
    
	if (name == "Show All Actors")
	{
        ofxUILabelToggle *t = (ofxUILabelToggle *)e.widget;
		showAll(t->getValue());
	}
	
	if (name == "Reset Positions")
	{
        ofxUILabelToggle *t = (ofxUILabelToggle *)e.widget;
        resetPosAll(t->getValue());
	}
	
	if (name == "Pause (Space key)")
	{
        ofxUILabelToggle *t = (ofxUILabelToggle *)e.widget;
		pauseAll(t->getValue());
	}
	
	if (name == "Recording All Actors")
	{
        ofxUILabelToggle *t = (ofxUILabelToggle *)e.widget;
		recAll(t->getValue());
	}
}
Ejemplo n.º 3
0
/** Called when sound is globally switched on or off. It either pauses or
 *  resumes all sound effects. 
 *  \param on If sound is switched on or off.
 */
void SFXManager::toggleSound(const bool on)
{
    // When activating SFX, load all buffers
    if (on)
    {
        std::map<std::string, SFXBuffer*>::iterator i = m_all_sfx_types.begin();
        for (; i != m_all_sfx_types.end(); i++)
        {
            SFXBuffer* buffer = (*i).second;
            buffer->load();
        }

        reallyResumeAllNow();
        m_all_sfx.lock();
        const int sfx_amount = (int)m_all_sfx.getData().size();
        for (int n=0; n<sfx_amount; n++)
        {
            m_all_sfx.getData()[n]->onSoundEnabledBack();
        }
        m_all_sfx.unlock();
    }
    else
    {
        // First stop all sfx that are not looped
        const int sfx_amount = (int)m_all_sfx.getData().size();
        m_all_sfx.lock();
        for (int i=0; i<sfx_amount; i++)
        {
            if(!m_all_sfx.getData()[i]->isLooped())
            {
                m_all_sfx.getData()[i]->reallyStopNow();
            }
        }
        m_all_sfx.unlock();
        pauseAll();
    }
}   // toggleSound