Esempio n. 1
0
// hide the currently active panel and show the new one
void wxNotebook::ChangePage(int nOldSel, int nSel)
{
    if (nOldSel == nSel)
        return;

    if ( nOldSel != wxNOT_FOUND )
        m_pages[nOldSel]->Show( false );

    if ( nSel != wxNOT_FOUND )
    {
        wxNotebookPage *pPage = m_pages[nSel];
#if 0 // deactivate r65078 for the moment
        if ( IsShownOnScreen() )
        {
            pPage->Show( true );
            pPage->SetFocus();
        }
        else
        {
            // Postpone Show() until the control is actually shown.
            // Otherwise this forces the containing toplevel window
            // to show, even if it's just being created and called
            // AddPage() without intent to show the window yet.
            // We Show() the selected page in our OnSize handler,
            // unless it already is shown.
        }
#else
        pPage->Show( true );
        pPage->SetFocus();
#endif
    }

    m_selection = nSel;
    GetPeer()->SetValue( m_selection + 1 ) ;
}
Esempio n. 2
0
void CFCEditorGLWindow::OnTimer( wxTimerEvent& /*event*/ )
{
    if ( IsShownOnScreen() )
    {
        SetCurrent(*m_glRC);
    }
    FC_PERFORMDETECT_START(ePNT_Editor)
    CRenderManager::GetInstance()->SetCamera(m_pCamera);

    FC_PERFORMDETECT_START(ePNT_UpdateCamera)
    UpdateCamera();
    FC_PERFORMDETECT_STOP(ePNT_UpdateCamera)

    FC_PERFORMDETECT_STOP(ePNT_Editor)

    CEngineCenter::GetInstance()->Update();

    CEditorMainFrame* pWFrame = static_cast<CEngineEditor*>(wxApp::GetInstance())->GetMainFrame();
    if (pWFrame->GetPerformanceDialogPtr())
    {
        pWFrame->GetPerformanceDialogPtr()->UpdatePerformData();
    }
    FC_PERFORMDETECT_RESET();

    SwapBuffers();
}
Esempio n. 3
0
void VideoDisplay::UpdateSize() {
	auto provider = con->project->VideoProvider();
	if (!provider || !IsShownOnScreen()) return;

	videoSize.Set(provider->GetWidth(), provider->GetHeight());
	videoSize *= zoomValue;
	if (con->videoController->GetAspectRatioType() != AspectRatio::Default)
		videoSize.SetWidth(videoSize.GetHeight() * con->videoController->GetAspectRatioValue());

	wxEventBlocker blocker(this);
	if (freeSize) {
		wxWindow *top = GetParent();
		while (!top->IsTopLevel()) top = top->GetParent();

		wxSize cs = GetClientSize();
		wxSize oldSize = top->GetSize();
		top->SetSize(top->GetSize() + videoSize / scale_factor - cs);
		SetClientSize(cs + top->GetSize() - oldSize);
	}
	else {
		SetMinClientSize(videoSize / scale_factor);
		SetMaxClientSize(videoSize / scale_factor);

		GetGrandParent()->Layout();
	}

	PositionVideo();
}
Esempio n. 4
0
void MyCanvas::OnSize(wxSizeEvent& event)
{
	//printf("OnSize\n");
	if (!IsShownOnScreen()) return;
	SetCurrent(*m_glRC);
	resize_callback(event.GetSize().x, event.GetSize().y);
}
Esempio n. 5
0
void VideoDisplay::UpdateSize() {
	if (!con->videoController->IsLoaded() || !IsShownOnScreen()) return;

	videoSize.Set(con->videoController->GetWidth(), con->videoController->GetHeight());
	videoSize *= zoomValue;
	if (con->videoController->GetAspectRatioType() != 0)
		videoSize.SetWidth(videoSize.GetHeight() * con->videoController->GetAspectRatioValue());

	wxEventBlocker blocker(this);
	if (freeSize) {
		wxWindow *top = GetParent();
		while (!top->IsTopLevel()) top = top->GetParent();

		wxSize cs = GetClientSize();
		wxSize oldSize = top->GetSize();
		top->SetSize(top->GetSize() + videoSize - cs);
		SetClientSize(cs + top->GetSize() - oldSize);
	}
	else {
		SetMinClientSize(videoSize);
		SetMaxClientSize(videoSize);

		GetGrandParent()->Layout();
	}

	PositionVideo();
}
Esempio n. 6
0
void FrameMain::SetDisplayMode(int video, int audio) {
	if (!IsShownOnScreen()) return;

	bool sv = false, sa = false;

	if (video == -1) sv = showVideo;
	else if (video)  sv = context->videoController->IsLoaded() && !context->dialog->Get<DialogDetachedVideo>();

	if (audio == -1) sa = showAudio;
	else if (audio)  sa = context->audioController->IsAudioOpen();

	// See if anything changed
	if (sv == showVideo && sa == showAudio) return;

	showVideo = sv;
	showAudio = sa;

	bool didFreeze = !IsFrozen();
	if (didFreeze) Freeze();

	context->videoController->Stop();

	TopSizer->Show(videoBox, showVideo, true);
	ToolsSizer->Show(audioBox, showAudio, true);

	MainSizer->CalcMin();
	MainSizer->RecalcSizes();
	MainSizer->Layout();
	Layout();

	if (didFreeze) Thaw();
}
Esempio n. 7
0
void ModelPreviewCanvas::RenderWindow()
{
	if(!IsShownOnScreen())
		return;

	Driver* driver = gEngine->GetDriver();
	IDirect3DDevice9* d3dDevice = driver->GetD3DDevice();

	mCamera->FrameUpdate();

	if(wxWindow::FindFocus() == this)
		mCamera->ApplyCameraController();

	driver->RenderToSwapChain(mSwapChainIndex);
	driver->Clear(D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x7f36404a, 1.0f);
	driver->BeginScene();

	std::vector<Vector3> points;
	points.push_back(Vector3::Zero);
	points.push_back(Vector3(2, 0, 0));
	DebugDrawer::DrawLine(points, 0xffff0000, mCamera);

	Material* diffMtl = gEngine->GetMaterialManager()->GetDefaultViewMtl();

	if(mModel)
	{
		mModel->Draw(IDENTITY_MATRIX, mCamera, true);
	}

	driver->EndScene();
	driver->Present((HWND)GetHWND());
}
Esempio n. 8
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);
    }
}
Esempio n. 9
0
void MyGLCanvas::OnSize(wxSizeEvent& event)
{
    event.Skip();
    
    // If this window is not fully initialized, dismiss this event
    if ( !IsShownOnScreen() )
        return;
    
    if ( !m_oglManager )
    {
        //Now we have a context, retrieve pointers to OGL functions
        if ( !oglInit() )
            return;
        //Some GPUs need an additional forced paint event
        PostSizeEvent();
    }
    
    // This is normally only necessary if there is more than one wxGLCanvas
    // or more than one wxGLContext in the application.
    SetCurrent(*m_oglContext);
    
    // It's up to the application code to update the OpenGL viewport settings.
    m_winHeight = event.GetSize().y;
    m_oglManager->SetViewport(0, 0, event.GetSize().x, m_winHeight);
    
    // Generate paint event without erasing the background.
    Refresh(false);
}
Esempio n. 10
0
void BubbleHardwareManager::popUpBoardList()
{
    if (IsShownOnScreen())
    {
        if (comboBoardName)
            comboBoardName->popUpList();
    }
}
Esempio n. 11
0
void WSortView::RepaintNow()
{
    if (!IsShownOnScreen()) return;

    wxClientDC dc(this);
    wxBufferedDC bdc(&dc, GetSize(), wxBUFFER_CLIENT_AREA);
    paint(bdc, GetSize());
}
Esempio n. 12
0
void wxToolBar::OnInternalIdle()
{
    // Check if we have to show window now
    if (GTKShowFromOnIdle()) return;

    if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
Esempio n. 13
0
void dlgMarkers::UpdateValues()
{
    if(IsShownOnScreen())
    {
        for(int i=0; i<labels.size(); ++i)
        {
            if(parent_graph == NULL)
                return;
            if (!parent_graph->markers[i].used)
                continue;
            char text[128];
            double valueA = 0;
            double valueB = 0;
            double freq =  parent_graph->markers[i].posX/1000000;
            int cnt=0;

            if(parent_graph->series[0]->size > 0 && parent_graph->series[0]->visible)
            {
                valueA = parent_graph->series[0]->values[parent_graph->markers[i].dataValueIndex+1];
                cnt = sprintf(text, "%3.1f (ChA) ; ",valueA);
            }

            if(parent_graph->series[1]->size > 0 && parent_graph->series[1]->visible)
            {
                valueB = parent_graph->series[1]->values[parent_graph->markers[i].dataValueIndex+1];
                sprintf(text+cnt, "%3.1f (ChB) ;",valueB);
            }

            labels[i]->SetLabel(wxString(text));
            marker_valuesA[i] = valueA;
            marker_valuesB[i] = valueB;
            enables[i]->SetValue(parent_graph->markers[i].used);
            shows[i]->SetValue(parent_graph->markers[i].show);
            freqs[i]->SetValue(wxString::Format("%3.2f", freq));
        }

        for(int i=0; i<5; ++i)
        {
            int src1 = deltaSrc[2*i]->GetSelection();
            int src2 = deltaSrc[2*i+1]->GetSelection();
            char text[128]={0};
            int cnt = 0;

            if(parent_graph->series[0]->size > 0 && parent_graph->series[0]->visible)
            {
                float deltaValue = marker_valuesA[src1]-marker_valuesA[src2];
                cnt = sprintf(text, "%.3f (ChA) ; ",deltaValue);
            }

            if(parent_graph->series[1]->size > 0 && parent_graph->series[1]->visible)
            {
                float deltaValue = marker_valuesB[src1]-marker_valuesB[src2];
                sprintf(text+cnt, "%.3f (ChB)",deltaValue);
            }
            deltaValues[i]->SetLabel(wxString(text));
        }
    }
}
Esempio n. 14
0
bool wxGLCanvasBase::SetCurrent(const wxGLContext& context) const
{
    // although on MSW it works even if the window is still hidden, it doesn't
    // work in other ports (notably X11-based ones) and documentation mentions
    // that SetCurrent() can only be called for a shown window, so check for it
    wxASSERT_MSG( IsShownOnScreen(), _T("can't make hidden GL canvas current") );

    return context.SetCurrent(*static_cast<const wxGLCanvas *>(this));
}
Esempio n. 15
0
void GLMainCanvas::OnSize(wxSizeEvent &event)
{
    if (!IsShownOnScreen()) {
        return;
    }
    wxSize size = GetClientSize();
    GLMainContext &canvas = GetGLContext();
    canvas.ResizeGL(size.x, size.y);
}
Esempio n. 16
0
void BubbleHardwareManager::popUpPortList()
{
    if (IsShownOnScreen())
    {
        updatePorts();
        if (comboBootPortName)
            comboBootPortName->popUpList();
    }
}
Esempio n. 17
0
void wxGLCanvas::MacVisibilityChanged()
{
    if ( IsShownOnScreen() != m_macCanvasIsShown )
    {
        m_macCanvasIsShown = !m_macCanvasIsShown;
        MacUpdateView();
    }

    wxWindowMac::MacVisibilityChanged();
}
Esempio n. 18
0
        void SplitterWindow2::OnIdle(wxIdleEvent& event) {
            if (IsBeingDeleted()) return;

            if (IsShownOnScreen()) {
                Unbind(wxEVT_IDLE, &SplitterWindow2::OnIdle, this);
                
                // if the initial sash position could not be set until now, then it probably cannot be set at all
                m_initialSplitRatio = -1.0;
            }
        }
Esempio n. 19
0
bool wxVScrolledWindow::ScrollToLine(size_t line)
{
    if ( !m_lineMax )
    {
        // we're empty, code below doesn't make sense in this case
        return false;
    }

    // determine the real first line to scroll to: we shouldn't scroll beyond
    // the end
    size_t lineFirstLast = FindFirstFromBottom(m_lineMax - 1, true);
    if ( line > lineFirstLast )
        line = lineFirstLast;

    // anything to do?
    if ( line == m_lineFirst )
    {
        // no
        return false;
    }


    // remember the currently shown lines for the refresh code below
    size_t lineFirstOld = GetVisibleBegin(),
           lineLastOld = GetVisibleEnd();

    m_lineFirst = line;


    // the size of scrollbar thumb could have changed
    UpdateScrollbar();


    // finally refresh the display -- but only redraw as few lines as possible
    // to avoid flicker
    if ( GetChildren().empty() &&
         (GetVisibleBegin() >= lineLastOld || GetVisibleEnd() <= lineFirstOld ) )
    {
        // the simplest case: we don't have any old lines left, just redraw
        // everything
        Refresh();
    }
    else // overlap between the lines we showed before and should show now
    {
        // Avoid scrolling visible parts of the screen on Mac
#ifdef __WXMAC__
        if (!IsShownOnScreen())
            Refresh();
        else
#endif
        ScrollWindow(0, GetLinesHeight(GetVisibleBegin(), lineFirstOld));
    }

    return true;
}
bool CListProcess::TransferDataToWindow()
{
  wxString sTime;
  bool bStartTime = false;
  bool bStopTime = false;
  bool bRtn = true;
  bool bIsShown = IsShownOnScreen();
  if(bIsShown)
  {
    Show(false);
  }

  size_t n = m_pDirList->GetCount();
  long nItem;
  CDirEntry *pDirEntry;
  ClearAll();
  InsertColumn(ITEM_DIR,_T("Directory"),wxLIST_FORMAT_LEFT);
  InsertColumn(ITEM_START,_T("Start"),wxLIST_FORMAT_LEFT);
  InsertColumn(ITEM_STOP,_T("Stop"),wxLIST_FORMAT_LEFT);
  InsertColumn(ITEM_STATUS,_T("Status"),wxLIST_FORMAT_LEFT);
  for(size_t i = 0; (i < n) && bRtn; i++)
  {
    pDirEntry = m_pDirList->At(i);
    const wxString &sInput(pDirEntry->GetInputDir());
    const wxString &sStatus(pDirEntry->GetStatusString());
    nItem = InsertItem((long)i,sInput);
    sTime = pDirEntry->FormatStartTime();
    SetItem(nItem,ITEM_START,sTime);
    if(!sTime.IsEmpty())
    {
      bStartTime = true;
    }

    sTime = pDirEntry->FormatStopTime();
    SetItem(nItem,ITEM_STOP,sTime);
    if(!sTime.IsEmpty())
    {
      bStopTime = true;
    }
    SetItem(nItem,ITEM_STATUS,sStatus);
    SetItemTextColour(nItem,pDirEntry->GetStatusColour());
  }
  SetColumnWidth(ITEM_DIR,wxLIST_AUTOSIZE );
#define HEADER_SIZE 80
  SetColumnWidth(ITEM_START,bStartTime ? wxLIST_AUTOSIZE : HEADER_SIZE);
  SetColumnWidth(ITEM_STOP,bStopTime ? wxLIST_AUTOSIZE : HEADER_SIZE);
#undef HEADER_SIZE
  SetColumnWidth(ITEM_STATUS,wxLIST_AUTOSIZE );
  if(bIsShown)
  {
    Show(true);
  }
  Refresh();
  return bRtn;
}
Esempio n. 21
0
void LightInspector::onRadiantShutdown()
{
    if (IsShownOnScreen())
    {
        Hide();
    }

    // Destroy the window
    SendDestroyEvent();
    InstancePtr().reset();
}
Esempio n. 22
0
void Waveform::InitializeGLCanvas()
{
    if(!IsShownOnScreen()) return;
    SetCurrentGLContext();
    LOG_GL_ERRORV(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); // Black Background
    LOG_GL_ERRORV(glDisable(GL_BLEND));
    LOG_GL_ERRORV(glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA));
    LOG_GL_ERRORV(glClear(GL_COLOR_BUFFER_BIT));
    prepare2DViewport(0,0,mWindowWidth, mWindowHeight);
    mIsInitialized = true;
    SetZoomLevel(mZoomLevel);
}
Esempio n. 23
0
void TypePage::OnDataUpdate(wxNotifyEvent & WXUNUSED(event)) {
  // Set default and focus if we're visible
  if (IsShownOnScreen()) {
    rbOneShot->SetFocus();

    wxWindow *win = wxWindow::FindWindowById(wxID_FORWARD, GetParent());
    wxButton *nextButton = wxDynamicCast(win, wxButton);

    if (nextButton)
      nextButton->SetDefault();
  }
}
Esempio n. 24
0
void GLAnimationCanvas::ResetProjectionMode()
{
    if ( !IsShownOnScreen() )
        return;

    SetCurrent(*m_pGLRC);

    int w, h;
    GetClientSize(&w, &h);

    CRenderManager::GetInstance()->SetWindowSize(w, h);
}
Esempio n. 25
0
void FindResultsWnd::tryUpdateState(bool force)
{
	if (m_pendingUpdate && !force)
		return;

	m_pendingUpdate = true;
	postAppLambdaEvent([this, force]()
	{
		if (IsShownOnScreen() || force)
			updateState();
		m_pendingUpdate = false;
	});
}
Esempio n. 26
0
void wxControl::OnInternalIdle()
{
    if ( GTKShowFromOnIdle() )
        return;

    if ( GTK_WIDGET_REALIZED(m_widget) )
    {
        GTKUpdateCursor();
    }

    if ( wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen() )
        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
Esempio n. 27
0
void PatchInspector::onRadiantShutdown()
{
	rMessage() << "PatchInspector shutting down." << std::endl;

	if (IsShownOnScreen())
	{
		Hide();
	}

	// Destroy the window 
	SendDestroyEvent();
	InstancePtr().reset();
}
Esempio n. 28
0
void Canvas::OnPaint(wxPaintEvent &WXUNUSED(event))
{
//    int i,j;
	wxPaintDC dc(this);
	dc.Clear();

	if (!IsShownOnScreen())
	    return;

	Render();

	Draw(&dc);
	
}
Esempio n. 29
0
void CFCEditorGLWindow::OnSize(wxSizeEvent& event)
{
    if ( IsShownOnScreen() )
    {
        SetCurrent(*m_glRC);
    }
    kmVec2 kmVecSize;
    wxSize size = event.GetSize();
    kmVecSize.x = size.GetWidth();
    kmVecSize.y = size.GetHeight();
    CRenderManager::GetInstance()->SetWindowSize(kmVecSize.x, kmVecSize.y);
    m_pCamera->SetWidth(size.GetWidth());
    m_pCamera->SetHeight(size.GetHeight());
}
Esempio n. 30
0
bool VideoDisplay::InitContext() {
	if (!IsShownOnScreen())
		return false;

	// If this display is in a minimized detached dialog IsShownOnScreen will
	// return true, but the client size is guaranteed to be 0
	if (GetClientSize() == wxSize(0, 0))
		return false;

	if (!glContext)
		glContext = agi::make_unique<wxGLContext>(this);

	SetCurrent(*glContext);
	return true;
}