void _ji_system_exit() { SetDisplay(NULL); set_mouse_cursor(NULL); remove_int(clock_inc); }
bool cScoreboard::RemoveObjective(const AString & a_Name) { cCSLock Lock(m_CSObjectives); cObjectiveMap::iterator it = m_Objectives.find(a_Name); if (it == m_Objectives.end()) { return false; } ASSERT(m_World != NULL); m_World->BroadcastScoreboardObjective(it->second.GetName(), it->second.GetDisplayName(), 1); for (unsigned int i = 0; i < (unsigned int) dsCount; ++i) { if (m_Display[i] == &it->second) { SetDisplay(NULL, (eDisplaySlot) i); } } m_Objectives.erase(it); return true; }
void setOurBitmap(void) { HideCursor(); SetDisplay(display_page ? GrafPg1 : GrafPg0); SetBitmap(display_page ? GrafPg1 : GrafPg0); ShowCursor(); }
/***************************************************************************** ** Procedure: CDSPhone::UnsolicitedEvent ** ** Arguments: 'lpBuff' - Data buffer (structure) specific to code ** ** Returns: void ** ** Description: This function processes any responses from the device which ** are not matched to a pending line request. ** *****************************************************************************/ bool CDSPhone::UnsolicitedEvent(LPCVOID lpBuff) { USES_CONVERSION; EVENTBUFF* pevBuff = (EVENTBUFF*) lpBuff; switch (pevBuff->dwResponse) { // A lamp has changed states. case EMRESULT_LAMPCHANGED: { LPEMLAMPCHANGE lpChange = (LPEMLAMPCHANGE) pevBuff->lpBuff; SetLampState ((int)lpChange->wButtonLampID, g_LampStates[lpChange->wLampState]); } break; // A hookswitch device has changed states. case EMRESULT_HSCHANGED: { LPEMHOOKSWITCHCHANGE lpChange = (LPEMHOOKSWITCHCHANGE) pevBuff->lpBuff; _TSP_ASSERTE (lpChange->wHookswitchID == HSDEVICE_HANDSET); SetHookSwitch (PHONEHOOKSWITCHDEV_HANDSET, g_hsStates[lpChange->wHookswitchState]); } break; // A button has changed case EMRESULT_BUTTONCHANGED: { LPEMBUTTONCHANGE lpChange = (LPEMBUTTONCHANGE) pevBuff->lpBuff; SetButtonState (lpChange->wButtonLampID, g_ButtonStates[lpChange->wButtonState]); } break; // Ringer mode changed case EMRESULT_RINGCHANGE: SetRingMode (*((LPDWORD)pevBuff->lpBuff)); break; // Volume/Gain of the handset changed case EMRESULT_LEVELCHANGED: { LPEMLEVELCHANGE lpChange = (LPEMLEVELCHANGE) pevBuff->lpBuff; if (lpChange->wLevelType == LEVELTYPE_MIC) SetGain (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); else if (lpChange->wLevelType == LEVELTYPE_SPEAKER) SetVolume (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); } break; // The display has changed. case EMRESULT_DISPLAYCHANGED: { LPEMDISPLAY lpChange = (LPEMDISPLAY) pevBuff->lpBuff; SetDisplay (A2T(lpChange->szDisplay)); } break; } return true; }// CDSPhone::UnsolicitedEvent
void cScoreboard::SetDisplay(const AString & a_Objective, eDisplaySlot a_Slot) { ASSERT(a_Slot < dsCount); cObjective * Objective = GetObjective(a_Objective); SetDisplay(Objective, a_Slot); }
Display::~Display() { if( m_Fullscreen ) { SetDisplay( true ); } m_DisplayModes.Clear(); }
bool WaveformPrefs::Apply() { const bool isOpenPage = this->IsShown(); const auto partner = mWt ? // Assume linked track is wave or null static_cast<WaveTrack*>(mWt->GetLink()) : nullptr; ShuttleGui S(this, eIsGettingFromDialog); PopulateOrExchange(S); mTempSettings.ConvertToActualDBRange(); WaveformSettings::Globals::Get().SavePrefs(); if (mWt) { if (mDefaulted) { mWt->SetWaveformSettings({}); if (partner) partner->SetWaveformSettings({}); } else { WaveformSettings *pSettings = &mWt->GetIndependentWaveformSettings(); *pSettings = mTempSettings; if (partner) { pSettings = &partner->GetIndependentWaveformSettings(); *pSettings = mTempSettings; } } } if (!mWt || mDefaulted) { WaveformSettings *const pSettings = &WaveformSettings::defaults(); *pSettings = mTempSettings; pSettings->SavePrefs(); } mTempSettings.ConvertToEnumeratedDBRange(); if (mWt && isOpenPage) { mWt->SetDisplay(WaveTrack::Waveform); if (partner) partner->SetDisplay(WaveTrack::Waveform); } if (isOpenPage) { TrackPanel *const tp = ::GetActiveProject()->GetTrackPanel(); tp->UpdateVRulers(); tp->Refresh(false); } return true; }
/***************************************************************************** ** Procedure: CJTPhone::read ** ** Arguments: 'istm' - Input stream ** ** Returns: pointer to istm ** ** Description: This function is called to serialize data in from the ** registry. The phone object has already been completely ** initialized by the TSP++ library ** *****************************************************************************/ TStream& CJTPhone::read(TStream& istm) { // Load our default display which is used while we have no agent // logged into this station. SetDisplay(_T(" NOT LOGGED ON")); // Return the base class loading. return CTSPIPhoneConnection::read(istm); }// CJTPhone::read
FileList::FileList() { iconwidth = DPI(16); ItemHeight(max(Draw::GetStdFontCy(), DPI(17))); Ctrl::Add(edit); edit.Hide(); edit.SetFrame(BlackFrame()); renaming = false; justname = false; accelkey = false; selectdir = false; SetDisplay(*this); }
/*******************************************MAIN PROGRAM*******************************************/ int main() { init(); SetDisplay(); // Setup the display ClearDisplay(); while (1) { _delay_ms(60); // To allow sufficient time between queries (60ms min) PORTC |= (1<<PC4); // Set trigger high _delay_us(10); // for 10uS PORTC &= ~(1<<PC4); // to trigger the ultrasonic module } }
VOID ProcessArithmetic( LONG newaction ) /* new operator key pressed */ { switch(oldaction) { /* process prior action key */ case BUTTON_MULTIPLY: /* multiplication */ case BUTTON_DIVIDE: /* division */ case BUTTON_PLUS: /* addition */ case BUTTON_MINUS: /* subtraction */ case BUTTON_IDIV: /* integer division */ case BUTTON_REMAINDER: /* remainder division */ case BUTTON_POWER: /* raise a number to power */ /* call the appropriate */ /* Rexx operand processor */ if (ProcessProgram(operator_names[oldaction-BUTTON_MULTIPLY])) oldaction = 0; /* cancel next on error */ else oldaction = newaction; /* remember the new action */ break; default: /* copy display into accum */ strcpy(accumulator.strptr, display.strptr); /* copy the length also */ accumulator.strlength = display.strlength; display.strlength = 0; /* clear out digits */ break; /* no more needed */ } switch (newaction) { /* now process then new key */ /* process function keys */ /* immediately */ case BUTTON_PROGRAM1: /* program key one */ case BUTTON_PROGRAM2: /* program key two */ /* call the appropriate */ /* Rexx operand processor */ SetDisplay(&accumulator); /* update display */ ProcessProgram(operator_names[newaction-BUTTON_MULTIPLY]); oldaction = 0; /* cancel next action */ break; default: /* all other operations */ oldaction = newaction; /* remember the new action */ } }
void SiloDumpAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SiloDumpAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("filename")) != 0) SetFilename(node->AsString()); if((node = searchNode->GetNode("display")) != 0) SetDisplay(node->AsBool()); }
void StateGameMode::InitState(ALLEGRO_DISPLAY *display, Settings *settings, Map *currentMap, ImageLoader *imageLoader){ SetImageLoader(imageLoader); SetDisplay(display); SetSettings(settings); SetId(EnumDLL::STATES::EDITORMODE); SetEventQueue(NULL); SetRedraw(true); SetDone(false); SetRunning(true); SetKeyPressReturnVal(EnumDLL::STATES::DEFAULT); SetFont(al_load_font("arial.ttf", 20, 0)); SetTimer(al_create_timer(1.0/60)); SetEventQueue(al_create_event_queue()); SetStateDirection(EnumDLL::STATEDIRECTION::NA); al_register_event_source(GetEventQueue(), al_get_keyboard_event_source()); al_register_event_source(GetEventQueue(), al_get_mouse_event_source()); al_register_event_source(GetEventQueue(), al_get_display_event_source(GetDisplay())); al_register_event_source(GetEventQueue(), al_get_timer_event_source(GetTimer())); SetMouseCursorPos(0,0); SetRightMousePos(0,0); SetRightMouseDown(false); SetLeftMouseDown(false); SetPlayerSelected(false); SetMap(currentMap); player1_ = new Player(GetSettings(),GetMap()); player1_->SetGravityY(-9.8); for(int i = 0; i < GetImageLoader()->GetImageSetDictionary().size(); i++) { if(GetImageLoader()->GetImageSetDictionary()[i]->GetImageSetId() == EnumDLL::IMAGESETS::PLAYERIMAGESET) { player1_->SetObjectImageColor(GetImageLoader()->GetImageSetDictionary()[i]->GetImageDictionary()[0]); } } SetChosenColor(al_map_rgb_f(1,1,1)); al_start_timer(GetTimer()); }
/* LCDP::begin ** ** Synopsis: ** ** Parameters: ** uint8_t bkl - the pin corresponding to Backlight pin ** uint8_t rs - the pin corresponding to RS pin ** uint8_t rw - the pin corresponding to RW pin ** uint8_t enable - the pin corresponding to Enable pin ** uint8_t d0 - the pin corresponding to D0 pin ** uint8_t d1 - the pin corresponding to D1 pin ** uint8_t d2 - the pin corresponding to D2 pin ** uint8_t d3 - the pin corresponding to D3 pin ** uint8_t d4 - the pin corresponding to D4 pin ** uint8_t d5 - the pin corresponding to D5 pin ** uint8_t d6 - the pin corresponding to D6 pin ** uint8_t d7 - the pin corresponding to D7 pin ** ** Return Values: ** ** Errors: ** ** ** Description: ** This function saves the pins corresponding to the CLP and performs the required LCDP initialization tasks. ** ** */ void LCDP::begin(uint8_t bkl, uint8_t rs, uint8_t rw, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7) { m_bkl_pin = bkl; m_rs_pin = rs; m_rw_pin = rw; m_enable_pin = enable; if(d0 == 0 && d1 == 1 && d2 == 2 && d3 == 3 && d4 == 4 && d5 == 5 && d6 == 6 && d7 == 7) { m_fDirectPortJA = true; } else { m_data_pins[0] = d0; m_data_pins[1] = d1; m_data_pins[2] = d2; m_data_pins[3] = d3; m_data_pins[4] = d4; m_data_pins[5] = d5; m_data_pins[6] = d6; m_data_pins[7] = d7; } // declare command pins as output pinMode(m_bkl_pin, OUTPUT); pinMode(m_rs_pin, OUTPUT); pinMode(m_rw_pin, OUTPUT); pinMode(m_enable_pin, OUTPUT); // perform initialization sequence, according to datasheet // wait 20 ms delayMicroseconds(20*1000); // Set function WriteCommand(LCDP_CMD_LcdFcnInit); // Wait 37 us delayMicroseconds(37); // display on, no cursor, no blinking SetDisplay(true); // Wait 37 us delayMicroseconds(37); // Display Clear DisplayClear(); // Wait 1.52 ms delayMicroseconds(1520); }
void GISEraseApplicationMsgData::Validate() throw(GException) { LOG_LEVEL4("Validate()"); enum { eDefaultDisplayNumber = 1 }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //TODO: DisplayManager Constrain - If improvement is done on Specs, this should be removed. if ( GetDisplay() != static_cast<int>(eDefaultDisplayNumber)) { SetDisplay(static_cast<int>(eDefaultDisplayNumber)); GISCommandStatusEnum oError(GISCommandStatusEnum::eInvalidDisplayNumberOrDisplayNumberDoesNotExist); LOG_LEVEL2(oError.toString() ); //throw GIS_EXCEPTION(GISCommandStatusEnum::eInvalidDisplayNumberOrDisplayNumberDoesNotExist); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
void ResetDisplay (ImageDisplay *IDdata) /* set display parameters and ensures a single expose event to repaint the image on the display */ { int old_wid, old_hei; /* save old display size */ old_wid = IDdata->disp_wid; old_hei = IDdata->disp_hei; /* reset display parameters*/ SetDisplay(IDdata); /* terrible hack - if SetDisplay made the display area larger then this will provoke an expose event. If not then create one here. */ if ((XtIsRealized (IDdata->canvas)) && (old_wid>=IDdata->disp_wid) && (old_hei>=IDdata->disp_hei)) { PaintImage(IDdata); /* redraw */ } } /* end ResetDisplay */
static void AddCall( instruction *ins, cn call ) { /****************************************************/ name *proc_name; if( _IsTargetModel(FLOATING_DS) && (call->state->attr&ROUTINE_NEEDS_DS_LOADED) ) { AddIns( MakeMove( NearSegment(), AllocRegName( HW_DS ), U2 ) ); } if( call->name->tipe == TypeProcParm ) { proc_name = AllocTemp( ClassPointer ); /* what to do? proc_name->usage |= USE_REGISTER;*/ AddIns( MakeMove( ins->operands[CALL_OP_ADDR], proc_name, ClassPointer )); ins->operands[CALL_OP_ADDR] = proc_name; SetDisplay( GenIns( call->name ) ); AddIns( ins ); SaveDisplay( OP_POP ); } else { AddCallIns( ins, call ); } }
void ImageRedispCB (Widget w, XtPointer clientData, XtPointer callData) /* redisplay image canvas */ { ImageDisplay *IDdata = (ImageDisplay *)clientData; XmDrawingAreaCallbackStruct *cb = (XmDrawingAreaCallbackStruct *)callData; XExposeEvent *event = (XExposeEvent *) cb->event; /* NOP unless widget is canvas */ if (!IDdata) return; if (!IDdata->canvas) return; if (w!=IDdata->canvas) return; /*fprintf (stderr,"RedispCB: x %d, y %d, nx %d, ny %d, count %d\n", event->x, event->y, event->width, event->height, event->count);*/ /* return if there are more expose events in the queue */ if (event->count) return; /* reset display */ SetDisplay(IDdata); /* redraw exposed area from ImageData */ PaintImage (IDdata); } /* end of ImageRedispCB */
void StateEditorMode::InitState(ALLEGRO_DISPLAY *display, Settings *settings, Map *currentMap, ImageLoader *imageLoader){ SetImageLoader(imageLoader); SetDisplay(display); SetSettings(settings); SetId(EnumDLL::STATES::EDITORMODE); SetEventQueue(NULL); SetRedraw(true); SetDone(false); SetRunning(true); SetKeyPressReturnVal(EnumDLL::STATES::DEFAULT); SetFont(al_load_font("arial.ttf", 20, 0)); SetTimer(al_create_timer(1.0/60)); SetEventQueue(al_create_event_queue()); SetStateDirection(EnumDLL::STATEDIRECTION::NA); al_register_event_source(GetEventQueue(), al_get_keyboard_event_source()); al_register_event_source(GetEventQueue(), al_get_mouse_event_source()); al_register_event_source(GetEventQueue(), al_get_display_event_source(GetDisplay())); al_register_event_source(GetEventQueue(), al_get_timer_event_source(GetTimer())); SetMouseCursorPos(0,0); SetRightMousePos(0,0); SetRightMouseDown(false); SetLeftMouseDown(false); SetPlayerSelected(false); SetMap(currentMap); editorOverLayController_ = new EditorOverLayController(settings, imageLoader); SetChosenColor(al_map_rgb_f(1,1,1)); al_start_timer(GetTimer()); }
MOboolean moGUIManager::Init( MO_HANDLE p_OpWindowHandle, MO_DISPLAY p_Display ) { SetDisplay( p_Display ); SetOpWindowHandle( p_OpWindowHandle ); return true; }
int main(void) { //u32 i,j; //u8 x=0; HV57708_Init(HV57708_MODE_NORMAL); IIC_GPIO_Config(); Neon_Init(); LED_Init(); //LED_ON(); //Neon_Flip(); //GPIO_SetBits(GPIOA,GPIO_Pin_3|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7); //GPIO_SetBits(GPIOC,GPIO_Pin_4|GPIO_Pin_5); //GPIO_SetBits(GPIOC,GPIO_Pin_14|GPIO_Pin_15); //while(1) { // Neon_Flip(); // Delay(5000); //} //HV57708_SendData(0, 0); //HV57708_OutputData(); //Neon_Flip(); //while(1); //SetDisplay(dis_data); //while(1); //Relay //GPIO_ResetBits(GPIOB,GPIO_Pin_9); //GPIO_SetBits(GPIOB,GPIO_Pin_9); //GPIO_SetBits(GPIOC,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3); TimeValue.year=DS3231_YEARDATA; TimeValue.month=0x01; TimeValue.week=0x07; TimeValue.date=0x24; TimeValue.hour=0x02; TimeValue.minute=0x49; TimeValue.second=0x00; Time_Handle(); second_previous = Display_Time[7] - 0x30; //DS3231_Time_Init(&TimeValue); //Time_Handle(); //while(1); while(1) { Time_Handle(); dis_data[0] = Display_Time[0] - 0x30; dis_data[1] = Display_Time[1] - 0x30; dis_data[2] = Display_Time[3] - 0x30; dis_data[3] = Display_Time[4] - 0x30; dis_data[4] = Display_Time[6] - 0x30; dis_data[5] = Display_Time[7] - 0x30; if(dis_data[5] != second_previous) { second_previous = dis_data[5]; Neon_Flip(); } SetDisplay(dis_data); Delay(500); } }
//------------------------------------------------------------------------- void CSlot::ChangeDisplay( int p_nDisplayIndex ) { if( p_nDisplayIndex < 0 ) { if( !m_bIsHideDisplay ) { m_bIsHideDisplay = true; m_pDisplayBridge->RemoveDisplay(); UpdateChlidArmatureAnimation(); } } else { bool bIsChangeShowState = false; if( m_bIsHideDisplay ) { m_bIsHideDisplay = false; bIsChangeShowState = true; if( m_pArmature ) { m_pDisplayBridge->AddDisplay( m_pArmature->m_pDisplay ); m_pArmature->m_bIsSlotsZOrderChanged = true; } } int nLength = m_vecDisplayList.size(); if( p_nDisplayIndex >= nLength && nLength > 0 ) { p_nDisplayIndex = nLength - 1; } if( m_nDisplayIndex != p_nDisplayIndex ) { m_nDisplayIndex = p_nDisplayIndex; IObject* pContent = m_vecDisplayList[m_nDisplayIndex]; if( dynamic_cast<CArmature*>(pContent) ) { SetDisplay(( static_cast<CArmature*>(pContent) )->m_pDisplay ); } else { SetDisplay( pContent ); } if( !m_vecDisplayDataList.empty() && m_nDisplayIndex <= static_cast<int>(m_vecDisplayDataList.size()) ) { m_OriginTransform = m_vecDisplayDataList[m_nDisplayIndex]->m_Transform; } } else if( bIsChangeShowState ) { UpdateChlidArmatureAnimation(); } } if( !m_bIsHideDisplay && m_pDisplayBridge->GetDisplay() ) { m_bIsDisplayOnStage = true; } else { m_bIsDisplayOnStage = false; } }
MRESULT EXPENTRY Calculator( HWND hwnd, /* window handle */ ULONG msg, /* dispatched message id */ MPARAM mp1, /* first message parameter */ MPARAM mp2 ) /* second message parameter */ { ULONG action; /* Action to process */ switch (msg) { /* switch based on the message*/ /* received */ /* The initialization message has been received. We do some */ /* additional fixup of the dialog to make it look a little */ /* nicer. */ case WM_INITDLG: /* initialize accumulator */ MAKERXSTRING(accumulator, accbuff, 1); strcpy(accbuff, "0"); /* fill in a zero */ digits = 0; /* no digits in number */ hadperiod = NO; /* no period yet */ hadexponent = NO; /* no exponential yet */ oldaction = 0; /* no pending operations */ strcpy(precision, "9"); /* set default precision */ form = SCIENTIFIC; /* set default form */ SetDisplay(&accumulator); /* set initial display value */ /* update the calculator */ /* display */ WinSetWindowText(WinWindowFromID(hwnd, DISPLAY), display.strptr); /* register our external */ /* functions */ RexxRegisterFunctionExe("CalcPrecision", (PFN)CalcPrecision); RexxRegisterFunctionExe("CalcForm", (PFN)CalcForm); return FALSE; /* initialization complete */ /* We are going away, time to post a quit message to the */ /* message loop. */ case WM_CLOSE: /* Deregister our defined */ /* functions */ RexxDeregisterFunction("CalcPrecision"); RexxDeregisterFunction("CalcForm"); /* Standard Close processing */ WinPostMsg(hwnd, WM_QUIT, 0L, 0L); return FALSE; /* Exit now */ /* We've received a WM_CONTROL message. This was */ /* generated by the "Form" check blox. */ case WM_CONTROL: /* change current form */ action = SHORT1FROMMP(mp1); /* Extract message sub-type */ switch (action) { /* process the control */ case BUTTON_FORM: /* form switch button */ if (form == SCIENTIFIC) { /* current scientific? */ form = ENGINEERING; /* make it engineering */ /* update label */ WinSetWindowText(WinWindowFromID(hwnd, BUTTON_FORM), "Engineering"); } else { form = SCIENTIFIC; /* otherwise scientfic */ WinSetWindowText(WinWindowFromID(hwnd, BUTTON_FORM), "Scientific"); } return FALSE; /* all done */ default: /* Unknown, can't handle this */ return FALSE; } /* We've received a WM_COMMAND message. WM_COMMAND messages */ /* are generated by "pressing" buttons on the calculator. The */ /* additional parameters in the received message identify the */ /* button that was pressed */ case WM_COMMAND: action = SHORT1FROMMP(mp1); /* Extract message sub-type */ switch (action) { /* The following buttons will be processed by the actual */ /* calculator routine */ case BUTTON_CLEAR: /* Clear key */ /* initialize accumulator */ MAKERXSTRING(accumulator, accbuff, 1); strcpy(accbuff, "0"); /* fill in a zero */ /* initialize the display */ MAKERXSTRING(display, dispbuff, 1); strcpy(dispbuff, "0"); /* fill in a zero display */ digits = 0; /* no digits yet */ hadperiod = NO; /* turn off number processing */ hadexponent = NO; /* flags. */ oldaction = 0; /* and any pending operations */ /* update the calculator */ /* display */ WinSetWindowText(WinWindowFromID(hwnd, DISPLAY), display.strptr); return FALSE; /* All done */ case BUTTON_DIGITS: /* set new digits */ /* not a whole number? */ if (!CheckWhole(&display)) /* give an error beep */ WinAlarm(HWND_DESKTOP, WA_ERROR); else { /* process the number */ /* copy the number */ strcpy(precision, display.strptr); /* redisplay the accumlator */ SetDisplay(&accumulator); /* display */ WinSetWindowText(WinWindowFromID(hwnd, DISPLAY), display.strptr); } return FALSE; /* All done */ case BUTTON_0: /* Numeric keys */ case BUTTON_1: case BUTTON_2: case BUTTON_3: case BUTTON_4: case BUTTON_5: case BUTTON_6: case BUTTON_7: case BUTTON_8: case BUTTON_9: case BUTTON_PERIOD: /* decimal point */ case BUTTON_EXPONENT: /* exponent value */ case BUTTON_SIGN: /* sign change */ /* Add a digit to display */ AddDigit(action); /* update the accumulator */ /* display */ WinSetWindowText(WinWindowFromID(hwnd, DISPLAY), display.strptr); return FALSE; /* All done */ /* The arithmetic operation keys all have a deferred */ /* execution. When one of these is pressed, the previous*/ /* arithmetic operation is processed using the */ /* accumulator and the current display. The new operator*/ /* is saved for later execution. If no operator exists, */ /* then the current display is moved to the accumulator */ /* and no arithmetic is done */ case BUTTON_MULTIPLY: /* Multiply key */ case BUTTON_DIVIDE: /* Division key */ case BUTTON_PLUS: /* Addition key */ case BUTTON_MINUS: /* Subtraction key */ case BUTTON_IDIV: /* integer division */ case BUTTON_REMAINDER: /* remainder division */ case BUTTON_POWER: /* raise a number to power */ case BUTTON_ENTER: /* "Total" key */ case BUTTON_PROGRAM1: /* programmed Rexx function */ case BUTTON_PROGRAM2: /* programmed Rexx function */ /* Process pending operations */ ProcessArithmetic(action); SetDisplay(&accumulator);/* reset display buffer */ /* update the calculator */ /* display */ WinSetWindowText(WinWindowFromID(hwnd, DISPLAY), accumulator.strptr); return FALSE; /* All done */ default: /* Unknown, can't handle this */ return FALSE; } case WM_ERASEBACKGROUND: /* disable background erase */ return MRFROMLONG(TRUE); /* don't allow this */ /* Message not handled by us. PM gives us first chance at all */ /* messages. Those we don't want to process we pass on to the */ /* default dialog procedure. */ default: return WinDefWindowProc(hwnd, msg, mp1, mp2); } return FALSE; /* Should never reach here */ }
//------------------------------------------------------------------------- void CSlot::SetDisplayValue( IObject* p_pValue ) { m_vecDisplayList[m_nDisplayIndex] = p_pValue; SetDisplay( p_pValue ); }
/***************************************************************************** ** Procedure: CDSPhone::Init ** ** Arguments: 'pDev' - Device object this phone belongs to ** 'dwPhoneDeviceID' - Unique phone identifier within the TSP ** 'dwPos' - Index position of phone within device array ** 'dwItemData' - Used when line was dynamically created (P&P). ** ** Returns: void ** ** Description: This function is called by the device owner to initialize ** the phone object. ** *****************************************************************************/ VOID CDSPhone::Init (CTSPIDevice* pDev, DWORD dwPhoneDeviceID, DWORD dwPos, DWORD /*dwItemData*/) { // Let the base class initialize first. CTSPIPhoneConnection::Init (pDev, dwPhoneDeviceID, dwPos); // Grab the settings from the emulator. EMSETTINGS Settings; if (!GetDeviceInfo()->DRV_GetSwitchSettings (&Settings)) return; // Add the handset device to our hookswitch list. AddHookSwitchDevice(PHONEHOOKSWITCHDEV_HANDSET, // Hookswitch device (PHONEHOOKSWITCHMODE_ONHOOK | // Modes available to hookswitch PHONEHOOKSWITCHMODE_MIC | PHONEHOOKSWITCHMODE_SPEAKER | PHONEHOOKSWITCHMODE_MICSPEAKER | PHONEHOOKSWITCHMODE_UNKNOWN), g_hsStates[Settings.wHandsetHookswitch], // States supported by hookswitch Settings.wVolHandset, // Current Volume level of hookswitch (0-0xffff) Settings.wGainHandset, // Current Gain level of hookswitch (0-0xffff) 0xffffffff, 0xffffffff, true, true); // Monitored/Set modes // Setup the display buffer for the phone. It uses a standard line feed so don't // change the default line break character. SetupDisplay(DISPLAY_COLS, DISPLAY_ROWS); // Add all the buttons to our phone. for (int i = 0; i < BUTTON_COUNT; i++) { // If the button is one of our STANDARD buttons (0-9,A-D,#,*), then it is a keypad // button. if (i < TOTAL_STD_BUTTONS) { AddButton (PHONEBUTTONFUNCTION_NONE, // Button function PHONEBUTTONMODE_KEYPAD, // Button mode PHONELAMPMODE_DUMMY, // Available Lamp states (Dummy = None) PHONELAMPMODE_DUMMY, // Current Lamp state (Dummy = None) CString(g_szKeypad[i],1)); // Text name of button } // Otherwise the button is a "soft" button, the mode and function are determined // by how the user sets up the emulator. The emulator reports the button functions // through the EMSETTINGS structure. else { // Determine the available lamp states based on the reported mode of the // button from the emulator. DWORD dwAvailLampStates = 0; if (Settings.wButtonModes[i] == BUTTONFUNCTION_CALL) dwAvailLampStates = (PHONELAMPMODE_OFF | PHONELAMPMODE_STEADY | PHONELAMPMODE_WINK | PHONELAMPMODE_FLASH); else if (Settings.wLampStates[i] == LAMPSTATE_NONE) dwAvailLampStates = PHONELAMPMODE_DUMMY; else dwAvailLampStates = (PHONELAMPMODE_OFF | PHONELAMPMODE_STEADY | PHONELAMPMODE_WINK); // Add the button AddButton (g_ButtonFunctions[Settings.wButtonModes[i]].dwFunction, g_ButtonFunctions[Settings.wButtonModes[i]].dwMode, dwAvailLampStates, g_LampStates[Settings.wLampStates[i]], g_ButtonFunctions[Settings.wButtonModes[i]].pszText); } } // Setup the initial state of the display. USES_CONVERSION; SetDisplay (A2T(Settings.szDisplay)); // Setup the ringer modes LPPHONECAPS pPhoneCaps = GetPhoneCaps(); LPPHONESTATUS pPhoneStatus = GetPhoneStatus(); pPhoneCaps->dwNumRingModes = 4; pPhoneStatus->dwRingMode = (DWORD) Settings.wRingMode; // Add the WAV devices which will be our handset I/O if (waveInGetNumDevs() > 0) AddDeviceClass(_T("wave/in"), (DWORD)0); if (waveOutGetNumDevs() > 0) AddDeviceClass(_T("wave/out"), (DWORD)0); }// CDSPhone::Init
//------------------------------------------------------------------------- void CSlot::SetChildArmature( CArmature* p_pArmature ) { m_vecDisplayList[m_nDisplayIndex] = p_pArmature; if( p_pArmature != NULL ) SetDisplay( p_pArmature->m_pDisplay ); }
void main(int argc, char *argv[]) { double r, g, b; uint rows, cols; char fname[256]; double colormag; time_t tstart, tend; int nrgbr = 63, nrgbg = 63, nrgbb = 63; OctreeType *octree; RGBType color; FILE *f; char title[40]; char description[128]; ulong i; uint j; int n; RGBType palette[256]; ulong image_start; union REGS regs; int resx, resy; int px, py; int ii; int cols2, rows2; int k; int cli; int maxr=0, maxg=0, maxb=0; #if defined METAWINDO rect screen; #endif printf("Image file : "); scanf("%s",fname); if ((f = fopen(fname,"rb")) == NULL) { printf("%s not found.\n",fname); exit(1); } /* ** Read the image file header */ fgets(title,40,f); fgets(description,128,f); fscanf(f,"%d %d",&cols,&rows); fscanf(f,"%lf",&colormag); image_start = ftell(f); cols2 = cols/2; rows2 = rows/2; time(&tstart); /* ** Initialize the color octree */ octree = CreateOctNode(0); /* ** Loop through the image and store each unique color. */ for (i = 0L; i < (ulong)rows*(ulong)cols; i++) { /* ** Show progress... */ if ((i % (ulong)cols) == 0L) printf("%ld\r",i/cols); fscanf(f,"%lf %lf %lf",&r,&g,&b); /* ** Convert input floating point values to bytes. NOTE: We assume that ** all input values are between 0..1.0 */ color.r = (unsigned char)(r * nrgbr); color.g = (unsigned char)(g * nrgbg); color.b = (unsigned char)(b * nrgbb); if (color.r > nrgbr) color.r = nrgbr; if (color.g > nrgbg) color.g = nrgbg; if (color.b > nrgbb) color.b = nrgbb; /* ** Insert this color into the octree */ InsertTree(&octree, &color, 0); /* ** If there are too many colors in the tree as a result of this ** insert, reduce the octree */ while (TotalLeafNodes() > npal) { ReduceTree(); } } /* ** Make a pass through the completed octree to average down the ** rgb components. When done, 'n' contains the actual number of ** colors in the palette table. */ n = 0; MakePaletteTable(octree, palette, &n); /* ** How long did it take? */ time(&tend); printf("Processed %ld pixels per second\ninto %d quantized colors\n", ((long)rows*(long)cols)/(tend-tstart), n); j = 0; while (j != 3) { printf("Output to (1)monitor or (2).PCX file or (3) quit: "); scanf("%s",title); j = atoi(title); if (j == 2) { fseek(f,image_start,0); SaveAsPCX(f, octree, cols, rows, nrgbr, nrgbg, nrgbb, npal, palette); } else if (j == 1) { #if defined METAWINDO /* ** NOTE: This section requires MetaWINDOW graphics lib ** ** Let the user choose his graphics device and resolution */ MetQuery(argc,argv); if (InitGraphics(GrafixCard) != 0) { printf("\n---Error initializing graphics device---\n"); exit(1); } SetDisplay(GrafPg0); BackColor(0); /* ** Set the VGA palette */ for (j = 0; j < n; j++) { regs.h.al = 0x10; regs.h.ah = 0x10; regs.h.bl = j; regs.h.bh = 0; regs.h.ch = (int)(palette[j].g); regs.h.cl = (int)(palette[j].b); regs.h.dh = (int)(palette[j].r); int86(0x10,®s,®s); } /* ** Center the image on the screen */ ScreenRect(&screen); resx = screen.Xmax; resy = screen.Ymax; px = resx/2 - npal; /* ** Display a color bar at the top of the screen */ for (ii = 0; ii < npal; ii++){ PenColor(ii); SetPixel(ii*2+px,1); SetPixel(ii*2+px+1,1); SetPixel(ii*2+px,2); SetPixel(ii*2+px+1,2); SetPixel(ii*2+px,3); SetPixel(ii*2+px+1,3); SetPixel(ii*2+px,4); SetPixel(ii*2+px+1,4); } fseek(f,image_start,0); py = resy/2 - rows2 - 1; for (ii = 0; ii < rows ; ii++) { px = resx/2 - cols2; for (k = 0; k < cols; k++) { if (fscanf(f,"%f %f %f",&r,&g,&b) == EOF) { goto pdone; } color.r = (byte)(nrgbr * r); color.g = (byte)(nrgbg * g); color.b = (byte)(nrgbb * b); cli = QuantizeColor(octree, &color); PenColor(cli); SetPixel(px,py); px++; } py++; } pdone: getch(); SetDisplay(TextPg0); StopGraphics(); #endif } } }
/***************************************************************************** ** Procedure: CJTPhone::UnsolicitedEvent ** ** Arguments: 'lpBuff' - Our CEventBlock* pointer ** ** Returns: void ** ** Description: This function is called when no request processed a given ** response from the device and it was directed at this phone. ** *****************************************************************************/ bool CJTPhone::UnsolicitedEvent(LPCVOID lpBuff) { // Cast our pointer back to an event block const CEventBlock* pBlock = static_cast<const CEventBlock*>(lpBuff); // Manage the phone event we have received. switch (pBlock->GetEventType()) { // Display changed case CEventBlock::DisplayChanged: { // Get the new display string and set it into our device. const CPEDisplay* pDisplay = dynamic_cast<const CPEDisplay*>(pBlock->GetElement(CPBXElement::Display)); if (pDisplay != NULL) SetDisplay(pDisplay->GetDisplay().c_str()); } break; // Volume changed case CEventBlock::VolumeChanged: { const CPEVolume* pVolume = dynamic_cast<const CPEVolume*>(pBlock->GetElement(CPBXElement::Volume)); if (pVolume != NULL) SetVolume(PHONEHOOKSWITCHDEV_SPEAKER, pVolume->GetVolume()); } break; // Gain changed case CEventBlock::GainChanged: { const CPEGain* pGain = dynamic_cast<const CPEGain*>(pBlock->GetElement(CPBXElement::Gain)); if (pGain != NULL) SetGain(PHONEHOOKSWITCHDEV_SPEAKER, pGain->GetGain()); } break; // Hookswitch changed case CEventBlock::HookswitchChanged: { const CPEHookswitch* pHS = dynamic_cast<const CPEHookswitch*>(pBlock->GetElement(CPBXElement::Hookswitch)); if (pHS != NULL) { SetHookSwitch(PHONEHOOKSWITCHDEV_HEADSET, (pHS->GetHookswitchState() == CPEHookswitch::OnHook) ? PHONEHOOKSWITCHMODE_ONHOOK : (pHS->GetHookswitchState() == CPEHookswitch::OffHook) ? PHONEHOOKSWITCHMODE_MICSPEAKER : PHONEHOOKSWITCHMODE_SPEAKER); } } break; // Lamp changed case CEventBlock::LampChanged: { const CPELampInfo* pLamp = dynamic_cast<const CPELampInfo*>(pBlock->GetElement(CPBXElement::Lamp)); if (pLamp != NULL) { _TSP_ASSERTE(pLamp->GetLampID() == 0 || pLamp->GetLampID() == 1); // Note we could search for the button we want, but since we know the // button layout of the phone we will just use it directly. // If this were a production TSP it would probably keep a mapping of // button id to lamps from the PBX and use that to lookup the proper // button. int iButtonID = (pLamp->GetLampID() == 0) ? 21 : 22; SetLampState(iButtonID, (pLamp->IsLit()) ? PHONELAMPMODE_STEADY : PHONELAMPMODE_OFF); } } break; // Unknown or unhandled default: break; } // It doesn't really matter what we return to this function since we are letting // the library handle the request management directly. The caller doesn't look // at the return code for unsolicited handlers. If we were managing the // ReceiveData() ourselves then this could be used to continue looking for // an owner for a data event. return true; }// CJTPhone::UnsolicitedEvent
bool SetTrackVisualsCommand::ApplyInner(const CommandContext & context, Track * t ) { static_cast<void>(context); auto wt = dynamic_cast<WaveTrack *>(t); //auto pt = dynamic_cast<PlayableTrack *>(t); static const double ZOOMLIMIT = 0.001f; // You can get some intriguing effects by setting R and L channels to // different values. if( wt && bHasColour ) wt->SetWaveColorIndex( mColour ); if( t && bHasHeight ) t->SetHeight( mHeight ); if( wt && bHasDisplayType ) wt->SetDisplay( (mDisplayType == kWaveform) ? WaveTrack::WaveTrackDisplayValues::Waveform : WaveTrack::WaveTrackDisplayValues::Spectrum ); if( wt && bHasScaleType ) wt->GetIndependentWaveformSettings().scaleType = (mScaleType==kLinear) ? WaveformSettings::stLinear : WaveformSettings::stLogarithmic; if( wt && bHasVZoom ){ switch( mVZoom ){ default: case kReset: wt->SetDisplayBounds(-1,1); break; case kTimes2: wt->SetDisplayBounds(-2,2); break; case kHalfWave: wt->SetDisplayBounds(0,1); break; } } if ( wt && (bHasVZoomTop || bHasVZoomBottom) && !bHasVZoom){ float vzmin, vzmax; wt->GetDisplayBounds(&vzmin, &vzmax); if ( !bHasVZoomTop ){ mVZoomTop = vzmax; } if ( !bHasVZoomBottom ){ mVZoomBottom = vzmin; } // Can't use std::clamp until C++17 mVZoomTop = std::max(-2.0, std::min(mVZoomTop, 2.0)); mVZoomBottom = std::max(-2.0, std::min(mVZoomBottom, 2.0)); if (mVZoomBottom > mVZoomTop){ std::swap(mVZoomTop, mVZoomBottom); } if ( mVZoomTop - mVZoomBottom < ZOOMLIMIT ){ double c = (mVZoomBottom + mVZoomTop) / 2; mVZoomBottom = c - ZOOMLIMIT / 2.0; mVZoomTop = c + ZOOMLIMIT / 2.0; } wt->SetDisplayBounds(mVZoomBottom, mVZoomTop); TrackPanel *const tp = ::GetActiveProject()->GetTrackPanel(); tp->UpdateVRulers(); } if( wt && bHasUseSpecPrefs ){ wt->UseSpectralPrefs( bUseSpecPrefs ); } if( wt && bHasSpectralSelect ){ wt->GetSpectrogramSettings().spectralSelection = bSpectralSelect; } if( wt && bHasGrayScale ){ wt->GetSpectrogramSettings().isGrayscale = bGrayScale; } return true; }
CX11Window::~CX11Window() {GUCEF_TRACE; WindowDestroy(); SetDisplay( NULL ); }