Beispiel #1
0
//Setting values
void wxFixWidthImportCtrl::SetValues(const wxArrayInt& values)
{
    size_t nval = values.GetCount();
    size_t i, j, tot;
    int val;

    m_values.Clear();

    if ( nval < 1 )
    {   Refresh();
        FireEvent();
        return;
    }

    //Add the first value
    m_values.Add( values.Item(0) );

    //Add/insert the rest, avoiding duplicates
    for ( i=1; i<nval; i++)
    {   j=0;
        val = values.Item(i);
        tot = m_values.GetCount();
        while ( j < tot && val > m_values.Item(j) )
            j++;
        if ( j >= tot && val > m_values.Item(tot-1) )
            m_values.Add(val);
        if ( j < tot && val < m_values.Item(j) )
            m_values.Insert(val, j);
    }

    Refresh();
    FireEvent();
}
Beispiel #2
0
void SListBoxEx::NotifySelChange( int nOldSel,int nNewSel)
{
    EventLBSelChanging evt1(this);
    
    evt1.nOldSel=nOldSel;
    evt1.nNewSel=nNewSel;
    FireEvent(evt1);
    
    if(evt1.bCancel) return ;

    m_iSelItem=nNewSel;
    if(nOldSel!=-1)
    {
        m_arrItems[nOldSel]->ModifyItemState(0,WndState_Check);
        RedrawItem(nOldSel);
    }
    if(m_iSelItem!=-1)
    {
        m_arrItems[m_iSelItem]->ModifyItemState(WndState_Check,0);
        RedrawItem(m_iSelItem);
    }
    
    EventLBSelChanged evt2(this);
    evt2.nOldSel=nOldSel;
    evt2.nNewSel=nNewSel;
    FireEvent(evt2);
}
Beispiel #3
0
LRESULT CPdnWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if((wParam == SC_CLOSE || wParam == SC_DEFAULT) && m_sCloseHandler.length())
	{
		FireEvent(m_sCloseHandler, 0, 0);
		return 0;
	}
	else if((wParam == SC_SCREENSAVE || (wParam == SC_MONITORPOWER &&
		lParam == 2) ) && m_sScreenSaveHandler.length())
	{
		FireEvent(m_sScreenSaveHandler, 0, 0);
	}
	else if(wParam == SC_MINIMIZE && m_sMinHandler.length())
	{
		FireEvent(m_sMinHandler, 0, 0);
	}
	else if(wParam == SC_RESTORE && m_sRestoreHandler.length())
	{
		FireEvent(m_sRestoreHandler, 0, 0);
	}
	else if(wParam == SC_MAXIMIZE)
	{
	}
	return ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
}
Beispiel #4
0
LRESULT CPdnWnd::OnWTSSessionChange(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if(wParam == 0x1 /* WTS_CONSOLE_CONNECT */) {
	}
	else if(wParam == 0x2 /* WTS_CONSOLE_DISCONNECT */) {
	}
	else if(wParam == 0x3 /* WTS_REMOTE_CONNECT */) {
	}
	else if(wParam == 0x4 /* WTS_REMOTE_DISCONNECT */) {
	}
	else if(wParam == 0x5 /* WTS_SESSION_LOGON */) {
	}
	else if(wParam == 0x6 /* WTS_SESSION_LOGOFF */) {
	}
	else if(wParam == 0x7 /* WTS_SESSION_LOCK */ &&
		m_sWorkstationLockHandler.length()) {
		FireEvent(m_sWorkstationLockHandler, 0, 0);
	}
	else if(wParam == 0x8 /* WTS_SESSION_UNLOCK */ &&
		m_sWorkstationUnlockHandler.length()) {
		FireEvent(m_sWorkstationUnlockHandler, 0, 0);
	}
	else if(wParam == 0x9 /* WTS_SESSION_REMOTE_CONTROL */) {
	}

	return 0;
}
Beispiel #5
0
void KAIVM::Active()
{
    if (m_nPendingEvent != aevInvalid)
    {
        int nEvent = m_nPendingEvent;
        m_nPendingEvent = aevInvalid;

        FireEvent(nEvent, m_dwPendingEventSrc, m_nPendingEventParam);
    }

    if (m_nPrimaryTimerFrame != 0 && g_pSO3World->m_nGameLoop >= m_nPrimaryTimerFrame)
    {
        m_nPrimaryTimerFrame = 0;
        FireEvent(aevOnPrimaryTimer, m_pOwner->m_dwID, g_pSO3World->m_nGameLoop);
    }

    if (m_nSecondaryTimerFrame != 0 && g_pSO3World->m_nGameLoop >= m_nSecondaryTimerFrame)
    {
        m_nSecondaryTimerFrame = 0;
        FireEvent(aevOnSecondaryTimer, m_pOwner->m_dwID, g_pSO3World->m_nGameLoop);
    }

    if (m_nTertiaryTimerFrame != 0 && g_pSO3World->m_nGameLoop >= m_nTertiaryTimerFrame)
    {
        m_nTertiaryTimerFrame = 0;
        FireEvent(aevOnTertiaryTimer, m_pOwner->m_dwID, g_pSO3World->m_nGameLoop);
    }
}
Beispiel #6
0
void *InstallThread::Action()
{
    LocalDictionary *dict = dynamic_cast<LocalDictionary*>((Dictionary*)m_data);
    if (dict) {
        FireEvent(wxT(""), myID_START);
        m_exword->InstallDictionary(dict);
        FireEvent(wxT(""), myID_FINISH);
    }
    return NULL;
}
Beispiel #7
0
void *RemoveThread::Action()
{
    wxString message;
    RemoteDictionary *dict = dynamic_cast<RemoteDictionary*>((Dictionary*)m_data);
    if (dict) {
        message.Printf(_("Removing %s..."), dict->GetName().c_str());
        FireEvent(message, myID_START);
        m_exword->RemoveDictionary(dict);
        FireEvent(wxT(""), myID_FINISH);
    }
    return NULL;
}
Beispiel #8
0
BOOL STabCtrl::SetCurSel( int nIndex )
{
    if( nIndex < 0 || nIndex> (int)GetItemCount()-1 || (m_nCurrentPage == nIndex)) return FALSE;
    int nOldPage = m_nCurrentPage;
    
    EventTabSelChanging evt(this);
    evt.uOldSel=nOldPage;
    evt.uNewSel=nIndex;

    FireEvent(evt);

    if (evt.bCancel)
        return FALSE;

    STabPage *pTab=GetItem(nIndex);

    CRect rcItem;

    GetItemRect(m_nCurrentPage, rcItem);
    InvalidateRect(rcItem);
    GetItemRect(nIndex, rcItem);
    InvalidateRect(rcItem);
    
    if(m_tabSlider)
    {
        m_tabSlider->Stop();
    }
    if(m_nAnimateSteps && IsVisible(TRUE) && nOldPage!=-1 && nIndex !=-1)
    {
        m_tabSlider = new STabSlider(this,nOldPage,nIndex,m_nAnimateSteps);
    }else
    {
        if(nOldPage!=-1)
        {
            GetItem(nOldPage)->SetVisible(FALSE,TRUE);
        }
        if(nIndex!=-1)
        {
            GetItem(nIndex)->SetVisible(TRUE,TRUE);
        }
    }
    m_nCurrentPage = nIndex;
        
    EventTabSelChanged evt2(this);
    evt2.uNewSel=nIndex;
    evt2.uOldSel=nOldPage;

    FireEvent(evt2);
    return TRUE;
}
HRESULT CSampleMSPStream::ProcessGraphEvent(
    IN  long lEventCode,
    IN  long lParam1,
    IN  long lParam2
    )
{
    LOG((MSP_EVENT, "CSampleMSPStream::ProcessGraphEvent - enter"));

    HRESULT        hr = S_OK;

    switch (lEventCode)
    {
    case EC_COMPLETE:
        
        hr = FireEvent(CALL_STREAM_INACTIVE, (HRESULT) lParam1, CALL_CAUSE_UNKNOWN);
        break;
    
    case EC_USERABORT:
        
        hr = FireEvent(CALL_STREAM_INACTIVE, S_OK, CALL_CAUSE_UNKNOWN);
        break;

    case EC_ERRORABORT:
    case EC_STREAM_ERROR_STOPPED:
    case EC_STREAM_ERROR_STILLPLAYING:
    case EC_ERROR_STILLPLAYING:

        hr = FireEvent(CALL_STREAM_FAIL, (HRESULT) lParam1, CALL_CAUSE_UNKNOWN);
        break;

    default:
        
        LOG((MSP_EVENT, "CSampleMSPStream::ProcessGraphEvent - "
            "ignoring event code %d", lEventCode));
        break;
    }

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ProcessGraphEvent - "
            "FireEvent failed - exit 0x%08x", hr));

        return hr;
    }

    LOG((MSP_EVENT, "CSampleMSPStream::ProcessGraphEvent - exit S_OK"));

    return S_OK;
}
Beispiel #10
0
LRESULT SItemPanel::DoFrameEvent(UINT uMsg,WPARAM wParam,LPARAM lParam)
{
    AddRef();

    if(!IsDisabled())
    {
        switch(uMsg)
        {
        case WM_MOUSEHOVER: 
            {
                ModifyState(WndState_Hover,0,TRUE);
                EventItemPanelHover evt(this);
                FireEvent(evt);
                break;
            }
        case WM_MOUSELEAVE: 
            {
                ModifyState(0,WndState_Hover,TRUE);
                EventItemPanelLeave evt(this);
                FireEvent(evt);
                break;
            }
        case WM_LBUTTONDOWN:
            {
                EventItemPanelClick evt(this);
                FireEvent(evt);
                break;
            }
        case WM_RBUTTONDOWN:
            {
                EventItemPanelRclick evt(this);
                FireEvent(evt);
                break;
            }
        case WM_LBUTTONDBLCLK:
            {
                EventItemPanelDbclick evt(this);
                FireEvent(evt);
                break;
            }
        }
    }

    SetMsgHandled(FALSE);
    LRESULT lRet=__super::DoFrameEvent(uMsg,wParam,lParam);
    Release();
    return lRet;
}
Beispiel #11
0
//Setting the selected line (0 to nulines-1)
void wxFixWidthImportCtrl::SelectLine(size_t nline)
{
    size_t nulines = m_Lines.GetCount();
    if ( nline >= 0 && nline != m_markedL && nulines > 0)
    {   if ( nline >= nulines )
            m_markedL = nulines - 1;
        else
            m_markedL = nline;

        //Adjust vertical scrollbar's thumb position
        int pos=0; //number of hidden lines upwards
        int range = m_scrbarV->GetRange();
        int tsize = m_scrbarV->GetThumbSize();
        if (m_markedL == nulines - 1) //last line
            pos = range - tsize;
        else if (m_markedL > 0) //middle line, cuasi-center m_markedL
            pos = m_markedL - (tsize - 1)/2; //page is tsize-1

        pos = wxMin(pos, range - tsize);
        pos = wxMax(pos, 0);

        m_scrbarV->SetThumbPosition(pos);
        m_curposL = (size_t)pos;

        Refresh();
        FireEvent();
    }
}
Beispiel #12
0
    bool SSearchDropdownList::OnEditNotify(EventArgs *e)
    {
        EventRENotify *pEvtNotify = sobj_cast<EventRENotify>(e);
        if(pEvtNotify->iNotify == EN_CHANGE)
        {
            if(!m_pDropDownWnd)
            {
                m_pDropDownWnd = new SDropdownList(this);
                m_pDropDownWnd -> Create(m_xmlDropdown.child(KNode_PopupStyle));
                SASSERT(m_pDropDownWnd);
            }

            EventFillSearchDropdownList evt(this);
            evt.strKey = sobj_cast<SEdit>(e->sender)->GetWindowText();
            evt.pDropdownWnd = m_pDropDownWnd;
            FireEvent(evt);
            
            if(evt.bPopup)
            {
                AdjustDropdownList();
            }else
            {
                CloseUp(IDCANCEL);
            }
        }
        return true;
    }
Beispiel #13
0
	// Notify the Firefox that the progress has changed.
	void CPlugin::OnIEProgressChanged(int progress)
	{
		CString strEventType = _T("IEProgressChanged");
		CString strDetail;
		strDetail.Format(_T("%d"), progress);
		FireEvent(strEventType, strDetail);
	}
Beispiel #14
0
	void CPlugin::SetFirefoxCookie(const vector<SetFirefoxCookieParams>& vCookies, ULONG_PTR ulWindowId)
	{
		CString strEventType = _T("IEBatchSetCookie");
		CString strDetail;
		Json::Value json;
		Json::Value aCookies;
		for (size_t i = 0; i < vCookies.size(); i++)
		{
			const SetFirefoxCookieParams& param = vCookies[i];
			Json::Value cookie;
			cookie["url"] = (LPCSTR)CT2A(param.strURL, CP_UTF8);
			cookie["header"] = (LPCSTR)CT2A(param.strCookie, CP_UTF8);
			aCookies.append(cookie);
		}
		json["cookies"] = aCookies;

		if (ulWindowId)
		{
			char szWindowId[32] = { 0 };
			_ui64toa_s(ulWindowId, szWindowId, 32, 10);
			json["windowId"] = szWindowId;
		}

		strDetail = CA2T(json.toStyledString().c_str(), CP_UTF8);
		FireEvent(strEventType, strDetail);
	}
Beispiel #15
0
    void SComboBase::DropDown()
    {
        if(m_dwBtnState==WndState_PushDown) return;


        if(!m_pDropDownWnd)
        {
            m_pDropDownWnd = new SDropDownWnd_ComboBox(this);
            m_pDropDownWnd->SDispatchMessage(UM_SETSCALE, GetScale(), 0);
		}

		EventCBDropdown evt(this);
		evt.pDropDown = m_pDropDownWnd;
		FireEvent(evt);

		CRect rcPopup;
		BOOL bDown=CalcPopupRect(GetListBoxHeight(),rcPopup);
		m_pDropDownWnd->Create(rcPopup,0);

		if(m_nAnimTime>0)
			m_pDropDownWnd->AnimateHostWindow(m_nAnimTime,AW_SLIDE|(bDown?AW_VER_POSITIVE:AW_VER_NEGATIVE));
		else
			m_pDropDownWnd->SetWindowPos(HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);

		m_pDropDownWnd->CSimpleWnd::SetCapture();
	}
Beispiel #16
0
//Fill array with file passed
bool wxFixWidthImportCtrl::LoadFile(const wxString& filename, const wxMBConv& conv)
{
    wxTextFile file;
    if (!file.Open(filename, conv) )
        return false;

    m_Lines.Clear();
    wxString str;
    m_maxLen = 0;
    size_t i = 0;
    size_t nto = file.GetLineCount();
    if (nto > 0)
    {   m_Lines.Alloc(nto);
        for ( i=0; i < nto; i++ )
        {   str = file.GetLine(i);

            if (m_tabSize > -1) //replace tabs with needed spaces
                str = TabsToSpaces(str);

            if (str.Len() > m_maxLen)
                m_maxLen = str.Len();

            m_Lines.Add(str);
        }
    }

    m_Lines.Shrink();

    m_curposX = m_curposL = m_markedL = m_LAct = 0;
    AdjustScrollbars();
    Refresh();
    FireEvent();
    return true;
}
bool DesktopNode::updateChildren()
{
    if ((status_filter_ & NODE_NOT_ON_CLOUD) && !checkCloudCacheOrUpdate())
    {
        // pending scaning until cloud info is retrieved
        pending_scan_ = true;
        return true;
    }    

    switch (current_display_mode_)
    {
        case BY_FOLDER:
            updateChildrenByFolder();
            break;
        case BY_SORT:
            updateChildrenBySort();
            break;
        case EXPAND_ALL:
            updateChildrenByExpandingAll();
            break;
        default:
            return false;
    }
    setDirty(false);

    NodeChildenReadyArgs children_ready_args;
    children_ready_args.current_node_path = absolutePath();
    children_ready_args.succeeded = true;
    children_ready_args.children = filterChildren(children_);
    FireEvent(EventChildrenIsReady, children_ready_args);
    return true;
}
Beispiel #18
0
    void SFlyWnd::OnAnimatorState( int percent )
    {
        if(percent == SAnimator::PER_END)
        {
            m_bAniMove = TRUE;
            Move(m_rcAniEnd);
            m_bAniMove = FALSE;
            m_bFloat = FALSE;

            GetContainer()->UnregisterTimelineHandler(this);
        }else
        {
            CRect rcWnd;
            rcWnd.left   = m_rcAniBegin.left   + (m_rcAniEnd.left  - m_rcAniBegin.left  ) * percent / 100; 
            rcWnd.top    = m_rcAniBegin.top    + (m_rcAniEnd.top   - m_rcAniBegin.top   ) * percent / 100;
            rcWnd.right  = m_rcAniBegin.right  + (m_rcAniEnd.right - m_rcAniBegin.right ) * percent / 100;
            rcWnd.bottom = m_rcAniBegin.bottom + (m_rcAniEnd.bottom- m_rcAniBegin.bottom) * percent / 100;

            m_bAniMove = TRUE;
            Move(rcWnd);
            m_bFloat = FALSE;
            m_bAniMove = FALSE;
        }
        FlyStateEvent evt(this,percent,m_bEndPos);
        FireEvent(evt);
    }
bool Slider::OnKeyboardEvent(bool bKeyDown, unsigned int sym, unsigned int /*mod*/)
{
   if (!m_bFocused || !bKeyDown)
      return false;

   // check left and right keys
   bool bLeftKey = sym == SDLK_LEFT || sym == SDLK_UP || sym == SDLK_PAGEUP;
   bool bRightKey = sym == SDLK_RIGHT || sym == SDLK_DOWN || sym == SDLK_PAGEDOWN;

   if (!bLeftKey && !bRightKey)
      return false;

   unsigned int uiNewSliderPos = BaseClass::Current();

   if (bLeftKey && uiNewSliderPos > 0)
      uiNewSliderPos--;
   else
      if (bRightKey && uiNewSliderPos + 1 <= BaseClass::Max())
         uiNewSliderPos++;

   if (BaseClass::Current() != uiNewSliderPos)
   {
      // current pos moved
      BaseClass::Current(uiNewSliderPos);

      FireEvent(SliderEvent::Moved);
   }

   return true;
}
Beispiel #20
0
void CPlugin::NewIETab(DWORD id, const CString& strURL)
{
  CString strEventType = _T("NewIETab");
  CString strDetail;
  strDetail.Format(_T("{\"id\": \"%d\", \"url\": \"%s\"}"), id, strURL);
  FireEvent(strEventType, strDetail);
}
Beispiel #21
0
/** Create an event and fire it, without adding to the queue.
 *
 */
BOOL CEventManager::DoEvent(CListener *pFrom, BOOL Broadcast, int EventID, void *pData)
{
    // can't create non-broadcast events without a listener
    if (!pFrom && !Broadcast)
        return FALSE;

    EventQueueItem_t *pNewEI = (EventQueueItem_t *)malloc(sizeof(EventQueueItem_t));

    if (!pNewEI)
        return FALSE;

    // set who it's from
    pNewEI->pFrom = pFrom;
    // set flags
    if (Broadcast)
        pNewEI->Flags |= ET_BROADCAST;
    // set the event data
    pNewEI->EventID = EventID;
    pNewEI->pData = pData;
    // set the status
    pNewEI->Processing = FALSE;
    FireEvent(pNewEI);

    free(pNewEI);

    return TRUE;
}
Beispiel #22
0
	void Clock::Update( double DT )
	{
		double tempScale = m_timeScale;

		m_deltaTime = (DT > m_maxDT) ? m_maxDT : DT;

		if(m_isPaused)
			tempScale = 0.0;

		m_deltaTime *= tempScale;
		m_currentTime += m_deltaTime;

		for(auto it = m_children.begin(); it != m_children.end(); ++it)
			(*it)->Update(m_deltaTime);

		for(auto it = m_timers.begin(); it != m_timers.end(); ++it)
			(*it)->Update(m_deltaTime);

		while(!m_alarms.empty())
		{
			if(m_alarms.front().m_fireTime <= m_currentTime)
			{
				FireEvent(m_alarms.front().m_event, m_alarms.front().m_np);
				m_alarms.pop_front();
			}
			else
				break;
		}
	}
Beispiel #23
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
void FireEventForEachFileFound( const std::string& eventToFire, const std::string& directory, const std::string& searchPattern, bool recurseSubfolders )
{
    Strings files;
    EnumerateFiles( directory, searchPattern, files, recurseSubfolders );

    for (std::string& file : files)
    {
        std::string fileWithoutPath = ExtractFileNameFromPath( file );
        std::string fileName = RemoveFileExtension( fileWithoutPath );
        Strings fileNameTokens;
        Tokenize( fileWithoutPath, fileNameTokens, "." );
        std::string fileExtension = "." + fileNameTokens[1];
        std::string relativePath = ConvertBackSlashesToForwardSlashes( file );
        char fullPath[_MAX_PATH];
        _fullpath( fullPath, relativePath.c_str(), _MAX_PATH );
        std::string fullFilePath = ConvertBackSlashesToForwardSlashes( std::string( fullPath ) );

        ConsolePrintf( "File without path:  %s\n File Name: %s\n File Extension: %s\n File Relative: %s\n File Absolute: %s\n", fileWithoutPath.c_str(), fileName.c_str(), fileExtension.c_str(), relativePath.c_str(), fullFilePath.c_str() );

        NamedProperties props;
        props.Set( "FileName", fileWithoutPath );
        props.Set( "FileExtension", fileExtension );
        props.Set( "FileNameWithoutExtension", fileName );
        props.Set( "FileRelativePath", relativePath );
        props.Set( "FileAbsolutePath", fullFilePath );

        FireEvent( eventToFire, props );
    }
}
Beispiel #24
0
LRESULT SSliderBar::NotifyPos(UINT uCode, int nPos)
{
    EventSliderPos evt(this);
    evt.nPos = nPos;

    return FireEvent(evt);
}
Beispiel #25
0
	void CPlugin::OnABPFilterLoaded(int numFilters, unsigned int ticks)
	{
		CString strEventType = _T("IEABPFilterLoaded");
		CString strDetail;
		strDetail.Format(_T("{ \"number\": %d, \"ticks\": %d }"), numFilters, ticks);
		FireEvent(strEventType, strDetail);
	}
void CDocViewCoreCtrl::DocumentOpened(LPCTSTR strDocPath, LPCTSTR strDocTitle)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: 在此添加调度处理程序代码
	FireEvent(dispidDocumentOpened,EVENT_PARAM(VTS_BSTR VTS_BSTR),strDocPath,strDocTitle);
}
Beispiel #27
0
void SColorPicker::OnColorEnd( BOOL bCancel,COLORREF cr )
{
	if(bCancel) m_crCur=m_crDef;
	else m_crCur=cr|0xff000000;
	ModifyState(0,WndState_PushDown,TRUE);
    EventColorChange evt(this,m_crCur);
    FireEvent(evt);
}
Beispiel #28
0
bool DynamicObject::HandleEvent(const char *action)
{
    if (FireEvent(action)) {
        systemObject->Log(3, "HandleEvent: %s processed event %s", name, action);
        return true;
    }
    return false;
}
Beispiel #29
0
void CMainFrmThread::AddClipToSave(CClip *pClip)
{
	ATL::CCritSecLock csLock(m_cs.m_sect);

	Log(_T("Adding clip to thread for save to db"));
	m_saveClips.AddTail(pClip);
	FireEvent(SAVE_CLIPS);
}
 void SCaptureButton::OnMouseMove( UINT nFlags, CPoint point )
 {
     if(IsChecked())
     {
         EventCapture evt(this,point);
         FireEvent(evt);
     }
 }