void ProcCommand() { string comName = GetEventData(); string nodName = GetEventData(); switch(nodName) { case "B_OK": if(comName=="activate" || comName=="click") { ExecuteSailorPayment(); PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT); } break; case "B_CANCEL": if(comName=="activate" || comName=="click") { SkipSailorPayment(); PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT); } if(comName=="upstep") { if(GetSelectable("B_OK")) {SetCurrentNode("B_OK");} } break; } }
//============================================================= //Body::Body //============================================================= Body::Body() { Event *newEvent; takedamage = DamageYes; edict->s.eType = ET_MODELANIM; health = 10; edict->clipmask = MASK_DEADSOLID; edict->svflags |= SVF_DEADMONSTER; setSolidType( SOLID_NOT ); //setSolidType( SOLID_BBOX ); //setContents( CONTENTS_CORPSE ); setMoveType( MOVETYPE_NONE ); //PostEvent( EV_FadeOut, 6.0f ); newEvent = new Event( EV_DisplayEffect ); newEvent->AddString( "TransportOut" ); newEvent->AddString( "Multiplayer" ); PostEvent( newEvent, 0.0f ); PostEvent( EV_Remove, 5.0f ); //Event *transport_event = new Event( EV_DisplayEffect ); //transport_event->AddString( "transport_out" ); //ProcessEvent( transport_event ); animate = new Animate( this ); }
void nxInputManager::Prepare(bool bRawInput,bool bDInput,bool bXInput) { PostEvent(NX_INPUT_ENUMERATE,0,0); /// Create XINPUT devices if (bXInput) { for (DWORD i = 0;i < nxXInputDevice::XI_MAXDEVICES;++i) { nxDeviceId uDevId = CreateDeviceId(); std::stringstream ss; ss << "XINPUT_" << (i+1); // Map the handle/index to the device id mpHandleId[i] = uDevId; // Map the "GUID" to the device id SetGUIDMapping(uDevId,ss.str()); } } /// Create RAWINPUT devices if (bRawInput) { // Enumerate the raw input devices on the system std::vector<nxRawInputDevice> vcDevices; nxRawInputDevice::Enumerate(vcDevices); for (std::vector<nxRawInputDevice>::iterator it=vcDevices.begin();it!=vcDevices.end();++it) { // See if the GUID already has a device id nxDeviceId uDevId; const nxDeviceId*ptDevId=srDeviceGUID.LookupRight(it->GetGUID()); // If the guid already has a device id, get it if (ptDevId) { uDevId = *ptDevId; } else // Otherwise, make one. { // If it doesn't, create one and add the mapping. uDevId = CreateDeviceId(); SetGUIDMapping(uDevId,it->GetGUID()); } // Map the handle to the device id mpHandleId[it->GetDeviceHandle()] = uDevId; } } /// Create DIRECTINPUT devices if (bDInput) { // Try to create a directinput interface if it doesn't exist already if (DirectInput8Create(nxInstanceHandle(), DIRECTINPUT_VERSION, IID_IDirectInput8, ( VOID** )&pDI, NULL) != DI_OK) pDI = NULL; else { // Enumerate the devices pDI->EnumDevices( DI8DEVCLASS_GAMECTRL,EnumJoysticksCallback,NULL, DIEDFL_ATTACHEDONLY ); } } PostEvent(NX_INPUT_READY,0,0); }
virtual void * Entry() { CUrlOpt opt(m_url, URL_OPT_REFRESH, m_proxy); m_bResult = (opt.Run() == CURLE_WRITE_ERROR); if (m_bResult) PostEvent(EVENT_TYPE_REFRESH_SUCC, m_proxy); else PostEvent(EVENT_TYPE_REFRESH_FAIL, m_proxy); return NULL; }
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_HOTKEY: switch ( HIWORD( lParam ) ) { case VK_RIGHT: PostEvent( EVENT_TYPE_HOTKEY_NEXT ); break; case VK_SPACE: PostEvent( EVENT_TYPE_HOTKEY_PAUSE ); break; } break; case WM_WTSSESSION_CHANGE: switch ( wParam ) { case WTS_SESSION_LOCK: PostEvent( EVENT_TYPE_CONSOLE_LOCK ); break; case WTS_SESSION_UNLOCK: PostEvent( EVENT_TYPE_CONSOLE_UNLOCK ); break; } break; case WM_WINDOWPOSCHANGING: { WINDOWPOS * pPos = (WINDOWPOS*) lParam; pPos->flags |= SWP_HIDEWINDOW; pPos->flags &= ~SWP_SHOWWINDOW; } break; case WM_INITDIALOG: g_hwnd = hDlg; WTSRegisterSessionNotification( hDlg, NOTIFY_FOR_ALL_SESSIONS ); RegisterHotKey( g_hwnd, 1, MOD_ALT | MOD_CONTROL, VK_SPACE ); RegisterHotKey( g_hwnd, 2, MOD_ALT | MOD_CONTROL, VK_RIGHT ); return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; }
static void custom_butclick( CursorDevicePtr dev, short button ) { static int toggle=0; if( !toggle ) { PostEvent( keyDown, (0x3b << 8) | 0xff ); PostEvent( mouseDown, 0 ); } else { PostEvent( mouseUp, 0 ); PostEvent( keyUp, (0x3b << 8) | 0xff ); } }
/*! \fn swMain::_prepare_keyinput_ev( Event* _ev ) */ Event* swMain::_prepare_keyinput_ev( Event* _ev ) { event_t ev = 0; MessageEvent* Mes; KeyPressEvent* Kev; ///@todo Before pushing the key event, there is lots of function keys and other keyboard commands to translate into MessageEvent or refined KeyInput event if( _ev->NcursesEvent() == KEY_RESIZE){ PostEvent( (Mes = new MessageEvent(event::TermResize) ) ); return Mes; } // Just push the event PostEvent( _ev );//( Kev = new KeyPressEvent( _ev->What(), bMeta ) ) ); return _ev; }
void Animate::DoExitCommands( int slot ) { tiki_cmd_t cmds; AnimationEvent *ev; if( animFlags[ slot ] & ANIM_NOEXIT ) { return; } // exit the previous animation if( gi.Frame_Commands( edict->tiki, edict->s.frameInfo[ slot ].index, TIKI_FRAME_EXIT, &cmds ) ) { int ii, j; for( ii = 0; ii < cmds.num_cmds; ii++ ) { ev = new AnimationEvent( cmds.cmds[ ii ].args[ 0 ] ); ev->SetAnimationNumber( edict->s.frameInfo[ slot ].index ); ev->SetAnimationFrame( 0 ); for( j = 1; j < cmds.cmds[ ii ].num_args; j++ ) { ev->AddToken( cmds.cmds[ ii ].args[ j ] ); } PostEvent( ev, 0 ); } } animFlags[ slot ] |= ANIM_NOEXIT; }
void SkipSailorPayment() { ref mchref = GetMainCharacter(); int morale = 45; if( CheckAttribute(mchref,"Ship.Crew.Morale") ) morale = sti(mchref.Ship.Crew.Morale); morale -= nMoraleDecreaseQ; if(morale<0) morale = 0; mchref.CrewPayment = nPaymentQ; int cn; for(int i=0; i<4; i++) { cn = GetCompanionIndex(mchref,i); if(cn>=0) { Characters[cn].Ship.Crew.Morale = morale; } } if(morale<MORALE_NORMAL) { if(morale<=I_MIN_MORALE) { PostEvent("ievent_GameOver",1,"s","mutiny"); } } }
Item* SecretItem::ItemPickup( Entity *other, qboolean add_to_inventory = true, qboolean checkautopickup = true ) { str pickupSoundName; Q_UNUSED(checkautopickup); Q_UNUSED(add_to_inventory); PostEvent( EV_Remove, 0.0f ); level.found_specialItems++; levelVars.SetVariable( "found_specialItems" , level.found_specialItems ); gi.centerprintf ( other->edict, CENTERPRINT_IMPORTANCE_NORMAL, "$$FoundSecretItem$$" ); pickupSoundName = GetRandomAlias( "snd_pickup" ); if ( pickupSoundName.length() > 1 ) { other->Sound( pickupSoundName, CHAN_ITEM ); } if ( other && other->isSubclassOf( Player ) ) { Player *player = (Player *)other; player->incrementSecretsFound(); } return NULL; }
void SoundManager::Show( void ) { CurrentGainsFocus(); CancelEventsOfType( EV_SoundManager_ShowingSounds ); PostEvent( EV_SoundManager_ShowingSounds, FRAMETIME ); UpdateUI(); }
void CReceiverThread::PostClosePort( const QString &strCOMx ) { CComThreadEvent* pEvent = CComThreadEvent::CreateThreadEvent( CComThreadEvent::ThreadReceiver, CComThreadEvent::EventClosePort ); pEvent->SetPortName( strCOMx ); PostEvent( pEvent ); }
nsresult nsSocketTransportService::DetachSocket(SocketContext *sock) { LOG(("nsSocketTransportService::DetachSocket [handler=%x]\n", sock->mHandler)); // inform the handler that this socket is going away sock->mHandler->OnSocketDetached(sock->mFD); // cleanup sock->mFD = nsnull; NS_RELEASE(sock->mHandler); // find out what list this is on. PRUint32 index = sock - mActiveList; if (index < NS_SOCKET_MAX_COUNT) RemoveFromPollList(sock); else RemoveFromIdleList(sock); // NOTE: sock is now an invalid pointer // // notify the first element on the pending socket queue... // if (!PR_CLIST_IS_EMPTY(&mPendingSocketQ)) { // move event from pending queue to event queue PLEvent *event = PLEVENT_FROM_LINK(PR_LIST_HEAD(&mPendingSocketQ)); PR_REMOVE_AND_INIT_LINK(&event->link); PostEvent(event); } return NS_OK; }
void wxGISGPToolManager::OnFinish(IProcess* pProcess, bool bHasErrors) { size_t nIndex; for(nIndex = 0; nIndex < m_ProcessArray.size(); nIndex++) if(pProcess == m_ProcessArray[nIndex].pProcess) break; wxDateTime end = wxDateTime::Now(); if(m_ProcessArray[nIndex].pTrackCancel) { if(bHasErrors) { m_ProcessArray[nIndex].pTrackCancel->PutMessage(wxString::Format(_("An error occured while executing %s. Failed to execute (%s)."), m_ProcessArray[nIndex].pTool->GetName().c_str(), m_ProcessArray[nIndex].pTool->GetName().c_str()), -1, enumGISMessageErr); m_ProcessArray[nIndex].pTrackCancel->PutMessage(_("Error!"), -1, enumGISMessageTitle); } else { m_ProcessArray[nIndex].pTrackCancel->PutMessage(wxString::Format(_("Executed (%s) successfully"), m_ProcessArray[nIndex].pTool->GetName().c_str()), -1, enumGISMessageInfo); m_ProcessArray[nIndex].pTrackCancel->PutMessage(_("Done"), -1, enumGISMessageTitle); } wxTimeSpan span = end - m_ProcessArray[nIndex].pProcess->GetBeginTime(); m_ProcessArray[nIndex].pTrackCancel->PutMessage(wxString::Format(_("End Time: %s (Elapsed Time: %s)"), end.Format().c_str(), span.Format(_("%H hours %M min. %S sec.")).c_str()), -1, enumGISMessageInfo); } wxGISProcessEvent event(wxPROCESS_FINISH, nIndex, bHasErrors); PostEvent(event); RunNextTask(); }
void QAnalogCameraThread::PostStartSourceStreamEvent( int nChannel, bool bRegister ) { QCameraEvent* pEvent = new QCameraEvent( ( QEvent::Type ) QCameraEvent::CameraStartSourceStream ); pEvent->SetChannel( nChannel ); pEvent->SetRecognize( bRegister ); PostEvent( pEvent ); }
void QAnalogCameraThread::PostPlayVideoEvent( int nChannel, HWND hVideo ) { QCameraEvent* pEvent = new QCameraEvent( ( QEvent::Type ) QCameraEvent::CameraStartPreview ); pEvent->SetChannel( nChannel ); pEvent->SetVideoWndHandle( hVideo ); PostEvent( pEvent ); }
void wxGISMapView::OnMapDrawing(wxMxMapViewUIEvent& event) { wxEventType eType = event.GetEventType(); if(eType == wxMXMAP_DRAWING_START) { if(m_nDrawingState != enumGISMapFlashing) //maybe m_nDrawingState == enumGISMapNone m_nDrawingState = enumGISMapDrawing; wxCHECK_RET(m_pAni, wxT("Animation progress is not initiated")); m_pAni->ShowProgress(true); m_pAni->Play(); } else if(eType == wxMXMAP_DRAWING_STOP) { if(!m_pGISDisplay->IsDerty() && m_nDrawingState == enumGISMapDrawing) m_nDrawingState = enumGISMapNone; if( m_nDrawingState == enumGISMapNone ) { m_ClipGeometry.Clear(); } //m_nDrawingState = enumGISMapNone; Refresh(); wxCHECK_RET(m_pAni, wxT("Animation progress is not initiated")); m_pAni->Stop(); m_pAni->ShowProgress(false); } PostEvent(event); }
void EventQueue::Tick() { // create temporary lists, so new events generated won't execute next tick ( avoid possible loop with events generating themselves ) std::deque<Event> tmp_EventQueue = LocalEventQueue; LocalEventQueue.clear(); // Add the Events from other Threads to the EventQueue Event e("INVALID_EVENT"); while (ThreadedEventQueue.try_pop(e)) { //if ( !e.Is( "VIEW_DBG_STRING" ) && !e.Is( "EVT_FRAME") && !e.Is("EVT_TICK") ) Engine::out() << "[FE:"<< Module::Get()->GetName() <<"] Found Remote Event: " << e.getDebugName() << std::endl; tmp_EventQueue.push_back(e); // exclude remote origin events LocalEventsThisSecond--; } for (auto& e : tmp_EventQueue) { LocalEventsThisSecond++; PostEvent(e); } }
void wxGISTaskManager::AddMessage(const wxXmlNode* pIniNode) { wxCHECK_RET(pIniNode, wxT("Input wxXmlNode pointer is null")); int nTaskId = GetDecimalValue(pIniNode, wxT("id"), wxNOT_FOUND); if(nTaskId == wxNOT_FOUND) return; wxGISTask* pTasks = m_moTasks[nTaskId]; if(pTasks == NULL) return; long nMsgId = GetDecimalValue(pIniNode, wxT("msg_id"), wxNOT_FOUND); if(nMsgId == wxNOT_FOUND) return; wxGISEnumMessageType eType = (wxGISEnumMessageType)GetDecimalValue(pIniNode, wxT("msg_type"), enumGISMessageUnk); wxDateTime dt = GetDateValue(pIniNode, wxT("msg_dt"), wxDateTime::Now()); wxString sInfoData = pIniNode->GetAttribute(wxT("msg")); if(!dt.IsValid() || sInfoData.IsEmpty()) return; pTasks->AddMessage(new wxGISTaskMessage(nMsgId, sInfoData, eType, dt)); //notify wxGISTaskEvent event(nTaskId, wxGISTASK_MESSAGEADDED, nMsgId); PostEvent(event); }
// // Name: AdaptiveArmor() // Class: AdaptiveArmor // // Description: Constructor // // Parameters: None // // Returns: None // AdaptiveArmor::AdaptiveArmor() { amount = 0; SetMax ( 200 ); // Add Adaptions to list _fxList.AddObject( "fx/fx-borg-sheild-01.tik" ); _fxList.AddObject( "fx/fx-borg-sheild-02.tik" ); _fxList.AddObject( "fx/fx-borg-sheild-03.tik" ); // Set our current Adaption _AdaptionFX = "fx/fx-borg-sheild-01.tik"; // Set our index _currentFXIndex = 1; _fxTimeNormal = 0.15; _fxTimeExplosive = 1.0; _AddMODToCannotAdaptList( MOD_IMOD_PRIMARY); _AddMODToCannotAdaptList( MOD_IMOD_SECONDARY); _AddMODToCannotAdaptList( MOD_SUICIDE ); if ( !LoadingSavegame ) { //Try and pull data from the gameVars Event *loadEvent = new Event ( EV_Armor_LoadAdaptionDataFromGameVars ); PostEvent( loadEvent, 3.0 ); //LoadDataFromGameVars(); } }
Object::Object() { animate = new Animate( this ); if ( LoadingSavegame ) { // Archive function will setup all necessary data return; } // // all objects default to not solid // setSolidType( SOLID_NOT ); health = 0; takedamage = ( spawnflags & 2 ) ? DamageNo : DamageYes; // // we want the bounds of this model auto-rotated // flags |= FlagRotatedbounds; if ( !com_blood->integer ) { flags &= ~FlagBlood; flags &= ~FlagDieGibs; } PostEvent( EV_Object_Setup, EV_POSTSPAWN ); }
void QAnalogCameraThread::PostStopMotionDetectEvent( int nChannel ) { QCameraEvent* pEvent = new QCameraEvent( ( QEvent::Type ) QCameraEvent::CameraStopMotionDetect ); pEvent->SetChannel( nChannel ); PostEvent( pEvent ); }
void CInPlaceCombo::FocusChange (FocusChangeEvt e) { ControlWindow::FocusChange (e); if (!e.gotFocus()) { char cbBuffer[_MAX_PATH]; cbBuffer[0] = '\0'; GetComboBox() -> GetString (cbBuffer, -1, sizeof(cbBuffer)); // Send Notification to parent of ListView ctrl LV_DISPINFO dispinfo; HWND hParent = GetParent()->Handle(API_WINDOW_HWND); dispinfo.hdr.hwndFrom = hParent; dispinfo.hdr.idFrom = ::GetDlgCtrlID (Handle(API_WINDOW_HWND)); dispinfo.hdr.code = LVN_ENDLABELEDIT; dispinfo.item.mask = LVIF_TEXT; dispinfo.item.iItem = m_iItem; dispinfo.item.iSubItem = m_iSubItem; dispinfo.item.pszText = m_bESC ? NULL : cbBuffer; dispinfo.item.cchTextMax = m_bESC ? 0 : strlen(cbBuffer); GetParent()->GetParent()->ForwardEvent(WM_NOTIFY, GetDlgCtrlID(hParent), (LPARAM)&dispinfo); Hide(); // sofort ausblenden PostEvent(WM_CLOSE); // jetzt zerlegen } }
bool wxGISGPToolManager::ExecTask(WXGISEXECDDATA &data, size_t nIndex) { wxDateTime begin = wxDateTime::Now(); if(data.pTrackCancel) { data.pTrackCancel->PutMessage(wxString::Format(_("Executing (%s)"), data.pTool->GetName().c_str()), -1, enumGISMessageInfo); //add some tool info GPParameters Params = data.pTool->GetParameterInfo(); data.pTrackCancel->PutMessage(wxString(_("Parameters:")), -1, enumGISMessageInfo); for(size_t i = 0; i < Params.GetCount(); ++i) { IGPParameter* pParam = Params[i]; if(!pParam) continue; wxString sParamName = pParam->GetName(); wxString sParamValue = pParam->GetValue(); data.pTrackCancel->PutMessage(wxString::Format(wxT("%s = %s"), sParamName.c_str(), sParamValue.c_str()), -1, enumGISMessageNorm); } data.pTrackCancel->PutMessage(wxString::Format(_("Start Time: %s"), begin.Format().c_str()), -1, enumGISMessageInfo); } data.pProcess->Start(); m_nRunningTasks++; wxGISProcessEvent event(wxPROCESS_START, nIndex); PostEvent(event); return true; }
void t4p::FinderActionClass::BackgroundWork() { if (!Finder.Prepare()) { return; } Code = t4p::CharToIcu(Utf8Buf); int32_t nextIndex(0); bool found = Finder.FindNext(Code, nextIndex); int32_t matchStart(0); int32_t matchLength(0); while (found) { if (Finder.GetLastMatch(matchStart, matchLength)) { // convert match back to UTF-8 ugh int utf8Start = t4p::CharToUtf8Pos(Utf8Buf, BufferLength, matchStart); int utf8End = t4p::CharToUtf8Pos(Utf8Buf, BufferLength, matchStart + matchLength); t4p::FinderHitEventClass hit(GetEventId(), utf8Start, utf8End - utf8Start); PostEvent(hit); nextIndex = matchStart + matchLength + 1; // prevent infinite find next's } else { break; } found = Finder.FindNext(Code, nextIndex); } delete[] Utf8Buf; }
void wxGISGPParameter::SetMessage(wxGISEnumGPMessageType nType, const wxString &sMsg) { m_sMessage = sMsg; m_nMsgType = nType; wxGISGPParamEvent event(m_Value, m_Value.GetName(), m_nId, wxGPPARAM_MSG_SET); PostEvent(event); }
void gkMouse::PostOnlyIfChanged(SInputSymbol* pSymbol, EInputState newState) { if (pSymbol->state != eIS_Released && newState == eIS_Released ) { pSymbol->state = newState; pSymbol->value = 0.0f; } else if (pSymbol->state == eIS_Released && newState == eIS_Pressed) { pSymbol->state = newState; pSymbol->value = 1.0f; } else { return; } if (pSymbol->keyId >= eKI_Mouse1 && pSymbol->keyId <= eKI_Mouse8) { POINT point; GetCursorPos( &point ); ScreenToClient( gEnv->pRenderer->GetWindowHwnd(), &point ); Vec2i offset = gEnv->pRenderer->GetWindowOffset(); pSymbol->value = point.x - offset.x; pSymbol->value2 = point.y - offset.y; } PostEvent(pSymbol); }
LRESULT COptionsDlg::OnM_Prefix(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int ch=m_add_m_prefix.GetCheck(); PostEvent(evCfgSetBOOLVal, _T("Code Generation"), _T("m_Prefix"), ch == BST_CHECKED ? TRUE: FALSE); return 0; }
void wxGISGPParameter::SetValue(const wxVariant &Val) { m_bHasBeenValidated = false; m_Value = Val; wxGISGPParamEvent event(m_Value, m_Value.GetName(), m_nId, wxGPPARAM_CHANGED); PostEvent(event); }
void t4p::ExplorerModifyActionClass::BackgroundWork() { wxFileName parentDir; wxString name; bool totalSuccess = true; std::vector<wxFileName> dirsDeleted; std::vector<wxFileName> dirsNotDeleted; std::vector<wxFileName> filesDeleted; std::vector<wxFileName> filesNotDeleted; if (t4p::ExplorerModifyActionClass::DELETE_FILES_DIRS == Action) { std::vector<wxFileName>::iterator d; for (d = Dirs.begin(); d != Dirs.end(); ++d) { bool success = t4p::RecursiveRmDir(d->GetPath()); if (success) { wxFileName wxFileName; wxFileName.AssignDir(d->GetPath()); dirsDeleted.push_back(wxFileName); } else { wxFileName wxFileName; wxFileName.AssignDir(d->GetPath()); dirsNotDeleted.push_back(wxFileName); } totalSuccess &= success; } std::vector<wxFileName>::iterator f; for (f = Files.begin(); f != Files.end(); ++f) { bool success = wxRemoveFile(f->GetFullPath()); if (success) { wxFileName deletedFile(f->GetFullPath()); filesDeleted.push_back(deletedFile); } else { wxFileName deletedFile(f->GetFullPath()); filesNotDeleted.push_back(deletedFile); } totalSuccess &= success; } t4p::ExplorerModifyEventClass modEvent(GetEventId(), dirsDeleted, filesDeleted, dirsNotDeleted, filesNotDeleted, totalSuccess); PostEvent(modEvent); } else if (t4p::ExplorerModifyActionClass::RENAME_FILE == Action) { wxFileName destFile(OldFile.GetPath(), NewName); bool success = wxRenameFile(OldFile.GetFullPath(), destFile.GetFullPath(), false); t4p::ExplorerModifyEventClass modEvent(GetEventId(), OldFile, NewName, success); PostEvent(modEvent); } }