Commit 7ab4a9bf authored by stambaughw's avatar stambaughw
Browse files

Minor fixes and code cleaning.

* Remove redundant background redrawing RedrawActiveWindow.
* Remove redundant managed cursor callback in RedrawActiveWindow.
* Use refresh to redraw instead of directly calling RedrawActiveWindow.
* Remove unused SetDrawBgColor for drawframe.cpp.
* Fix compiler warning in cvpcb/cvframe.cpp.
* Fix menu spelling and syntax errors in pcbnew.
* Rename Trace_Curseur to DrawCursor in common/drawpanel.cpp.
parent f41cc301
Loading
Loading
Loading
Loading
+0 −28
Original line number Original line Diff line number Diff line
@@ -596,34 +596,6 @@ void WinEDA_DrawFrame::AdjustScrollBars()
}
}




/* Updates the background color for drawing panel.  The only valid colors
 * are BLACK and WHITE.
 * XorMode the parameter is updated according to the background color
 */
void WinEDA_DrawFrame::SetDrawBgColor( int color_num )
{
    if( ( color_num != WHITE ) && ( color_num != BLACK ) )
        color_num = BLACK;
    g_DrawBgColor = color_num;
    if( color_num == WHITE )
    {
        g_XorMode    = GR_NXOR;
        g_GhostColor = BLACK;
    }
    else
    {
        g_XorMode    = GR_XOR;
        g_GhostColor = WHITE;
    }

    if( DrawPanel )
        DrawPanel->SetBackgroundColour(
            wxColour( ColorRefs[g_DrawBgColor].m_Red,
                      ColorRefs[g_DrawBgColor].m_Green,
                      ColorRefs[g_DrawBgColor].m_Blue ) );
}


void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
{
{
    int id = event.GetId();
    int id = event.GetId();
+13 −13
Original line number Original line Diff line number Diff line
@@ -121,32 +121,32 @@ BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
/*
/*
 *  Draw the schematic cursor which is usually on grid
 *  Draw the schematic cursor which is usually on grid
 */
 */
void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
void WinEDA_DrawPanel::DrawCursor( wxDC* aDC, int aColor )
{
{
    if( m_CursorLevel != 0 ||  DC == NULL )
    if( m_CursorLevel != 0 || aDC == NULL )
        return;
        return;


    wxPoint Cursor = GetScreen()->m_Curseur;
    wxPoint Cursor = GetScreen()->m_Curseur;


    GRSetDrawMode( DC, GR_XOR );
    GRSetDrawMode( aDC, GR_XOR );
    if( m_Parent->m_CursorShape == 1 )    /* Draws a crosshair. */
    if( m_Parent->m_CursorShape == 1 )    /* Draws a crosshair. */
    {
    {
        int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
        int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
        int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
        int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );


        GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y,
        GRLine( &m_ClipBox, aDC, Cursor.x - dx, Cursor.y,
                Cursor.x + dx, Cursor.y, 0, color );            // Y axis
                Cursor.x + dx, Cursor.y, 0, aColor );            // Y axis
        GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - dx,
        GRLine( &m_ClipBox, aDC, Cursor.x, Cursor.y - dx,
                Cursor.x, Cursor.y + dy, 0, color );            // X axis
                Cursor.x, Cursor.y + dy, 0, aColor );            // X axis
    }
    }
    else
    else
    {
    {
        int len = GetScreen()->Unscale( CURSOR_SIZE );
        int len = GetScreen()->Unscale( CURSOR_SIZE );


        GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y,
        GRLine( &m_ClipBox, aDC, Cursor.x - len, Cursor.y,
                Cursor.x + len, Cursor.y, 0, color );
                Cursor.x + len, Cursor.y, 0, aColor );
        GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - len,
        GRLine( &m_ClipBox, aDC, Cursor.x, Cursor.y - len,
                Cursor.x, Cursor.y + len, 0, color );
                Cursor.x, Cursor.y + len, 0, aColor );
    }
    }
}
}


@@ -157,7 +157,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
 */
 */
void WinEDA_DrawPanel::CursorOff( wxDC* DC )
void WinEDA_DrawPanel::CursorOff( wxDC* DC )
{
{
    Trace_Curseur( DC );
    DrawCursor( DC );
    --m_CursorLevel;
    --m_CursorLevel;
}
}


@@ -168,7 +168,7 @@ void WinEDA_DrawPanel::CursorOff( wxDC* DC )
void WinEDA_DrawPanel::CursorOn( wxDC* DC )
void WinEDA_DrawPanel::CursorOn( wxDC* DC )
{
{
    ++m_CursorLevel;
    ++m_CursorLevel;
    Trace_Curseur( DC );
    DrawCursor( DC );


    if( m_CursorLevel > 0 )  // Shouldn't happen, but just in case ..
    if( m_CursorLevel > 0 )  // Shouldn't happen, but just in case ..
        m_CursorLevel = 0;
        m_CursorLevel = 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -200,7 +200,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
    if( m_FootprintList )
    if( m_FootprintList )
        m_auimgr.AddPane( m_FootprintList,
        m_auimgr.AddPane( m_FootprintList,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
                          Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );
                          Right().BestSize( (int) ( m_FrameSize.x * 0.36 ), m_FrameSize.y ) );


    m_auimgr.Update();
    m_auimgr.Update();
#endif
#endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -297,7 +297,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
    if( GetScreen()->IsRefreshReq() )
    if( GetScreen()->IsRefreshReq() )
    {
    {
        flagcurseur = 2;
        flagcurseur = 2;
        RedrawActiveWindow( DC, TRUE );
        Refresh();
    }
    }


    if( oldpos != GetScreen()->m_Curseur )
    if( oldpos != GetScreen()->m_Curseur )
+2 −4
Original line number Original line Diff line number Diff line
@@ -92,16 +92,14 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )


    ActiveScreen = (PCB_SCREEN*) GetScreen();
    ActiveScreen = (PCB_SCREEN*) GetScreen();


    if( EraseBg )
        DrawPanel->EraseScreen( DC );

    DrawPanel->DrawBackGround( DC );
    DrawPanel->DrawBackGround( DC );
    GetBoard()->Draw( DrawPanel, DC, GR_COPY );
    GetBoard()->Draw( DrawPanel, DC, GR_COPY );


    MODULE* Module = GetBoard()->m_Modules;
    MODULE* Module = GetBoard()->m_Modules;
    if ( Module )
    if ( Module )
        Module->DisplayInfo( this );
        Module->DisplayInfo( this );
    DrawPanel->Trace_Curseur( DC );

    DrawPanel->DrawCursor( DC );
}
}




Loading