Small cleanup: remove a few unnecessary casts, and minor cleaning code.

This commit is contained in:
unknown 2015-09-03 09:44:30 +02:00 committed by jean-pierre charras
parent 4a56ee42c5
commit 8fedc57499
10 changed files with 14 additions and 21 deletions

View File

@ -619,7 +619,7 @@ public:
*/
virtual void SetActiveLayer( LAYER_ID aLayer )
{
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
GetScreen()->m_Active_Layer = aLayer;
}
/**
@ -628,7 +628,7 @@ public:
*/
virtual LAYER_ID GetActiveLayer() const
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
return GetScreen()->m_Active_Layer;
}
void LoadSettings( wxConfigBase* aCfg ); // override virtual

View File

@ -367,7 +367,7 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
// Note: virtual, overridden in PCB_EDIT_FRAME;
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
{
LAYER_ID preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
LAYER_ID preslayer = GetActiveLayer();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// Check if the specified layer matches the present layer
@ -583,7 +583,7 @@ BOARD_ITEM* PCB_BASE_FRAME::GetCurItem()
GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
{
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->GetVisibleLayers(),
( (PCB_SCREEN*)GetScreen())->m_Active_Layer );
GetActiveLayer() );
// account for the globals
guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( MOD_TEXT_INVISIBLE ));

View File

@ -74,7 +74,7 @@ void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
{
PCB_SCREEN* screen = (PCB_SCREEN*) ( parent->GetScreen() );
PCB_SCREEN* screen = parent->GetScreen();
wxPoint pos;
foundItem = NULL;
@ -144,7 +144,7 @@ void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
{
PCB_SCREEN* screen = (PCB_SCREEN*) ( parent->GetScreen() );
PCB_SCREEN* screen = parent->GetScreen();
wxPoint pos;
foundItem = NULL;

View File

@ -143,7 +143,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
LAYER_ID lyrSelect = m_parent->GetActiveLayer();
if( m_zone )
lyrSelect = m_zone->GetLayer();

View File

@ -203,7 +203,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
GetBoard()->Add( textePcb );
textePcb->SetFlags( IS_NEW );
LAYER_ID layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
LAYER_ID layer = GetActiveLayer();
textePcb->SetLayer( layer );

View File

@ -50,10 +50,10 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
if( aTrack == NULL )
{
if( GetActiveLayer() != ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
SetActiveLayer( ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP );
if( GetActiveLayer() != GetScreen()->m_Route_Layer_TOP )
SetActiveLayer( GetScreen()->m_Route_Layer_TOP );
else
SetActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
SetActiveLayer( GetScreen()->m_Route_Layer_BOTTOM );
UpdateStatusBar();
return true;

View File

@ -104,7 +104,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
// This frame is always show modal:
SetModal( true );
m_configPath = FOOTPRINT_WIZARD_FRAME_NAME;
m_showAxis = true; // true to draw axis.
// Give an icon
@ -391,8 +390,6 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
wxConfigPathChanger cpc( aCfg, m_configPath );
aCfg->Read( PARTLIST_WIDTH_KEY, &m_pageListWidth, 100 );
aCfg->Read( PARAMLIST_WIDTH_KEY, &m_parameterGridWidth, 200 );
@ -409,7 +406,6 @@ void FOOTPRINT_WIZARD_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
wxConfigPathChanger cpc( aCfg, m_configPath );
aCfg->Write( PARTLIST_WIDTH_KEY, m_pageList->GetSize().x );
aCfg->Write( PARAMLIST_WIDTH_KEY, m_parameterGrid->GetSize().x );
}

View File

@ -51,9 +51,6 @@ private:
wxGrid* m_parameterGrid; ///< The list of parameters
int m_parameterGridWidth; ///< size of the grid
// Flags
wxString m_configPath; ///< subpath for configuration
// Column index to display parameters in m_parameterGrid
static int m_columnPrmName;
static int m_columnPrmValue;

View File

@ -110,7 +110,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
}
Route_Layer_TOP_color =
g_ColorsSettings.GetLayerColor( ( ( PCB_SCREEN* ) GetScreen() )->m_Route_Layer_TOP );
g_ColorsSettings.GetLayerColor( GetScreen()->m_Route_Layer_TOP );
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
{
@ -119,7 +119,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
}
Route_Layer_BOTTOM_color =
g_ColorsSettings.GetLayerColor( ( (PCB_SCREEN*) GetScreen() )->m_Route_Layer_BOTTOM );
g_ColorsSettings.GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM );
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
{

View File

@ -59,7 +59,7 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
PCB_SCREEN* screen = GetScreen();
if( !GetBoard() || !screen )
return;