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.
This commit is contained in:
parent
f41cc301f8
commit
7ab4a9bf2c
|
@ -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 )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
|
|
@ -121,32 +121,32 @@ BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
|
|||
/*
|
||||
* 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;
|
||||
|
||||
wxPoint Cursor = GetScreen()->m_Curseur;
|
||||
|
||||
GRSetDrawMode( DC, GR_XOR );
|
||||
GRSetDrawMode( aDC, GR_XOR );
|
||||
if( m_Parent->m_CursorShape == 1 ) /* Draws a crosshair. */
|
||||
{
|
||||
int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
|
||||
int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
|
||||
|
||||
GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y,
|
||||
Cursor.x + dx, Cursor.y, 0, color ); // Y axis
|
||||
GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - dx,
|
||||
Cursor.x, Cursor.y + dy, 0, color ); // X axis
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x - dx, Cursor.y,
|
||||
Cursor.x + dx, Cursor.y, 0, aColor ); // Y axis
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x, Cursor.y - dx,
|
||||
Cursor.x, Cursor.y + dy, 0, aColor ); // X axis
|
||||
}
|
||||
else
|
||||
{
|
||||
int len = GetScreen()->Unscale( CURSOR_SIZE );
|
||||
|
||||
GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y,
|
||||
Cursor.x + len, Cursor.y, 0, color );
|
||||
GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - len,
|
||||
Cursor.x, Cursor.y + len, 0, color );
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x - len, Cursor.y,
|
||||
Cursor.x + len, Cursor.y, 0, aColor );
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x, Cursor.y - len,
|
||||
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 )
|
||||
{
|
||||
Trace_Curseur( DC );
|
||||
DrawCursor( DC );
|
||||
--m_CursorLevel;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void WinEDA_DrawPanel::CursorOff( wxDC* DC )
|
|||
void WinEDA_DrawPanel::CursorOn( wxDC* DC )
|
||||
{
|
||||
++m_CursorLevel;
|
||||
Trace_Curseur( DC );
|
||||
DrawCursor( DC );
|
||||
|
||||
if( m_CursorLevel > 0 ) // Shouldn't happen, but just in case ..
|
||||
m_CursorLevel = 0;
|
||||
|
|
|
@ -200,7 +200,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
|
|||
if( m_FootprintList )
|
||||
m_auimgr.AddPane( 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();
|
||||
#endif
|
||||
|
|
|
@ -297,7 +297,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
if( GetScreen()->IsRefreshReq() )
|
||||
{
|
||||
flagcurseur = 2;
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
if( oldpos != GetScreen()->m_Curseur )
|
||||
|
|
|
@ -92,16 +92,14 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
|
||||
ActiveScreen = (PCB_SCREEN*) GetScreen();
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
GetBoard()->Draw( DrawPanel, DC, GR_COPY );
|
||||
|
||||
MODULE* Module = GetBoard()->m_Modules;
|
||||
if ( Module )
|
||||
Module->DisplayInfo( this );
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
|
||||
DrawPanel->DrawCursor( DC );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -378,7 +378,8 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
|
|||
g_DrawBgColor = WHITE;
|
||||
else
|
||||
g_DrawBgColor = BLACK;
|
||||
m_Parent->SetDrawBgColor( g_DrawBgColor );
|
||||
|
||||
m_Parent->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,21 +52,6 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
|
||||
ActiveScreen = GetScreen();
|
||||
|
||||
/* Reinit draw and pen parameters */
|
||||
GRResetPenAndBrush( DC );
|
||||
DC->SetBackground( *wxBLACK_BRUSH );
|
||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||
|
||||
DrawPanel->CursorOff( DC );
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
{
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
}
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
|
||||
RedrawStructList( DrawPanel, DC, GetScreen()->EEDrawList,
|
||||
|
@ -74,14 +59,13 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
|
||||
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
|
||||
|
||||
DrawPanel->CursorOn( DC );
|
||||
if( DrawPanel->ManageCurseur )
|
||||
{
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
}
|
||||
|
||||
GetScreen()->ClrRefreshReq();
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
DrawPanel->DrawCursor( DC );
|
||||
|
||||
// Display the sheet filename, and the sheet path, for non root sheets
|
||||
if( GetScreen()->m_FileName == m_DefaultSchematicFileName )
|
||||
{
|
||||
|
|
|
@ -305,7 +305,6 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName,
|
|||
if( m_ComponentLibFiles.GetCount() == 0 )
|
||||
m_ComponentLibFiles.Add( wxT( "power" ) );
|
||||
|
||||
SetDrawBgColor( g_DrawBgColor );
|
||||
LoadLibraries();
|
||||
GetBaseScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
||||
|
|
|
@ -201,33 +201,19 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
|
||||
ActiveScreen = GetScreen();
|
||||
|
||||
DC->SetBackground( *wxBLACK_BRUSH );
|
||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||
GRResetPenAndBrush( DC );
|
||||
|
||||
DrawPanel->CursorOff( DC );
|
||||
if( DrawPanel->ManageCurseur )
|
||||
{
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, false );
|
||||
}
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
|
||||
if( m_component )
|
||||
m_component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit,
|
||||
m_convert, GR_DEFAULT_DRAWMODE );
|
||||
|
||||
DrawPanel->CursorOn( DC ); // redraw cursor
|
||||
GetScreen()->ClrRefreshReq();
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
{
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, false );
|
||||
}
|
||||
|
||||
GetScreen()->ClrRefreshReq();
|
||||
DrawPanel->DrawCursor( DC );
|
||||
|
||||
DisplayLibInfos();
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
|
|
@ -266,14 +266,6 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
if( entry == NULL )
|
||||
return;
|
||||
|
||||
/* Forcage de la reinit de la brosse et plume courante */
|
||||
GRResetPenAndBrush( DC );
|
||||
DC->SetBackground( *wxBLACK_BRUSH );
|
||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
|
||||
if( entry->isAlias() )
|
||||
|
@ -312,6 +304,9 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert,
|
||||
GR_DEFAULT_DRAWMODE );
|
||||
|
||||
/* Redraw the cursor */
|
||||
DrawPanel->DrawCursor( DC );
|
||||
|
||||
if( !tmp.IsEmpty() )
|
||||
component->SetName( tmp );
|
||||
|
||||
|
@ -320,6 +315,4 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
AppendMsgPanel( _( "Alias" ), msg, RED, 6 );
|
||||
AppendMsgPanel( _( "Description" ), entry->GetDescription(), CYAN, 6 );
|
||||
AppendMsgPanel( _( "Key words" ), entry->GetKeyWords(), DARKDARKGRAY );
|
||||
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ void WinEDA_GerberFrame::Block_Delete( wxDC* DC )
|
|||
}
|
||||
}
|
||||
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,9 +77,6 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
ActiveScreen = screen;
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
|
||||
Trace_Gerber( DC, GR_COPY, -1 );
|
||||
|
@ -88,7 +85,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
DrawPanel->DrawCursor( DC );
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
|
|
|
@ -196,8 +196,20 @@ public:
|
|||
void MouseTo( const wxPoint& Mouse );
|
||||
|
||||
/* Cursor functions */
|
||||
// Draw the user cursor (grid cursor)
|
||||
void Trace_Curseur( wxDC* DC, int color = WHITE );
|
||||
/**
|
||||
* Draw the user cursor.
|
||||
*
|
||||
* The user cursor is not the mouse cursor although they may be at the
|
||||
* same screen position. The mouse cursor is still render by the OS.
|
||||
* This is a drawn cursor that is used to snap to grid when grid snapping
|
||||
* is enabled. This is required because OSX does not allow moving the
|
||||
* cursor programmatically.
|
||||
*
|
||||
* @param aDC - the device context to draw the cursor
|
||||
* @param aColor - the color to draw the cursor
|
||||
*/
|
||||
void DrawCursor( wxDC* aDC, int aColor = WHITE );
|
||||
|
||||
// remove the grid cursor from the display
|
||||
void CursorOff( wxDC* DC );
|
||||
// display the grid cursor
|
||||
|
|
|
@ -224,7 +224,6 @@ public:
|
|||
void Affiche_Message( const wxString& message );
|
||||
void EraseMsgBox();
|
||||
void Process_PageSettings( wxCommandEvent& event );
|
||||
void SetDrawBgColor( int color_num );
|
||||
virtual void SetToolbars();
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
virtual void ReCreateHToolbar() = 0;
|
||||
|
|
|
@ -417,7 +417,7 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
|
|||
case RATSNEST_VISIBLE: color = m_BoardSettings->m_RatsnestColor; break;
|
||||
case GRID_VISIBLE: color = g_GridColor; break;
|
||||
default:
|
||||
wxLogDebug("BOARD::GetVisibleElementColor(): bad arg %d", aPCB_VISIBLE );
|
||||
wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
|
||||
}
|
||||
|
||||
return color;
|
||||
|
@ -442,7 +442,7 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
|
|||
case RATSNEST_VISIBLE: m_BoardSettings->m_RatsnestColor = aColor; break;
|
||||
case GRID_VISIBLE: g_GridColor = aColor; break;
|
||||
default:
|
||||
wxLogDebug("BOARD::SetVisibleElementColor(): bad arg %d", aPCB_VISIBLE );
|
||||
wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
|
||||
/* PCBNew Board */
|
||||
item = new wxMenuItem( filesMenu, ID_APPEND_FILE, _( "&Append Board" ),
|
||||
_( "Append a other PCBNew board to the current loaded board" ) );
|
||||
_( "Append another PCBNew board to the current loaded board" ) );
|
||||
item->SetBitmap( import_xpm );
|
||||
filesMenu->Append( item );
|
||||
|
||||
|
@ -168,7 +168,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
|
||||
/* Export GenCAD Format */
|
||||
item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
|
||||
_( "&GenCAD" ), _( "Export GenCAD Format" ) );
|
||||
_( "&GenCAD" ), _( "Export GenCAD format" ) );
|
||||
item->SetBitmap( export_xpm );
|
||||
submenuexport->Append( item );
|
||||
|
||||
|
@ -208,13 +208,12 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
wxMenu* submenuarchive = new wxMenu();
|
||||
item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES,
|
||||
_( "Add New Footprints" ),
|
||||
_(
|
||||
"Archive new footprints only in a library (keep other footprints in this lib)" ) );
|
||||
_( "Archive new footprints only in a library (keep other footprints in this lib)" ) );
|
||||
item->SetBitmap( library_update_xpm );
|
||||
submenuarchive->Append( item );
|
||||
item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES,
|
||||
_( "Create Footprint Archive" ),
|
||||
_( "Archive all footprints in a library(old lib will be deleted)" ) );
|
||||
_( "Archive all footprints in a library (old library will be deleted)" ) );
|
||||
item->SetBitmap( library_xpm );
|
||||
submenuarchive->Append( item );
|
||||
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuarchive,
|
||||
|
@ -289,9 +288,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
|
||||
/* Tracks */
|
||||
item = new wxMenuItem( editMenu, ID_MENU_PCB_CLEAN,
|
||||
_( "&Tracks and Vias Cleanup" ),
|
||||
_(
|
||||
"Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ) );
|
||||
_( "&Cleanup Tracks and Vias" ),
|
||||
_( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ) );
|
||||
item->SetBitmap( delete_body_xpm );
|
||||
editMenu->Append( item );
|
||||
|
||||
|
@ -431,7 +429,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
|
||||
/* Pads */
|
||||
item = new wxMenuItem( dimensionsMenu, ID_PCB_PAD_SETUP, _( "Pads" ),
|
||||
_( "Adjust default pads caracteristics" ) );
|
||||
_( "Adjust default pad characteristics" ) );
|
||||
item->SetBitmap( pad_xpm );
|
||||
dimensionsMenu->Append( item );
|
||||
|
||||
|
@ -486,13 +484,13 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
/* Design Rules */
|
||||
item = new wxMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
|
||||
_( "Design Rules" ),
|
||||
_( "Open the design rules dialog editor" ) );
|
||||
_( "Open the design rules editor" ) );
|
||||
item->SetBitmap( hammer_xpm );
|
||||
designRulesMenu->Append( item );
|
||||
|
||||
/* Layers Setup */
|
||||
item = new wxMenuItem( configmenu, ID_PCB_LAYERS_SETUP, _( "&Layers Setup" ),
|
||||
_( "Enable and set properties of layers" ) );
|
||||
_( "Enable and set layer properties" ) );
|
||||
item->SetBitmap( copper_layers_setup_xpm );
|
||||
designRulesMenu->Append( item );
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
ActiveScreen = screen;
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
TraceWorkSheet( DC, screen, 0 );
|
||||
|
||||
|
@ -43,13 +40,13 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
module->Draw( DrawPanel, DC, GR_OR );
|
||||
}
|
||||
|
||||
screen->ClrRefreshReq();
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
/* Redraw the cursor */
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
|
||||
screen->ClrRefreshReq();
|
||||
DrawPanel->DrawCursor( DC );
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,9 +62,6 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
ActiveScreen = screen;
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
|
||||
TraceWorkSheet( DC, GetScreen(), 0 );
|
||||
|
@ -82,7 +76,7 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
// Redraw the cursor
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
DrawPanel->DrawCursor( DC );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue