Example #1
0
//----------------------------------------
// 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;
  }
}
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);
}
Example #3
0
void SpectraMainFrame::OnIdle(wxIdleEvent& event)
{
	if(!coroutine_exec->DoWork())
		event.RequestMore();
	for(auto* doc_frame : doc_frames)
		doc_frame->OnIdle(event);
}
Example #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 :-)
}
Example #5
0
void ModelPreviewCanvas::OnIdle( wxIdleEvent& event )
{
	if(gEngine->GetDriver()->GetD3DDevice())
		RenderWindow();

	event.RequestMore(true);
}
Example #6
0
/*!
    \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();
}
Example #7
0
void 
OSGFrame::OnIdle(wxIdleEvent &event)
{
    _viewer->frame();

    event.RequestMore();
}
Example #8
0
void CApplication::OnIdle(wxIdleEvent& evt)
{
	if (mRenderOn)
	{
		mMainFrame->PaintFlowEditor();
		evt.RequestMore();
	}
}
void VisApp::onIdle(wxIdleEvent& evt)
{
    if(render_loop_on)
    {
        drawPane->paintNow();
        evt.RequestMore(); // render continuously, not only once on idle
    }
}
Example #10
0
//when program idle, read the output
void CscopePlugin::OnIdle(wxIdleEvent& event)
{
  if ( m_pProcess && m_pProcess->ReadProcessOutput() )
  {
    event.RequestMore();
  }
  event.Skip();
}
Example #11
0
void hvApp::OnIdle(wxIdleEvent& event)
{
    if (m_exitIfNoMainWindow && !GetTopWindow())
        ExitMainLoop();

    event.Skip();
    event.RequestMore();
}
Example #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();
}
Example #13
0
void MainFrame::OnIdle(wxIdleEvent &event)
{
    if (!_viewer->isRealized())
        return;

    _viewer->frame();

    event.RequestMore();
}
void ProjectManager::OnIdle(wxIdleEvent& evt)
{
   if (mProjectLoaded)
   {
      mEditorCamera.mainLoop();
      Torque::Engine.mainLoop();
      evt.RequestMore();
   }
}
Example #15
0
////////////////////////////////////////////////////////////
/// 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
}
Example #16
0
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);
	}
}
Example #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);
    }
}
Example #18
0
void wxCmguiApp::OnIdle(wxIdleEvent& event)
{
	if (event_dispatcher)
	{
		if (Event_dispatcher_process_idle_event(event_dispatcher))
		{
			event.RequestMore();
		}
	}
}
Example #19
0
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();
}
Example #20
0
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);
  }
}
Example #21
0
void ToolsManager::OnIdle(wxIdleEvent& event)
{
    if (m_pProcess)
    {
        if (m_pProcess->HasInput())
        {
            event.RequestMore();
        }
    }
    else
        event.Skip();
}
Example #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();
}
	virtual void OnIdle(wxIdleEvent& event)
	{
		if(OpQuit())
		{
			GetParent()->Close(true);
			return;
		}
		Handler()->OnLoop();
		OnLoopSound();
		Refresh(false);
		if(!Handler()->FullSpeed())
			wxMilliSleep(3);
		event.RequestMore();
	}
Example #24
0
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
}
void wxAuiFloatingFrame::OnIdle(wxIdleEvent& event)
{
    if (m_moving)
    {
        if (!isMouseDown())
        {
            m_moving = false;
            OnMoveFinished();
        }
        else
        {
            event.RequestMore();
        }
    }
}
Example #26
0
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
}
Example #27
0
File: gui.cpp Project: 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();
}
Example #28
0
    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();
    }
Example #29
0
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();
}
Example #30
0
// 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
}