Commit fab8dece authored by charras's avatar charras
Browse files

Minor enhancements and changes for wxWidgets 3 compat

parent d6af27a3
Loading
Loading
Loading
Loading
+10 −27
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ enum onrclick_id {
 */

BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
EVT_SIZE( Pcb3D_GLCanvas::OnSize )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
@@ -67,7 +66,7 @@ END_EVENT_TABLE()
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, const wxWindowID id,
                                int* gl_attrib ) :
    wxGLCanvas( parent, id,
                wxPoint( -1, -1 ), wxSize( -1, -1 ), 0, wxT( "Pcb3D_glcanvas" ), gl_attrib )
                wxPoint( -1, -1 ), wxSize( -1, -1 ), wxFULL_REPAINT_ON_RESIZE )
/*************************************************************************/
{
    m_init   = FALSE;
@@ -479,36 +478,20 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
/*************************************************/
{
    wxPaintDC dc( this );

#ifndef __WXMOTIF__
    if( !GetContext() )
        return;
#endif
    // Set the OpenGL viewport according to the client size of this canvas.
    // This is done here rather than in a wxSizeEvent handler because our
    // OpenGL rendering context (and thus viewport setting) is used with
    // multiple canvases: If we updated the viewport in the wxSizeEvent
    // handler, changing the size of one canvas causes a viewport setting that
    // is wrong when next another canvas is repainted.
    const wxSize ClientSize = GetClientSize();

    glViewport(0, 0, ClientSize.x, ClientSize.y);
    Redraw();
    event.Skip();
}


/*****************************************************/
void Pcb3D_GLCanvas::OnSize( wxSizeEvent& event )
/*****************************************************/
{
    int w, h;
    // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
    // this is also necessary to update the context on some platforms
    wxGLCanvas::OnSize( event );

    GetClientSize( &w, &h );
#ifndef __WXMOTIF__
    if( GetContext() )
#endif
    {
        glViewport( 0, 0, (GLint) w, (GLint) h );
    }

    event.Skip();
}


/***********************************************************/
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
+0 −1
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ public:
    void ClearLists();

    void OnPaint(wxPaintEvent& event);
    void OnSize(wxSizeEvent& event);
    void OnEraseBackground(wxEraseEvent& event);
    void OnChar(wxKeyEvent& event);
    void OnMouseEvent(wxMouseEvent& event);
+1 −1
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ FOOTPRINT* GetModuleDescrByName( const wxString& FootprintName,
    {
        footprint = *i;

        if( *footprint->m_Module == FootprintName )
        if( footprint->m_Module == FootprintName )
            return footprint;
    }

+10 −2
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ void DialogLabelEditor::init()
{
    wxString msg;

    SetFont( *g_DialogFont );

    m_TextLabel->SetValue( m_CurrentText->m_Text );
    m_TextLabel->SetFocus();

@@ -133,3 +131,13 @@ void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
    m_Parent->DrawPanel->MouseToCursorSchema();
    EndModal( -1 );
}

/*!
 * wxTE_PROCESS_ENTER  event handler for m_TextLabel
 */

void DialogLabelEditor::onEnterKey( wxCommandEvent& event )
{
    TextPropertiesAccept( event );
}
+2 −3
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@ private:
    WinEDA_SchematicFrame * m_Parent;
    SCH_TEXT * m_CurrentText;

    void init();

protected:
    // these are protected so that the static ShowModally() gets used.
    DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
@@ -36,7 +34,8 @@ public:
    static int ShowModally(  WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText );

private:
    void OnInitDialog( wxInitDialogEvent& event );
    void init( );
	void onEnterKey( wxCommandEvent& event );
    void OnButtonOKClick( wxCommandEvent& event );
    void OnButtonCANCEL_Click( wxCommandEvent& event );
    void TextPropertiesAccept( wxCommandEvent& event );
Loading