Commit 93b0a083 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor fixes and code cleaning.

* Check to see if image handler is already initialized to prevent warning
  on debug builds.
* Change LIB_PART destructor message output to use wxLogDebug for debugging
  on windows builds.
* Minor code cleaning and coding policy fixes.
parent 4a95880b
...@@ -383,9 +383,15 @@ bool PGM_BASE::initPgm() ...@@ -383,9 +383,15 @@ bool PGM_BASE::initPgm()
App().SetAppName( pgm_name.GetName().Lower() ); App().SetAppName( pgm_name.GetName().Lower() );
// Install some image handlers, mainly for help // Install some image handlers, mainly for help
wxImage::AddHandler( new wxPNGHandler ); if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == NULL )
wxImage::AddHandler( new wxGIFHandler ); wxImage::AddHandler( new wxPNGHandler );
wxImage::AddHandler( new wxJPEGHandler );
if( wxImage::FindHandler( wxBITMAP_TYPE_GIF ) == NULL )
wxImage::AddHandler( new wxGIFHandler );
if( wxImage::FindHandler( wxBITMAP_TYPE_JPEG ) == NULL )
wxImage::AddHandler( new wxJPEGHandler );
wxFileSystem::AddHandler( new wxZipFSHandler ); wxFileSystem::AddHandler( new wxZipFSHandler );
// Analyze the command line & initialize the binary path // Analyze the command line & initialize the binary path
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -241,17 +241,9 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : ...@@ -241,17 +241,9 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) :
LIB_PART::~LIB_PART() LIB_PART::~LIB_PART()
{ {
#if defined(DEBUG) && 1 wxLogDebug( wxT( "%s: destroying part '%s' with alias list count of %d\n" ),
GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ),
if( m_aliases.size() ) int( m_aliases.size() ) );
{
int breakhere = 1;
(void) breakhere;
}
printf( "%s: destroying part '%s' with alias list count of %d\n",
__func__, TO_UTF8( GetName() ), int( m_aliases.size() ) );
#endif
// If the part is being deleted directly rather than through the library, // If the part is being deleted directly rather than through the library,
// delete all of the aliases. // delete all of the aliases.
...@@ -298,8 +290,9 @@ void LIB_PART::SetName( const wxString& aName ) ...@@ -298,8 +290,9 @@ void LIB_PART::SetName( const wxString& aName )
void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset, int aMulti, void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset, int aMulti,
int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor, const TRANSFORM& aTransform, int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
bool aShowPinText, bool aDrawFields, bool aOnlySelected ) const TRANSFORM& aTransform, bool aShowPinText, bool aDrawFields,
bool aOnlySelected )
{ {
BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL; BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
...@@ -469,7 +462,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, ...@@ -469,7 +462,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) ) if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue; continue;
// The reference is a special case: we shoud change the basic text // The reference is a special case: we should change the basic text
// to add '?' and the part id // to add '?' and the part id
LIB_FIELD& field = (LIB_FIELD&) item; LIB_FIELD& field = (LIB_FIELD&) item;
wxString tmp = field.GetShownText(); wxString tmp = field.GetShownText();
...@@ -511,7 +504,8 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD ...@@ -511,7 +504,8 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD
if( *i == aItem ) if( *i == aItem )
{ {
if( aDc != NULL ) if( aDc != NULL )
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR,
g_XorMode, NULL, DefaultTransform );
drawings.erase( i ); drawings.erase( i );
SetModified(); SetModified();
...@@ -1466,7 +1460,7 @@ void LIB_PART::RotateSelectedItems( const wxPoint& aCenter ) ...@@ -1466,7 +1460,7 @@ void LIB_PART::RotateSelectedItems( const wxPoint& aCenter )
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
KICAD_T aType, const wxPoint& aPoint ) KICAD_T aType, const wxPoint& aPoint )
{ {
BOOST_FOREACH( LIB_ITEM& item, drawings ) BOOST_FOREACH( LIB_ITEM& item, drawings )
{ {
...@@ -1484,7 +1478,7 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, ...@@ -1484,7 +1478,7 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
const wxPoint& aPoint, const TRANSFORM& aTransform ) const wxPoint& aPoint, const TRANSFORM& aTransform )
{ {
/* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
* wxPoint& pt ) to search items. * wxPoint& pt ) to search items.
...@@ -1763,15 +1757,6 @@ void LIB_PART::AddAlias( const wxString& aName ) ...@@ -1763,15 +1757,6 @@ void LIB_PART::AddAlias( const wxString& aName )
} }
/** Set the separator char between the subpart id and the reference
* 0 (no separator) or '.' , '-' and '_'
* and the ascii char value to calculate the subpart symbol id from the part number:
* 'A' or '1' only are allowed. (to print U1.A or U1.1)
* if this is a digit, a number is used as id symbol
* Note also if the subpart symbol is a digit, the separator cannot be null.
* @param aSep = the separator symbol (0 (no separator) or '.' , '-' and '_')
* @param aFirstId = the Id of the first part ('A' or '1')
*/
void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId ) void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId )
{ {
m_subpartFirstId = 'A'; m_subpartFirstId = 'A';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment