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();
}
Beispiel #2
0
void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
{
    // wxMSW prior to 2.5.3 created MDI child frames as visible, which resulted
    // in flicker e.g. when the frame contained controls with non-trivial
    // layout. Since 2.5.3, the frame is created hidden as all other top level
    // windows. In order to maintain backward compatibility, the frame is shown
    // in OnIdle, unless Show(false) was called by the programmer before.
    if ( m_needsInitialShow )
    {
        Show(true);
    }

    // MDI child frames get their WM_SIZE when they're constructed but at this
    // moment they don't have any children yet so all child windows will be
    // positioned incorrectly when they are added later - to fix this, we
    // generate an artificial size event here
    if ( m_needsResize )
    {
        m_needsResize = false; // avoid any possibility of recursion

        SendSizeEvent();
    }

    event.Skip();
}
Beispiel #3
0
void MyApp::OnIdle(wxIdleEvent& event)
{
    if ( m_client )
        m_client->StartNextTestIfNecessary();

    event.Skip();
}
Beispiel #4
0
 void OnAppIdle(wxIdleEvent& ev)
 {
     ev.Skip();
     // Only respond to setting changes if we've been triggered once already.
     if (m_state != State::Inactive)
         UpdateState();
 }
Beispiel #5
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();
}
Beispiel #6
0
void MyFrame::OnIdle(wxIdleEvent& event)
{
#if wxUSE_STATUSBAR
    if ( m_treeCtrl )
    {
        wxTreeItemId idRoot = m_treeCtrl->GetRootItem();
        wxString status;
        if (idRoot.IsOk())
        {
            wxTreeItemId idLast = m_treeCtrl->GetLastChild(idRoot);
            status = wxString::Format(
                _T("Root/last item is %svisible/%svisible"),
                m_treeCtrl->IsVisible(idRoot) ? _T("") : _T("not "),
                idLast.IsOk() && m_treeCtrl->IsVisible(idLast)
                    ? _T("") : _T("not "));
        }
        else
            status = _T("No root item");

        SetStatusText(status, 1);
    }
#endif // wxUSE_STATUSBAR

    event.Skip();
}
void ModeSelectorCanvas::OnIdle(wxIdleEvent &event) {
	if (mouseTracker.mouseInView()) {
		Refresh();
	} else {
		event.Skip();
	}
}
Beispiel #8
0
void wxPopupTransientWindow::OnIdle(wxIdleEvent& event)
{
    event.Skip();

    if (IsShown() && m_child)
    {
        // Store the last mouse position to minimize the number of calls to
        // wxFindWindowAtPoint() which are quite expensive.
        static wxPoint s_posLast;
        const wxPoint pos = wxGetMousePosition();
        if ( pos != s_posLast )
        {
            s_posLast = pos;

            wxWindow* const winUnderMouse = wxFindWindowAtPoint(pos);

            // We release the mouse capture while the mouse is inside the popup
            // itself to allow using it normally with the controls inside it.
            if ( wxGetTopLevelParent(winUnderMouse) == this )
            {
                if ( m_child->HasCapture() )
                {
                    m_child->ReleaseMouse();
                }
            }
            else // And we reacquire it as soon as the mouse goes outside.
            {
                if ( !m_child->HasCapture() )
                {
                    m_child->CaptureMouse();
                }
            }
        }
    }
}
Beispiel #9
0
void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event)
{
    event.Skip();

    if ( !m_stylePopup )
        return;

    wxRichTextCtrl * const richtext = GetRichTextCtrl();
    if ( !richtext )
        return;

    if ( !IsPopupShown() && IsShownOnScreen() && wxWindow::FindFocus() != this )
    {
        wxString styleName =
            wxRichTextStyleListBox::GetStyleToShowInIdleTime(richtext, 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);
    }
}
Beispiel #10
0
void vtFrame::OnIdle(wxIdleEvent& event)
{
	// Check if we were requested to close on the next Idle event.
	if (m_bCloseOnIdle)
		Close();
	else
		event.Skip();
}
Beispiel #11
0
//when program idle, read the output
void CscopePlugin::OnIdle(wxIdleEvent& event)
{
  if ( m_pProcess && m_pProcess->ReadProcessOutput() )
  {
    event.RequestMore();
  }
  event.Skip();
}
Beispiel #12
0
void hvApp::OnIdle(wxIdleEvent& event)
{
    if (m_exitIfNoMainWindow && !GetTopWindow())
        ExitMainLoop();

    event.Skip();
    event.RequestMore();
}
Beispiel #13
0
void wxFrameView::OnIdle( wxIdleEvent& event)
{
    event.Skip();

    if ( mDoToolUpdates )
    {
        // TBD::
    }
}
Beispiel #14
0
void MyStatusBar::OnIdle(wxIdleEvent& event)
{
    SetStatusText(numlockIndicators[wxGetKeyState(WXK_NUMLOCK)],
                  Field_NumLockIndicator);
    SetStatusText(capslockIndicators[wxGetKeyState(WXK_CAPITAL)],
                  Field_CapsLockIndicator);

    event.Skip();
}
Beispiel #15
0
void gcFrame::onIdle( wxIdleEvent& event )
{
	if (m_bEnableIdealSize && !(this->GetWindowStyle() & wxRESIZE_BORDER))
	{
		if (GetSize() != m_IdealSize)
			SetSize(m_IdealSize);
	}

	event.Skip();
}
Beispiel #16
0
void OpenWindowsPanel::OnIdle(wxIdleEvent& event)
{
    event.Skip();
    static bool once = false;
    if(!once && m_initDone && m_mgr->GetPageCount() && m_dvListCtrl->GetItemCount() == 0) {
        // populate the control
        once = true;
        PopulateView();
    }
}
Beispiel #17
0
void EnviroFrame::OnIdle(wxIdleEvent& event)
{
	// Check if we were requested to close on the next Idle event.
	if (m_bCloseOnIdle)
	{
		m_bCloseOnIdle = false;
		Close(false);	// False means: don't force a close.
	}
	else
		event.Skip();
}
Beispiel #18
0
void ToolsManager::OnIdle(wxIdleEvent& event)
{
    if (m_pProcess)
    {
        if (m_pProcess->HasInput())
        {
            event.RequestMore();
        }
    }
    else
        event.Skip();
}
Beispiel #19
0
void ecRunTestsDialog::OnIdle(wxIdleEvent& event)
{
    FlushBuffer();

    if (m_testsAreComplete)
    {
        m_testsAreComplete = FALSE;
        SubmitTests();
    }

    event.Skip();
}
Beispiel #20
0
void wxMainFrame::OnIdle(wxIdleEvent& event)
{
  wxString msg;

//  m_TEDProtocol->GetSocketData();
  while ((msg=m_TEDProtocol->GetMessage())!=wxEmptyString)
  {
//    ::wxMessageBox(msg,_("Mensaje del Servidor2"));
    ProcessMessage(msg);
  }
  event.Skip();
}
Beispiel #21
0
// Make sure the correct toolbars are showing for the active view
void csFrame::OnIdle(wxIdleEvent& event)
{
    wxSashLayoutWindow* paletteWin = wxGetApp().GetDiagramPaletteSashWindow();
    wxSashLayoutWindow* diagramToolBarWin = wxGetApp().GetDiagramToolBarSashWindow();
    if (!paletteWin || !diagramToolBarWin)
        return;
    bool doLayout = false;
    if (GetActiveChild())
    {
        if (!paletteWin->IsShown() || !diagramToolBarWin->IsShown())
        {
            paletteWin->Show(true);
            diagramToolBarWin->Show(true);

            doLayout = true;
        }
    }
    else
    {
        if (paletteWin->IsShown() || diagramToolBarWin->IsShown())
        {
            paletteWin->Show(false);
            diagramToolBarWin->Show(false);
            doLayout = true;
        }
    }
    if (doLayout)
    {
        wxLayoutAlgorithm layout;
        layout.LayoutMDIFrame(this);

#if defined(__WXMSW__)
        // Need to do something else to get it to refresh properly
        // when a client frame is first displayed; moving the client
        // window doesn't cause the proper refresh. Just refreshing the
        // client doesn't work (presumably because it's clipping the
        // children).
        // FIXED in wxWidgets, by intercepting wxMDIClientWindow::DoSetSize
        // and checking if the position has changed, before redrawing the
        // child windows.
#if 0
        wxMDIChildFrame* childFrame = GetActiveChild();
        if (childFrame)
        {
            HWND hWnd = (HWND) childFrame->GetHWND();
            ::RedrawWindow(hWnd, NULL, NULL, RDW_FRAME|RDW_ALLCHILDREN|RDW_INVALIDATE );

        }
#endif
#endif // __WXMSW__
    }
    event.Skip();
}
Beispiel #22
0
void wxExListViewFile::OnIdle(wxIdleEvent& event)
{
  event.Skip();

  if (
    !IsShown() ||
     GetItemCount() == 0 ||
     !wxConfigBase::Get()->ReadBool("AllowSync", true))
  {
    return;
  }

  if (m_ItemNumber < GetItemCount())
  {
    wxExListItem item(this, m_ItemNumber);

    if ( item.GetFileName().FileExists() &&
        (item.GetFileName().GetStat().GetModificationTime() != 
         GetItemText(m_ItemNumber, _("Modified")) ||
         item.GetFileName().GetStat().IsReadOnly() != item.IsReadOnly())
        )
    {
      item.Update();
      wxExLogStatus(item.GetFileName(), STAT_SYNC | STAT_FULLPATH);
      m_ItemUpdated = true;
    }

    m_ItemNumber++;
  }
  else
  {
    m_ItemNumber = 0;

    if (m_ItemUpdated)
    {
      if (wxConfigBase::Get()->ReadBool("List/SortSync", true))
      {
        SortColumn(_("Modified"), SORT_KEEP);
      }

      m_ItemUpdated = false;
    }
  }

  if (
    IsShown() &&
    GetItemCount() > 0)
  {
    CheckSync();
  }
}
Beispiel #23
0
void GainCanvas::OnIdle(wxIdleEvent &event) {
	if (mouseTracker.mouseInView()) {
	    Refresh();
	} else {
		event.Skip();
	}
    
    for (auto gi : gainPanels) {
        if (gi->getChanged()) {
            wxGetApp().setGain(gi->getName(), gi->getValue());
            gi->setChanged(false);
        }
    }
}
Beispiel #24
0
void GainCanvas::OnIdle(wxIdleEvent &event) {
    if (mouseTracker.mouseInView()) {
        Refresh();
    } else {
        event.Skip();
    }

    for (std::vector<GainInfo *>::iterator gi = gainInfo.begin(); gi != gainInfo.end(); gi++) {
        GainInfo *gInfo = (*gi);
        if (gInfo->changed) {
            wxGetApp().setGain(gInfo->name, gInfo->current);
            gInfo->changed = false;
        }
    }
}
Beispiel #25
0
void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
{
    // MDI child frames get their WM_SIZE when they're constructed but at this
    // moment they don't have any children yet so all child windows will be
    // positioned incorrectly when they are added later - to fix this, we
    // generate an artificial size event here
    if ( m_needsResize )
    {
        m_needsResize = false; // avoid any possibility of recursion

        SendSizeEvent();
    }

    event.Skip();
}
Beispiel #26
0
void wxSTEditorFindReplacePanel::OnIdle(wxIdleEvent &event)
{
    if (IsShown())
    {
        // This is a really ugly hack because the combo forgets it's insertion
        //   point in MSW whenever it loses focus
        wxWindow* focus = FindFocus();
        if (m_findCombo && (focus == m_findCombo))
            m_find_insert_pos = m_findCombo->GetInsertionPoint();
        if (m_replaceCombo && (focus == m_replaceCombo))
            m_replace_insert_pos = m_replaceCombo->GetInsertionPoint();
    }

    event.Skip();
}
Beispiel #27
0
void ZoomText::OnIdle(wxIdleEvent& event)
{
    event.Skip();
    // sanity
    if(!m_classes.IsEmpty() || IsEmpty()) return;
    
    IEditor* editor = clGetManager()->GetActiveEditor();
    if(!editor) return;

    if(m_classes.IsEmpty() && !editor->GetKeywordClasses().IsEmpty() &&
       (editor->GetFileName().GetFullPath() == m_filename)) {
        // Sync between the keywords
        SetKeyWords(1, editor->GetKeywordClasses()); // classes
        SetKeyWords(3, editor->GetKeywordLocals());  // locals
        Colourise(0, GetLength());
    }
}
Beispiel #28
0
// Resize dialog if necessary
void wxPropertySheetDialog::OnIdle(wxIdleEvent& event)
{
    event.Skip();

    if ((GetSheetStyle() & wxPROPSHEET_SHRINKTOFIT) && GetBookCtrl())
    {
        int sel = GetBookCtrl()->GetSelection();
        if (sel != -1 && sel != m_selectedPage)
        {
            GetBookCtrl()->InvalidateBestSize();
            InvalidateBestSize();
            SetSizeHints(-1, -1, -1, -1);

            m_selectedPage = sel;
            LayoutDialog(0);
        }
    }
}
Beispiel #29
0
void MyFrame::OnIdle(wxIdleEvent& event)
{
#if wxUSE_STATUSBAR
    if ( m_treeCtrl )
    {
        wxTreeItemId idRoot = m_treeCtrl->GetRootItem();

        SetStatusText(wxString::Format
                      (
                        _T("Root/last item is %svisible/%svisible"),
                        m_treeCtrl->IsVisible(idRoot) ? _T("") : _T("not "),
                        m_treeCtrl->IsVisible(m_treeCtrl->GetLastChild(idRoot))
                            ? _T("") : _T("not ")
                      ), 1);
    }
#endif // wxUSE_STATUSBAR

    event.Skip();
}
void CodeStatExecDlg::OnIdle(wxIdleEvent& evt)
{
    if (!m_changed)
        return;

    m_changed = false;

    int index = m_choice->GetSelection();
    if (index == 0)
    {
        DoParseWorkspace();

    }
    else
        DoParseProject(index);
    ShowResults(index);

    evt.Skip();
}