int COrderManageDlg::AcceptEvent(int nEventCode, WPARAM wParam, LPARAM lParam)
{
	return SendEvent(nEventCode, wParam, lParam);	
}
示例#2
0
void Object::SendEvent(StringHash eventType)
{
    VariantMap noEventData;

    SendEvent(eventType, noEventData);
}
示例#3
0
void RogueSkill5::HandleHudButt(StringHash eventType, VariantMap& eventData)
{
	UIElement* ele = static_cast<UIElement*>(eventData[HudButt::P_BUTT].GetPtr());

	String name = ele->GetName();

	if (name == "rogue")
	{
		skillSprite_->SetTexture(main_->cache_->
				GetResource<Texture2D>("Textures/terriesHud/icons/rogue/S_Dagger02.png"));
		skillSprite_->SetOpacity(1.0f);
	}

	if (name == "skill5")
	{
		//if (cooling_){return;}
		if (node_->HasComponent<Dead>())
		{
			return;
		}

		if (node_->GetComponent<RogueSkill0>()->enabled_)
		{
			return;
		}

		if (main_->mySceneNode_->GetComponent<SpriteSheetPlayer>()->focusedSprite_ == "rogue")
		{
			if (!enabled_)
			{
				enabled_ = true;

				node_->GetComponent<Armor>()->ModifyArmor(10, -1, false);
				int attack = node_->GetVar("attack").GetInt();
				node_->SetVar("attack", attack + 100);

				Node* particleStartNode_ = node_->GetScene()->CreateChild(0,LOCAL);
				ParticleEmitter* emitterStartFX_ = particleStartNode_->CreateComponent<ParticleEmitter>(LOCAL);
				emitterStartFX_->SetEffect(main_->cache_->GetResource<ParticleEffect>("Particle/terriesCrit.xml"));
				emitterStartFX_->SetViewMask(1);
				emitterStartFX_->SetEmitting(true);

				node_->AddChild(particleStartNode_);
				particleStartNode_->SetWorldPosition(node_->GetWorldPosition());
				particleStartNode_->SetScale(0.5f);

				particleNode_ = particleStartNode_;

				particleStartNode_->AddComponent(new SoundSource3D(context_), 0, LOCAL);
				particleStartNode_->GetComponent<SoundSource3D>()->SetGain(0.25f);
				particleStartNode_->GetComponent<SoundSource3D>()->Play(main_->cache_->GetResource<Sound>("Sounds/170636__korgchops__8-bit-snare.ogg"));

			}
			else
			{
				enabled_ = false;

				node_->GetComponent<Armor>()->ModifyArmor(10, 1, false);
				int attack = node_->GetVar("attack").GetInt();
				node_->SetVar("attack", attack - 100);

				node_->RemoveChild(particleNode_);
			}

			VariantMap vm;
			vm[AnimateSceneNode::P_NODE] = node_;

			if (node_->GetVar("sex").GetBool())
			{
				vm[AnimateSceneNode::P_ANIMATION] = "gestureF";
			}
			else
			{
				vm[AnimateSceneNode::P_ANIMATION] = "gestureM";
			}

			vm[AnimateSceneNode::P_LOOP] = false;
			vm[AnimateSceneNode::P_LAYER] = 0;

			SendEvent(E_ANIMATESCENENODE, vm);
		}
	}
}
示例#4
0
void wxGenericFindReplaceDialog::OnFind(wxCommandEvent& WXUNUSED(event))
{
    SendEvent(wxEVT_FIND_NEXT);
}
示例#5
0
void wxGenericFindReplaceDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
    SendEvent(wxEVT_FIND_CLOSE);

    Show(false);
}
// This function shouldn't modify any internal variables without using a
// critical section since the wxLuaDebuggerCServer calls it from the thread.
int wxLuaDebuggerBase::HandleDebuggeeEvent(int event_type)
{
    wxCHECK_MSG(GetSocketBase(), event_type, wxT("Invalid socket"));

    //wxLuaDebuggerEvent d(wxEVT_WXLUA_DEBUGGER_PRINT, this);
    //d.SetMessage(wxT("wxLuaDebugger : ") + wxLuaSocketCmdEventMsg(event_type));
    //SendEvent(d);

    switch (event_type)
    {
        case wxLUASOCKET_DEBUGGEE_EVENT_BREAK:
        {
            wxString fileName;
            wxInt32  lineNumber = 0;

            if (CheckSocketRead(
                GetSocketBase()->ReadString(fileName) &&
                GetSocketBase()->ReadInt32(lineNumber),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_BREAK")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_BREAK, this, lineNumber, fileName);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_PRINT:
        {
            wxString strMessage;

            if (CheckSocketRead(
                GetSocketBase()->ReadString(strMessage),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_PRINT")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_PRINT, this);
                debugEvent.SetMessage(strMessage);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_ERROR:
        {
            wxString strMessage;

            if (CheckSocketRead(
                GetSocketBase()->ReadString(strMessage),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_ERROR")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_ERROR, this);
                debugEvent.SetMessage(strMessage);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_EXIT:
        {
            wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_EXIT, this);
            wxPostEvent(this, debugEvent);
            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENUM:
        {
            wxLuaDebugData debugData(true);

            if (CheckSocketRead(
                GetSocketBase()->ReadDebugData(debugData),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENUM")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_STACK_ENUM, this);
                debugEvent.SetDebugData(-1, debugData);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENTRY_ENUM:
        {
            wxInt32 stackRef = 0;
            wxLuaDebugData debugData(true);

            if (CheckSocketRead(
                GetSocketBase()->ReadInt32(stackRef) &&
                GetSocketBase()->ReadDebugData(debugData),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENTRY_ENUM")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, this);
                debugEvent.SetDebugData(stackRef, debugData);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM:
        {
            long itemNode = 0;
            wxLuaDebugData debugData(true);

            if (CheckSocketRead(
                GetSocketBase()->ReadLong(itemNode) &&
                GetSocketBase()->ReadDebugData(debugData),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, this);
                debugEvent.SetDebugData(itemNode, debugData);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR:
        {
            wxInt32 exprRef = 0;
            wxString strResult;

            if (CheckSocketRead(
                GetSocketBase()->ReadInt32(exprRef) &&
                GetSocketBase()->ReadString(strResult),
                wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, this);
                debugEvent.SetMessage(strResult);
                debugEvent.SetDebugData(exprRef);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        default : return -1; // don't know this event?
    }

    return event_type;
}
void wxSpeedButton::DoClick(bool inLeft) {

    SetDown(! mButtonDown);
    SendEvent(inLeft);
    Refresh(false);
}
示例#8
0
void EXMotionDetection::CalibrationDone() {
	if (_CalibrationStep == CalibrationStepFinished) {
		_CalibrationStep = CalibrationStepDone;
		SendEvent(new MotionCalibrationEvent(_CalibrationStep));
	}
}
// The unit tests themselves
TEST_F(SocketTransportServiceTest, SendEvent) {
  SendEvent();
}
OMX_ERRORTYPE VideoFilter::ProcessInBufferFlags()
{
    if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_STARTTIME) 
        bGetNewSegment = OMX_TRUE;

    if(bGetNewSegment == OMX_TRUE && (!(pInBufferHdr->nFlags & OMX_BUFFERFLAG_CODECCONFIG))) {
        OMX_S32 nDurationThr,nBufCntThr;
        LOG_DEBUG("Get New sement buffer, ts %lld\n", pInBufferHdr->nTimeStamp);
        bGetNewSegment = OMX_FALSE;
        bNewSegment = OMX_TRUE;
		bLastInput = OMX_FALSE;
        bLastOutput = OMX_FALSE;
		nInvalidFrameCnt = 0;
        if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_STARTTRICK) {
            LOG_DEBUG("Set ts manager to FIFO mode.\n");
            tsmReSync(hTsHandle, pInBufferHdr->nTimeStamp, MODE_FIFO);
        }
        else {
            LOG_DEBUG("Set ts manager to AI mode.\n");
            tsmReSync(hTsHandle, pInBufferHdr->nTimeStamp, MODE_AI);
        }
        GetInputDataDepthThreshold(&nDurationThr, &nBufCntThr);
        LOG_INFO("nDurationThr: %d, nBufCntThr: %d\n", nDurationThr, nBufCntThr);
        tsmSetDataDepthThreshold(hTsHandle, nDurationThr, nBufCntThr);
    }

    if(bLastInput != OMX_FALSE) {
        LOG_DEBUG("Filter drop input buffers in EOS state.\n");
        ReturnInputBuffer();
        return OMX_ErrorNoMore;
    }

    if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_EOS) {
        bLastInput = OMX_TRUE;
        bNeedInputBuffer = OMX_FALSE;
        return OMX_ErrorNone;
    }

    if(!(pInBufferHdr->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) && bFilterSupportPartilInput != OMX_TRUE) {
        ProcessPartialInput();
        return OMX_ErrorNotReady;
    }

    if(PartialInputHdr.pBuffer != NULL) {
        ProcessPartialInput();
        pInBufferHdr = &PartialInputHdr;
    }

    if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_DECODEONLY)
        nDecodeOnly ++;

    if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_CODECCONFIG && pInBufferHdr->nFilledLen > 0) {
        if(pCodecData == NULL) {
            pCodecData = FSL_MALLOC(pInBufferHdr->nFilledLen);
            if(pCodecData == NULL) {
                SendEvent(OMX_EventError, OMX_ErrorInsufficientResources, 0, NULL);
                return OMX_ErrorInsufficientResources;
            }
        }
        else {
            pCodecData = FSL_REALLOC(pCodecData, nCodecDataLen + pInBufferHdr->nFilledLen);
            if(pCodecData == NULL) {
                SendEvent(OMX_EventError, OMX_ErrorInsufficientResources, 0, NULL);
                return OMX_ErrorInsufficientResources;
            }
        }
        fsl_osal_memcpy((char *)pCodecData + nCodecDataLen, pInBufferHdr->pBuffer, pInBufferHdr->nFilledLen);
        nCodecDataLen += pInBufferHdr->nFilledLen;
        LOG_INFO("Get Codec configure data, len: %d\n", nCodecDataLen);
        ReturnInputBuffer();
        return OMX_ErrorNotReady;
    }

    return OMX_ErrorNone;
}
示例#11
0
void
ESChildComboBox::ShowListBox(bool bHide /*= false*/){
	if( bHide ){
		if( m_pListBox ){
			SendEvent(this, EventCode_ComboBoxCloseUp);
			_Rect rcListBox = m_pListBox->GetClientRect();
			m_pListBox->SetVisible(false, false);
			m_pOwner->RemoveChildControl(m_pListBox);
			m_pListBox = NULL;
			RedrawRect	(rcListBox,		true);
			RedrawRect	(m_rcBoxButton, true);
			}
		return;
		}

	if( m_pListBox == NULL ){
		m_pListBox			= new ESChildComboListBox();

		int nItems			= m_content.GetCount();
		int nItemCY			= m_pListBox->GetItemHeight();
		int nListBoxHeight	= m_nListBoxHeight;
		if( nListBoxHeight > nItems*nItemCY ){
			nListBoxHeight = nItems*nItemCY;
			}

		_Rect rcListBox(m_rRect.left, m_rRect.bottom + 1, m_rRect.right, (m_rRect.bottom + 1) + nListBoxHeight);
		_Rect rcOwner;
        
		if( !m_pParent )
			m_pOwner->GetClientRectMy(rcOwner);
		else
			rcOwner = m_pParent->GetClientRect();

		if( rcOwner.bottom < rcListBox.bottom ){
			rcListBox.bottom	= m_rRect.top - 1;
			rcListBox.top		= rcListBox.bottom - nListBoxHeight;
			}

		SendEvent(this, EventCode_ComboBoxDropDown);

		if( m_pOwner->AddChildControl(m_pListBox, MercuryBaseView::GetChildControlIdUnused(m_pOwner), rcListBox, m_pParent, 100) ){
			for(int i=0; i<m_content.GetCount(); i++)
				m_pListBox->AddItem(m_content.GetKey(i), m_content.GetValueByIndex(i), false);

			m_pListBox->GetVScrollBar()->OwnerWindowSizeChanged(rcOwner.Width(), rcOwner.Height());

			int nIndex = -1;
			if( m_content.KeyExists(GetText(), &nIndex) )
				m_pListBox->SetSelectedItem(nIndex, false, true);

			m_pListBox->AddEventListener((ESFrameBase*)this, ChildControlEventCode::EventCode_ListBoxItemClick, (ControlEventListener)&ESChildComboBox::OnListBoxItemClick);
			m_pListBox->SetTextFont		(&m_textFont, false);
			m_pOwner->RedrawRect		(rcListBox, 1);
			RedrawRect					(m_rcBoxButton, true);
			}
		else{
			delete m_pListBox;
			m_pListBox = NULL;
			return;
			}
		}
	else{
		for(int i=0; i<m_content.GetCount(); i++)
			m_pListBox->AddItem(m_content.GetKey(i), m_content.GetValueByIndex(i), false);

		int nIndex = -1;
		if( m_content.KeyExists(GetText(), &nIndex) )
			m_pListBox->SetSelectedItem(nIndex, false, true);
		}
	}
OMX_ERRORTYPE VideoFilter::ProcessDataBuffer()
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_U32 flags=0;

    if(bInReturnBufferState == OMX_TRUE)
        return OMX_ErrorNoMore;

    ret = ProcessInputBuffer();
    if(ret == OMX_ErrorNotReady)
        return OMX_ErrorNone;
    if(ret != OMX_ErrorNone)
        return ret;

    ret = ProcessOutputBuffer();
    if(ret != OMX_ErrorNone)
        return ret;

    FilterBufRetCode DecRet = FILTER_OK;
    DecRet = FilterOneBuffer();
    if(DecRet & FILTER_INPUT_CONSUMED) {
        DecRet = (FilterBufRetCode)(DecRet & ~FILTER_INPUT_CONSUMED);
        ReturnInputBuffer();
    }
    if(DecRet & FILTER_INPUT_CONSUMED_EXT_READ) {
        DecRet = (FilterBufRetCode)(DecRet & ~FILTER_INPUT_CONSUMED_EXT_READ);        
        if(pInBufferHdr){
            InBufferHdrList.Add(pInBufferHdr);
            pInBufferHdr = NULL;
        }
        else{
            //for eos buffer with size=0, pInBufferHdr may be retured aleady before (in ProcessInputBuffer()) 
        }
    }
    if(DecRet & FILTER_INPUT_CONSUMED_EXT_RETURN) {
        OMX_PTR ptr;
        DecRet = (FilterBufRetCode)(DecRet & ~FILTER_INPUT_CONSUMED_EXT_RETURN);
        GetReturnedInputDataPtr(&ptr);
        //since the list is FIFO, we needn't map ptr and pHdr
        if(InBufferHdrList.GetNodeCnt()>0){
            OMX_BUFFERHEADERTYPE* pHdr;
            pHdr=InBufferHdrList.GetNode(0);
            if(pHdr==NULL){
                LOG_ERROR("warning: get one null hdr from InBufferHdrList !\n");
            }
            if(pHdr->pBuffer!=ptr){
                LOG_ERROR("warning: the address doesn't match between ptr and pHdr->pBuffer !\n");
            }
            InBufferHdrList.Remove(pHdr);
            ports[IN_PORT]->SendBuffer(pHdr);
        }
        else{
            //this path is only for eos
            if((DecRet&FILTER_LAST_OUTPUT)==0){
                LOG_ERROR("warning: the numbers between insert and get doesn't matched !\n");
            }
        }
    }

    if(DecRet & FILTER_ONE_FRM_DECODED){
        OMX_S32 nStuffSize;
        OMX_S32 nFrmSize;
        OMX_PTR pFrm;
        ret=GetDecBuffer(&pFrm, &nStuffSize, &nFrmSize);
        if(ret == OMX_ErrorNone){
            LOG_DEBUG("%s: get one decoded frm: 0x%X(%d,%d) \n",__FUNCTION__,(int)pFrm,(int)nStuffSize,(int)nFrmSize);	
            tsmSetFrmBoundary(hTsHandle, nStuffSize, nFrmSize, pFrm);
        }
        else{
            LOG_ERROR("%s: get decoded buffer failure !\n",__FUNCTION__);
        }
        DecRet = (FilterBufRetCode)(DecRet & ~FILTER_ONE_FRM_DECODED);
    }

    switch(DecRet & FILTER_FLAGS_MASK) {
        case FILTER_FLAG_CODEC_DATA:
            flags=OMX_BUFFERFLAG_CODECCONFIG;
            break;
        case FILTER_FLAG_NONKEY_FRAME:
            flags=OMX_BUFFERFLAG_ENDOFFRAME;
            break;
        case FILTER_FLAG_KEY_FRAME:
            flags=OMX_BUFFERFLAG_SYNCFRAME|OMX_BUFFERFLAG_ENDOFFRAME;
            break;
        default:
            flags=0;
            break;
    }
    DecRet = (FilterBufRetCode)(DecRet & ~FILTER_FLAGS_MASK);

    if(DecRet > 0) {
        LOG_DEBUG("DecRet: %d\n", DecRet);
    }

    switch(DecRet) {
        case FILTER_OK:
            break;
        case FILTER_NO_INPUT_BUFFER:
            if(pInBufferHdr != NULL)
                SetInputBuffer(pInBufferHdr->pBuffer + pInBufferHdr->nOffset, pInBufferHdr->nFilledLen, bLastInput);
            else
                bNeedInputBuffer = OMX_TRUE;
            break;
        case FILTER_NO_OUTPUT_BUFFER:
            bNeedOutBuffer = OMX_TRUE;
            break;
        case FILTER_DO_INIT:
            ret = InitFilter();
            if(ret == OMX_ErrorNone)
                bInit = OMX_TRUE;
            break;
        case FILTER_LAST_OUTPUT:
            HandleLastOutput(flags);
            ret = OMX_ErrorNoMore;
            break;
        case FILTER_HAS_OUTPUT:
            {
                OMX_PTR pBuffer = NULL;
                OMX_S32 nOutSize=0;
                OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;
                GetOutputBuffer(&pBuffer,&nOutSize);
				if (nOutSize == 0) {
					nInvalidFrameCnt ++;
					if (nInvalidFrameCnt <= MOSAIC_COUNT) {
						SetOutputBuffer(pBuffer);	//still need to return it to vpu to avoid the frame is isolated in the pipeline
						tsmGetFrmTs(hTsHandle, NULL);
						break;
					}
				} else {
					nInvalidFrameCnt = 0;
				}
                pBufferHdr = GetOutBufferHdrFromList(pBuffer);
                if(pBufferHdr != NULL) {
                    pBufferHdr->nFlags = flags;
                    pBufferHdr->nFilledLen = nOutSize;//pBufferHdr->nAllocLen;
                    ReturnOutputBuffer(pBufferHdr,flags);
                }
                else{
                    SetOutputBuffer(pBuffer);	//still need to return it to vpu to avoid the frame is isolated in the pipeline
                    LOG_ERROR("Can't find related bufferhdr with frame: %p\n", pBuffer);
                }
            }
            break;
        case FILTER_SKIP_OUTPUT:
            tsmGetFrmTs(hTsHandle, NULL);
            break;
        case FILTER_ERROR:
            SendEvent(OMX_EventError, OMX_ErrorStreamCorrupt, 0, NULL);
            ret=OMX_ErrorStreamCorrupt;
            break;
        default: 
            break;
    }

    return ret;
}
示例#13
0
void wxSTEditorShell::OnKeyDown(wxKeyEvent &event)
{
    event.Skip(false);
    CheckReadOnly(true);

    switch (event.GetKeyCode())
    {
        case WXK_UP : case WXK_NUMPAD_UP :
        {
            // you can scroll up through multiline entry
            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();
            if ((current_line < prompt_line) || (current_line > prompt_line))
                break;

            // up/down arrows go through the history buffer
            wxString promptText = GetPromptText();
            SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText));
            return;
        }
        case WXK_DOWN : case WXK_NUMPAD_DOWN :
        {
            // you can scroll down through multiline entry
            int total_lines = GetLineCount();
            total_lines = wxMax(0, total_lines - 1);
            int current_line = GetCurrentLine();
            if (current_line < total_lines)
                break;

            // up/down arrows go through the history buffer
            if ((int)GetHistoryIndex() < (int)GetHistoryCount()-1)
            {
                wxString promptText = GetPromptText();
                SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText));
            }
            return;
        }
        case WXK_LEFT : case WXK_NUMPAD_LEFT :
        {
            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();
            if (current_line >= prompt_line)
            {
                int caret_pos = 0;
                GetCurLine(&caret_pos);
                if (caret_pos < 1)
                    return;
            }
            break;
        }

        case WXK_PRIOR : case WXK_NUMPAD_PRIOR : //case WXK_NUMPAD_PAGEUP :
        case WXK_NEXT  : case WXK_NUMPAD_NEXT  : //case WXK_NUMPAD_PAGEDOWN :
        case WXK_END   : case WXK_NUMPAD_END   :
        case WXK_HOME  : case WXK_NUMPAD_HOME  :
        case WXK_RIGHT : case WXK_NUMPAD_RIGHT :

        case WXK_SHIFT :
        case WXK_CONTROL :
        case WXK_ALT :
        {
            // default processing for these keys
            event.Skip();
            return;
        }

        case WXK_RETURN : case WXK_NUMPAD_ENTER :
        {
            // put cursor at end if not already on the last line
            if (!CaretOnPromptLine(STE_CARET_MOVE_NONE))
            {
                GotoPos(GetLength());
                return;
            }

            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();

            // allow multiline entry for shift+enter
            if ((current_line >= prompt_line) && event.ShiftDown())
            {
                event.Skip();
                return;
            }

            wxString promptText = GetPromptText();

            // goto the end of the line and store the line for the history
            LineEnd();
            if (!promptText.IsEmpty())
                AddHistoryLine(promptText, true);

            // just send the event, the receiver can do what they like
            SendEvent(wxEVT_STESHELL_ENTER, 0, GetState(), promptText);
            return;
        }
        case WXK_BACK :
        {
            // go to the end of the last line if not on last line
            if (!CaretOnPromptLine(STE_CARET_MOVE_NONE))
            {
                GotoPos(GetLength());
                return;
            }
            // don't let them backspace into previous line
            int caret_pos = 0;
            GetCurLine(&caret_pos);
            if (caret_pos < 1)
                return;

            break;
        }
        default : // move cursor to end if not already there
        {
            CaretOnPromptLine(STE_CARET_MOVE_ENDTEXT);
            break;
        }
    }

    event.Skip();
}
示例#14
0
void	
ESChildControlImage::OnLButtonClick(_Point pt, UINT nFlags){
	// Send click event.
	SendEvent(this, ChildControlEventCode::EventCode_ImageClick);
	}
示例#15
0
int ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
  int status = 0;
  try
    {
      Supplier_Client client;
      status = client.init (argc, argv);

      if (status == 0)
        {
          CosNotifyChannelAdmin::EventChannel_var ec =
            client.create_event_channel ("MyEventChannel", 0);

          CORBA::ORB_ptr orb = client.orb ();

          sig_i* sig_impl;
          ACE_NEW_RETURN (sig_impl, sig_i (orb), 1);
          PortableServer::ServantBase_var owner_transfer(sig_impl);

          CORBA::Object_var object =
            orb->resolve_initial_references ("RootPOA");
          PortableServer::POA_var root_poa =
            PortableServer::POA::_narrow (object.in ());

          PortableServer::ObjectId_var id =
            root_poa->activate_object (sig_impl);

          object = root_poa->id_to_reference (id.in ());

          sig_var sig = sig::_narrow (object.in ());

          CORBA::String_var ior = orb->object_to_string (sig.in ());

          // Output the IOR to the <ior_output_file>
          FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
          if (output_file != 0)
            {
              ACE_OS::fprintf (output_file, "%s", ior.in ());
              ACE_OS::fclose (output_file);
            }

          CosNotifyChannelAdmin::SupplierAdmin_var admin =
            create_supplieradmin (ec.in ());
          if (!CORBA::is_nil (admin.in ()))
            {
              create_suppliers (admin.in (), client.root_poa ());

              sig_impl->wait_for_startup();

              ACE_DEBUG ((LM_DEBUG,
                          "1 supplier sending %d events...\n", max_events));
              for (int i = 0; i < max_events; ++i)
              {
                ACE_DEBUG ((LM_DEBUG, "+"));
                SendEvent (i);
              }
              ACE_DEBUG ((LM_DEBUG,
                          "\nSupplier sent %d events.\n", max_events));

              ACE_OS::unlink (ior_output_file);
              supplier_1->disconnect ();

              ec->destroy ();
            }
        }
    }
  catch (const CORBA::Exception& e)
    {
      e._tao_print_exception ("Supplier Error: ");
      status = 1;
    }

  return status;
}
示例#16
0
/**
 * Trigger an action, like sending an event and setting the exp_mask
 * 
 * @param state watchdog state which should be triggered 
 **/
void NewSimulatorWatchdog::TriggerAction( WdtStateT state ) {
   SaHpiWatchdogActionEventT wdtaction;
   SaHpiSeverityT sev = SAHPI_MAJOR;
   
   if ( ( state == PRETIMEOUT ) &&
         ( m_state != PRETIMEOUT ) ) {
      cTime now( cTime::Now() );
      now -= m_start;
      m_state = PRETIMEOUT;
      wdtaction = SAHPI_WAE_TIMER_INT;
      sev = SAHPI_MAJOR;
      
      m_wdt_data.PresentCount = m_wdt_data.InitialCount - now.GetMsec();
      Reset( m_wdt_data.PreTimeoutInterval );
      
      if ( m_wdt_data.Log == SAHPI_TRUE ) {
         // The next is implementation specific, HPI-B, p. 154
         // An event is generated when the pre-timer expires, unless the 
         // pre-timer interrupt action is “None” and the pre-timer interval is zero, 
         // in which case it is implementation-dependent whether an event is generated.
         if (!(    (m_wdt_data.PretimerInterrupt == SAHPI_WPI_NONE)
                && (m_wdt_data.PreTimeoutInterval == 0)  ))
            SendEvent( wdtaction, sev );
            
      }
   }
  
   if ( state == TIMEOUT ) {

      m_wdt_data.Running = SAHPI_FALSE;
      m_wdt_data.PresentCount = 0;
      m_start.Clear();
      stdlog << "DBG: Stop TimerThread due to TimerAction\n";
      Stop();
      m_state = TIMEOUT;
      
      switch ( m_wdt_data.TimerAction ) {
         case SAHPI_WA_NO_ACTION:
            sev = SAHPI_INFORMATIONAL;
            wdtaction = SAHPI_WAE_NO_ACTION;
            break;
            
         case SAHPI_WA_RESET:
            sev = SAHPI_MAJOR;
            wdtaction = SAHPI_WAE_RESET;
            break;
            
         case SAHPI_WA_POWER_DOWN:
            sev = SAHPI_MAJOR;
            wdtaction = SAHPI_WAE_POWER_DOWN;
            break;
            
         case SAHPI_WA_POWER_CYCLE:
            sev = SAHPI_MAJOR;
            wdtaction = SAHPI_WAE_POWER_CYCLE;
            break;
            
         default:
            err("Invalid TimerAction is configured inside Watchdog");
            sev = SAHPI_INFORMATIONAL;
            wdtaction = SAHPI_WAE_NO_ACTION;
            break;
      }
      
      switch ( m_wdt_data.TimerUse ) {
      	  case SAHPI_WTU_NONE:
      	  case SAHPI_WTU_UNSPECIFIED:
      	     break;
      	     
          case SAHPI_WTU_BIOS_FRB2:
             m_wdt_data.TimerUseExpFlags |= SAHPI_WATCHDOG_EXP_BIOS_FRB2;
             break;
             
          case SAHPI_WTU_BIOS_POST:
             m_wdt_data.TimerUseExpFlags |= SAHPI_WATCHDOG_EXP_BIOS_POST;
             break;
             
          case SAHPI_WTU_OS_LOAD:
             m_wdt_data.TimerUseExpFlags |= SAHPI_WATCHDOG_EXP_OS_LOAD;
             break;
             
          case SAHPI_WTU_SMS_OS:
             m_wdt_data.TimerUseExpFlags |= SAHPI_WATCHDOG_EXP_SMS_OS;
             break;
             
          case SAHPI_WTU_OEM:
             m_wdt_data.TimerUseExpFlags |= SAHPI_WATCHDOG_EXP_OEM;
             break;
             
          default:
             err("Invalid TimerUse is configured inside Watchdog");
             break;
      }
      stdlog << "DBG: Watchdog::SendEvent if allowed\n";
      if ( m_wdt_data.Log == SAHPI_TRUE )
         SendEvent( wdtaction, sev ); 
   }
}
OMX_ERRORTYPE AudioFilter::ProcessDataBuffer()
{
	OMX_ERRORTYPE ret = OMX_ErrorNone;
	LOG_LOG("Audio filter In: %d, Out: %d\n", ports[AUDIO_FILTER_INPUT_PORT]->BufferNum(), ports[AUDIO_FILTER_OUTPUT_PORT]->BufferNum());

	if(((ports[AUDIO_FILTER_INPUT_PORT]->BufferNum() == 0 && pInBufferHdr == NULL )
	        || pInBufferHdr != NULL) /**< Ring buffer full */
	        && (ports[AUDIO_FILTER_OUTPUT_PORT]->BufferNum() == 0  && pOutBufferHdr == NULL))
		return OMX_ErrorNoMore;
	if(pOutBufferHdr == NULL && ports[AUDIO_FILTER_OUTPUT_PORT]->BufferNum() > 0)
	{
		ports[AUDIO_FILTER_OUTPUT_PORT]->GetBuffer(&pOutBufferHdr);
		pOutBufferHdr->nFlags = 0;
	}

	if(pInBufferHdr == NULL && ports[AUDIO_FILTER_INPUT_PORT]->BufferNum() > 0)
	{
		ports[AUDIO_FILTER_INPUT_PORT]->GetBuffer(&pInBufferHdr);
		if(pInBufferHdr != NULL)
		{
			ret = ProcessInputBufferFlag();
			if (ret != OMX_ErrorNone)
			{
				LOG_ERROR("Process input buffer flag fail.\n");
				return ret;
			}
		}
	}

	if(pInBufferHdr != NULL)
	{
		ret = ProcessInputDataBuffer();
		if (ret != OMX_ErrorNone)
		{
			LOG_ERROR("Process input data buffer fail.\n");
			return ret;
		}
	}

	if (bInstanceReset == OMX_TRUE)
	{
		bInstanceReset = OMX_FALSE;
		ret = AudioFilterInstanceReset();
		if (ret != OMX_ErrorNone)
		{
			LOG_ERROR("Audio filter instance reset fail.\n");
			bDecoderEOS = OMX_TRUE;
			SendEvent(OMX_EventError, ret, 0, NULL);
			return ret;
		}
	}

	if (bFirstFrame == OMX_TRUE)
	{
		ret = AudioFilterCheckFrameHeader();
		if (ret != OMX_ErrorNone)
		{
			LOG_ERROR("AudioFilterCheckFrameHeader fail.\n");
		}

	}

	LOG_LOG("Audio Filter Ringbuffer data len: %d\n", AudioRingBuffer.AudioDataLen());
	if ((AudioRingBuffer.AudioDataLen() < nPushModeInputLen && bReceivedEOS == OMX_FALSE)
	        || bDecoderEOS == OMX_TRUE)
	{
		LOG_DEBUG("Input buffer is not enough for filter.\n");
		if(ports[AUDIO_FILTER_INPUT_PORT]->BufferNum() > 0)
			return OMX_ErrorNone;
		else
			return OMX_ErrorNoMore;
	}

	if (bCodecInit == OMX_FALSE)
	{
		bCodecInit = OMX_TRUE;
		ret = AudioFilterCodecInit();
		if (ret != OMX_ErrorNone)
		{
			LOG_ERROR("Audio decoder codec init fail.\n");
			bDecoderInitFail = OMX_TRUE;
		}
	}

	if(pOutBufferHdr != NULL)
	{
		ret = ProcessOutputDataBuffer();
		if (ret != OMX_ErrorNone)
			LOG_ERROR("Process Output data buffer fail.\n");
	}

	return OMX_ErrorNone;
}
示例#18
0
void wxCheckListBox::OnKeyDown(wxKeyEvent& event)
{
    // what do we do?
    enum
    {
        NONE,
        TOGGLE,
        SET,
        CLEAR
    } oper;

    switch ( event.GetKeyCode() )
    {
        case WXK_SPACE:
            oper = TOGGLE;
            break;

        case WXK_NUMPAD_ADD:
        case '+':
            oper = SET;
            break;

        case WXK_NUMPAD_SUBTRACT:
        case '-':
            oper = CLEAR;
            break;

        default:
            oper = NONE;
    }

    if ( oper != NONE )
    {
        wxArrayInt selections;
        int count = 0;
        if ( HasMultipleSelection() )
        {
            count = GetSelections(selections);
        }
        else
        {
            int sel = GetSelection();
            if (sel != -1)
            {
                count = 1;
                selections.Add(sel);
            }
        }

        for ( int i = 0; i < count; i++ )
        {
            int nItem = selections[i];

            switch ( oper )
            {
                case TOGGLE:
                    Toggle(nItem);
                    break;

                case SET:
                case CLEAR:
                    Check(nItem, oper == SET);
                    break;

                default:
                    wxFAIL_MSG( wxT("what should this key do?") );
            }

            // we should send an event as this has been done by the user and
            // not by the program
            SendEvent(nItem);
        }
    }
    else // nothing to do
    {
        event.Skip();
    }
}
示例#19
0
文件: menubtn.cpp 项目: bigbensk/gpac
void wxCustomButton::OnMouseEvents(wxMouseEvent& event)
{
    if (m_button_style & wxCUSTBUT_NOTOGGLE) return;
    
    if (event.LeftDown() || event.RightDown())
    {
        if (!HasCapture()) 
            CaptureMouse(); // keep depressed until up
        
        m_down++;
        Redraw();
    }
    else if (event.LeftDClick() || event.RightDClick())
    {
        m_down++; // GTK eats second down event
        Redraw();
    }
    else if (event.LeftUp())
    {
        if (HasCapture()) 
            ReleaseMouse();
        
        m_eventType = wxEVT_LEFT_UP;
        
#if (wxMINOR_VERSION<8) 
        if (wxRect(wxPoint(0,0), GetSize()).Inside(event.GetPosition()))
#else
        if (wxRect(wxPoint(0,0), GetSize()).Contains(event.GetPosition()))
#endif
        {
            if ((m_button_style & wxCUSTBUT_BUTTON) && (m_down > 0))
            {
                m_down = 0;
                Redraw();
                SendEvent();
                return;
            }
            else
            {
                if (!m_timer)
                {
                    m_timer = new wxTimer(this, m_down+1);
                    m_timer->Start(200, TRUE);
                }
                else
                {
                    m_eventType = wxEVT_LEFT_DCLICK;
                }
                
                if ((m_button_style & wxCUSTBUT_TOGGLE) && 
                    (m_button_style & wxCUSTBUT_TOG_DCLICK_BUT)) m_down++;
            }
        }

        Redraw();
    }
    else if (event.RightUp())
    {
        if (HasCapture()) 
            ReleaseMouse();
        
        m_eventType = wxEVT_RIGHT_UP;

#if (wxMINOR_VERSION<8) 
        if (wxRect(wxPoint(0,0), GetSize()).Inside(event.GetPosition()))
#else
        if (wxRect(wxPoint(0,0), GetSize()).Contains(event.GetPosition()))
#endif
        {
            if ((m_button_style & wxCUSTBUT_BUTTON) && (m_down > 0))
            {
                m_down = 0;
                Redraw();
                SendEvent();
                return;
            }
            else
            {
                m_down++;
            
                if (!m_timer)
                {
                    m_timer = new wxTimer(this, m_down);
                    m_timer->Start(250, TRUE);
                }
                else
                {
                    m_eventType = wxEVT_RIGHT_DCLICK;
                }
            }
        }
        
        Redraw();
    }
    else if (event.Entering())
    {
        m_focused = TRUE;
        if ((event.LeftIsDown() || event.RightIsDown()) && HasCapture()) 
            m_down++;
        
        Redraw();
    }
    else if (event.Leaving())
    {
        m_focused = FALSE;
        if ((event.LeftIsDown() || event.RightIsDown()) && HasCapture())
            m_down--;
        
        Redraw();
    }
}
示例#20
0
////////////////////////////////////////////////////////////
/// Process a Win32 event
////////////////////////////////////////////////////////////
void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam)
{
    // Don't process any message until window is created
    if (myHandle == NULL)
        return;

    switch (Message)
    {
        // Destroy event
        case WM_DESTROY :
        {
            // Here we must cleanup resources !
            Cleanup();
            break;
        }

        // Set cursor event
        case WM_SETCURSOR :
        {
            // The mouse has moved, if the cursor is in our window we must refresh the cursor
            if (LOWORD(LParam) == HTCLIENT)
                SetCursor(myCursor);

            break;
        }

        // Close event
        case WM_CLOSE :
        {
            Event Evt;
            Evt.Type = Event::Closed;
            SendEvent(Evt);
            break;
        }

        // Resize event
        case WM_SIZE :
        {
            // Update window size
            RECT Rect;
            GetClientRect(myHandle, &Rect);
            myWidth  = Rect.right - Rect.left;
            myHeight = Rect.bottom - Rect.top;

            Event Evt;
            Evt.Type        = Event::Resized;
            Evt.Size.Width  = myWidth;
            Evt.Size.Height = myHeight;
            SendEvent(Evt);
            break;
        }

        // Gain focus event
        case WM_SETFOCUS :
        {
            Event Evt;
            Evt.Type = Event::GainedFocus;
            SendEvent(Evt);
            break;
        }

        // Lost focus event
        case WM_KILLFOCUS :
        {
            Event Evt;
            Evt.Type = Event::LostFocus;
            SendEvent(Evt);
            break;
        }

        // Text event
        case WM_CHAR :
        {
            if (myKeyRepeatEnabled || ((LParam & (1 << 30)) == 0))
            {
                Event Evt;
                Evt.Type = Event::TextEntered;
                Evt.Text.Unicode = static_cast<Uint32>(WParam);
                SendEvent(Evt);
            }
            break;
        }

        // Keydown event
        case WM_KEYDOWN :
        case WM_SYSKEYDOWN :
        {
            if (myKeyRepeatEnabled || ((HIWORD(LParam) & KF_REPEAT) == 0))
            {
                Event Evt;
                Evt.Type        = Event::KeyPressed;
                Evt.Key.Alt     = HIWORD(GetAsyncKeyState(VK_MENU))    != 0;
                Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0;
                Evt.Key.Shift   = HIWORD(GetAsyncKeyState(VK_SHIFT))   != 0;
                Evt.Key.Code    = VirtualKeyCodeToSF(WParam, LParam);
                SendEvent(Evt);
            }
            break;
        }

        // Keyup event
        case WM_KEYUP :
        case WM_SYSKEYUP :
        {
            Event Evt;
            Evt.Type        = Event::KeyReleased;
            Evt.Key.Alt     = HIWORD(GetAsyncKeyState(VK_MENU))    != 0;
            Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0;
            Evt.Key.Shift   = HIWORD(GetAsyncKeyState(VK_SHIFT))   != 0;
            Evt.Key.Code    = VirtualKeyCodeToSF(WParam, LParam);
            SendEvent(Evt);

            break;
        }

        // Mouse wheel event
        case WM_MOUSEWHEEL :
        {
            Event Evt;
            Evt.Type = Event::MouseWheelMoved;
            Evt.MouseWheel.Delta = static_cast<Int16>(HIWORD(WParam)) / 120;
            SendEvent(Evt);
            break;
        }

        // Mouse left button down event
        case WM_LBUTTONDOWN :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonPressed;
            Evt.MouseButton.Button = Mouse::Left;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse left button up event
        case WM_LBUTTONUP :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonReleased;
            Evt.MouseButton.Button = Mouse::Left;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse right button down event
        case WM_RBUTTONDOWN :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonPressed;
            Evt.MouseButton.Button = Mouse::Right;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse right button up event
        case WM_RBUTTONUP :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonReleased;
            Evt.MouseButton.Button = Mouse::Right;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse wheel button down event
        case WM_MBUTTONDOWN :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonPressed;
            Evt.MouseButton.Button = Mouse::Middle;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse wheel button up event
        case WM_MBUTTONUP :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonReleased;
            Evt.MouseButton.Button = Mouse::Middle;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse X button down event
        case WM_XBUTTONDOWN :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonPressed;
            Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse X button up event
        case WM_XBUTTONUP :
        {
            Event Evt;
            Evt.Type               = Event::MouseButtonReleased;
            Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2;
            Evt.MouseButton.X      = LOWORD(LParam);
            Evt.MouseButton.Y      = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse move event
        case WM_MOUSEMOVE :
        {
            // Check if we need to generate a MouseEntered event
            if (!myIsCursorIn)
            {
                TRACKMOUSEEVENT MouseEvent;
                MouseEvent.cbSize    = sizeof(TRACKMOUSEEVENT);
                MouseEvent.hwndTrack = myHandle;
                MouseEvent.dwFlags   = TME_LEAVE;
                TrackMouseEvent(&MouseEvent);

                myIsCursorIn = true;

                Event Evt;
                Evt.Type = Event::MouseEntered;
                SendEvent(Evt);
            }

            Event Evt;
            Evt.Type        = Event::MouseMoved;
            Evt.MouseMove.X = LOWORD(LParam);
            Evt.MouseMove.Y = HIWORD(LParam);
            SendEvent(Evt);
            break;
        }

        // Mouse leave event
        case WM_MOUSELEAVE :
        {
            myIsCursorIn = false;

            Event Evt;
            Evt.Type = Event::MouseLeft;
            SendEvent(Evt);
            break;
        }
    }
}
示例#21
0
    void ProcessNativeEvent(const inotify_event& inevt)
    {
        wxLogTrace(wxTRACE_FSWATCHER, InotifyEventToString(inevt));

        // after removing inotify watch we get IN_IGNORED for it, but the watch
        // will be already removed from our list at that time
        if (inevt.mask & IN_IGNORED)
        {
            return;
        }

        // get watch entry for this event
        wxFSWatchEntryDescriptors::iterator it = m_watchMap.find(inevt.wd);
        wxCHECK_RET(it != m_watchMap.end(),
                             "Watch descriptor not present in the watch map!");

        wxFSWatchEntry& watch = *(it->second);
        int nativeFlags = inevt.mask;
        int flags = Native2WatcherFlags(nativeFlags);

        // check out for error/warning condition
        if (flags & wxFSW_EVENT_WARNING || flags & wxFSW_EVENT_ERROR)
        {
            wxString errMsg = GetErrorDescription(Watcher2NativeFlags(flags));
            wxFileSystemWatcherEvent event(flags, errMsg);
            SendEvent(event);
        }
        // filter out ignored events and those not asked for.
        // we never filter out warnings or exceptions
        else if ((flags == 0) || !(flags & watch.GetFlags()))
        {
            return;
        }
        // renames
        else if (nativeFlags & IN_MOVE)
        {
            wxInotifyCookies::iterator it = m_cookies.find(inevt.cookie);
            if ( it == m_cookies.end() )
            {
                int size = sizeof(inevt) + inevt.len;
                inotify_event* e = (inotify_event*) operator new (size);
                memcpy(e, &inevt, size);

                wxInotifyCookies::value_type val(e->cookie, e);
                m_cookies.insert(val);
            }
            else
            {
                inotify_event& oldinevt = *(it->second);

                wxFileSystemWatcherEvent event(flags);
                if ( inevt.mask & IN_MOVED_FROM )
                {
                    event.SetPath(GetEventPath(watch, inevt));
                    event.SetNewPath(GetEventPath(watch, oldinevt));
                }
                else
                {
                    event.SetPath(GetEventPath(watch, oldinevt));
                    event.SetNewPath(GetEventPath(watch, inevt));
                }
                SendEvent(event);

                m_cookies.erase(it);
                delete &oldinevt;
            }
        }
        // every other kind of event
        else
        {
            wxFileName path = GetEventPath(watch, inevt);
            wxFileSystemWatcherEvent event(flags, path, path);
            SendEvent(event);
        }
    }
示例#22
0
int CTransfer::Transfer(CMobileClient *pClient, char *pszType, int nNzcNumber, int nPort, char *pszFileName, int nTryTime, BOOL bCompress)
{
	char	szNumber[64] = "";
	int		nState, nError;
	BOOL	bConnected = FALSE;
	BOOL	bCDMA, bEvent;
	int		nRetry = 0;
	int		nIndex = 0;
	int		nResult;
	time_t	tmStart, tmNow;

	m_bCompress	= bCompress;
	m_nNzcNumber = nNzcNumber;
	m_nMobileType = MOBILE_GSM;
	bCDMA = (strcmp(pszType, "cdma") == 0) ? TRUE : FALSE;
	if (bCDMA) m_nMobileType = MOBILE_CDMA;
	bEvent = strstr(pszFileName, "event") != NULL ? TRUE : FALSE;

	LoadPhoneList();
	if (m_nPhoneCount == 0)
	{
		XDEBUG("File not found: /app/sw/phonelist\r\n");
		return 0;
	}

	time(&tmStart);
	for(nState=STATE_INIT; !m_bExitSignalPending;)
	{
		switch(nState) {
 		  case STATE_INIT :
			   nRetry = 0;
			   DisconnectModem();
			   nState = STATE_TRY_CONNECT;
			   break;

		  case STATE_TRY_CONNECT :
			   strcpy(szNumber, m_szPhoneList[nIndex]);
		       XDEBUG("CIRCUIT: Try Connect to %s. (%s)\r\n",
						szNumber, bEvent ? "Event" : "Data");
			   UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d Try connect.\n", szNumber, nPort);

			   nError = ConnectToHost(pClient, szNumber, bCDMA, nPort);
			   if (nError != 0)
			   {
				   switch(nError) {
					 case -4 :
					      XDEBUG("CIRCUIT: Server is not accept. (CPIN=%s, CSQ=%s, SBV=%s)\r\n",
								szCPIN, szCSQ, szSBV);
			       	      UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d Server is not accept. (CPIN=%s, CSQ=%s, SBV=%s)\n",
								szNumber, nPort, szCPIN, szCSQ, szSBV);
						  break;
				     case -10 :
					      XDEBUG("CIRCUIT: Modem or SIM error!!.\r\n");
			       	      UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d Modem or SIM error.\n", szNumber, nPort);
						  break;
				     case -1 :
					 case -2 :
					 case -3 :
					  default:
					      XDEBUG("CIRCUIT: Cannot connect to host. (CPIN=%s, CSQ=%s, SBV=%s)\r\n",
								szCPIN, szCSQ, szSBV);
			       	      UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d Cannot connect to host. (CPIN=%s, CSQ=%s, SBV=%s)\n",
								szNumber, nPort, szCPIN, szCSQ, szSBV);
						  break;
				   }	
				   nState = STATE_RETRY;
				   break;
			   }

		       XDEBUG("CIRCUIT: Connected.\r\n");
			   UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d Connected. (%s)\n", szNumber, nPort, bEvent ? "Event" : "Data");
			   bConnected = TRUE;
			   nState = STATE_SEND;
		 	   break;

		  case STATE_SEND :
			   XDEBUG("CIRCUIT: Sending %s...\r\n", bEvent ? "Event" : "Data");
			   nResult = -1;
			   m_pszReadBuffer = (char *)MALLOC(1024*30);
			   if (m_pszReadBuffer != NULL)
			   {
				   if (bEvent)
			   		    nResult = SendEvent(pClient, pszFileName);
			   	   else nResult = SendMetering(pClient, pszFileName);
				   FREE(m_pszReadBuffer);
			   }
			   nState = (nResult == SENDERR_OK) ? STATE_TERMINATE : STATE_RETRY;
			   if (nState == STATE_RETRY)
			   {
			   	   UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d %s Sending fail (ERROR=%d).\n",
								szNumber, nPort,
								bEvent ? "Event" : "Data",
								nResult);
			   }
		 	   break;

		  case STATE_RETRY :
			   XDEBUG("CIRCUIT: Disconnect mobile session.\r\n");
			   DisconnectModem();

			   nIndex++;
			   if (nIndex >= m_nPhoneCount)
			       nIndex = 0;

			   nRetry++;
			   if (nRetry >= MAX_RETRY_COUNT)
			   {
				   XDEBUG("CIRCUIT: Out of MAX_RETRY_COUNT(%d).\r\n", MAX_RETRY_COUNT);
				   DisconnectModem();
				   return 0;
			   }

			   time(&tmNow);
			   if ((tmNow-tmStart) > nTryTime)
			   {
				   XDEBUG("CIRCUIT: Max try timeout(%d).\r\n", (int)(tmNow-tmStart));
				   DisconnectModem();
				   return 0;
			   }

			   XDEBUG("\r\n");
			   XDEBUG("CIRCUIT: SEND RETRY (Retry=%d, Time=%d min %d seconds)\r\n",
						nRetry,
						(int)(tmNow-tmStart) / 60,
						(int)(tmNow-tmStart) % 60);
			   nState = STATE_TRY_CONNECT;
		 	   break;

		  case STATE_TERMINATE :
			   time(&tmNow);
			   XDEBUG("\r\n");
			   XDEBUG("CIRCUIT: Total send time = %d min %d seconds\r\n",
						(int)(tmNow-tmStart) / 60,
						(int)(tmNow-tmStart) % 60);
			   XDEBUG("CIRCUIT: Disconnect mobile session.\r\n");
			   UpdateLogFile(LOG_DIR, UPLOAD_LOG_FILE, 0, TRUE, "%s:%d %s Sending ok (Total=%d).\n",
						szNumber, nPort,
						bEvent ? "Event" : "Data",
						m_nSentLine);
			   DisconnectModem();
			   return 1;
		}
	}

	if (m_bExitSignalPending)
	{
	    XDEBUG("CIRCUIT: User stop. Disconnect mobile.\r\n");
		DisconnectModem();
	}
	
	return 0;
}
示例#23
0
void wxGenericFindReplaceDialog::OnReplaceAll(wxCommandEvent& WXUNUSED(event))
{
    SendEvent(wxEVT_FIND_REPLACE_ALL);
}
void SceneView3D::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
{

    // Visualize the currently selected nodes
    if (selectedNode_.NotNull())
    {
        DrawNodeDebug(selectedNode_, debugRenderer_);

    }

    if (!MouseInView())
        return;

    Input* input = GetSubsystem<Input>();

    mouseLeftDown_ = false;

    if (input->GetMouseButtonPress(MOUSEB_LEFT))
    {
        if (!mouseMoved_ && !sceneEditor_->GetGizmo()->Selected())
        {
            Ray camRay  = GetCameraRay();
            PODVector<RayQueryResult> result;

            RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
            octree_->RaycastSingle(query);

            if (query.result_.Size())
            {
                const RayQueryResult& r = result[0];

                if (r.drawable_)
                {

                    VariantMap neventData;
                    neventData[EditorActiveNodeChange::P_NODE] = r.drawable_->GetNode();
                    SendEvent(E_EDITORACTIVENODECHANGE, neventData);

                }
            }
        }

        mouseMoved_ = false;

    }
    else if (!input->GetMouseButtonDown(MOUSEB_LEFT))
    {

        Ray camRay  = GetCameraRay();
        PODVector<RayQueryResult> result;

        mouseMoved_ = false;

        /*
        Array<int> pickModeDrawableFlags = {
            DRAWABLE_GEOMETRY,
            DRAWABLE_LIGHT,
            DRAWABLE_ZONE
        };
        */

        RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
        octree_->RaycastSingle(query);

        if (query.result_.Size())
        {
            const RayQueryResult& r = result[0];

            if (r.drawable_)
            {
                debugRenderer_->AddNode(r.drawable_->GetNode(), 1.0, false);
                r.drawable_->DrawDebugGeometry(debugRenderer_, false);
            }

        }
    }
    else
    {
        mouseLeftDown_ = true;
        if (Abs(input->GetMouseMoveX() > 3 || input->GetMouseMoveY() >  3))
        {
            mouseMoved_ = true;
        }
    }

}
示例#25
0
void wxGenericFindReplaceDialog::OnCloseWindow(wxCloseEvent &)
{
    SendEvent(wxEVT_FIND_CLOSE);
}
示例#26
0
	bool Event1(void* data)
	{
		std::cout << "Event1 received by cube!"<<std::endl;
		SendEvent(GetID("request_new"),new ObjectRequest("triangle"));
		return false;
	}
示例#27
0
void SearchThread::DoSearchFile(const wxString& fileName, const SearchData* data)
{
    // Process single lines
    int lineNumber = 1;
    if(!wxFileName::FileExists(fileName)) { return; }

    size_t size = FileUtils::GetFileSize(fileName);
    if(size == 0) { return; }
    wxString fileData;
    fileData.Alloc(size);

#if wxUSE_GUI
    // support for other encoding
    wxFontEncoding enc = wxFontMapper::GetEncodingFromName(data->GetEncoding().c_str());
    wxCSConv fontEncConv(enc);
    if(!FileUtils::ReadFileContent(fileName, fileData, fontEncConv)) {
        m_summary.GetFailedFiles().Add(fileName);
        return;
    }
#else
    if(!FileUtils::ReadFileContent(fileName, fileData, wxConvLibc)) {
        m_summary.GetFailedFiles().Add(fileName);
        return;
    }
#endif
    // take a wild guess and see if we really need to construct
    // a TextStatesPtr object (it is quite an expensive operation)
    bool shouldCreateStates(true);
    if(data->IsMatchCase() && !data->IsRegularExpression()) {
        shouldCreateStates = (fileData.Find(data->GetFindString()) != wxNOT_FOUND);

    } else if(!data->IsMatchCase() && !data->IsRegularExpression()) {
        // !data->IsMatchCase()
        wxString tmpData = fileData;
        shouldCreateStates = (tmpData.MakeLower().Find(data->GetFindString()) != wxNOT_FOUND);
    }

    wxStringTokenizer tkz(fileData, wxT("\n"), wxTOKEN_RET_EMPTY_ALL);

    // Incase one of the C++ options is enabled,
    // create a text states object
    TextStatesPtr states(NULL);
    if(data->HasCppOptions() && shouldCreateStates && false) {
        CppWordScanner scanner("", fileData.mb_str().data(), 0);
        states = scanner.states();
    }

    int lineOffset = 0;
    if(data->IsRegularExpression()) {
        // regular expression search
        while(tkz.HasMoreTokens()) {
            // Read the next line
            wxString line = tkz.NextToken();
            DoSearchLineRE(line, lineNumber, lineOffset, fileName, data, states);
            lineOffset += line.Length() + 1;
            lineNumber++;
        }
    } else {
        // simple search
        wxString findString;
        wxArrayString filters;
        findString = data->GetFindString();
        if(data->IsEnablePipeSupport()) {
            if(data->GetFindString().Find('|') != wxNOT_FOUND) {
                findString = data->GetFindString().BeforeFirst('|');

                wxString filtersString = data->GetFindString().AfterFirst('|');
                filters = ::wxStringTokenize(filtersString, "|", wxTOKEN_STRTOK);
                if(!data->IsMatchCase()) {
                    for(size_t i = 0; i < filters.size(); ++i) {
                        filters.Item(i).MakeLower();
                    }
                }
            }
        }

        if(!data->IsMatchCase()) { findString.MakeLower(); }

        while(tkz.HasMoreTokens()) {

            // Read the next line
            wxString line = tkz.NextToken();
            DoSearchLine(line, lineNumber, lineOffset, fileName, data, findString, filters, states);
            lineOffset += line.Length() + 1;
            lineNumber++;
        }
    }

    if(m_results.empty() == false) { SendEvent(wxEVT_SEARCH_THREAD_MATCHFOUND, data->GetOwner()); }
}
示例#28
0
void wxListBox::GTKOnActivated(int item)
{
    SendEvent(wxEVT_LISTBOX_DCLICK, item, IsSelected(item));
}
示例#29
0
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  ACE_Auto_Ptr< sig_i > sig_impl;
  try
  {
    Supplier_Client client;
    int status = client.init (argc, argv);
    ACE_UNUSED_ARG(status);
    ACE_ASSERT(status == 0);

    CosNotifyChannelAdmin::EventChannel_var ec =
      client.create_event_channel ("MyEventChannel", 0);

    CosNotification::QoSProperties qos (1);
    qos.length (1);
    qos[0].name = CORBA::string_dup (CosNotification::OrderPolicy);
    qos[0].value <<= order_policy;
    ec->set_qos (qos);

    CORBA::ORB_ptr orb = client.orb ();

    sig_impl.reset( new sig_i( orb ) );
    sig_var sig = sig_impl->_this ();

    CORBA::String_var ior =
      orb->object_to_string (sig.in ());

    if (ior_output_file != 0)
    {
      FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
      if (output_file == 0)
        ACE_ERROR_RETURN ((LM_ERROR,
        "Cannot open output file %s for "
        "writing IOR: %C",
        ior_output_file,
        ior.in ()),
        1);
      ACE_OS::fprintf (output_file, "%s", ior.in ());
      ACE_OS::fclose (output_file);
    }

    CosNotifyChannelAdmin::SupplierAdmin_var admin =
      create_supplieradmin (ec.in ());
    ACE_ASSERT(!CORBA::is_nil (admin.in ()));
    create_suppliers (admin.in (), client.root_poa ());

    sig_impl->wait_for_startup();

    ACE_DEBUG((LM_DEBUG, "1 supplier sending %d events...\n", num_events));
    for (int i = 0; i < num_events; ++i)
    {
      ACE_DEBUG((LM_DEBUG, "+"));
      SendEvent (i);
    }
    ACE_DEBUG((LM_DEBUG, "\nSupplier sent %d events.\n", num_events));

    sig_impl->wait_for_completion();

    ACE_OS::unlink (ior_output_file);

    supplier_1->disconnect();

    ec->destroy();

    return 0;
  }
  catch (const CORBA::Exception& e)
  {
    e._tao_print_exception ("Error: ");
  }

  return 1;
}
示例#30
0
    RunMode EventCallback::OnBreakpointInternal( 
        Program* prog, Thread* thread, Address64 address, bool embedded )
    {
        HRESULT     hr = S_OK;

        if ( embedded )
        {
            RefPtr<EmbeddedBreakpointEvent> event;

            hr = MakeCComObject( event );
            if ( FAILED( hr ) )
                return RunMode_Run;

            event->Init( prog );

            hr = SendEvent( event, prog, thread );
            if ( FAILED( hr ) )
                return RunMode_Run;

            return RunMode_Break;
        }
        else
        {
            std::vector< BPCookie > iter;
            int         stoppingBPs = 0;

            hr = prog->EnumBPCookies( address, iter );
            if ( FAILED( hr ) )
                return RunMode_Run;

            for ( std::vector< BPCookie >::iterator it = iter.begin(); it != iter.end(); it++ )
            {
                if ( *it != EntryPointCookie )
                {
                    stoppingBPs++;
                }
            }

            if ( stoppingBPs > 0 )
            {
                RefPtr<BreakpointEvent>     event;
                CComPtr<IEnumDebugBoundBreakpoints2>    enumBPs;

                hr = MakeCComObject( event );
                if ( FAILED( hr ) )
                    return RunMode_Run;

                InterfaceArray<IDebugBoundBreakpoint2>  array( stoppingBPs );

                if ( array.Get() == NULL )
                    return RunMode_Run;

                int i = 0;
                for ( std::vector< BPCookie >::iterator it = iter.begin(); it != iter.end(); it++ )
                {
                    if ( *it != EntryPointCookie )
                    {
                        IDebugBoundBreakpoint2* bp = (IDebugBoundBreakpoint2*) *it;

                        _ASSERT( i < stoppingBPs );
                        array[i] = bp;
                        array[i]->AddRef();
                        i++;
                    }
                }

                hr = MakeEnumWithCount<EnumDebugBoundBreakpoints>( array, &enumBPs );
                if ( FAILED( hr ) )
                    return RunMode_Run;

                event->Init( enumBPs );

                hr = SendEvent( event, prog, thread );
                if ( FAILED( hr ) )
                    return RunMode_Run;

                return RunMode_Break;
            }
            else if ( (prog->GetEntryPoint() != 0) && (address == prog->GetEntryPoint()) )
            {
                RefPtr<EntryPointEvent> entryPointEvent;

                hr = MakeCComObject( entryPointEvent );
                if ( FAILED( hr ) )
                    return RunMode_Run;

                hr = SendEvent( entryPointEvent, prog, thread );
                if ( FAILED( hr ) )
                    return RunMode_Run;

                return RunMode_Break;
            }
        }

        return RunMode_Run;
    }