Eeschema: remove unused headers, unused variables, redundant casts, and minor boolean tweaks.

This commit is contained in:
Mark Roszko 2015-11-03 14:44:05 -05:00 committed by Wayne Stambaugh
parent 602e38dab5
commit 33419ee4bf
27 changed files with 20 additions and 65 deletions

View File

@ -35,10 +35,6 @@
#include <sch_reference_list.h>
#include <class_library.h>
#include <sch_component.h>
#include <lib_pin.h>
#include <boost/foreach.hpp>
void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
{

View File

@ -48,9 +48,6 @@
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <boost/foreach.hpp>
// Imported functions:
extern void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen );
extern void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );

View File

@ -87,7 +87,7 @@ int LIB_EDIT_FRAME::BlockCommand( int key )
bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
int ItemCount = 0;
int nextCmd = false;
bool nextCmd = false;
wxPoint pt;
if( GetScreen()->m_BlockLocate.GetCount() )
@ -323,7 +323,6 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
{
BLOCK_SELECTOR* block;
BASE_SCREEN* screen = aPanel->GetScreen();
wxPoint move_offset;
block = &screen->m_BlockLocate;
LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();

View File

@ -30,7 +30,6 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <schframe.h>
#include <lib_draw_item.h>
@ -43,7 +42,6 @@
#include <sch_text.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <trigo.h>
static void AbortCreateNewLine( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
@ -208,7 +206,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
}
else // A segment is in progress: terminates the current segment and add a new segment.
{
SCH_LINE* prevSegment = (SCH_LINE*) segment->Back();
SCH_LINE* prevSegment = segment->Back();
// Be aware prevSegment can be null when the horizontal and vertical lines only switch is off
// when we create the first segment.

View File

@ -31,11 +31,8 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <eeschema_id.h>
#include <confirm.h>
#include <schframe.h>
#include <general.h>
#include <sch_bus_entry.h>

View File

@ -39,7 +39,6 @@
#include <config_params.h>
#include <wildcards_and_files_ext.h>
#include <project_rescue.h>
//#include <richio.h>
#include <general.h>
#include <class_library.h>
@ -487,8 +486,6 @@ bool PART_LIB::Load( wxString& aErrorMsg )
// There is no header if this is a symbol library.
if( type == LIBRARY_TYPE_EESCHEMA )
{
wxString tmp;
line = reader.Line();
header = FROM_UTF8( line );
@ -648,7 +645,6 @@ bool PART_LIB::LoadDocs( wxString& aErrorMsg )
char line[8000], * name, * text;
LIB_ALIAS* entry;
FILE* file;
wxString msg;
wxFileName fn = fileName;
fn.SetExt( DOC_EXT );
@ -1066,8 +1062,6 @@ void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
}
else
{
wxString pro = aProject->GetProjectFullName();
if( !aProject->ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH, ca ) )
{
wxString msg = wxString::Format( _(

View File

@ -52,7 +52,6 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
int aHotKeyCommandId )
{
SCH_ITEM* item;
wxString msg;
LIB_PIN* Pin = NULL;
SCH_COMPONENT* LibItem = NULL;
wxPoint gridPosition = GetNearestGridPosition( aPosition );

View File

@ -139,7 +139,7 @@ KIFACE_I& Kiface() { return kiface; }
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
{
process = (PGM_BASE*) aProgram;
process = aProgram;
return &kiface;
}

View File

@ -167,7 +167,6 @@ void LIB_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent )
void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
wxFileName fn;
switch( id )
{

View File

@ -337,7 +337,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
bool SCH_EDIT_FRAME::AppendOneEEProject()
{
wxString fullFileName;
wxString msg;
SCH_SCREEN* screen = GetScreen();

View File

@ -65,7 +65,6 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
SCH_SHEET_LIST schematic;
SCH_SHEET_PATH* sheetFoundIn = NULL;
bool wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0;
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
bool warpCursor = ( ( event.GetId() == wxEVT_COMMAND_FIND_CLOSE ) ||
!( event.GetFlags() & FR_NO_WARP_CURSOR ) );
@ -118,7 +117,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
SCH_SHEET_PATH* sheetWithComponentFound = NULL;
SCH_ITEM* item = NULL;
SCH_COMPONENT* Component = NULL;
wxPoint pos, curpos;
wxPoint pos;
bool centerAndRedraw = false;
bool notFound = true;
LIB_PIN* pin;
@ -131,7 +130,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
for( ; sheet != NULL; sheet = sheetList.GetNext() )
{
item = (SCH_ITEM*) sheet->LastDrawList();
item = sheet->LastDrawList();
for( ; ( item != NULL ) && ( notFound == true ); item = item->Next() )
{
@ -306,10 +305,6 @@ bool SCH_EDIT_FRAME::IsSearchCacheObsolete( const SCH_FIND_REPLACE_DATA& aSearch
void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
{
static wxPoint itemPosition; // the actual position of the matched item.
SCH_SHEET_LIST schematic;
wxString msg;
SCH_FIND_REPLACE_DATA searchCriteria;
SCH_FIND_COLLECTOR_DATA data;

View File

@ -93,11 +93,10 @@ bool LIB_BEZIER::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
strtok( line + 2, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" );
strtok( NULL, " \t\n" );
for( i = 0; i < ccount; i++ )
{
wxPoint point;
p = strtok( NULL, " \t\n" );
if( sscanf( p, "%d", &pt.x ) != 1 )
@ -289,7 +288,6 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
wxPoint pos1;
std::vector<wxPoint> PolyPointsTraslated;
EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE );
@ -358,7 +356,7 @@ bool LIB_BEZIER::HitTest( const wxPoint& aRefPos ) const
bool LIB_BEZIER::HitTest( const wxPoint &aPosRef, int aThreshold, const TRANSFORM& aTransform ) const
{
wxPoint ref, start, end;
wxPoint start, end;
if( aThreshold < 0 )
aThreshold = GetPenSize() / 2;

View File

@ -98,11 +98,10 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
strtok( line + 2, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" );
strtok( NULL, " \t\n" );
for( i = 0; i < ccount; i++ )
{
wxPoint point;
p = strtok( NULL, " \t\n" );
if( p == NULL || sscanf( p, "%d", &pt.x ) != 1 )
@ -244,7 +243,6 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
{
aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
aFill = false; // body is now filled, do not fill it later.
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
@ -337,7 +335,7 @@ bool LIB_POLYLINE::HitTest( const wxPoint& aPosition ) const
bool LIB_POLYLINE::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM& aTransform ) const
{
wxPoint ref, start, end;
wxPoint start, end;
if( aThreshold < 0 )
aThreshold = GetPenSize() / 2;

View File

@ -533,7 +533,7 @@ void LIB_EDIT_FRAME::OnUpdatePinByPin( wxUpdateUIEvent& event )
void LIB_EDIT_FRAME::OnUpdatePinTable( wxUpdateUIEvent& event )
{
LIB_PART* part = GetCurPart();
event.Enable( part );
event.Enable( part != NULL );
}
void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )

View File

@ -53,7 +53,6 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
wxString msg;
wxString footprint;
SCH_SHEET_PATH* sheet;
EDA_ITEM* DrawList;
SCH_COMPONENT* component;

View File

@ -30,7 +30,6 @@
#include <fctsys.h>
#include <eeschema_id.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <schframe.h>
#include <menus_helpers.h>

View File

@ -38,7 +38,7 @@
void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
{
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_parent;
SCH_EDIT_FRAME* schframe = m_parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();

View File

@ -43,7 +43,6 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. In
* complex hierarchies, we must update component references and others

View File

@ -105,7 +105,6 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
wxPoint plot_offset;
wxString outputDirName = m_outputDirectoryName->GetValue();
wxFileName outputDir = wxFileName::DirName( outputDirName );
wxString msg;
REPORTER& reporter = m_MessagesBox->Reporter();

View File

@ -248,8 +248,8 @@ bool SCH_COLLECTOR::IsCorner() const
if( GetCount() != 2 )
return false;
bool is_busentry0 = dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_List[0] );
bool is_busentry1 = dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_List[1] );
bool is_busentry0 = (dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_List[0] ) != NULL);
bool is_busentry1 = (dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_List[1] ) != NULL);
if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_LINE_T) )
return true;

View File

@ -601,7 +601,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
Text = wxT( "Sheet: " ) + m_name;
DrawGraphicText( clipbox, aDC, pos_sheetname,
(EDA_COLOR_T) txtcolor, Text, name_orientation,
txtcolor, Text, name_orientation,
wxSize( m_sheetNameSize, m_sheetNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth,
false, false );
@ -614,7 +614,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
Text = wxT( "File: " ) + m_fileName;
DrawGraphicText( clipbox, aDC, pos_filename,
(EDA_COLOR_T) txtcolor, Text, name_orientation,
txtcolor, Text, name_orientation,
wxSize( m_fileNameSize, m_fileNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth,
false, false );

View File

@ -213,7 +213,7 @@ wxString SCH_SHEET_PATH::Path() const
wxString SCH_SHEET_PATH::PathHumanReadable() const
{
wxString s, t;
wxString s;
s = wxT( "/" );

View File

@ -117,7 +117,7 @@ void SCH_SHEET_PIN::SetNumber( int aNumber )
void SCH_SHEET_PIN::SetEdge( SCH_SHEET_PIN::SHEET_SIDE aEdge )
{
SCH_SHEET* Sheet = (SCH_SHEET*) GetParent();
SCH_SHEET* Sheet = GetParent();
// use SHEET_UNDEFINED_SIDE to adjust text orientation without changing edge
@ -161,7 +161,7 @@ enum SCH_SHEET_PIN::SHEET_SIDE SCH_SHEET_PIN::GetEdge() const
void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
{
SCH_SHEET* sheet = (SCH_SHEET*) GetParent();
SCH_SHEET* sheet = GetParent();
if( sheet == NULL )
return;

View File

@ -121,9 +121,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
commandToUndo->m_TransformPoint = aTransformPoint;
ITEM_PICKER itemWrapper( aItem, aCommandType );
if( aItem )
itemWrapper.SetFlags( aItem->GetFlags() );
itemWrapper.SetFlags( aItem->GetFlags() );
switch( aCommandType )
{

View File

@ -465,7 +465,7 @@ void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{
SCH_SCREEN* screen = GetScreen();
SCH_SCREEN* screen;
SCH_SCREENS s_list;
/* Set the sheet count, and the sheet number (1 for root sheet)

View File

@ -96,7 +96,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
}
wxString msg;
wxString tmp;
bool loadFromFile = false;
SCH_SCREEN* useScreen = NULL;
@ -270,7 +269,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
static void resizeSheetWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
wxPoint moveVector;
BASE_SCREEN* screen = aPanel->GetScreen();
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();

View File

@ -140,11 +140,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
ReCreateHToolbar();
ReCreateVToolbar();
wxSize size = GetClientSize();
size.y -= m_MsgFrameHeight + 2;
wxPoint win_pos( 0, 0 );
if( !aLibrary )
{
// Creates the libraries window display
@ -162,7 +157,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
}
// Creates the component window display
win_pos.x = m_libListWidth;
m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST,
wxPoint( 0, 0 ), wxSize(m_cmpListWidth, -1),
0, NULL, wxLB_HSCROLL );