コード例 #1
0
ファイル: LogPanel.cpp プロジェクト: adakite/main
//----------------------------------------
// input polling
void CLogPanel::OnIdle(wxIdleEvent& event)
{
  CMapProcess::iterator it;
  wxObArray processToRemove(false);
  CProcess* process = NULL;

  for (it = m_processes.begin() ; it != m_processes.end() ; it++)
  {
    process = GetProcess(it);
    if (process != NULL)
    {
      if ( (process->IsKilled()) || (process->IsEnded()) )
      {
        GetTasklist()->RemoveProcess(process);
        processToRemove.Insert(process);
        m_processToRemove.Insert(process);
      }
      else if ( process->HasInput() )
      {
          event.RequestMore();
      }
    }
  }

  for (uint32_t i = 0 ; i < processToRemove.size() ; i ++)
  {
    process = dynamic_cast<CProcess*>(processToRemove[i]);
    RemoveProcess(process->GetName());
    //delete process;
    process = NULL;
  }
}
コード例 #2
0
void wxJigsawEditorCanvas::OnIdle( wxIdleEvent& event )
{	
	do
	{
		if(!HasCapture()) break;

		// get mouse in client coordinates
		wxPoint currentPos = ScreenToClient(wxGetMousePosition());

		//Update the offset to the next mouse down event
		if(m_View->GetSelectedObject())
		{
			wxPoint diagramPoint = PointToViewPoint(currentPos);
			wxPoint groupPosition = m_View->GetRealGroupPosition(m_View->GetSelectedObject());
			m_SelectedObjectOffset = wxSize(
				diagramPoint.x - groupPosition.x,
				diagramPoint.y - groupPosition.y);
		}

		// get scroll position
		wxPoint scrollPos = GetScrollPosition();
		

		// auto scroll
		// check current drag position and update scroll regularly
		if(AutoScroll(currentPos, scrollPos))
		{
			event.RequestMore();
		}
		FixViewOffset();
	}
	while(false);
}
コード例 #3
0
void SpectraMainFrame::OnIdle(wxIdleEvent& event)
{
	if(!coroutine_exec->DoWork())
		event.RequestMore();
	for(auto* doc_frame : doc_frames)
		doc_frame->OnIdle(event);
}
コード例 #4
0
void FindInProjectDlg::OnIdle(wxIdleEvent& event) {
    if (!m_searchThread->IsSearching()) {
        if (m_inSearch) {
            if (m_searchThread->LastError()) {
                wxString errorMsg;
                m_searchThread->GetCurrentPath(errorMsg);
                m_pathStatic->SetLabel(errorMsg);
            }
            else if (!m_pathStatic->GetLabel().empty()) m_pathStatic->SetLabel(wxT(""));

            m_searchButton->SetLabel(_("Search"));
            m_inSearch = false;
        }
        return;
    }

    wxString currentPath = m_pathStatic->GetLabel();
    if (m_searchThread->GetCurrentPath(currentPath)) m_pathStatic->SetLabel(currentPath);

    if (m_searchThread->UpdateOutput(m_output)) {
        m_browser->LoadString(m_output);
    }

    event.RequestMore(); // we don't want the search to look slow :-)
}
コード例 #5
0
ファイル: ModelPanel.cpp プロジェクト: SinYocto/Zee
void ModelPreviewCanvas::OnIdle( wxIdleEvent& event )
{
	if(gEngine->GetDriver()->GetD3DDevice())
		RenderWindow();

	event.RequestMore(true);
}
コード例 #6
0
ファイル: openocd.cpp プロジェクト: BackupTheBerlios/cbmcu
/*!
    \brief Idle time processing.

    OnIdle time here originates from the CodeBlocks message loop itself. The mcu plugin
    passes it to the mcu manager, which in turn passes it to us.

    \param event wxIdleEvent object.
*/
void OpenOCDDriver::OnIdle(wxIdleEvent& event)
{
    if (m_pProcess && ((PipedProcess*)m_pProcess)->HasInput())
        event.RequestMore();
    else
        event.Skip();
}
コード例 #7
0
ファイル: OSGFrame.cpp プロジェクト: topscores/AREngine
void 
OSGFrame::OnIdle(wxIdleEvent &event)
{
    _viewer->frame();

    event.RequestMore();
}
コード例 #8
0
ファイル: Application.cpp プロジェクト: cyj0912/EasyFlow
void CApplication::OnIdle(wxIdleEvent& evt)
{
	if (mRenderOn)
	{
		mMainFrame->PaintFlowEditor();
		evt.RequestMore();
	}
}
コード例 #9
0
void VisApp::onIdle(wxIdleEvent& evt)
{
    if(render_loop_on)
    {
        drawPane->paintNow();
        evt.RequestMore(); // render continuously, not only once on idle
    }
}
コード例 #10
0
ファイル: CscopePlugin.cpp プロジェクト: jenslody/codeblocks
//when program idle, read the output
void CscopePlugin::OnIdle(wxIdleEvent& event)
{
  if ( m_pProcess && m_pProcess->ReadProcessOutput() )
  {
    event.RequestMore();
  }
  event.Skip();
}
コード例 #11
0
ファイル: helpview.cpp プロジェクト: EdgarTx/wx
void hvApp::OnIdle(wxIdleEvent& event)
{
    if (m_exitIfNoMainWindow && !GetTopWindow())
        ExitMainLoop();

    event.Skip();
    event.RequestMore();
}
コード例 #12
0
void TTrackball::OnIdle(wxIdleEvent& event)
{
    long elapsed = wxGetElapsedTime(false);

    // 'elapsed' can be less than 'previous' if the timer gets reset somewhere else.
    if (elapsed < previous) {
        previous = elapsed;
    }

    // Animate the shader if at least one millisecond has elapsed.
    else if (elapsed - previous > 0) {
        canvas->Animate(elapsed - previous);
        previous = elapsed;
    }

    //
    // When not showing frames per second, wait enough between frames to not exceed a maximum frame rate.
    // The proper way of doing this is wait-for-vertical-sync, accessible via the display applet.
    // (Some older 3Dlabs products do not support the wglSwapControl extension.)
    //

    // If wglSwapInterval isn't available, wait for some time to elapse.
    if (wxGetApp().CapFps() && !wglSwapIntervalEXT) {
        if (!inertiaTheta || elapsed < Delay) {
            event.RequestMore();
            event.Skip();
            return;
        }

        // Reset timer.
        wxGetElapsedTime(true);
        previous = 0;
    } else {
        // Recalculate the fps every second.
        if (elapsed > 1000) {
            // Reset timer.
            wxGetElapsedTime(true);
            previous = 0;

            // Update the fps display counter on the status bar.
            wxGetApp().UpdateFps((float) frames * 1000.0f / (float) elapsed);
            frames = 0;
        }
        ++frames;
    }

    // Continue spinning the model.
    glLoadIdentity();
    vec3 offset = wxGetApp().Frame()->GetCenter();
    glTranslate(offset);
    glRotatef(-inertiaTheta, inertiaAxis.x, inertiaAxis.y, inertiaAxis.z);
    glTranslate(-offset);
    glMultMatrixf((float*) &xform);
    glGetFloatv(GL_MODELVIEW_MATRIX, (float*) &xform);
    canvas->Update();
    event.Skip();
}
コード例 #13
0
ファイル: osgviewerWX.cpp プロジェクト: aalex/osg
void MainFrame::OnIdle(wxIdleEvent &event)
{
    if (!_viewer->isRealized())
        return;

    _viewer->frame();

    event.RequestMore();
}
コード例 #14
0
void ProjectManager::OnIdle(wxIdleEvent& evt)
{
   if (mProjectLoaded)
   {
      mEditorCamera.mainLoop();
      Torque::Engine.mainLoop();
      evt.RequestMore();
   }
}
コード例 #15
0
ファイル: wxSFMLCanvas.cpp プロジェクト: Lizard-13/GD
////////////////////////////////////////////////////////////
/// Called when the control is idle - we can refresh our
/// SFML window
////////////////////////////////////////////////////////////
void wxSFMLCanvas::OnIdle(wxIdleEvent &event) {
  // Send a paint message when the control is idle, to ensure maximum framerate
  Refresh();

#if defined(__WXGTK__)
  event.RequestMore();  // On GTK, we need to specify that we want continuous
                        // idle events.
#endif
}
コード例 #16
0
ファイル: main.cpp プロジェクト: scummvm/scummvm-tools
void ScummToolsFrame::onIdle(wxIdleEvent &evt) {
	// Delete old panels on idle event
	destroyOldPanels();
	if (_pages.back()->onIdle(dynamic_cast<wxPanel *>(_wizardpane->FindWindow(wxT("Wizard Page"))))) {
		// We want more!
		evt.RequestMore(true);
		// This way we don't freeze the OS with continous events
		wxMilliSleep(10);
	}
}
コード例 #17
0
void MainFrame::OnIdle(wxIdleEvent& event)
{
    if(!m_pCenterPageManager) return;
    if(m_pCenterPageManager->GetPicViewCtrl(0))
    {
        m_pCenterPageManager->GetPicViewCtrl(0)->CalFitScaleRate();
        m_pCenterPageManager->GetPicViewCtrl(0)->SetRulerCtrlFited();
        event.RequestMore(false);
    }
}
コード例 #18
0
ファイル: cmgui.cpp プロジェクト: A1kmm/libzinc
void wxCmguiApp::OnIdle(wxIdleEvent& event)
{
	if (event_dispatcher)
	{
		if (Event_dispatcher_process_idle_event(event_dispatcher))
		{
			event.RequestMore();
		}
	}
}
コード例 #19
0
ファイル: BundlePane.cpp プロジェクト: khmerlovers/e
void BundlePane::OnIdle(wxIdleEvent& event) {
	if (!m_bundleTree->IsEmpty()) return; // already updated
	
	// Keep waiting until all bundles are updated
	if (!m_plistHandler.AllBundlesUpdated()) {
		event.RequestMore();
		return;
	}

	LoadBundles();
}
コード例 #20
0
ファイル: main.cpp プロジェクト: zulman/qutemol
void MyFrame::OnIdle(wxIdleEvent& event){
  if (mol.DoingAO()) {
    m_tb->UpdateGearsIcon(true);
    if (mol.PrepareAOstep()) {
      m_canvas->SceneChanged();
      event.RequestMore(false); 
      m_tb->UpdateGearsIcon(false);
      return;
    }
    else event.RequestMore(true);      
  } else {
    event.RequestMore(false); 
    if (hardSettings.STILL_QUALITY!=hardSettings.MOVING_QUALITY)
    if (!m_canvas->shownHQ) {
      m_canvas->shownHQ=true;
      mustDoHQ=true;
      m_canvas->Refresh(false);
    }
    m_tb->UpdateGearsIcon(false);
  }
}
コード例 #21
0
void ToolsManager::OnIdle(wxIdleEvent& event)
{
    if (m_pProcess)
    {
        if (m_pProcess->HasInput())
        {
            event.RequestMore();
        }
    }
    else
        event.Skip();
}
コード例 #22
0
////////////////////////////////////////////////////////////
// Class name:  MainFrame
// Method name: onIdle
//
// Description: Idle event handler (render loop).
////////////////////////////////////////////////////////////
void MainFrame::onIdle(wxIdleEvent& event)
{
    // process next frame
    m_model->processNextFrame();
       
    // update video frame
    m_resultFrame->m_imagePanel->paintNow();
    m_leftEyeFrame->m_imagePanel->paintNow();
    m_rightEyeFrame->m_imagePanel->paintNow();
        
    // render continously
    event.RequestMore();
}
コード例 #23
0
	virtual void OnIdle(wxIdleEvent& event)
	{
		if(OpQuit())
		{
			GetParent()->Close(true);
			return;
		}
		Handler()->OnLoop();
		OnLoopSound();
		Refresh(false);
		if(!Handler()->FullSpeed())
			wxMilliSleep(3);
		event.RequestMore();
	}
コード例 #24
0
ファイル: frame.cpp プロジェクト: timhutton/linear-enzymes
void MyFrame::OnIdle(wxIdleEvent& event) {
    if( render_every == 0 ) return;

    try {
        this->arena.update();
    }
    catch( exception& e ) {
        wxMessageBox( e.what() );
    }
    this->iterations++;
    if( iterations % this->render_every == 0 )
        this->Refresh( false );
    event.RequestMore(); // render continuously, not only once on idle
}
コード例 #25
0
void wxAuiFloatingFrame::OnIdle(wxIdleEvent& event)
{
    if (m_moving)
    {
        if (!isMouseDown())
        {
            m_moving = false;
            OnMoveFinished();
        }
        else
        {
            event.RequestMore();
        }
    }
}
コード例 #26
0
ファイル: sQ1App.cpp プロジェクト: simlabrobotics/sq1_windows
void sQ1App::OnIdle(wxIdleEvent& evt)
{
	static int sync_counter = 0;

	sync_counter++;

	if (sync_counter == 1) {
				
		for (int ch = 0; ch < (int)CAN_Ch_COUNT; ch++)
		{
			if (!CAN_Ch_Enabled[ch]) continue;

			for (int node = 0; node < (int)NODE_COUNT; node++)
			{
				if (!NODE_Enabled[ch][node]) continue;

				if (GetHomingDone() == HOMING_DONE &&
					(statusWord[ch][node]&0x1000) != 0 &&
					(controlWord[ch][node]&0x0010) != 0) { // when "Set new point" bit is set...
					controlWord[ch][node] &= 0xDF8F; // masking irrelevant bits
					controlWord[ch][node] |= 0x0000; // clear all operation mode specific bits
				}

				can_pdo_rx1(CAN_Ch[ch], JointNodeID[ch][node], targetPosition[ch][node], targetVelocity[ch][node]);
				can_pdo_rx3(CAN_Ch[ch], JointNodeID[ch][node], controlWord[ch][node], modeOfOperation);
			}
		}
				
		for (int ch = 0; ch < (int)CAN_Ch_COUNT; ch++)
		{
			if (!CAN_Ch_Enabled[ch]) continue;
			can_sync(CAN_Ch[ch]);
		}

		sync_counter = 0;
	}

	Sleep(5);

	for (int ch = 0; ch < (int)CAN_Ch_COUNT; ch++)
	{
		if (!CAN_Ch_Enabled[ch]) continue;
		ProcessCANMessage(ch);
	}

	evt.RequestMore(); // render continuously, not only once on idle
}
コード例 #27
0
ファイル: gui.cpp プロジェクト: zoibot/knes
void MainWindow::OnIdle(wxIdleEvent& event) {
    double frame_rate = 1000.0f/double(frame_timer.Time());
    frame_timer.Start();
    wxClientDC dc(this);
    if(running && mach) {
        mach->run(1);
        //draw screen
        dc.DrawBitmap(mach->screenshot(), 0, 0);
        //display framerate
        wxString framerate;
        framerate << frame_rate;
        dc.SetTextBackground(wxTheColourDatabase->Find("black"));
        dc.SetTextForeground(wxTheColourDatabase->Find("green"));
        dc.DrawText(framerate, 0, 0);
    }
    event.RequestMore();
}
コード例 #28
0
ファイル: wxgl_main.cpp プロジェクト: matus-chochlik/oglplus
    void OnIdle(wxIdleEvent& event) {
        try {
            if(idle_call_count == 0) {
                idle_call_count++;
                Update();
                event.RequestMore();
                idle_call_count--;
            }
            return;
        } catch(oglplus::Error& err) {
            HandleError(err);
        } catch(const std::exception& se) {
            HandleError(se);
        }

        Close();
    }
コード例 #29
0
ファイル: S3DViewPanel.cpp プロジェクト: junsun2h/tigerjk0409
void S3DViewPanel::OnIdle(wxIdleEvent& event)
{
	if( m_bSetup == false )
	{
		int nWidth = 100;
		int nHeight = 100;
		GetSize(&nWidth, &nHeight);

		CENGINE_INIT_PARAM engineParam;
		engineParam.hWnd = GetHWND();
		engineParam.width = nWidth;
		engineParam.height = nHeight;
		engineParam.resourceFolder = L"\\Data";

		GLOBAL::InitDevice( engineParam );

		g_pLight = GLOBAL::Engine()->LightMgr()->Create();

		g_pLight->pos = CVector3(-100, 100, 100);
		g_pLight->range = 300;
		g_pLight->color = CVector3(1,0,0);
		g_pLight->intensity = 1;

		g_pLight2 = GLOBAL::Engine()->LightMgr()->Create();

		g_pLight2->pos = CVector3(100, 100, 100);
		g_pLight2->range = 300;
		g_pLight2->color = CVector3(0,1,0);
		g_pLight2->intensity = 1;


		m_bSetup = true;
	}

//	TestLogicUpdate();

	if( GLOBAL::ObserverCamera() != NULL)
	{
		CCAMERA_DESC cameraDesc;
		GLOBAL::ObserverCamera()->CopyDesc(&cameraDesc);
		GLOBAL::Engine()->UpdateAndRender( &cameraDesc, &g_PostRenderer);
	}
	
	event.RequestMore();
}
コード例 #30
0
ファイル: userControl.cpp プロジェクト: idanceyang/DynaMechs
// I still don't fully understand the mechanism behind idle func ...
// but the following works ... need to read more documentation
void BasicGLPane::updateSim(wxIdleEvent& event)
{
	if (!paused_flag)
	{
		for (int i=0; i<render_rate; i++)
	    {
			G_integrator->simulate(idt);
			sim_time += idt;
		}
	}
	camera->setPerspective(45.0, (GLfloat)getWidth()/(GLfloat)getHeight(), 1.0, 200.0);
	camera->update(mouse);
	camera->applyView();
	Refresh(); // ask for repaint

	// if you want the GL light to move with the camera, comment the following two lines - yiping
	GLfloat light_position0[] = { 1.0, 1.0, 1.0, 0.0 };
	glLightfv (GL_LIGHT0, GL_POSITION, light_position0);

	GLfloat light_position1[] = { -1.0, -1.0, 1.0, 0.0 };
	glLightfv (GL_LIGHT1, GL_POSITION, light_position1);


	timer_count++;
	dmGetSysTime(&tv);

	double elapsed_time = ((double) tv.tv_sec - last_tv.tv_sec) +
	                      (1.0e-9*((double) tv.tv_nsec - last_tv.tv_nsec));

	if (elapsed_time > 2.5)
	{
		rtime += elapsed_time;
		cerr << "time/real_time: " << sim_time << '/' << rtime
		   << "  frame_rate: " << (double) timer_count/elapsed_time << endl;

		timer_count = 0;
		last_tv.tv_sec = tv.tv_sec;
		last_tv.tv_nsec = tv.tv_nsec;
	}

	// WakeUpIdle(); //?
	event.RequestMore();// render continuously, not only once on idle
}