示例#1
0
/// Auto-select from style under caret in idle time
void wxRichTextStyleListBox::OnIdle(wxIdleEvent& event)
{
    if (CanAutoSetSelection() && GetRichTextCtrl() && IsShownOnScreen() && wxWindow::FindFocus() != this)
    {
        wxString styleName = GetStyleToShowInIdleTime(GetRichTextCtrl(), GetStyleType());

        int sel = GetSelection();
        if (!styleName.IsEmpty())
        {
            // Don't do the selection if it's already set
            if (sel == GetIndexForStyle(styleName))
                return;

            SetStyleSelection(styleName);
        }
        else if (sel != -1)
            SetSelection(-1);
    }
    event.Skip();
}
示例#2
0
void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event)
{
    if (GetRichTextCtrl() && !IsPopupShown() && m_stylePopup && IsShownOnScreen() && wxWindow::FindFocus() != this)
    {
        wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(GetRichTextCtrl(), m_stylePopup->GetStyleType());

        wxString currentValue = GetValue();
        if (!styleName.IsEmpty())
        {
            // Don't do the selection if it's already set
            if (currentValue == styleName)
                return;

            SetValue(styleName);
        }
        else if (!currentValue.IsEmpty())
            SetValue(wxEmptyString);
    }
    event.Skip();
}
示例#3
0
void wxExFrameWithHistory::OnIdle(wxIdleEvent& event)
{
  event.Skip();

  const wxString title(GetTitle());
  
  if (title.empty())
  {
    return;
  }
  

#ifdef wxExUSE_CPP0X	
  auto* stc = GetSTC();
  auto* project = GetProject();
#else
  wxExSTC* stc = GetSTC();
  wxExListViewFile* project = GetProject();
#endif

  const wxUniChar indicator('*');

  if ((project != NULL && project->GetContentsChanged()) ||
       // using GetContentsChanged gives assert in vcs dialog
      (stc != NULL && stc->GetModify() && stc->AllowChangeIndicator()))
  {
    // Project or editor changed, add indicator if not yet done.
    if (title.Last() != indicator)
    {
      SetTitle(title + " " + indicator);
    }
  }
  else
  {
    // Project or editor not changed, remove indicator if not yet done.
    if (title.Last() == indicator && title.size() > 2)
    {
      SetTitle(title.substr(0, title.length() - 2));
    }
  }
}
示例#4
0
void DropDownPopup::OnIdle( wxIdleEvent& event )
{
    if (IsShown())
    {
        m_mouse = ScreenToClient(wxGetMousePosition());
        wxPrintf(wxT("OnIdle mouse %d %d\n"), m_mouse.x, m_mouse.y);

        wxWindow *child = GetChild();
        if (!child) return; // nothing to do

        wxRect clientRect(GetClientRect());
        //wxPrintf(wxT("**DropDownPopup::OnIdle mouse %d %d -- %d %d %d\n"), m_mouse.x, m_mouse.y, m_popped_handler, m_child, m_handlerPopup); fflush(stdout);
        // pop the event handler if inside the child window or
        // restore the event handler if not in the child window
        if (clientRect.Contains(m_mouse))
            PopPopupHandler(child);
        else
            PushPopupHandler(child);
    }
    event.Skip();
}
示例#5
0
void DendrogramPanel::OnIdle(wxIdleEvent& event)
{
    if (isResize && isWindowActive) {
        isResize = false;
        
        wxSize sz = GetClientSize();
        if (sz.x > 0 && sz.y > 0) {
            if (layer_bm)  {
                delete layer_bm;
                layer_bm = 0;
            }

            double scale_factor = GetContentScaleFactor();
            layer_bm = new wxBitmap;
            layer_bm->CreateScaled(sz.x, sz.y, 32, scale_factor);

            if (root) init();
        }
    }
    event.Skip();
}
void CTimeBarFrame::OnIdle(wxIdleEvent& event)
{
    if (m_bPlaying)
    {
        wxLongLong timeNow = wxGetLocalTimeMillis();
        if (m_nIntervalMS < timeNow - m_nBeginTime)
        {
            m_nBeginTime = timeNow;
            BEATS_ASSERT(m_uMaxFrameIndex != 0);
            if (m_nPlayType == 0)
            {
                if ((m_nCursorPos + 1) >(int)m_uMaxFrameIndex)
                {
                    m_bPlaying = false;
                }
            }
            SetCursorPos((m_nCursorPos + 1) % (m_uMaxFrameIndex + 1));
        }
    }
    event.Skip();
}
示例#7
0
文件: glcanvas.cpp 项目: Nau3D/nau
void
GLCanvas::OnIdle(wxIdleEvent& event) {

	//if (!inited) {
	//	((FrmMainFrame *)mParent)->init();
	//	inited = true;
	//}
	if (!m_pEngine)
		return;
	{
		PROFILE("Nau");

		if (!isPaused) {
			this->Render();
			if (APISupport->apiSupport(IAPISupport::BUFFER_ATOMICS))
				DlgAtomics::Instance()->update();
		}
		event.RequestMore();
	}
	if (m_pEngine->getProfileResetRequest())
		Profile::Reset();
}
示例#8
0
void CUnitPane::OnIdle(wxIdleEvent& event)
{
    // Set sorting
    if (m_ColClicked>=0)
    {
        CListLayoutItem * p;
        int               col = m_ColClicked;

        m_ColClicked = -1;
        p = (CListLayoutItem*)m_pLayout->At(col);
        if (p)
        {
            wxString choice, message=wxString::FromAscii(p->m_Caption), caption=wxT("Set sort order");
            wxString choices[NUM_SORTS-1];

            choices[0]=wxT("primary");
            choices[1]=wxT("secondary");
            choices[2]=wxT("tertiary");

            choice = wxGetSingleChoice(message, caption, NUM_SORTS-1, choices, m_pParent);

            if (!choice.IsEmpty())
            {
                int key;
                if (0==stricmp(choice.mb_str(), "primary"))
                    key = 0;
                else if (0==stricmp(choice.mb_str(), "secondary"))
                    key = 1;
                else
                    key = 2;
                SetSortName(key, p->m_Name);
                Sort();
            }
        }
    }

    //CListPane::OnIdle(event);
    event.Skip();
}
示例#9
0
void wxlCan::OnIdle(wxIdleEvent &event)
{
    if ( m_pendingObjects )
    {
        m_rootobject.Update( 0, 0 );

        // we will now render all objects stored in the canvas to a bitmap
        wxMemoryDC mdc;
        mdc.SelectObject( m_buffer );

        //draw object into buffer
        Render( mdc );

        mdc.SelectObject( wxNullBitmap );

        // force a repaint in OnPaint()
        Refresh();

        m_pendingObjects = false;
    }
    event.Skip(); //always skip idle events
}
示例#10
0
文件: grav.cpp 项目: ralphbean/grav
void gravApp::idleHandler( wxIdleEvent& evt )
{
    // start secondary thread if not running
    if ( usingThreads && !threadRunning )
    {
        grav->setThreads( usingThreads );
        threadRunning = true;
        VPMthread = thread_start( threadTest, this );
    }

    if ( !usingThreads )
        sessionManager->iterateSessions();

    if ( timerIntervalUS > 0 )
    {
        // this is the method for rendering on idle, with a limiter based on the
        // timer interval
        unsigned long time = (unsigned long)timer->getTiming();
        if ( time > (unsigned long)timerIntervalUS )
        {
            //gravUtil::logVerbose( "%lu\n", time );
            canvas->draw();
            timer->resetTiming();
        }
        else
        {
            wxMilliSleep( 1 );
        }
    }
    // otherwise (if fps value isn't set) just constantly draw - if vsync is on,
    // will be limited to vsync
    else if ( timerIntervalUS == 0 )
    {
        canvas->draw();
    }

    evt.RequestMore();
}
示例#11
0
    void OnIdle(wxIdleEvent& event)
    {
        if ( m_runTests )
        {
            m_runTests = false;

#ifdef __WXOSX__
            // we need to wait until the window is activated and fully ready
            // otherwise no events can be posted
            wxEventLoopBase* const loop = wxEventLoop::GetActive();
            if ( loop )
            {
                loop->DispatchTimeout(1000);
                loop->Yield();
            }
#endif // __WXOSX__

            m_exitcode = RunTests();
            ExitMainLoop();
        }

        event.Skip();
    }
示例#12
0
void MyFrame::OnIdle(wxIdleEvent& event)
{
    // This code is useful for debugging focus problems
    // (which are plentiful when dealing with popup windows).
#if 0
    static wxWindow* lastFocus = (wxWindow*) NULL;

    wxWindow* curFocus = ::wxWindow::FindFocus();

    if ( curFocus != lastFocus )
    {
        const wxChar* className = wxT("<none>");
        if ( curFocus )
            className = curFocus->GetClassInfo()->GetClassName();
        lastFocus = curFocus;
        wxLogDebug( wxT("FOCUSED: %s %X"),
            className,
            (unsigned int)curFocus);
    }
#endif

    event.Skip();
}
示例#13
0
void GotoFileDlg::OnIdle(wxIdleEvent& event) {
	if (!m_project.HasProject()) return; // No project, so no files to load.
	if (m_filesLoaded) return; // Already done loading files.

	if (m_dirStack.empty()) {
		const wxString root_path = m_project.GetRoot().GetPath();
		m_files.reserve(100);
		BuildFileList(root_path);
	}
	else {
		DirState& dirState = *m_dirStack.back();

		// Get next subdir
		if (dirState.WalkFolders()) {
			const wxString fulldirname = dirState.FullFolderName();
			wxLogDebug(fulldirname);
			BuildFileList(fulldirname);
		}
		else {
			// All sub-dirs visited
			if (dirState.info) {
				m_filters.pop_back();
				delete dirState.info;
			}

			delete m_dirStack.back();
			m_dirStack.pop_back();

			if (m_dirStack.empty())
				m_filesLoaded = true;
		}
	}

	m_cmdList->UpdateList();
	if (!m_dirStack.empty()) event.RequestMore();
}
示例#14
0
void wxNewBitmapButton::OnIdle(wxIdleEvent& event)
{
    DoButtonUpdate();

    event.Skip();
}
示例#15
0
文件: glue.cpp 项目: GWRon/wx.mod
int bmx_wxidleevent_morerequested(wxIdleEvent & event) {
	return static_cast<int>(event.MoreRequested());
}
示例#16
0
文件: glue.cpp 项目: GWRon/wx.mod
void bmx_wxidleevent_requestmore(wxIdleEvent & event, int needMore) {
	event.RequestMore(static_cast<bool>(needMore));
}
示例#17
0
void wxTerminal::OnIdle(wxIdleEvent& event)
{
    event.Skip();
    DoFlushOutputBuffer();
}
示例#18
0
void DolphinApp::OnIdle(wxIdleEvent& ev)
{
  ev.Skip();
  Core::HostDispatchJobs();
}
示例#19
0
void panRender::OnIdle( wxIdleEvent& event )
{
	return; // DEBUG!!!
	if (b_nRealtimeWindows>0 && !mbRealtime) 
	{
		notRealtimeCnt++;
		if (notRealtimeCnt<300) { event.Skip(); return; }
		notRealtimeCnt=0;
	}

	// INPUT
	if (m_bActive)
	{
		float delta = g_pEngine->GetDeltaTime();
		P3DMOUSED md = g_pInput->GetMouseData();

		// ortho zoom
		m_fOrthoZoom += md.z * delta * 100000;
		if (m_fOrthoZoom<10) m_fOrthoZoom = 10;

		// axes
		switch(miViewType)
		{
		case 0: // right
			//m_vPos
			break;
		case 1: // top
			m_vPos.x -= md.x * delta * 1000;
			m_vPos.z -= md.y * delta * 1000;
			//g_pRenderer->SetProjectionOrtho(m_fOrthoZoom*fAspect, m_fOrthoZoom, 0, DEFAULT_FAR_PLANE);
			//g_pEngine->SetCamera(pntEye, P3DXPoint3D(0, -1, 0), P3DXPoint3D(0, 0, 1));
			break;
		case 2: // front
			//g_pRenderer->SetProjectionOrtho(m_fOrthoZoom*fAspect, m_fOrthoZoom, 0, DEFAULT_FAR_PLANE);
			//g_pEngine->SetCamera(pntEye, P3DXPoint3D(0, 0, 1), P3DXPoint3D(0, 1, 0));
			break;
		case 3: // perspect
			//g_pRenderer->SetProjection(DEFAULT_FIELD_OF_VIEW, fAspect,DEFAULT_NEAR_PLANE, DEFAULT_FAR_PLANE);
			break;
		}

		//char tmp[32];
		//sprintf(tmp, "%f", m_fOrthoZoom);
		//g_pFrmMain->AddConsoleMsg(tmp, tmp);
	}

	// SET PROJECTION AND CAMERA
	wxSize vpSize = this->panViewport->GetSize();
	float fAspect = (float)vpSize.x/(float)vpSize.y;
	P3DXPoint3D pntEye;
	pntEye.x = pntEye.y = pntEye.z = 0;

	switch(miViewType)
	{
	case 0: // right
		g_pRenderer->SetProjectionOrtho(m_fOrthoZoom*fAspect, m_fOrthoZoom, 0, DEFAULT_FAR_PLANE);
		g_pEngine->SetCamera(pntEye, P3DXPoint3D(-1, 0, 0), P3DXPoint3D(0, 1, 0));
		break;
	case 1: // top
		g_pRenderer->SetProjectionOrtho(m_fOrthoZoom*fAspect, m_fOrthoZoom, 0, DEFAULT_FAR_PLANE);
		g_pEngine->SetCamera(m_vPos, P3DXPoint3D(0, -1, 0), P3DXPoint3D(0, 0, 1));
		break;
	case 2: // front
		g_pRenderer->SetProjectionOrtho(m_fOrthoZoom*fAspect, m_fOrthoZoom, 0, DEFAULT_FAR_PLANE);
		g_pEngine->SetCamera(pntEye, P3DXPoint3D(0, 0, 1), P3DXPoint3D(0, 1, 0));
		break;
	case 3: // perspect
		g_pRenderer->SetProjection(DEFAULT_FIELD_OF_VIEW, fAspect,DEFAULT_NEAR_PLANE, DEFAULT_FAR_PLANE);
		break;
	}

	// RENDER SCENE
	eEngineState engState = g_pEngine->RenderScene(GetViewportHWND());
	if (m_bActive) g_pEngine->UpdateScene();
	// ---------------------

	if (mbRealtime) event.RequestMore(true);
}
示例#20
0
文件: mdi.cpp 项目: Bluehorn/wxPython
void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
{
    event.Skip();
}
示例#21
0
void MainFrame::OnIdle( wxIdleEvent & event )
{
    viewer_->frame();

    event.RequestMore();
}
示例#22
0
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
    processInputQueue();
    Refresh();
    event.RequestMore();
}
示例#23
0
void wxFlatButtonBar::OnIdle(wxIdleEvent& event) { event.Skip(); }
示例#24
0
void wxToolbook::OnIdle(wxIdleEvent& event)
{
    if (m_needsRealizing)
        Realize();
    event.Skip();
}
示例#25
0
void MyFrame::OnIdle(wxIdleEvent &event)
{
    event.Skip();
}
示例#26
0
void Application::idleEvent(wxIdleEvent &event)
{
	drawPane->render();
	event.RequestMore(); // keep rendering
}
示例#27
0
void CDialogProxyRefresh::OnIdle( wxIdleEvent& event )
{
	event.Skip();
}
示例#28
0
void MyFrame::OnIdle(wxIdleEvent& event)
{
    UpdateThreadStatus();

    event.Skip();
}
void ZoomNavigator::OnIdle(wxIdleEvent& e)
{
    e.Skip();
    DoUpdate();
}
示例#30
0
文件: main.cpp 项目: Zhardas/gui
void MyApp::OnIdle(wxIdleEvent &evt) {
  if (render_loop_on) {
    drawPane->paintNow();
    evt.RequestMore(); // render continuously, not only once on idle
  }
}