int main(void) { /* Disable watchdog: not required for this application */ MCUSR &= ~(1 << WDRF); wdt_disable(); setupStateMachine(); setupTimer(); setupIO(); initialiseMap(); UART_Init(UART0, 9600, 32, 32, false); I2C_SetPrescaler(64); DS3231_Init(); UC_BTN_Init(APP_TICK_MS); TLC5916_Init(&tlc, SR_ShiftOut, tlcLatchFn, tlcOEFn); TLC5916_OutputEnable(&tlc, true); uint8_t displayBytes[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; TLC5916_ClockOut(displayBytes, 10, &tlc); /* All processing interrupt based from here */ sei(); /* First get the time from the DS3231. * Don't worry about the state machine or any events, just get the time * and see if it's greater than the compile time */ DS3231_ReadDeviceDateTime(NULL); while ( !DS3231_IsIdle() ) { I2C_Task(); } DS3231_GetDateTime(&tm); DS3231_SetRate(DS3231_RATE_1HZ); DS3231_SQWINTControl(DS3231_SQW); DS3231_UpdateControl(); while ( !DS3231_IsIdle() ) { I2C_Task(); } s_unixtime = time_to_unix_seconds(&tm); if (s_unixtime < COMPILE_TIME_INT) { TM compile_time = COMPILE_TIME_STRUCT; DS3231_SetDeviceDateTime(&compile_time, false, NULL); while ( !DS3231_IsIdle() ) { I2C_Task(); } s_unixtime = COMPILE_TIME_INT; } updateUnixTimeDigits(); //putTimeToUART(); s_displayDirty = true; while (true) { if (TMR8_Tick_TestAndClear(&appTick)) { applicationTick(); } if (TMR8_Tick_TestAndClear(&heartbeatTick)) { s_BlinkState = !s_BlinkState; s_displayDirty |= true; } if (PCINT_TestAndClear(secondTickVector)) { s_bTick = !s_bTick; if (s_bTick && (SM_GetState(&sm) == (SM_STATEID)DISPLAY)) { s_unixtime++; updateUnixTimeDigits(); s_displayDirty |= true; } for(uint8_t i = 0; i < (uint8_t)SM_GetState(&sm); ++i) { //IO_Control(HB_PORT, HB_PIN, IO_OFF); //IO_Control(HB_PORT, HB_PIN, IO_ON); } } if (s_displayDirty) { updateDisplay(); s_displayDirty |= false; } I2C_Task(); } }
/* * setup service to define the track positions * control remains in this function as long as the setup button is active */ void setup(void) { confirm(5); // start with position mid stepnr = initpos; choice = MAX_TRACKS / 2 + 1; updateDisplay(); pulswidth = MAX_PULSWIDTH; power = POWER_ON; waitMS(100); curtrack = choice; while( buttonSetup == BUTTON_ON ) { waitMS(10); if( buttonRight == BUTTON_ON && buttonLeft == BUTTON_ON ) { saveByte( ADDR_KEEPPOWER, readByte(ADDR_KEEPPOWER) ? KEEPPOWER_OFF:KEEPPOWER_ON ); confirm(3); while( buttonRight == BUTTON_ON && buttonLeft == BUTTON_ON ); } while( stepnr < MAX_STEPS && buttonLeft == BUTTON_OFF && buttonRight == BUTTON_ON ) { // turn right; end position is not reached stepnr++; oneStep(STEP_RIGHT); }; while( stepnr > 0 && buttonLeft == BUTTON_ON && buttonRight == BUTTON_OFF ) { // turn left; start position is not reached stepnr--; oneStep(STEP_LEFT); }; // check if the buttonSave is pressed if( buttonSave == BUTTON_ON ) { // save the new position in eeprom savePosition( choice, stepnr); confirm(1); choice++; if( choice > MAX_TRACKS ) choice = 1; curtrack = choice; updateDisplay(); while( buttonSave == BUTTON_ON ) waitMS(10); } // check if the buttonNext is pressed if( buttonNext == BUTTON_ON ) { confirm(1); choice++; if( choice > MAX_TRACKS ) choice = 1; curtrack = choice; updateDisplay(); while( buttonNext == BUTTON_ON ) waitMS(10); } } // end while if( !readByte(ADDR_KEEPPOWER) ) power = POWER_OFF; /* power off step motor */ }
int main(void) { max = 0; min = UINT16_MAX; sleeping = 0; reading = 0; displayMode = DISPLAY_MODE_CURRENT; diode_sensor_init(); WDTCTL = WDTPW | WDTHOLD; // Stop WDT // GPIO Setup /* Configuring P1.0 as output and P1.1 (switch) as input with pull-up resistor*/ P1DIR = ~(uint8_t) BIT1; P1OUT = BIT1; P1REN = BIT1; // Enable pull-up resistor (P1.1 output high) P1SEL0 = 0; P1SEL1 = 0; P1IFG = 0; // Clear all P1 interrupt flags P1IE = BIT1; // Enable interrupt for P1.1 P1IES = BIT1; // Interrupt on high-to-low transition P1OUT &= ~BIT0; // Clear LED to start P5SEL1 |= BIT4; // Configure P5.4 for ADC P5SEL0 |= BIT4; P4DIR |= BIT2; // P4.2 output P4SEL0 |= BIT2; // P4.2 option select PJSEL0 |= BIT0 | BIT1; // set LFXT pin as second function // Enable Port 1 interrupt on the NVIC NVIC_ISER1 = 1 << ((INT_PORT1 - 16) & 31); NVIC_ISER0 = 1 << ((INT_WDT_A - 16) & 31); NVIC_ISER0 |= 1 << ((INT_ADC14 - 16) & 31); // Enable ADC interrupt in NVIC module CSKEY = 0x695A; // Unlock CS module for register access CSCTL2 |= LFXT_EN; // LFXT on // Loop until XT1, XT2 & DCO fault flag is cleared do { // Clear XT2,XT1,DCO fault flags CSCLRIFG |= CLR_DCORIFG | CLR_HFXTIFG | CLR_LFXTIFG; SYSCTL_NMI_CTLSTAT &= ~ SYSCTL_NMI_CTLSTAT_CS_SRC; } while (SYSCTL_NMI_CTLSTAT & SYSCTL_NMI_CTLSTAT_CS_FLG); // Test oscillator fault flag CSCTL1 = CSCTL1 & ~(SELS_M | DIVS_M) | SELA_0; // Select ACLK as LFXTCLK CSKEY = 0; // Lock CS module from unintended accesses SCB_SCR &= ~SCB_SCR_SLEEPONEXIT; // Wake up on exit from ISR __enable_interrupt(); readingNo = 0; reading = 1; diode_sensor_read(); WDTCTL = WDTPW | WDTSSEL__ACLK | WDTTMSEL | WDTCNTCL | WDTIS_5; // WDT 250ms, ACLK, interval timer while (1) { if (diode_sensor_read_result(&samples[readingNo])) { // We got a result from the ADC, deal with it readingNo = (readingNo + 1) % NUM_SAMPLES; if( readingNo == 0) { // The result was the last one needed for this sensor, calculate the average // of the readings, and update min/max values. val = 0; for (i=0;i<NUM_SAMPLES;i++) { val += samples[i]; } val = val >> 3; if (val > max) { max = val; } if (val < min) { min = val; } voltage_ave = 0; for (i=0; i<NUM_SAMPLES; i++) { voltage_ave = voltage_ave + samples[i]; } voltage_ave = voltage_ave / NUM_SAMPLES; //>> 4; // divide by 4 by right shifting 2 //theVoltage = (voltage_ave*1.2) / 4096 * 100; //in mV millivolts = (voltage_ave * MV_REF) >> ADC_BITS; //shift replaces /4096 volts = millivolts / 1000; for (i=0; i<NUM_SAMPLES; i++) { samples[i] = 0; } P1OUT ^= BIT0; // Toggle LED0 after every average sample_index = 0; // reset reading state and update display ADC14CTL0 &= ~(REFON|ADC14ON); reading = 0; measurementCounter = 0; //curVal = 0; updateDisplay(); } else {
/* PatchTablePanel::onDisplayChanged * Called when a different patch or palette is selected * TODO: Separate palette changed and patch changed without breaking * default palette display; optimize label_textures display *******************************************************************/ void PatchTablePanel::onDisplayChanged(wxCommandEvent& e) { updateDisplay(); }
void main() { volatile int status = 0; uint16_t i; volatile FILE *fid; // If running from flash copy RAM only functions to RAM #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif // Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the F2806x_SysCtrl.c file. InitSysCtrl(); // For this example, only init the pins for the SCI-A port. EALLOW; GpioCtrlRegs.GPCMUX2.bit.GPIO84 = 1; GpioCtrlRegs.GPCMUX2.bit.GPIO85 = 1; GpioCtrlRegs.GPCGMUX2.bit.GPIO84 = 1; GpioCtrlRegs.GPCGMUX2.bit.GPIO85 = 1; EDIS; // Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the F2806x_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in F2806x_DefaultIsr.c. // This function is found in F2806x_PieVect.c. InitPieVectTable(); // Initialize SCIA scia_init(); //Initialize GPIOs for the LEDs and turn them off EALLOW; GpioCtrlRegs.GPADIR.bit.GPIO12 = 1; GpioCtrlRegs.GPADIR.bit.GPIO13 = 1; GpioDataRegs.GPADAT.bit.GPIO12 = 1; GpioDataRegs.GPADAT.bit.GPIO13 = 1; EDIS; // Enable global Interrupts and higher priority real-time debug events: EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // Configure the ADC: // Initialize the ADC EALLOW; //write configurations AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4 AdcbRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4 AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); AdcSetMode(ADC_ADCB, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); //Set pulse positions to late AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1; //power up the ADCs AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1; //delay for 1ms to allow ADC time to power up DELAY_US(1000); //ADCA EALLOW; AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0x0E; //SOC0 will convert pin ADCIN14 AdcaRegs.ADCSOC0CTL.bit.ACQPS = 25; //sample window is acqps + 1 SYSCLK cycles AdcaRegs.ADCSOC1CTL.bit.CHSEL = 0x0E; //SOC1 will convert pin ADCIN14 AdcaRegs.ADCSOC1CTL.bit.ACQPS = 25; //sample window is acqps + 1 SYSCLK cycles AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 1; //end of SOC1 will set INT1 flag AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; //enable INT1 flag AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared //Redirect STDOUT to SCI status = add_device("scia", _SSA, SCI_open, SCI_close, SCI_read, SCI_write, SCI_lseek, SCI_unlink, SCI_rename); fid = fopen("scia","w"); freopen("scia:", "w", stdout); setvbuf(stdout, NULL, _IONBF, 0); //Print a TI Logo to STDOUT drawTILogo(); //Twiddle LEDs GpioDataRegs.GPADAT.bit.GPIO12 = 0; GpioDataRegs.GPADAT.bit.GPIO13 = 1; for(i = 0; i < 50; i++){ GpioDataRegs.GPATOGGLE.bit.GPIO12 = 1; GpioDataRegs.GPATOGGLE.bit.GPIO13 = 1; DELAY_US(50000); } //LEDs off GpioDataRegs.GPADAT.bit.GPIO12 = 1; GpioDataRegs.GPADAT.bit.GPIO13 = 1; //Clear out one of the text boxes so we can write more info to it clearTextBox(); currentSample = sampleADC(); //Main program loop - continually sample temperature for(;;) { //Sample ADCIN14 currentSample = sampleADC(); //Update the serial terminal output updateDisplay(); //If the sample is above midscale light one LED if(currentSample > 2048){ GpioDataRegs.GPADAT.all = 0x2000; }else{ //Otherwise light the other GpioDataRegs.GPADAT.all = 0x1000; } DELAY_US(1000000); } }
void DeathMenu::handleInput(const Input &input, const Hotspot *cursorSpot) { PegasusEngine *vm = (PegasusEngine *)g_engine; if (input.upButtonDown()) { if (_menuSelection > (vm->isDemo() ? kFirstDeathSelectionDemo : kFirstDeathSelection)) { _menuSelection--; updateDisplay(); } } else if (input.downButtonDown() && (vm->isDemo() || !_playerWon)) { if (_menuSelection < (vm->isDemo() ? kLastDeathSelectionDemo : kLastDeathSelection)) { _menuSelection++; updateDisplay(); } } else if (JMPPPInput::isMenuButtonPressInput(input)) { if (vm->isDemo()) { switch (_menuSelection) { case kDeathScreenContinueDemo: _continueButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _continueButton.hide(); setLastCommand(kMenuCmdDeathContinue); break; case kDeathScreenQuitDemo: _quitButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _quitButton.hide(); setLastCommand(kMenuCmdDeathQuitDemo); break; case kDeathScreenMainMenuDemo: _mainMenuButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _mainMenuButton.hide(); setLastCommand(kMenuCmdDeathMainMenuDemo); break; } } else { switch (_menuSelection) { case kDeathScreenContinue: _continueButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _continueButton.hide(); setLastCommand(kMenuCmdDeathContinue); break; case kDeathScreenRestore: _restoreButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _restoreButton.hide(); setLastCommand(kMenuCmdDeathRestore); break; case kDeathScreenMainMenu: _mainMenuButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _mainMenuButton.hide(); setLastCommand(kMenuCmdDeathMainMenu); break; } } } InputHandler::handleInput(input, cursorSpot); }
void taskUpdateDisplay(void) { if (feature(FEATURE_DISPLAY)) { updateDisplay(); } }
/*! \brief Event filter When isEnabled() is true all events of the observed widget are filtered. Mouse and keyboard events are translated into widgetMouse- and widgetKey- and widgetWheel-events. Paint and Resize events are handled to keep rubber band and tracker up to date. \param object Object to be filtered \param event Event \return Always false. \sa widgetEnterEvent(), widgetLeaveEvent(), widgetMousePressEvent(), widgetMouseReleaseEvent(), widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(), widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent(), QObject::installEventFilter(), QObject::event() */ bool QwtPicker::eventFilter( QObject *object, QEvent *event ) { if ( object && object == parentWidget() ) { switch ( event->type() ) { case QEvent::Resize: { const QResizeEvent *re = static_cast<QResizeEvent *>( event ); /* Adding/deleting additional event filters inside of an event filter is not safe dues to the implementation in Qt ( changing alist while iterating ). So we create the overlays in a way, that they don't install en event filter ( parent set to NULL ) and do the resizing here. */ if ( d_data->trackerOverlay ) d_data->trackerOverlay->resize( re->size() ); if ( d_data->rubberBandOverlay ) d_data->rubberBandOverlay->resize( re->size() ); if ( d_data->resizeMode == Stretch ) stretchSelection( re->oldSize(), re->size() ); updateDisplay(); break; } case QEvent::Enter: { widgetEnterEvent( event ); break; } case QEvent::Leave: { widgetLeaveEvent( event ); break; } case QEvent::MouseButtonPress: { widgetMousePressEvent( static_cast<QMouseEvent *>( event ) ); break; } case QEvent::MouseButtonRelease: { widgetMouseReleaseEvent( static_cast<QMouseEvent *>( event ) ); break; } case QEvent::MouseButtonDblClick: { widgetMouseDoubleClickEvent( static_cast<QMouseEvent *>( event ) ); break; } case QEvent::MouseMove: { widgetMouseMoveEvent( static_cast<QMouseEvent *>( event ) ); break; } case QEvent::KeyPress: { widgetKeyPressEvent( static_cast<QKeyEvent *>( event ) ); break; } case QEvent::KeyRelease: { widgetKeyReleaseEvent( static_cast<QKeyEvent *>( event ) ); break; } case QEvent::Wheel: { widgetWheelEvent( static_cast<QWheelEvent *>( event ) ); break; } default: break; } } return false; }
VoiceAlarmDialog::VoiceAlarmDialog(QWidget *parent, VoiceAlarmData *invad, int eeType, int stickmode, int modelVersion, SKYModelData *pModel ) : QDialog(parent), ui(new Ui::VoiceAlarmDialog) { ui->setupUi(this); leeType = eeType ; lpModel = pModel ; vad = invad ; populateSourceCB( ui->SourceCB, stickmode, 1, vad->source, modelVersion, eeType ) ; // uint32_t value ; // value = vad->source ; // if ( eeType ) // { // if ( value >= EXTRA_POTS_POSITION ) // { // if ( value >= EXTRA_POTS_START ) // { // value -= ( EXTRA_POTS_START - EXTRA_POTS_POSITION ) ; // } // else // { // value += eeType == 2 ? 2 : NUM_EXTRA_POTS ; // } // } // } // ui->SourceCB->setCurrentIndex(value) ; populateSwitchCB( ui->SwitchCB, vad->swtch, eeType ) ; ui->FunctionCB->setCurrentIndex( vad->func ) ; ui->RateCB->setCurrentIndex( vad->rate ) ; ui->HapticCB->setCurrentIndex( vad->haptic ) ; ui->ValueSB->setValue( vad->offset ) ; ui->MuteCB->setCurrentIndex( vad->mute ) ; ui->FileTypeCB->setCurrentIndex( vad->fnameType ) ; ui->PlaySourceCB->setCurrentIndex( vad->vsource ) ; switch ( vad->fnameType ) { case 1 : ui->FileName->setText( (char *)vad->file.name ) ; break ; case 2 : ui->FileNumberSB->setValue( vad->file.vfile ) ; break ; case 3 : ui->AudioCB->setCurrentIndex( vad->file.vfile ) ; break ; } updateDisplay() ; connect(ui->SourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->FunctionCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->SwitchCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->RateCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->HapticCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->MuteCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->ValueSB,SIGNAL(valueChanged(int)),this,SLOT(valuesChanged())); connect(ui->FileTypeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->PlaySourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->FileName, SIGNAL(editingFinished()),this,SLOT(valuesChanged())); connect(ui->FileNumberSB,SIGNAL(valueChanged(int)),this,SLOT(valuesChanged())); connect(ui->AudioCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); }
FileItem::FileItem(const openstudio::runmanager::FileInfo &t_fi) : m_info(t_fi) { setEditable(false); updateDisplay(); }
void FileItem::setFileInfo(const openstudio::runmanager::FileInfo &t_fi) { m_info = t_fi; updateDisplay(); }
void timerTick(void *data) { s_timer = app_timer_register(500, timerTick, NULL); s_currentTimer++; updateDisplay(); }
void MidiForceToKey::processMidiEvents(VstMidiEventVec *inputs, VstMidiEventVec *outputs, VstInt32 sampleFrames) { const int tchannel = FLOAT_TO_CHANNEL(fChannel); const int nchannel = FLOAT_TO_CHANNEL(fNChannel); int transposey = roundToInt(fTranspose*100.f)-50; bool noteswitch[12] = {n0>=0.5f,n1>=0.5f,n2>=0.5f,n3>=0.5f,n4>=0.5f,n5>=0.5f, n6>=0.5f,n7>=0.5f,n8>=0.5f,n9>=0.5f,n10>=0.5f,n11>=0.5f}; for (unsigned int i=0;i<inputs[0].size();i++) { VstMidiEvent tomod = inputs[0][i]; const int status = tomod.midiData[0] & 0xf0; // scraping channel const int channel = tomod.midiData[0] & 0x0f; // isolating channel (0-15) const int data1 = tomod.midiData[1] & 0x7f; //int data2 = tomod.midiData[2] & 0x7f; bool discard = false; if (status==MIDI_PROGRAMCHANGE) { if (data1<kNumPrograms && fUsePC>=0.5f) { setProgram(data1); updateDisplay(); } } //set key notes based on "note channel" if (channel == nchannel) { discard = true; if (isNoteOn(tomod)) { int n = data1%12; if (fNChMode<0.5f && !noteswitch[n]) { noteswitch[n] = true; setParameterAutomated(k0+n, 1.f); } else { noteswitch[n] = !noteswitch[n]; setParameterAutomated(k0+n, noteswitch[n] ? 1.f : 0.f); } } else if (isNoteOff(tomod) && fNChMode<0.5f) { int n = data1%12; noteswitch[n] = false; setParameterAutomated(k0+n, 0.f); } } else { if (isNoteOn(tomod)) { if (!noteswitch[data1%12]) { dbg("wrong note " << data1); int transpose = 0; int j = -1; switch (mode) { //nearest note, down when tied (same as ndc) case nearest: discard = true; while (j<12) { if (noteswitch[(data1+j)%12]) { transpose = j; discard = false; break; } if (j<0) j = -j; else j = -j - 1; } break; //always up case alwaysup: j = 1; discard = true; while (j<12) { if (noteswitch[(data1+j)%12]) { transpose = j; discard = false; break; } j++; } break; //always down case alwaysdown: discard = true; while (j<12) { if (noteswitch[(data1+j)%12]) { transpose = j; discard = false; break; } j--; } break; //block wrong notes case block: dbg("block note"); discard = true; transposed[data1][channel]=-999; break; case off: default: break; } tomod.midiData[1] = data1 + transpose; } //transpose based on notes on "transpose channel" if (channel==tchannel) { dbg("tchannel"); discard=true; int root=FLOAT_TO_MIDI(fRoot); int m = 0; int counter=0; if (tomod.midiData[1] > root) { while (counter<(tomod.midiData[1]-root)) { m++; if (noteswitch[(root+m)%12]) counter++; if (tomod.midiData[1] - m == root) break; } } else if (tomod.midiData[1] < root) { while (counter>(tomod.midiData[1]-root)) { m++; if (noteswitch[(root-m)%12]) counter--; if (tomod.midiData[1] + m == root) break; } } transposey = counter; setParameterAutomated(kTranspose, ((float)(transposey+50))*0.01f); } } } if (!discard) { dbg("keep event"); if (isNoteOn(tomod) || status==MIDI_POLYKEYPRESSURE) { if (transposey > 0) { //move the note up to the right scale degree int counter=0; int m=0; while (counter<transposey) { m++; if (noteswitch[(tomod.midiData[1]+m)%12]) counter++; if ((tomod.midiData[1]+m) == 127) break; } tomod.midiData[1] += m; } else if (transposey < 0) { //move the note down the scale int counter=0; int m=0; while (counter>transposey) { m++; if (noteswitch[(tomod.midiData[1]-m)%12]) counter--; if ((tomod.midiData[1]-m) == 0) break; } tomod.midiData[1] -= m; } if (isNoteOn(tomod)) transposed[data1][channel] = tomod.midiData[1]; } else if (isNoteOff(tomod)) { dbg("noteoff " << data1 << " transposed " << transposed[data1][channel]); if (channel == tchannel) discard = true; // always transpose noteoff by the same amount as the noteon was transposed if (transposed[data1][channel]==-999) discard = true; else tomod.midiData[1] = transposed[data1][channel]; transposed[data1][channel] = data1; } if (!discard) outputs[0].push_back(tomod); } } }
void VirtualKeyboardGUI::forceRedraw() { updateDisplay(); extendDirtyRect(Rect(_overlayBackup.w, _overlayBackup.h)); redraw(); }
void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) { PegasusEngine *vm = (PegasusEngine *)g_engine; bool isDemo = vm->isDemo(); if (input.upButtonDown()) { if (_menuSelection > (isDemo ? kFirstSelectionDemo : kFirstSelection)) { _menuSelection--; updateDisplay(); } } else if (input.downButtonDown()) { if (_menuSelection < (isDemo ? kLastSelectionDemo : kLastSelection)) { _menuSelection++; updateDisplay(); } } else if (!isDemo && (input.leftButtonDown() || input.rightButtonDown())) { if (_menuSelection == kMainMenuDifficulty) { _adventureMode = !_adventureMode; updateDisplay(); } } else if (JMPPPInput::isMenuButtonPressInput(input)) { if (isDemo) { switch (_menuSelection) { case kMainMenuCreditsDemo: _creditsButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _creditsButton.hide(); setLastCommand(kMenuCmdCredits); break; case kMainMenuStartDemo: _startButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _startButton.hide(); setLastCommand(kMenuCmdStartAdventure); break; case kMainMenuQuitDemo: _quitButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _quitButton.hide(); setLastCommand(kMenuCmdQuit); break; } } else { switch (_menuSelection) { case kMainMenuOverview: _overviewButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _overviewButton.hide(); setLastCommand(kMenuCmdOverview); break; case kMainMenuRestore: _restoreButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _restoreButton.hide(); setLastCommand(kMenuCmdRestore); break; case kMainMenuCredits: _creditsButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _creditsButton.hide(); setLastCommand(kMenuCmdCredits); break; case kMainMenuStart: _startButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _startButton.hide(); if (_adventureMode) setLastCommand(kMenuCmdStartAdventure); else setLastCommand(kMenuCmdStartWalkthrough); break; case kMainMenuDifficulty: _adventureMode = !_adventureMode; updateDisplay(); break; case kMainMenuQuit: _quitButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _quitButton.hide(); setLastCommand(kMenuCmdQuit); break; } } } InputHandler::handleInput(input, cursorSpot); }
// End interaction at the specified screen coordinates void UChromaWindow::endInteraction(int mouseX, int mouseY) { // Check interaction pane if (!ViewPane::objectValid(UChromaSession::currentViewPane())) { msg.print("Internal Error: Invalid interaction pane - refusing to end interaction.\n"); return; } // Finalise interaction type switch (interactionMode_) { case (InteractionMode::FitSetupSelectXInteraction): editFitSetupDialog_.ui.XAbsoluteMinSpin->setValue(std::min(clickedInteractionValue_, currentInteractionValue_)); editFitSetupDialog_.ui.XAbsoluteMaxSpin->setValue(std::max(clickedInteractionValue_, currentInteractionValue_)); editFitSetupDialog_.updateAndExec(); break; case (InteractionMode::FitSetupSelectZInteraction): editFitSetupDialog_.ui.ZAbsoluteMinSpin->setValue(std::min(clickedInteractionValue_, currentInteractionValue_)); editFitSetupDialog_.ui.ZAbsoluteMaxSpin->setValue(std::max(clickedInteractionValue_, currentInteractionValue_)); editFitSetupDialog_.updateAndExec(); break; case (InteractionMode::OperateBGSubSelectYValueInteraction): OperateBGSubDialog::setConstantValue(currentInteractionValue_); OperateBGSubDialog(*this).updateAndExec(); break; case (InteractionMode::OperateBGSubSelectXRangeInteraction): OperateBGSubDialog::setXRange(std::min(clickedInteractionValue_, currentInteractionValue_), std::max(clickedInteractionValue_, currentInteractionValue_)); OperateBGSubDialog(*this).updateAndExec(); break; case (InteractionMode::OperateBGSubSelectZRangeInteraction): OperateBGSubDialog::setZRange(std::min(clickedInteractionValue_, currentInteractionValue_), std::max(clickedInteractionValue_, currentInteractionValue_)); OperateBGSubDialog(*this).updateAndExec(); break; case (InteractionMode::ViewInteraction): if (clickedObject_ == Viewer::CollectionObject) { ui.MainView->setHighlightCollection(NULL); Collection* collection = UChromaSession::locateCollection(clickedObjectInfo_); if (collection) UChromaSession::setCurrentCollection(collection); } break; case (InteractionMode::ZoomInteraction): // None : Zoom to defined region // Ctrl : Extract slice if (clickedInteractionModifiers_.testFlag(Qt::ControlModifier)) { UChromaSession::beginEditStateGroup("extract slice (%c = %e)", char(88+interactionAxis_), currentInteractionValue_); UChromaSession::currentCollection()->extractCurrentSlice(interactionAxis_, currentInteractionValue_); UChromaSession::endEditStateGroup(); refreshCollections(); } else { double newMin = std::min(clickedInteractionValue_, currentInteractionValue_); double newMax = std::max(clickedInteractionValue_, currentInteractionValue_); if ((newMax-newMin) > 1.0e-10) { UChromaSession::currentViewPane()->axes().setMin(interactionAxis_, newMin); UChromaSession::currentViewPane()->axes().setMax(interactionAxis_, newMax); axesWindow_.updateControls(); } } updateDisplay(); break; default: printf("Internal Error: Don't know how to complete interaction mode %i\n", interactionMode_); break; } interactionStarted_ = false; clickedObject_ = Viewer::NoObject; clickedObjectInfo_.clear(); }
// Never set the current input handler to the DeathMenu. DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _deathBackground(0), _continueButton(0), _mainMenuButton(0), _quitButton(0), _restoreButton(0), _largeSelect(0), _smallSelect(0) { PegasusEngine *vm = (PegasusEngine *)g_engine; bool isDemo = vm->isDemo(); _playerWon = (deathReason == kPlayerWonGame); Common::String prefix = "Images/"; Common::String imageName; if (isDemo) { prefix += "Demo/"; imageName = prefix; switch (deathReason) { case kDeathFallOffCliff: imageName += "dPfall"; break; case kDeathEatenByDinosaur: imageName += "dPdino"; break; case kDeathStranded: imageName += "dPstuck"; break; default: imageName += "dPdemowin"; break; } imageName += ".pict"; } else { prefix += "Death Screens/"; imageName = prefix; static const char *fileNames[] = { "dAunmade", "dAbombed", "dAshot", "dAassass", "dAnuked", "dTunmade", "dTshot", "dPfall", "dPdino", "dPstuck", "dNchoke", "dNcaught", "dNcaught", "dNsub", "dNrobot1", "dNrobot2", "dMfall", "dMcaught", "dMtracks", "dMrobot", "dMtoast", "dMexplo1", "dMexplo2", "dMchoke1", "dMchoke2", "dMdroid", "dMfall", "dMgears", "dMshutt1", "dMshutt2", "dWpoison", "dWcaught", "dWplasma", "dWshot", "dAfinale" }; imageName += fileNames[deathReason - 1]; imageName += ".pict"; } _deathBackground.initFromPICTFile(imageName); _deathReason = deathReason; if (!isDemo) { vm->_gfx->setCurSurface(_deathBackground.getSurface()); drawAllScores(); vm->_gfx->setCurSurface(vm->_gfx->getWorkArea()); } _deathBackground.setDisplayOrder(0); _deathBackground.startDisplaying(); _deathBackground.show(); if (isDemo) { if (_playerWon) // Make credits button... _continueButton.initFromPICTFile(prefix + "Credits.pict"); else // Make continue button... _continueButton.initFromPICTFile(prefix + "Continue.pict"); _mainMenuButton.initFromPICTFile(prefix + "MainMenu.pict"); _mainMenuButton.setDisplayOrder(1); _mainMenuButton.moveElementTo(kMainMenuLeftDemo, kMainMenuTopDemo); _mainMenuButton.startDisplaying(); _quitButton.initFromPICTFile(prefix + "Quit.pict"); _quitButton.setDisplayOrder(1); _quitButton.moveElementTo(kQuitLeftDemo, kQuitTopDemo); _quitButton.startDisplaying(); _menuSelection = kDeathScreenContinueDemo; } else { if (!_playerWon) { _mainMenuButton.initFromPICTFile(prefix + "MainMenu.pict"); _mainMenuButton.setDisplayOrder(1); _mainMenuButton.moveElementTo(kMainMenuLeft, kMainMenuTop); _mainMenuButton.startDisplaying(); _restoreButton.initFromPICTFile(prefix + "Restore.pict"); _restoreButton.setDisplayOrder(1); _restoreButton.moveElementTo(kRestoreLeftDeath, kRestoreTopDeath); _restoreButton.startDisplaying(); } _continueButton.initFromPICTFile(prefix + "Continue.pict"); _menuSelection = kDeathScreenContinue; } _smallSelect.initFromPICTFile(prefix + "SelectS.pict", true); _smallSelect.setDisplayOrder(2); _smallSelect.startDisplaying(); _continueButton.setDisplayOrder(1); _continueButton.moveElementTo(kContinueLeft, kContinueTop); _continueButton.startDisplaying(); if (isDemo || !_playerWon) { _largeSelect.initFromPICTFile(prefix + "SelectL.pict", true); _largeSelect.setDisplayOrder(2); _largeSelect.startDisplaying(); } else { _triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph"); _triumphSound.playSound(); } updateDisplay(); }
//----------------------------------------------------------------------------- // Function: registergraphitem::refresh() //----------------------------------------------------------------------------- void RegisterGraphItem::refresh() { updateDisplay(); reorganizeChildren(); }
// Never set the current input handler to the CPauseMenu. PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButton(0), _restoreButton(0), _walkthroughButton(0), _continueButton(0), _soundFXLevel(0), _ambienceLevel(0), _quitButton(0), _largeSelect(0), _smallSelect(0) { PegasusEngine *vm = (PegasusEngine *)g_engine; _pauseBackground.initFromPICTFile("Images/Pause Screen/PausScrn.pict", true); if (!vm->isDemo()) { Surface numbers; numbers.getImageFromPICTFile("Images/Pause Screen/Numbers.pict"); vm->_gfx->setCurSurface(_pauseBackground.getSurface()); drawScore(GameState.getTotalScore(), kMaxTotalScore, Common::Rect(kPauseScoreLeft, kPauseScoreTop, kPauseScoreRight, kPauseScoreBottom), &numbers); vm->_gfx->setCurSurface(vm->_gfx->getWorkArea()); } _pauseBackground.setDisplayOrder(kPauseMenuOrder); _pauseBackground.moveElementTo(kPauseLeft, kPauseTop); _pauseBackground.startDisplaying(); _pauseBackground.show(); if (!vm->isDemo()) { _saveButton.initFromPICTFile("Images/Pause Screen/SaveGame.pict"); _saveButton.setDisplayOrder(kSaveGameOrder); _saveButton.moveElementTo(kSaveGameLeft, kSaveGameTop); _saveButton.startDisplaying(); _restoreButton.initFromPICTFile("Images/Pause Screen/Restore.pict"); _restoreButton.setDisplayOrder(kRestoreOrder); _restoreButton.moveElementTo(kPauseRestoreLeft, kPauseRestoreTop); _restoreButton.startDisplaying(); _walkthroughButton.initFromPICTFile("Images/Pause Screen/Walkthru.pict"); _walkthroughButton.setDisplayOrder(kWalkthruOrder); _walkthroughButton.moveElementTo(kWalkthruLeft, kWalkthruTop); _walkthroughButton.startDisplaying(); if (GameState.getWalkthroughMode()) _walkthroughButton.show(); } _continueButton.initFromPICTFile("Images/Pause Screen/Continue.pict"); _continueButton.setDisplayOrder(kContinueOrder); _continueButton.moveElementTo(kPauseContinueLeft, kPauseContinueTop); _continueButton.startDisplaying(); _soundFXLevel.setDisplayOrder(kSoundFXOrder); _soundFXLevel.setBounds(Common::Rect(kSoundFXLeft, kSoundFXTop, kSoundFXRight, kSoundFXBottom)); _soundFXLevel.startDisplaying(); _soundFXLevel.show(); _soundFXLevel.setSoundLevel(vm->getSoundFXLevel()); _ambienceLevel.setDisplayOrder(kAmbienceOrder); _ambienceLevel.setBounds(Common::Rect(kAmbienceLeft, kAmbienceTop, kAmbienceRight, kAmbienceBottom)); _ambienceLevel.startDisplaying(); _ambienceLevel.show(); _ambienceLevel.setSoundLevel(vm->getAmbienceLevel()); _quitButton.initFromPICTFile("Images/Pause Screen/Quit2MM.pict"); _quitButton.setDisplayOrder(kQuitToMainMenuOrder); _quitButton.moveElementTo(kQuitLeft, kQuitTop); _quitButton.startDisplaying(); _largeSelect.initFromPICTFile("Images/Pause Screen/SelectL.pict", true); _largeSelect.setDisplayOrder(kPauseLargeHiliteOrder); _largeSelect.startDisplaying(); _smallSelect.initFromPICTFile("Images/Pause Screen/SelectS.pict", true); _smallSelect.setDisplayOrder(kPauseSmallHiliteOrder); _smallSelect.startDisplaying(); _menuSelection = (vm->isDemo()) ? kPauseMenuContinue : kPauseMenuSave; updateDisplay(); }
void RegisterView::updateDisplay(bool registerAliases) { //m_displayType = (registerAliases ? D_ALIAS : D_REGISTER); Q_UNUSED(registerAliases); updateDisplay(); }
/* Toggle push-pin */ void VBoxMiniToolBar::togglePushpin(bool fOn) { m_fAutoHide = !fOn; updateDisplay(!m_fAutoHide, false); }
void RegisterView::updateBase(int base) { Q_UNUSED(base); updateDisplay(); }
void OperatorEditor::sliderValueChanged (Slider* sliderThatWasMoved) { //[UsersliderValueChanged_Pre] //[/UsersliderValueChanged_Pre] if (sliderThatWasMoved == s_egl1) { //[UserSliderCode_s_egl1] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egl1] } else if (sliderThatWasMoved == s_egl2) { //[UserSliderCode_s_egl2] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egl2] } else if (sliderThatWasMoved == s_egl3) { //[UserSliderCode_s_egl3] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egl3] } else if (sliderThatWasMoved == s_egl4) { //[UserSliderCode_s_egl4] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egl4] } else if (sliderThatWasMoved == s_egv1) { //[UserSliderCode_s_egv1] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egv1] } else if (sliderThatWasMoved == s_egv2) { //[UserSliderCode_s_egv2] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egv2] } else if (sliderThatWasMoved == s_egv3) { //[UserSliderCode_s_egv3] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egv3] } else if (sliderThatWasMoved == s_egv4) { //[UserSliderCode_s_egv4] -- add your slider handling code here.. envDisplay->repaint(); //[/UserSliderCode_s_egv4] } else if (sliderThatWasMoved == opLevel) { //[UserSliderCode_opLevel] -- add your slider handling code here.. //[/UserSliderCode_opLevel] } else if (sliderThatWasMoved == opFine) { //[UserSliderCode_opFine] -- add your slider handling code here.. updateDisplay(); //[/UserSliderCode_opFine] } else if (sliderThatWasMoved == opCoarse) { //[UserSliderCode_opCoarse] -- add your slider handling code here.. updateDisplay(); //[/UserSliderCode_opCoarse] } else if (sliderThatWasMoved == detune) { //[UserSliderCode_detune] -- add your slider handling code here.. updateDisplay(); //[/UserSliderCode_detune] } else if (sliderThatWasMoved == sclLeftLevel) { //[UserSliderCode_sclLeftLevel] -- add your slider handling code here.. //[/UserSliderCode_sclLeftLevel] } else if (sliderThatWasMoved == sclRightLevel) { //[UserSliderCode_sclRightLevel] -- add your slider handling code here.. //[/UserSliderCode_sclRightLevel] } else if (sliderThatWasMoved == sclLvlBrkPt) { //[UserSliderCode_sclLvlBrkPt] -- add your slider handling code here.. //[/UserSliderCode_sclLvlBrkPt] } else if (sliderThatWasMoved == sclRateScaling) { //[UserSliderCode_sclRateScaling] -- add your slider handling code here.. //[/UserSliderCode_sclRateScaling] } else if (sliderThatWasMoved == keyVelSens) { //[UserSliderCode_keyVelSens] -- add your slider handling code here.. //[/UserSliderCode_keyVelSens] } else if (sliderThatWasMoved == ampModSens) { //[UserSliderCode_ampModSens] -- add your slider handling code here.. //[/UserSliderCode_ampModSens] } //[UsersliderValueChanged_Post] //[/UsersliderValueChanged_Post] }
/*! Handle a leave event for the observed widget. \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(), widgetMouseDoubleClickEvent(), widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent() */ void QwtPicker::widgetLeaveEvent(QEvent *) { d_data->trackerPosition = QPoint(-1, -1); if ( !isActive() ) updateDisplay(); }
//*************************************************************************** Kwave::NotchFilterDialog::NotchFilterDialog(QWidget *parent, double sample_rate) :QDialog(parent), Kwave::PluginSetupDialog(), Ui::NotchFilterDlg(), m_frequency(3500),m_bw(100), m_sample_rate(sample_rate), m_filter(0) { setupUi(this); setModal(true); // set maximum frequency to sample rate / 2 double f_max = sample_rate / 2.0; slider->setMaximum(Kwave::toInt(f_max)); spinbox->setMaximum(Kwave::toInt(f_max)); slider_2->setMaximum(Kwave::toInt(f_max)); spinbox_2->setMaximum(Kwave::toInt(f_max)); // initialize the frequency scale widget scale_freq->setMinMax(0, Kwave::toInt(f_max)); scale_freq->setLogMode(false); scale_freq->setUnit(i18n("Hz")); // initialize the attenuation scale widget scale_db->setMinMax(-24, +6); scale_db->setLogMode(false); scale_db->setUnit(i18n("dB")); // initialize the frequency response widget freq_response->init(f_max, -24, +6); // set up the low pass filter dunction m_filter = new NotchFilter(); freq_response->setFilter(m_filter); // initialize the controls and the curve display slider->setValue(Kwave::toInt(m_frequency)); spinbox->setValue(Kwave::toInt(m_frequency)); slider_2->setValue(Kwave::toInt(m_bw)); spinbox_2->setValue(Kwave::toInt(m_bw)); updateDisplay(); // changes in the slider or spinbox connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(freqValueChanged(int))); connect(spinbox_2, SIGNAL(valueChanged(int)), this, SLOT(bwValueChanged(int))); // click to the "Listen" button connect(btListen, SIGNAL(toggled(bool)), this, SLOT(listenToggled(bool))); // expand the "Listen" button to it's maximum width listenToggled(true); if (btListen->width() > btListen->minimumWidth()) btListen->setMinimumWidth(btListen->width()); listenToggled(false); if (btListen->width() > btListen->minimumWidth()) btListen->setMinimumWidth(btListen->width()); // set the initial size of the dialog int h = (width() * 3) / 5; if (height() < h) resize(width(), h); int w = (height() * 5) / 3; if (width() < w) resize(w, height()); connect(buttonHelp->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(invokeHelp())); // set the focus onto the "OK" button buttonBox->button(QDialogButtonBox::Ok)->setFocus(); }
void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) { PegasusEngine *vm = (PegasusEngine *)g_engine; if (input.upButtonDown()) { if (vm->isDemo()) { if (_menuSelection > kPauseMenuContinue) { switch (_menuSelection) { case kPauseMenuSoundFX: _menuSelection = kPauseMenuContinue; break; case kPauseMenuAmbience: _menuSelection = kPauseMenuSoundFX; break; case kPauseMenuQuitToMainMenu: _menuSelection = kPauseMenuAmbience; break; } updateDisplay(); } } else { if (_menuSelection > kFirstPauseSelection) { _menuSelection--; updateDisplay(); } } } else if (input.downButtonDown()) { if (vm->isDemo()) { if (_menuSelection < kPauseMenuQuitToMainMenu) { switch (_menuSelection) { case kPauseMenuContinue: _menuSelection = kPauseMenuSoundFX; break; case kPauseMenuSoundFX: _menuSelection = kPauseMenuAmbience; break; case kPauseMenuAmbience: _menuSelection = kPauseMenuQuitToMainMenu; break; } updateDisplay(); } } else { if (_menuSelection < kLastPauseSelection) { _menuSelection++; updateDisplay(); } } } else if (input.leftButtonDown()) { if (_menuSelection == kPauseMenuSoundFX) { _soundFXLevel.decrementLevel(); vm->setSoundFXLevel(_soundFXLevel.getSoundLevel()); } else if (_menuSelection == kPauseMenuAmbience) { _ambienceLevel.decrementLevel(); vm->setAmbienceLevel(_ambienceLevel.getSoundLevel()); } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) { GameState.setWalkthroughMode(!GameState.getWalkthroughMode()); if (GameState.getWalkthroughMode()) _walkthroughButton.show(); else _walkthroughButton.hide(); } } else if (input.rightButtonDown()) { if (_menuSelection == kPauseMenuSoundFX) { _soundFXLevel.incrementLevel(); vm->setSoundFXLevel(_soundFXLevel.getSoundLevel()); } else if (_menuSelection == kPauseMenuAmbience) { _ambienceLevel.incrementLevel(); vm->setAmbienceLevel(_ambienceLevel.getSoundLevel()); } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) { GameState.setWalkthroughMode(!GameState.getWalkthroughMode()); if (GameState.getWalkthroughMode()) _walkthroughButton.show(); else _walkthroughButton.hide(); } } else if (JMPPPInput::isMenuButtonPressInput(input)) { switch (_menuSelection) { case kPauseMenuSave: _saveButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _saveButton.hide(); setLastCommand(kMenuCmdPauseSave); break; case kPauseMenuRestore: _restoreButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _restoreButton.hide(); setLastCommand(kMenuCmdPauseRestore); break; case kPauseMenuContinue: _continueButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _continueButton.hide(); setLastCommand(kMenuCmdPauseContinue); break; case kPauseMenuWalkthru: GameState.setWalkthroughMode(!GameState.getWalkthroughMode()); if (GameState.getWalkthroughMode()) _walkthroughButton.show(); else _walkthroughButton.hide(); break; case kPauseMenuQuitToMainMenu: _quitButton.show(); vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale); _quitButton.hide(); setLastCommand(kMenuCmdPauseQuit); break; } } InputHandler::handleInput(input, cursorSpot); }
void MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu() { #if ENABLE(VIDEO_TRACK) // Remove any existing content. removeChildren(); m_menuItems.clear(); m_trackListHasChanged = false; if (!mediaController()->hasClosedCaptions()) return; HTMLMediaElement* mediaElement = toParentMediaElement(this); if (!mediaElement) return; TextTrackList* trackList = mediaElement->textTracks(); if (!trackList || !trackList->length()) return; Document* doc = document(); RefPtr<Element> captionsSection = doc->createElement(sectionTag, ASSERT_NO_EXCEPTION); RefPtr<Element> captionsHeader = doc->createElement(h3Tag, ASSERT_NO_EXCEPTION); captionsHeader->appendChild(doc->createTextNode(textTrackClosedCaptionsText())); captionsSection->appendChild(captionsHeader); RefPtr<Element> captionsMenuList = doc->createElement(ulTag, ASSERT_NO_EXCEPTION); RefPtr<Element> subtitlesSection = doc->createElement(sectionTag, ASSERT_NO_EXCEPTION); RefPtr<Element> subtitlesHeader = doc->createElement(h3Tag, ASSERT_NO_EXCEPTION); subtitlesHeader->appendChild(doc->createTextNode(textTrackSubtitlesText())); subtitlesSection->appendChild(subtitlesHeader); RefPtr<Element> subtitlesMenuList = doc->createElement(ulTag, ASSERT_NO_EXCEPTION); RefPtr<Element> trackItem; trackItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION); trackItem->appendChild(doc->createTextNode(textTrackOffText())); trackItem->setAttribute(trackIndexAttributeName(), textTracksOffAttrValue, ASSERT_NO_EXCEPTION); captionsMenuList->appendChild(trackItem); m_menuItems.append(trackItem); trackItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION); trackItem->appendChild(doc->createTextNode(textTrackOffText())); trackItem->setAttribute(trackIndexAttributeName(), textTracksOffAttrValue, ASSERT_NO_EXCEPTION); subtitlesMenuList->appendChild(trackItem); m_menuItems.append(trackItem); bool hasCaptions = false; bool hasSubtitles = false; for (unsigned i = 0, length = trackList->length(); i < length; ++i) { TextTrack* track = trackList->item(i); trackItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION); // Add a custom attribute to the <li> element which will allow // us to easily associate the user tapping here with the // track. Since this list is rebuilt if the tracks change, we // should always be in sync. trackItem->setAttribute(trackIndexAttributeName(), String::number(i), ASSERT_NO_EXCEPTION); AtomicString labelText = track->label(); if (labelText.isNull() || labelText.isEmpty()) labelText = displayNameForLanguageLocale(track->language()); if (labelText.isNull() || labelText.isEmpty()) labelText = textTrackNoLabelText(); trackItem->appendChild(doc->createTextNode(labelText)); if (track->kind() == track->captionsKeyword()) { hasCaptions = true; insertTextTrackMenuItemIntoSortedContainer(trackItem, captionsMenuList); } if (track->kind() == track->subtitlesKeyword()) { hasSubtitles = true; insertTextTrackMenuItemIntoSortedContainer(trackItem, subtitlesMenuList); } m_menuItems.append(trackItem); } captionsSection->appendChild(captionsMenuList); subtitlesSection->appendChild(subtitlesMenuList); if (hasCaptions) appendChild(captionsSection); if (hasSubtitles) appendChild(subtitlesSection); updateDisplay(); #endif }
// Never set the current input handler to the MainMenu. MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButton(0), _restoreButton(0), _adventureButton(0), _walkthroughButton(0), _startButton(0), _creditsButton(0), _quitButton(0), _largeSelect(0), _smallSelect(0) { bool isDemo = ((PegasusEngine *)g_engine)->isDemo(); if (isDemo) { if (((PegasusEngine *)g_engine)->isWindows()) _menuBackground.initFromPICTFile("Images/Demo/DemoMenuPC.pict"); else _menuBackground.initFromPICTFile("Images/Demo/DemoMenu.pict"); } else { _menuBackground.initFromPICTFile("Images/Main Menu/MainMenu.mac"); } _menuBackground.setDisplayOrder(0); _menuBackground.startDisplaying(); _menuBackground.show(); if (!isDemo) { _overviewButton.initFromPICTFile("Images/Main Menu/pbOvervi.pict"); _overviewButton.setDisplayOrder(1); _overviewButton.moveElementTo(kOverviewLeft, kOverviewTop); _overviewButton.startDisplaying(); _restoreButton.initFromPICTFile("Images/Main Menu/pbRestor.pict"); _restoreButton.setDisplayOrder(1); _restoreButton.moveElementTo(kRestoreLeft, kRestoreTop); _restoreButton.startDisplaying(); _adventureButton.initFromPICTFile("Images/Main Menu/BtnAdv.pict"); _adventureButton.setDisplayOrder(1); _adventureButton.moveElementTo(kDifficultyLeft, kDifficultyTop); _adventureButton.startDisplaying(); _walkthroughButton.initFromPICTFile("Images/Main Menu/BtnWlk.pict"); _walkthroughButton.setDisplayOrder(1); _walkthroughButton.moveElementTo(kDifficultyLeft, kDifficultyTop); _walkthroughButton.startDisplaying(); } if (isDemo) _startButton.initFromPICTFile("Images/Demo/Start.pict"); else _startButton.initFromPICTFile("Images/Main Menu/pbStart.pict"); _startButton.setDisplayOrder(1); _startButton.moveElementTo(isDemo ? kStartLeftDemo : kStartLeft, isDemo ? kStartTopDemo : kStartTop); _startButton.startDisplaying(); if (isDemo) _creditsButton.initFromPICTFile("Images/Demo/Credits.pict"); else _creditsButton.initFromPICTFile("Images/Main Menu/pbCredit.pict"); _creditsButton.setDisplayOrder(1); _creditsButton.moveElementTo(isDemo ? kCreditsLeftDemo : kCreditsLeft, isDemo ? kCreditsTopDemo : kCreditsTop); _creditsButton.startDisplaying(); if (isDemo) _quitButton.initFromPICTFile("Images/Demo/Quit.pict"); else _quitButton.initFromPICTFile("Images/Main Menu/pbQuit.pict"); _quitButton.setDisplayOrder(1); _quitButton.moveElementTo(isDemo ? kMainMenuQuitLeftDemo : kMainMenuQuitLeft, isDemo ? kMainMenuQuitTopDemo : kMainMenuQuitTop); _quitButton.startDisplaying(); if (isDemo) _largeSelect.initFromPICTFile("Images/Demo/SelectL.pict", true); else _largeSelect.initFromPICTFile("Images/Main Menu/SelectL.pict", true); _largeSelect.setDisplayOrder(1); _largeSelect.startDisplaying(); if (isDemo) _smallSelect.initFromPICTFile("Images/Demo/SelectS.pict", true); else _smallSelect.initFromPICTFile("Images/Main Menu/SelectS.pict", true); _smallSelect.setDisplayOrder(1); _smallSelect.startDisplaying(); _menuSelection = isDemo ? kFirstSelectionDemo : kFirstSelection; _adventureMode = true; _menuLoop.attachFader(&_menuFader); _menuLoop.initFromAIFFFile("Sounds/Main Menu.aiff"); updateDisplay(); }
void executePeriodicTasks(void) { static int periodicTaskIndex = 0; switch (periodicTaskIndex++) { #ifdef MAG case UPDATE_COMPASS_TASK: if (sensors(SENSOR_MAG)) { updateCompass(&masterConfig.magZero); } break; #endif #ifdef BARO case UPDATE_BARO_TASK: if (sensors(SENSOR_BARO)) { baroUpdate(currentTime); } break; #endif #ifdef PITOT case UPDATE_PITOT_TASK: if (sensors(SENSOR_PITOT)) { pitotUpdate(currentTime); } break; #endif #if defined(PITOT) case CALCULATE_AIRSPEED_TASK: if (sensors(SENSOR_PITOT)) { calculateAirspeed(currentTime); } break; #endif #if defined(BARO) || defined(SONAR) case CALCULATE_ALTITUDE_TASK: if (false #if defined(BARO) || (sensors(SENSOR_BARO) && isBaroReady()) #endif #if defined(SONAR) || sensors(SENSOR_SONAR) #endif ) { calculateEstimatedAltitude(currentTime); } break; #endif #ifdef SONAR case UPDATE_SONAR_TASK: if (sensors(SENSOR_SONAR)) { sonarUpdate(); } break; #endif #ifdef DISPLAY case UPDATE_DISPLAY_TASK: if (feature(FEATURE_DISPLAY)) { updateDisplay(); } break; #endif } if (periodicTaskIndex >= PERIODIC_TASK_COUNT) { periodicTaskIndex = 0; } }
void TableDialog::updateColumn(int sc) { int colType = d_table->columnType(sc); if (!sc) buttonPrev->setEnabled(false); else buttonPrev->setEnabled(true); if (sc >= d_table->numCols() - 1) buttonNext->setEnabled(false); else buttonNext->setEnabled(true); d_table->setSelectedCol(sc); d_table->table()->clearSelection(); d_table->table()->selectColumn(sc); int pd = d_table->colPlotDesignation(sc); columnsBox->setCurrentIndex(pd); displayBox->setEnabled(pd != Table::Label); QString colLabel = d_table->colLabel(sc); colName->setText(colLabel); colName->setFocus(); colName->selectAll(); comments->setText(d_table->comment(sc)); displayBox->setCurrentIndex(colType); updateDisplay(colType); boxReadOnly->setChecked(d_table->isReadOnlyColumn(sc)); bool hidden = d_table->isColumnHidden(sc); boxHideColumn->setChecked(hidden); if (hidden) colWidth->setValue(100); else colWidth->setValue(d_table->columnWidth(sc)); d_table->saveToMemory(); if (colType == Table::Numeric){ int f, prec; d_table->columnNumericFormat(sc, &f, &prec); formatBox->setCurrentIndex(f); precisionBox->setValue(prec); enablePrecision(f); } else if (colType == Table::Time || colType == Table::Date){ QString format = d_table->columnFormat(sc); if (formatBox->findText(format) < 0) formatBox->insertItem(0, format); formatBox->setCurrentText(format); } else if (colType == Table::Day){ QString format = d_table->columnFormat(sc); if (format == "ddd") formatBox->setCurrentIndex(0); else if (format == "dddd") formatBox->setCurrentIndex(1); else if (format == "d") formatBox->setCurrentIndex(2); } else if (colType == Table::Month){ QString format = d_table->columnFormat(sc); if (format == "MMM") formatBox->setCurrentIndex(0); else if (format == "MMMM") formatBox->setCurrentIndex(1); else if (format == "M") formatBox->setCurrentIndex(2); } }