Upstream merge.

This commit is contained in:
Maciej Suminski 2014-05-12 17:17:51 +02:00
commit d6fd8b2e23
60 changed files with 862 additions and 1110 deletions

View File

@ -157,7 +157,7 @@ bool EDA_BASE_FRAME::Enable( bool enable )
#if defined(DEBUG) #if defined(DEBUG)
const char* type_id = typeid( *this ).name(); const char* type_id = typeid( *this ).name();
printf( "wxFrame %s: %s\n", type_id, enable ? "enabled" : "disabled" ); printf( "wxFrame %-28s: %s\n", type_id, enable ? "enabled" : "disabled" );
#endif #endif
return wxFrame::Enable( enable ); return wxFrame::Enable( enable );

View File

@ -244,8 +244,12 @@ int DIALOG_SHIM::ShowQuasiModal()
if( win ) if( win )
win->ReleaseMouse(); win->ReleaseMouse();
// Get the optimal parent
wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() ); wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
// Show the optimal parent
DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
ENABLE_DISABLE toggle( parent ); // quasi-modal: disable only my "optimal" parent ENABLE_DISABLE toggle( parent ); // quasi-modal: disable only my "optimal" parent
Show( true ); Show( true );

View File

@ -137,6 +137,12 @@ FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) :
} }
FP_LIB_TABLE::~FP_LIB_TABLE()
{
// *fallBack is not owned here.
}
wxArrayString FP_LIB_TABLE::FootprintEnumerate( const wxString& aNickname ) wxArrayString FP_LIB_TABLE::FootprintEnumerate( const wxString& aNickname )
{ {
const ROW* row = FindRow( aNickname ); const ROW* row = FindRow( aNickname );
@ -514,9 +520,16 @@ std::vector<wxString> FP_LIB_TABLE::GetLogicalLibs()
} while( ( cur = cur->fallBack ) != 0 ); } while( ( cur = cur->fallBack ) != 0 );
ret.reserve( unique.size() );
// DBG(printf( "%s: count:%zd\n", __func__, unique.size() );)
// return a sorted, unique set of nicknames in a std::vector<wxString> to caller // return a sorted, unique set of nicknames in a std::vector<wxString> to caller
for( std::set<wxString>::const_iterator it = unique.begin(); it!=unique.end(); ++it ) for( std::set<wxString>::const_iterator it = unique.begin(); it!=unique.end(); ++it )
{
//DBG(printf( " %s\n", TO_UTF8( *it ) );)
ret.push_back( *it ); ret.push_back( *it );
}
return ret; return ret;
} }
@ -738,7 +751,7 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
void FP_LIB_TABLE::Load( const wxString& aFileName ) void FP_LIB_TABLE::Load( const wxString& aFileName )
throw( IO_ERROR ) throw( IO_ERROR )
{ {
// Empty footprint library tables are valid. // It's OK if footprint library tables are missing.
if( wxFileName::IsFileReadable( aFileName ) ) if( wxFileName::IsFileReadable( aFileName ) )
{ {
FILE_LINE_READER reader( aFileName ); FILE_LINE_READER reader( aFileName );

View File

@ -53,7 +53,7 @@ KIWAY::KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop ):
// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are // Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
// propogated upwards to parent windows if not handled below. Therefor the // propogated upwards to parent windows if not handled below. Therefore the
// m_top window should receive all wxWindowDestroyEvents originating from // m_top window should receive all wxWindowDestroyEvents originating from
// KIWAY_PLAYERs. It does anyways, but now player_destroy_handler eavesdrops // KIWAY_PLAYERs. It does anyways, but now player_destroy_handler eavesdrops
// on that event stream looking for KIWAY_PLAYERs being closed. // on that event stream looking for KIWAY_PLAYERs being closed.
@ -67,10 +67,14 @@ void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
// if destroying one of our flock, then mark it as deceased. // if destroying one of our flock, then mark it as deceased.
if( (wxWindow*) m_player[i] == w ) if( (wxWindow*) m_player[i] == w )
{ {
DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );) DBG(printf( "%s: m_player[%d] destroyed: %s\n",
__func__, i, TO_UTF8( m_player[i]->GetName() ) );)
m_player[i] = 0; m_player[i] = 0;
} }
} }
// event.Skip(); skip to who, the wxApp? I'm the top window.
} }

View File

@ -45,7 +45,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ), EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
KIWAY_HOLDER( aKiway ), KIWAY_HOLDER( aKiway ),
m_modal( false ), m_modal( false ),
m_modal_loop( 0 ) m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
{ {
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );) // DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
} }
@ -57,7 +57,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ), EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
KIWAY_HOLDER( 0 ), KIWAY_HOLDER( 0 ),
m_modal( false ), m_modal( false ),
m_modal_loop( 0 ) m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
{ {
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );) // DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
} }
@ -72,7 +72,7 @@ void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )
} }
bool KIWAY_PLAYER::ShowModal( wxString* aResult ) bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow )
{ {
wxASSERT_MSG( IsModal(), wxT( "ShowModal() shouldn't be called on non-modal frame" ) ); wxASSERT_MSG( IsModal(), wxT( "ShowModal() shouldn't be called on non-modal frame" ) );
@ -94,24 +94,31 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult )
~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
} clear_this( (void*&) m_modal_loop ); } clear_this( (void*&) m_modal_loop );
// exception safe way to disable all frames except the modal one,
// re-enables only those that were disabled on exit
wxWindowDisabler toggle( this );
m_modal_resultant_parent = aResultantFocusWindow;
Show( true ); Show( true );
SetFocus();
WX_EVENT_LOOP event_loop; {
// exception safe way to disable all frames except the modal one,
// re-enables only those that were disabled on exit
wxWindowDisabler toggle( this );
WX_EVENT_LOOP event_loop;
#if wxCHECK_VERSION( 2, 9, 4 ) // 2.9.4 is only approximate. #if wxCHECK_VERSION( 2, 9, 4 ) // 2.9.4 is only approximate.
// new code needs this, old code does it in wxEventLoop::Run() and cannot // new code needs this, old code does it in wxEventLoop::Run() and cannot
// tolerate it here. Where that boundary is as a version number, I don't know. // tolerate it here. Where that boundary is as a version number, I don't know.
// A closer look at the subversion repo for wx would tell. // A closer look at the subversion repo for wx would tell.
wxEventLoopActivator event_loop_stacker( &event_loop ); wxEventLoopActivator event_loop_stacker( &event_loop );
#endif #endif
m_modal_loop = &event_loop; m_modal_loop = &event_loop;
event_loop.Run(); event_loop.Run();
} // End of scop for some variables.
// End nesting before setting focus below.
if( aResult ) if( aResult )
*aResult = m_modal_string; *aResult = m_modal_string;
@ -119,9 +126,29 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult )
DBG(printf( "~%s: aResult:'%s' ret:%d\n", DBG(printf( "~%s: aResult:'%s' ret:%d\n",
__func__, TO_UTF8( m_modal_string ), m_modal_ret_val );) __func__, TO_UTF8( m_modal_string ), m_modal_ret_val );)
if( aResultantFocusWindow )
{
aResultantFocusWindow->Raise();
// have the final say, after wxWindowDisabler reenables my parent and
// the events settle down, set the focus
wxYield();
aResultantFocusWindow->SetFocus();
}
return m_modal_ret_val; return m_modal_ret_val;
} }
bool KIWAY_PLAYER::Destroy()
{
// Needed on Windows to leave the modal parent on top with focus
#ifdef __WINDOWS__
if( m_modal_resultant_parent && GetParent() != m_modal_resultant_parent )
Reparent( m_modal_resultant_parent );
#endif
return EDA_BASE_FRAME::Destroy();
}
bool KIWAY_PLAYER::IsDismissed() bool KIWAY_PLAYER::IsDismissed()
{ {

View File

@ -42,15 +42,22 @@ PROJECT::PROJECT()
memset( m_elems, 0, sizeof(m_elems) ); memset( m_elems, 0, sizeof(m_elems) );
} }
void PROJECT::ElemsClear()
{
// careful here, this should work, but the virtual destructor may not
// be in the same link image as PROJECT.
for( unsigned i = 0; i<DIM(m_elems); ++i )
{
delete m_elems[i];
m_elems[i] = NULL;
}
}
PROJECT::~PROJECT() PROJECT::~PROJECT()
{ {
#if 1 ElemsClear();
// careful here, this may work, but the virtual destructor may not
// be in the same link image as PROJECT.
for( unsigned i = 0; i<DIM(m_elems); ++i )
delete m_elems[i];
#endif
} }
@ -145,21 +152,29 @@ RETAINED_PATH& PROJECT::RPath( RETPATH_T aIndex )
} }
PROJECT::_ELEM* PROJECT::Elem( ELEM_T aIndex, _ELEM* aElem ) PROJECT::_ELEM* PROJECT::GetElem( ELEM_T aIndex )
{ {
unsigned ndx = unsigned( aIndex ); // This is virtual, so implement it out of line
if( ndx < DIM( m_elems ) ) if( unsigned( aIndex ) < DIM( m_elems ) )
{ {
if( aElem ) return m_elems[aIndex];
m_elems[ndx] = aElem;
return m_elems[ndx];
} }
return NULL; return NULL;
} }
void PROJECT::SetElem( ELEM_T aIndex, _ELEM* aElem )
{
// This is virtual, so implement it out of line
if( unsigned( aIndex ) < DIM( m_elems ) )
{
m_elems[aIndex] = aElem;
}
}
// non-member so it can be moved easily, and kept REALLY private. // non-member so it can be moved easily, and kept REALLY private.
// Do NOT Clear() in here. // Do NOT Clear() in here.
static void add_search_paths( SEARCH_STACK* aDst, wxConfigBase* aCfg, int aIndex ) static void add_search_paths( SEARCH_STACK* aDst, wxConfigBase* aCfg, int aIndex )

View File

@ -100,7 +100,6 @@ if( USE_KIWAY_DLLS )
cvpcb.cpp cvpcb.cpp
${CVPCB_SRCS} ${CVPCB_SRCS}
${CVPCB_DIALOGS} ${CVPCB_DIALOGS}
# ${CVPCB_RESOURCES}
) )
set_target_properties( cvpcb_kiface PROPERTIES set_target_properties( cvpcb_kiface PROPERTIES
OUTPUT_NAME cvpcb OUTPUT_NAME cvpcb
@ -148,12 +147,6 @@ if( USE_KIWAY_DLLS )
target_link_libraries( cvpcb_kiface rt ) target_link_libraries( cvpcb_kiface rt )
endif() endif()
if( APPLE )
set_target_properties( cvpcb PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
endif()
set_source_files_properties( cvpcb.cpp PROPERTIES set_source_files_properties( cvpcb.cpp PROPERTIES
# The KIFACE is in cvpcb.cpp, export it: # The KIFACE is in cvpcb.cpp, export it:
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL" COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
@ -172,18 +165,16 @@ if( USE_KIWAY_DLLS )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( TARGETS cvpcb_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE ) if( APPLE )
# copies kiface into the bundle # puts the *.kiface into the *.app bundle while linking
add_custom_target( _cvpcb_kiface_copy ALL set_target_properties( cvpcb_kiface PROPERTIES
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/cvpcb/_cvpcb.kiface "${CMAKE_BINARY_DIR}/cvpcb/cvpcb.app/Contents/MacOS/" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cvpcb.app/Contents/MacOS/
DEPENDS cvpcb_kiface )
COMMENT "Copying kiface into cvpcb" else()
) install( TARGETS cvpcb_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif() endif()
else() else()
@ -228,15 +219,15 @@ else()
# Must follow github_plugin # Must follow github_plugin
target_link_libraries( cvpcb ${Boost_LIBRARIES} ) target_link_libraries( cvpcb ${Boost_LIBRARIES} )
if( APPLE )
set_target_properties( cvpcb PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
endif()
install( TARGETS cvpcb install( TARGETS cvpcb
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
endif()
if( APPLE )
set_target_properties( cvpcb PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
endif() endif()

View File

@ -81,23 +81,8 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
if( m_NetlistFileExtension.IsEmpty() ) if( m_NetlistFileExtension.IsEmpty() )
m_NetlistFileExtension = wxT( "net" ); m_NetlistFileExtension = wxT( "net" );
// empty the table, Load() it again below. // Force it to be loaded on demand.
FootprintLibs()->Clear(); prj.ElemClear( PROJECT::ELEM_FPTBL );
/* this is done by ConfigLoad(), and that sets the env var too.
prj.SetProjectFullName( fn.GetFullPath() );
*/
wxString projectFpLibTableFileName = prj.FootprintLibTblName();
try
{
FootprintLibs()->Load( projectFpLibTableFileName );
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.errorText );
}
} }

View File

@ -488,7 +488,8 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ), wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ),
fpname.c_str(), nickname.c_str() ); fpname.c_str(), nickname.c_str() );
footprint = FootprintLibs()->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) ); footprint = Prj().PcbFootprintLibs()->FootprintLoad(
FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {

View File

@ -128,7 +128,7 @@ void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList )
{ {
RefreshItems( 0L, m_libraryList.Count()-1 ); RefreshItems( 0L, m_libraryList.Count()-1 );
#if defined (__WXGTK__ ) // && wxMINOR_VERSION == 8 #if defined (__WXGTK__ ) && wxMINOR_VERSION == 8
// @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the
// column parameter is -1. This was the only way to prevent GTK3 from // column parameter is -1. This was the only way to prevent GTK3 from
// ellipsizing long strings down to a few characters. It still doesn't set // ellipsizing long strings down to a few characters. It still doesn't set

View File

@ -200,24 +200,6 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
} }
FP_LIB_TABLE* CVPCB_MAINFRAME::FootprintLibs() const
{
PROJECT& prj = Prj();
FP_LIB_TABLE* tbl = dynamic_cast<FP_LIB_TABLE*>( prj.Elem( PROJECT::FPTBL ) );
if( !tbl )
{
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
// stack this way, all using the same global fallback table.
tbl = new FP_LIB_TABLE( &GFootprintTable );
prj.Elem( PROJECT::FPTBL, tbl );
}
return tbl;
}
void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg ) void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
{ {
EDA_BASE_FRAME::LoadSettings( aCfg ); EDA_BASE_FRAME::LoadSettings( aCfg );
@ -493,7 +475,7 @@ void CVPCB_MAINFRAME::ConfigCvpcb( wxCommandEvent& event )
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent ) void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
{ {
bool tableChanged = false; bool tableChanged = false;
int r = InvokePcbLibTableEditor( this, &GFootprintTable, FootprintLibs() ); int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
if( r & 1 ) if( r & 1 )
{ {
@ -521,7 +503,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
try try
{ {
FootprintLibs()->Save( fileName ); Prj().PcbFootprintLibs()->Save( fileName );
tableChanged = true; tableChanged = true;
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
@ -538,7 +520,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
if( tableChanged ) if( tableChanged )
{ {
BuildLIBRARY_LISTBOX(); BuildLIBRARY_LISTBOX();
m_footprints.ReadFootprintFiles( FootprintLibs() ); m_footprints.ReadFootprintFiles( Prj().PcbFootprintLibs() );
} }
} }
@ -735,7 +717,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
bool CVPCB_MAINFRAME::LoadFootprintFiles() bool CVPCB_MAINFRAME::LoadFootprintFiles()
{ {
FP_LIB_TABLE* fptbl = FootprintLibs(); FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
// Check if there are footprint libraries in the footprint library table. // Check if there are footprint libraries in the footprint library table.
if( !fptbl || !fptbl->GetLogicalLibs().size() ) if( !fptbl || !fptbl->GetLogicalLibs().size() )
@ -1012,11 +994,13 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
wxFONTWEIGHT_NORMAL ) ); wxFONTWEIGHT_NORMAL ) );
} }
if( FootprintLibs() ) FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
if( tbl )
{ {
wxArrayString libNames; wxArrayString libNames;
std::vector< wxString > libNickNames = FootprintLibs()->GetLogicalLibs(); std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
for( unsigned ii = 0; ii < libNickNames.size(); ii++ ) for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
libNames.Add( libNickNames[ii] ); libNames.Add( libNickNames[ii] );

View File

@ -88,12 +88,6 @@ public:
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ); // overload KIWAY_PLAYER bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ); // overload KIWAY_PLAYER
/**
* Function FootprintLibs
* @return the project #FP_LIB_TABLE.
*/
FP_LIB_TABLE* FootprintLibs() const;
/** /**
* @return a pointer on the Footprint Viewer frame, if exists, or NULL * @return a pointer on the Footprint Viewer frame, if exists, or NULL
*/ */

View File

@ -119,346 +119,6 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
} }
#if 0
/*
This code block was based on two major assumptions that are no longer true:
1) Footprint library basenames would remain the same.
(But no, basenames have been renamed in the github repo.)
2) *.mod files would still be around and merely reside in the FP_LIB_TABLE.
(But no, they have been converted to *.pretty.)
There is a newer replacement code block in the #else region.
*/
/**
* Function missingLegacyLibs
* tests the list of \a aLibNames by URI to determine if any of them are missing from
* the #FP_LIB_TABLE.
*
* @note The missing legacy footprint library test is performed by using old library
* file path lookup method. If the library is found, it is compared against all
* of the URIs in the table rather than the nickname. This was done because the
* user could change the nicknames from the default table. Using the full path
* is more reliable.
*
* @param aLibNames is the list of legacy library names.
* @param aErrorMsg is a pointer to a wxString object to store the URIs of any missing
* legacy library paths. Can be NULL.
* @return true if there are missing legacy libraries. Otherwise false.
*/
static bool missingLegacyLibs( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack,
const wxArrayString& aLibNames, wxString* aErrorMsg )
{
bool missing = false;
for( unsigned i = 0; i < aLibNames.GetCount(); i++ )
{
wxFileName fn( wxEmptyString, aLibNames[i], LegacyFootprintLibPathExtension );
wxString legacyLibPath = aSStack.FindValidPath( fn.GetFullPath() );
/*
if( legacyLibPath.IsEmpty() )
continue;
*/
if( !aTbl->FindRowByURI( legacyLibPath ) )
{
missing = true;
if( aErrorMsg )
{
*aErrorMsg += wxChar( '"' );
if( !legacyLibPath )
*aErrorMsg += !legacyLibPath ? aLibNames[i] : legacyLibPath;
*aErrorMsg += wxT( "\"\n" );
}
}
}
return missing;
}
/**
* Function convertFromLegacy
* converts the footprint names in \a aNetList from the legacy format to the #FPID format.
*
* @param aNetList is the #NETLIST object to convert.
* @param aLibNames is the list of legacy footprint library names from the currently loaded
* project.
* @param aReporter is the #REPORTER object to dump messages into.
* @return true if all footprint names were successfully converted to a valid FPID.
*/
static bool convertFromLegacy( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack, NETLIST& aNetList,
const wxArrayString& aLibNames, REPORTER* aReporter = NULL ) throw( IO_ERROR )
{
wxString msg;
FPID lastFPID;
COMPONENT* component;
MODULE* module = 0;
bool retv = true;
if( aNetList.IsEmpty() )
return true;
aNetList.SortByFPID();
wxString libPath;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned ii = 0; ii < aNetList.GetCount(); ii++ )
{
component = aNetList.GetComponent( ii );
// The footprint hasn't been assigned yet so ignore it.
if( component->GetFPID().empty() )
continue;
if( component->GetFPID() != lastFPID )
{
module = NULL;
for( unsigned ii = 0; ii < aLibNames.GetCount(); ii++ )
{
wxFileName fn( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
libPath = aSStack.FindValidPath( fn.GetFullPath() );
if( !libPath )
{
if( aReporter )
{
msg.Printf( _( "Cannot find footprint library file '%s' in any of the "
"KiCad legacy library search paths.\n" ),
GetChars( fn.GetFullPath() ) );
aReporter->Report( msg );
}
retv = false;
continue;
}
module = pi->FootprintLoad( libPath, component->GetFPID().GetFootprintName() );
if( module )
{
lastFPID = component->GetFPID();
break;
}
}
}
if( !module )
{
if( aReporter )
{
msg.Printf( _( "Component '%s' footprint '%s' was not found in any legacy "
"library.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().Format() ) );
aReporter->Report( msg );
}
// Clear the footprint assignment since the old library lookup method is no
// longer valid.
FPID emptyFPID;
component->SetFPID( emptyFPID );
retv = false;
continue;
}
else
{
wxString libNickname;
const FP_LIB_TABLE::ROW* row;
if( ( row = aTbl->FindRowByURI( libPath ) ) != NULL )
libNickname = row->GetNickName();
if( libNickname.IsEmpty() )
{
if( aReporter )
{
msg.Printf( _( "Component '%s' with footprint '%s' and legacy library path '%s' "
"was not found in the footprint library table.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().Format() ),
GetChars( libPath )
);
aReporter->Report( msg );
}
retv = false;
}
else
{
FPID newFPID = lastFPID;
newFPID.SetLibNickname( libNickname );
if( !newFPID.IsValid() )
{
if( aReporter )
{
msg.Printf( _( "Component '%s' FPID '%s' is not valid.\n" ),
GetChars( component->GetReference() ),
GetChars( newFPID.Format() ) );
aReporter->Report( msg );
}
retv = false;
}
else
{
// The footprint name should already be set.
component->SetFPID( newFPID );
}
}
}
}
return retv;
}
bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{
COMPONENT* component;
wxString msg;
bool isLegacy = true;
ReadSchematicNetlist();
if( m_ListCmp == NULL )
return false;
LoadProjectFile( m_NetlistFileName.GetFullPath() );
LoadFootprintFiles();
BuildFOOTPRINTS_LISTBOX();
BuildLIBRARY_LISTBOX();
m_ListCmp->Clear();
m_undefinedComponentCnt = 0;
if( m_netlist.AnyFootprintsLinked() )
{
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
component = m_netlist.GetComponent( i );
if( component->GetFPID().empty() )
continue;
if( isLegacy )
{
if( !component->GetFPID().IsLegacy() )
isLegacy = false;
}
}
}
else
{
isLegacy = false; // None of the components have footprints assigned.
}
wxString missingLibs;
// Check if footprint links were generated before the footprint library table was implemented.
if( isLegacy )
{
if( missingLegacyLibs( FootprintLibs(), Prj().PcbSearchS(), m_ModuleLibNames, &missingLibs ) )
{
msg = wxT( "The following legacy libraries are defined in the project file "
"but were not found in the footprint library table:\n\n" ) + missingLibs;
msg += wxT( "\nDo you want to update the footprint library table before "
"attempting to update the assigned footprints?" );
if( IsOK( this, msg ) )
{
wxCommandEvent cmd;
OnEditFootprintLibraryTable( cmd );
}
}
msg = wxT( "Some or all of the assigned footprints contain legacy entries. Would you "
"like CvPcb to attempt to convert them to the new footprint library table "
"format?" );
if( IsOK( this, msg ) )
{
msg.Clear();
WX_STRING_REPORTER reporter( &msg );
SEARCH_STACK& search = Prj().SchSearchS();
if( !convertFromLegacy( FootprintLibs(), search, m_netlist, m_ModuleLibNames, &reporter ) )
{
HTML_MESSAGE_BOX dlg( this, wxEmptyString );
dlg.MessageSet( wxT( "The following errors occurred attempting to convert the "
"footprint assignments:\n\n" ) );
dlg.ListSet( msg );
dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them "
"to be updated correctly the next time you import the "
"netlist in Pcbnew." ) );
dlg.ShowModal();
}
m_modified = true;
}
else
{
// Clear the legacy footprint assignments.
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
FPID emptyFPID;
component = m_netlist.GetComponent( i );
component->SetFPID( emptyFPID );
m_modified = true;
}
}
}
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
component = m_netlist.GetComponent( i );
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
m_ListCmp->AppendLine( msg );
if( component->GetFPID().empty() )
{
m_undefinedComponentCnt += 1;
continue;
}
}
if( !m_netlist.IsEmpty() )
m_ListCmp->SetSelection( 0, true );
DisplayStatus();
UpdateTitle();
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
return true;
}
#else // new strategy
/// Return true if the resultant FPID has a certain nickname. The guess /// Return true if the resultant FPID has a certain nickname. The guess
/// is only made if this footprint resides in only one library. /// is only made if this footprint resides in only one library.
/// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches /// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches
@ -503,7 +163,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{ {
wxString msg; wxString msg;
bool hasMissingNicks = false; bool hasMissingNicks = false;
FP_LIB_TABLE* tbl = FootprintLibs();
ReadSchematicNetlist(); ReadSchematicNetlist();
@ -512,6 +171,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
LoadProjectFile( m_NetlistFileName.GetFullPath() ); LoadProjectFile( m_NetlistFileName.GetFullPath() );
LoadFootprintFiles(); LoadFootprintFiles();
BuildFOOTPRINTS_LISTBOX(); BuildFOOTPRINTS_LISTBOX();
BuildLIBRARY_LISTBOX(); BuildLIBRARY_LISTBOX();
@ -554,6 +214,9 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
if( component->GetFPID().IsLegacy() ) if( component->GetFPID().IsLegacy() )
{ {
// get this first here, it's possibly obsoleted if we get it too soon.
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
int guess = guessNickname( tbl, (FPID*) &component->GetFPID() ); int guess = guessNickname( tbl, (FPID*) &component->GetFPID() );
switch( guess ) switch( guess )
@ -659,9 +322,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
} }
#endif
int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
{ {
wxFileName fn; wxFileName fn;
@ -685,7 +345,7 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
fn.SetExt( ComponentFileExtension ); fn.SetExt( ComponentFileExtension );
// Save the project specific footprint library table. // Save the project specific footprint library table.
if( !FootprintLibs()->IsEmpty( false ) ) if( !Prj().PcbFootprintLibs()->IsEmpty( false ) )
{ {
wxString fp_lib_tbl = Prj().FootprintLibTblName(); wxString fp_lib_tbl = Prj().FootprintLibTblName();
@ -695,7 +355,7 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
{ {
try try
{ {
FootprintLibs()->Save( fp_lib_tbl ); Prj().PcbFootprintLibs()->Save( fp_lib_tbl );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {

View File

@ -311,20 +311,18 @@ if( USE_KIWAY_DLLS )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( TARGETS eeschema_kiface
# actual filename subject to change at milestone C)
# modular-kicad blueprint.
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE ) if( APPLE )
# copies kiface into the bundle # puts the *.kiface into the *.app bundle while linking
add_custom_target( _eeschema_kiface_copy ALL set_target_properties( eeschema_kiface PROPERTIES
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/eeschema/_eeschema.kiface "${CMAKE_BINARY_DIR}/eeschema/eeschema.app/Contents/MacOS/" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/eeschema.app/Contents/MacOS/
DEPENDS eeschema_kiface )
COMMENT "Copying kiface into eeschema" else()
) install( TARGETS eeschema_kiface
# actual filename subject to change at milestone C)
# modular-kicad blueprint.
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif() endif()
else() else()

View File

@ -2,54 +2,36 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key> <string>Editor</string>
<string>Editor</string> <key>CFBundleTypeExtensions</key>
<key>CFBundleTypeExtensions</key> <array>
<array> <string>sch</string>
<string>sch</string> </array>
</array>
<key>CFBundleTypeIconFile</key> <key>CFBundleTypeIconFile</key> <string>eeschema.icns</string>
<string>eeschema.icns</string> <key>CFBundleTypeName</key> <string>eeschema document</string>
<key>CFBundleTypeName</key> <key>LSHandlerRank</key> <string>Owner</string>
<string>eeschema document</string> </dict>
<key>LSHandlerRank</key> </array>
<string>Owner</string>
</dict> <key>CFBundleDevelopmentRegion</key> <string>English</string>
</array> <key>CFBundleExecutable</key> <string>eeschema</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleGetInfoString</key> <string></string>
<string>English</string> <key>CFBundleIconFile</key> <string>eeschema.icns</string>
<key>CFBundleExecutable</key> <key>CFBundleIdentifier</key> <string>org.kicad-eda.eeschema</string>
<string>eeschema</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleGetInfoString</key> <key>CFBundleLongVersionString</key> <string></string>
<string></string> <key>CFBundleName</key> <string>EESchema</string>
<key>CFBundleIconFile</key> <key>CFBundlePackageType</key> <string>APPL</string>
<string>eeschema.icns</string> <key>CFBundleShortVersionString</key> <string></string>
<key>CFBundleIdentifier</key> <key>CFBundleSignature</key> <string>????</string>
<string>org.kicad-eda.eeschema</string> <key>CFBundleVersion</key> <string></string>
<key>CFBundleInfoDictionaryVersion</key> <key>CSResourcesFileMapped</key> <true/>
<string>6.0</string> <key>LSRequiresCarbon</key> <true/>
<key>CFBundleLongVersionString</key> <key>NSHumanReadableCopyright</key> <string></string>
<string></string> <key>NSHighResolutionCapable</key> <string>True</string>
<key>CFBundleName</key>
<string>EESchema</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict> </dict>
</plist> </plist>

View File

@ -436,13 +436,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::deleteFieldButtonHandler( wxCommandEven
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& event ) void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& event )
{ {
#if 0
wxString datasheet_uri = fieldValueTextCtrl->GetValue();
::wxLaunchDefaultBrowser( datasheet_uri );
#else
unsigned fieldNdx = getSelectedFieldNdx(); unsigned fieldNdx = getSelectedFieldNdx();
if( fieldNdx == DATASHEET ) if( fieldNdx == DATASHEET )
{ {
wxString datasheet_uri = fieldValueTextCtrl->GetValue(); wxString datasheet_uri = fieldValueTextCtrl->GetValue();
@ -455,17 +450,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& even
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true ); KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
if( frame->ShowModal( &fpid ) ) if( frame->ShowModal( &fpid, this ) )
{ {
printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); // DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
fieldValueTextCtrl->SetValue( fpid ); fieldValueTextCtrl->SetValue( fpid );
} }
frame->Destroy(); frame->Destroy();
} }
#endif
} }
@ -771,8 +763,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else else
m_show_datasheet_button->SetLabel( wxEmptyString ); m_show_datasheet_button->SetLabel( wxEmptyString );
m_show_datasheet_button->Enable( fieldNdx == DATASHEET || fieldNdx == FOOTPRINT );
// For power symbols, the value is NOR editable, because value and pin // For power symbols, the value is NOR editable, because value and pin
// name must be same and can be edited only in library editor // name must be same and can be edited only in library editor
if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->IsPower() ) if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->IsPower() )

View File

@ -28,6 +28,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <kiway.h>
#include <confirm.h> #include <confirm.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
@ -141,7 +142,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component ); DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component );
int abort = dlg.ShowModal(); int abort = dlg.ShowQuasiModal();
if( abort ) if( abort )
return; return;
@ -211,7 +212,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnListItemSelected( wxListEvent& event
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick( wxCommandEvent& event ) void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick( wxCommandEvent& event )
{ {
EndModal( 1 ); EndQuasiModal( 1 );
} }
@ -282,7 +283,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
m_parent->OnModify(); m_parent->OnModify();
EndModal( 0 ); EndQuasiModal( 0 );
} }
@ -381,8 +382,28 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler( wxCommandEvent& event ) void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler( wxCommandEvent& event )
{ {
wxString datasheet_uri = fieldValueTextCtrl->GetValue(); unsigned fieldNdx = getSelectedFieldNdx();
::wxLaunchDefaultBrowser( datasheet_uri );
if( fieldNdx == DATASHEET )
{
wxString datasheet_uri = fieldValueTextCtrl->GetValue();
::wxLaunchDefaultBrowser( datasheet_uri );
}
else if( fieldNdx == FOOTPRINT )
{
// pick a footprint using the footprint picker.
wxString fpid;
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
if( frame->ShowModal( &fpid, this ) )
{
// DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
fieldValueTextCtrl->SetValue( fpid );
}
frame->Destroy();
}
} }
@ -652,7 +673,14 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) ); textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) );
m_show_datasheet_button->Enable( fieldNdx == DATASHEET ); m_show_datasheet_button->Enable( fieldNdx == DATASHEET || fieldNdx == FOOTPRINT );
if( fieldNdx == DATASHEET )
m_show_datasheet_button->SetLabel( _( "Show in Browser" ) );
else if( fieldNdx == FOOTPRINT )
m_show_datasheet_button->SetLabel( _( "Assign Footprint" ) );
else
m_show_datasheet_button->SetLabel( wxEmptyString );
wxPoint coord = field.GetTextPosition(); wxPoint coord = field.GetTextPosition();
wxPoint zero; wxPoint zero;

View File

@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );

View File

@ -46,7 +46,7 @@
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">-1,-1</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property> <property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass"></property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Field Properties</property> <property name="title">Field Properties</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>

View File

@ -11,6 +11,9 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
@ -33,7 +36,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE /// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
{ {
private: private:

View File

@ -99,8 +99,7 @@ static struct IFACE : public KIFACE_I
case FRAME_SCH_LIB_EDITOR: case FRAME_SCH_LIB_EDITOR:
{ {
LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway, LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway, aParent );
dynamic_cast<SCH_EDIT_FRAME*>( aParent ) );
return frame; return frame;
} }
break; break;

View File

@ -79,7 +79,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedA
wxString cmpname; wxString cmpname;
if( viewlibFrame->ShowModal( &cmpname ) ) if( viewlibFrame->ShowModal( &cmpname, this ) )
{ {
if( aUnit ) if( aUnit )
*aUnit = viewlibFrame->GetUnit(); *aUnit = viewlibFrame->GetUnit();

View File

@ -187,7 +187,7 @@ END_EVENT_TABLE()
#define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" ) #define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, SCH_EDIT_FRAME* aParent ) : LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ), SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() ) wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() )
{ {

View File

@ -122,7 +122,7 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
public: public:
LIB_EDIT_FRAME( KIWAY* aKiway, SCH_EDIT_FRAME* aParent ); LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
~LIB_EDIT_FRAME(); ~LIB_EDIT_FRAME();

View File

@ -101,6 +101,8 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer ) EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
EVT_TOOL( ID_TO_PCB, SCH_EDIT_FRAME::OnOpenPcbnew ) EVT_TOOL( ID_TO_PCB, SCH_EDIT_FRAME::OnOpenPcbnew )
EVT_TOOL( ID_TO_PCB_MODULE_EDITOR, SCH_EDIT_FRAME::OnOpenPcbModuleEditor )
EVT_TOOL( ID_TO_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb ) EVT_TOOL( ID_TO_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb )
EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings ) EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings )
@ -794,6 +796,22 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
} }
void SCH_EDIT_FRAME::OnOpenPcbModuleEditor( wxCommandEvent& event )
{
if( !Kiface().IsSingle() )
{
wxFileName fn = g_RootSheet->GetScreen()->GetFileName();
if( fn.IsOk() )
{
KIWAY_PLAYER* player = Kiway().Player( FRAME_PCB_MODULE_EDITOR );
player->Show( true );
player->Raise();
}
}
}
void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
{ {
wxFileName fn = g_RootSheet->GetScreen()->GetFileName(); wxFileName fn = g_RootSheet->GetScreen()->GetFileName();

View File

@ -30,6 +30,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <kiface_i.h>
#include <general.h> #include <general.h>
#include <hotkeys.h> #include <hotkeys.h>
@ -139,10 +140,8 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ), m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ),
HELP_RUN_LIB_VIEWER ); HELP_RUN_LIB_VIEWER );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ), m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ),
HELP_ANNOTATE ); HELP_ANNOTATE );
@ -158,6 +157,13 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
// The user must HAVE footprints before he can assign them. So put this before
// the CVPCB.
if( !Kiface().IsSingle() ) // if pcbnew is not a separate process
{
m_mainToolBar->AddTool( ID_TO_PCB_MODULE_EDITOR, wxEmptyString, KiBitmap( module_editor_xpm ),
_( "Footprint Editor" ) );
}
m_mainToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ), m_mainToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ),
_( "Run CvPcb to associate components and footprints" ) ); _( "Run CvPcb to associate components and footprints" ) );

View File

@ -36,7 +36,6 @@
#include <sch_base_frame.h> #include <sch_base_frame.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class CMP_LIBRARY; class CMP_LIBRARY;

View File

@ -81,11 +81,11 @@ endif()
if( APPLE ) if( APPLE )
set(GERBVIEW_RESOURCES gerbview.icns gerbview_doc.icns) set( GERBVIEW_RESOURCES gerbview.icns gerbview_doc.icns )
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/gerbview.icns" PROPERTIES set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources MACOSX_PACKAGE_LOCATION Resources
) )
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/gerbview_doc.icns" PROPERTIES set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources MACOSX_PACKAGE_LOCATION Resources
) )
set( MACOSX_BUNDLE_ICON_FILE gerbview.icns ) set( MACOSX_BUNDLE_ICON_FILE gerbview.icns )
@ -120,7 +120,6 @@ if( USE_KIWAY_DLLS )
${GERBVIEW_SRCS} ${GERBVIEW_SRCS}
${DIALOGS_SRCS} ${DIALOGS_SRCS}
${GERBVIEW_EXTRA_SRCS} ${GERBVIEW_EXTRA_SRCS}
# ${GERBVIEW_RESOURCES}
) )
set_target_properties( gerbview_kiface PROPERTIES set_target_properties( gerbview_kiface PROPERTIES
OUTPUT_NAME gerbview OUTPUT_NAME gerbview
@ -152,18 +151,16 @@ if( USE_KIWAY_DLLS )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( TARGETS gerbview_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE ) if( APPLE )
# copies kiface into the bundle # puts the *.kiface into the *.app bundle while linking
add_custom_target( _gerbview_kiface_copy ALL set_target_properties( gerbview_kiface PROPERTIES
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/gerbview/_gerbview.kiface "${CMAKE_BINARY_DIR}/gerbview/gerbview.app/Contents/MacOS/" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gerbview.app/Contents/MacOS/
DEPENDS gerbview_kiface )
COMMENT "Copying kiface into gerbview" else()
) install( TARGETS gerbview_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif() endif()
else() else()
@ -194,5 +191,3 @@ if( APPLE )
set_target_properties( gerbview PROPERTIES set_target_properties( gerbview PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
endif() endif()

View File

@ -2,72 +2,54 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>pen</string> <string>pen</string>
<string>gba</string> <string>gba</string>
<string>gbr</string> <string>gbr</string>
<string>gbx</string> <string>gbx</string>
<string>gbo</string> <string>gbo</string>
<string>gbl</string> <string>gbl</string>
<string>gtl</string> <string>gtl</string>
<string>gto</string> <string>gto</string>
<string>gta</string> <string>gta</string>
<string>gbp</string> <string>gbp</string>
<string>gbp</string> <string>gbp</string>
<string>gbs</string> <string>gbs</string>
<string>gts</string> <string>gts</string>
<string>gtp</string> <string>gtp</string>
<string>gbx</string> <string>gbx</string>
<string>lgr</string> <string>lgr</string>
<string>ger</string> <string>ger</string>
<string>pho</string> <string>pho</string>
<string>drl</string> <string>drl</string>
</array> </array>
<key>CFBundleTypeIconFile</key>
<string>gerbview_doc.icns</string> <key>CFBundleTypeIconFile</key> <string>gerbview_doc.icns</string>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key> <string>gerbview document</string>
<string>gerbview document</string> <key>LSHandlerRank</key> <string>Default</string>
<key>LSHandlerRank</key> <key>CFBundleTypeRole</key> <string>Viewer</string>
<string>Default</string> </dict>
<key>CFBundleTypeRole</key> </array>
<string>Viewer</string>
</dict> <key>CFBundleDevelopmentRegion</key> <string>English</string>
</array> <key>CFBundleExecutable</key> <string>gerbview</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleGetInfoString</key> <string></string>
<string>English</string> <key>CFBundleIconFile</key> <string>gerbview.icns</string>
<key>CFBundleExecutable</key> <key>CFBundleIdentifier</key> <string>org.kicad-eda.gerbview</string>
<string>gerbview</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleGetInfoString</key> <key>CFBundleLongVersionString</key> <string></string>
<string></string> <key>CFBundleName</key> <string>GerbView</string>
<key>CFBundleIconFile</key> <key>CFBundlePackageType</key> <string>APPL</string>
<string>gerbview.icns</string> <key>CFBundleShortVersionString</key> <string></string>
<key>CFBundleIdentifier</key> <key>CFBundleSignature</key> <string>????</string>
<string>org.kicad-eda.gerbview</string> <key>CFBundleVersion</key> <string></string>
<key>CFBundleInfoDictionaryVersion</key> <key>CSResourcesFileMapped</key> <true/>
<string>6.0</string> <key>LSRequiresCarbon</key> <true/>
<key>CFBundleLongVersionString</key> <key>NSHumanReadableCopyright</key> <string></string>
<string></string> <key>NSHighResolutionCapable</key> <string>True</string>
<key>CFBundleName</key>
<string>GerbView</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict> </dict>
</plist> </plist>

View File

@ -102,7 +102,7 @@ enum pseudokeys {
#define GERBVIEW_EXE wxT( "gerbview.app/Contents/MacOS/gerbview" ) #define GERBVIEW_EXE wxT( "gerbview.app/Contents/MacOS/gerbview" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.app/Contents/MacOS/bitmap2component" ) #define BITMAPCONVERTER_EXE wxT( "bitmap2component.app/Contents/MacOS/bitmap2component" )
#define PCB_CALCULATOR_EXE wxT( "pcb_calculator.app/Contents/MacOS/pcb_calculator" ) #define PCB_CALCULATOR_EXE wxT( "pcb_calculator.app/Contents/MacOS/pcb_calculator" )
#define PL_EDITOR_EXE wxT( "pcb_calculator.app/Contents/MacOS/pl_editor" ) #define PL_EDITOR_EXE wxT( "pl_editor.app/Contents/MacOS/pl_editor" )
# endif # endif
#endif #endif

View File

@ -270,6 +270,8 @@ public:
*/ */
FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable = NULL ); FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable = NULL );
~FP_LIB_TABLE();
/// Delete all rows. /// Delete all rows.
void Clear() void Clear()
{ {

View File

@ -45,6 +45,7 @@
enum main_id enum main_id
{ {
ID_TO_PCB = wxID_HIGHEST, ID_TO_PCB = wxID_HIGHEST,
ID_TO_PCB_MODULE_EDITOR,
ID_TO_CVPCB, ID_TO_CVPCB,
ID_LOAD_PROJECT, ID_LOAD_PROJECT,
ID_APPEND_PROJECT, ID_APPEND_PROJECT,

View File

@ -185,11 +185,12 @@ public:
* event which ends the modal behavior. * event which ends the modal behavior.
* *
* @param aResult if not NULL, indicates a place to put a resultant string. * @param aResult if not NULL, indicates a place to put a resultant string.
* @param aResultantFocusWindow if not NULL, indicates what window to pass focus to on return.
* *
* @return bool - true if frame implementation called KIWAY_PLAYER::DismissModal() * @return bool - true if frame implementation called KIWAY_PLAYER::DismissModal()
* with aRetVal of true. * with aRetVal of true.
*/ */
VTBL_ENTRY bool ShowModal( wxString* aResult = NULL ); VTBL_ENTRY bool ShowModal( wxString* aResult = NULL, wxWindow* aResultantFocusWindow = NULL );
//----</Cross Module API>---------------------------------------------------- //----</Cross Module API>----------------------------------------------------
@ -201,6 +202,11 @@ public:
*/ */
virtual void KiwayMailIn( KIWAY_EXPRESS& aEvent ); virtual void KiwayMailIn( KIWAY_EXPRESS& aEvent );
/**
* Our version of Destroy() which is virtual from wxWidgets
*/
bool Destroy();
protected: protected:
bool IsModal() { return m_modal; } bool IsModal() { return m_modal; }
@ -228,6 +234,7 @@ protected:
// variables for modal behavior support, only used by a few derivatives. // variables for modal behavior support, only used by a few derivatives.
bool m_modal; // true if frame is intended to be modal, not modeless bool m_modal; // true if frame is intended to be modal, not modeless
WX_EVENT_LOOP* m_modal_loop; // points to nested event_loop, NULL means not modal and dismissed WX_EVENT_LOOP* m_modal_loop; // points to nested event_loop, NULL means not modal and dismissed
wxWindow* m_modal_resultant_parent; // the window caller in modal mode
wxString m_modal_string; wxString m_modal_string;
bool m_modal_ret_val; // true if a selection was made bool m_modal_ret_val; // true if a selection was made

View File

@ -35,7 +35,7 @@
class wxConfigBase; class wxConfigBase;
class PARAM_CFG_ARRAY; class PARAM_CFG_ARRAY;
class FP_LIB_TABLE;
#define VTBL_ENTRY virtual #define VTBL_ENTRY virtual
@ -49,11 +49,12 @@ class PROJECT
{ {
public: public:
/// Derive PROJECT elements from this, it has a virtual destructor, and /// A PROJECT can hold stuff it knows nothing about, in the form of
/// Elem*() functions can work with it. Implementation is opaque in /// _ELEM derivatives. Derive PROJECT elements from this, it has a virtual
/// class PROJECT. If find you have to include derived class headers in this /// destructor, and Elem*() functions can work with it. Implementation is
/// file, you are doing something wrong. Keep knowledge of derived classes /// opaque in class PROJECT. If find you have to include derived class headers
/// opaque to class PROJECT please. /// in this file, you are doing incompatible with the goal of this class.
/// Keep knowledge of derived classes opaque to class PROJECT please.
class _ELEM class _ELEM
{ {
public: public:
@ -63,6 +64,8 @@ public:
PROJECT(); PROJECT();
~PROJECT(); ~PROJECT();
//-----<Cross Module API>----------------------------------------------------
// VTBL_ENTRY bool MaybeLoadProjectSettings( const std::vector<wxString>& aFileSet ); // VTBL_ENTRY bool MaybeLoadProjectSettings( const std::vector<wxString>& aFileSet );
/** /**
@ -154,18 +157,12 @@ public:
*/ */
enum ELEM_T enum ELEM_T
{ {
FPTBL, ELEM_FPTBL,
ELEM_COUNT ELEM_COUNT
}; };
/** /**
* A PROJECT can hold stuff it knows nothing about, in the form of
* _ELEM derivatives. This function gives access to a PROJECT::_ELEM using
* enum ELEM_T as an index.
* <p>
* Acts as setter iff aElem is not NULL, else getter.
* <p>
* Typically wrapped somewhere else in a more meaningful function wrapper. * Typically wrapped somewhere else in a more meaningful function wrapper.
* This is a cross module API, therefore the _ELEM destructor is virtual and * This is a cross module API, therefore the _ELEM destructor is virtual and
* can point to a destructor function in another link image. Be careful that * can point to a destructor function in another link image. Be careful that
@ -174,7 +171,47 @@ public:
* Summary: 1) cross module API, 2) PROJECT knows nothing about _ELEM objects, * Summary: 1) cross module API, 2) PROJECT knows nothing about _ELEM objects,
* except how to delete them and set and get pointers to them. * except how to delete them and set and get pointers to them.
*/ */
VTBL_ENTRY _ELEM* Elem( ELEM_T aIndex, _ELEM* aElem = NULL ); VTBL_ENTRY _ELEM* GetElem( ELEM_T aIndex );
VTBL_ENTRY void SetElem( ELEM_T aIndex, _ELEM* aElem );
/// Inline, clear the _ELEM at position aIndex
void ElemClear( ELEM_T aIndex )
{
_ELEM* existing = GetElem( aIndex );
delete existing; // virtual
SetElem( aIndex, NULL );
}
/**
* Function ElemsClear
* deletes all the _ELEMs and set their pointers to NULL.
*/
VTBL_ENTRY void ElemsClear();
//-----</Cross Module API>---------------------------------------------------
//-----<KIFACE Specific APIs>------------------------------------------------
// These are the non-virtual DATA LOAD ON DEMAND members. They load project related
// data on demand, and do so typicallly into m_elems[] at a particular index using
// SetElem() & GetElem(). That is, they wrap SetElem() and GetElem().
// To get the data to reload on demand, first SetProjectFullName(),
// then call ElemClear() from client code.
// non-virtuals resident in PCBNEW link image(s). By being non-virtual, these
// functions can get linked into the KIFACE that needs them, and only there.
// In fact, the other KIFACEs don't even know they exist.
#if defined(PCBNEW) || defined(CVPCB)
// These are all prefaced with "Pcb"
FP_LIB_TABLE* PcbFootprintLibs();
#endif
#if defined(EESCHEMA)
// These are all prefaced with "Sch"
#endif
//-----</KIFACE Specific APIs>-----------------------------------------------
private: private:
@ -215,10 +252,6 @@ private:
//-----<possible futures>--------------------------------------------------------- //-----<possible futures>---------------------------------------------------------
#if 0 #if 0
VTBL_ENTRY int ElemAllocNdx();
VTBL_ENTRY void ElemSet( int aIndex, ELEMENT_BASE* aBlock );
VTBL_ENTRY ELEM_BASE* ElemGet( int aIndex )
/** /**
* Function Value * Function Value
* fetches a project variable @a aVariable and returns true if that variable was * fetches a project variable @a aVariable and returns true if that variable was

View File

@ -103,7 +103,7 @@ protected:
* *
* @param aFootprintId is the #FPID of component footprint to load. * @param aFootprintId is the #FPID of component footprint to load.
* @return the #MODULE if found or NULL if \a aFootprintId not found in any of the * @return the #MODULE if found or NULL if \a aFootprintId not found in any of the
* libraries in the table returned from #FootprintLibs(). * libraries in the table returned from #Prj().PcbFootprintLibs().
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error * @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
* occurs while reading footprint library files. * occurs while reading footprint library files.
*/ */
@ -127,7 +127,7 @@ public:
* *
* @param aFootprintId is the #FPID of component footprint to load. * @param aFootprintId is the #FPID of component footprint to load.
* @return the #MODULE if found or NULL if \a aFootprintId not found in any of the * @return the #MODULE if found or NULL if \a aFootprintId not found in any of the
* libraries in table returned from #FootprintLibs(). * libraries in table returned from #Prj().PcbFootprintLibs().
*/ */
MODULE* LoadFootprint( const FPID& aFootprintId ); MODULE* LoadFootprint( const FPID& aFootprintId );
@ -463,12 +463,6 @@ public:
*/ */
wxString SelectFootprintFromLibBrowser(); wxString SelectFootprintFromLibBrowser();
/**
* Function FootprintLibs
* @return the project #FP_LIB_TABLE.
*/
FP_LIB_TABLE* FootprintLibs() const;
// ratsnest functions // ratsnest functions
/** /**
* Function Compile_Ratsnest * Function Compile_Ratsnest

View File

@ -368,7 +368,7 @@ public:
*/ */
virtual void ExecuteRemoteCommand( const char* cmdline ); virtual void ExecuteRemoteCommand( const char* cmdline );
void KiwayMailIn( KIWAY_EXPRESS& aEvent ); // virtual overload from KIWAY_PLAYER void KiwayMailIn( KIWAY_EXPRESS& aEvent ); // override virtual from KIWAY_PLAYER
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition ); void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ); void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
@ -793,6 +793,7 @@ private:
void OnLoadProject( wxCommandEvent& event ); void OnLoadProject( wxCommandEvent& event );
void OnAppendProject( wxCommandEvent& event ); void OnAppendProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event ); void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenPcbModuleEditor( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event ); void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event ); void OnOpenLibraryEditor( wxCommandEvent& event );
void OnSetOptions( wxCommandEvent& event ); void OnSetOptions( wxCommandEvent& event );

View File

@ -57,6 +57,22 @@ if( UNIX )
endif() endif()
if( APPLE )
# In this CMakeLists.txt's build directory, create kiface symlinks should get
# "installed()" as part of the kicad.app bundle. These are pointers on the
# target which point up and over to the stand alone kicad app's *.kiface files.
foreach( symlink pcbnew eeschema cvpcb )
add_custom_command( TARGET kicad
COMMAND ${CMAKE_COMMAND} -E remove
"${CMAKE_CURRENT_BINARY_DIR}/kicad.app/Contents/MacOS/_${symlink}.kiface"
COMMAND ${CMAKE_COMMAND} -E create_symlink
"../../../${symlink}.app/Contents/MacOS/_${symlink}.kiface"
"${CMAKE_CURRENT_BINARY_DIR}/kicad.app/Contents/MacOS/_${symlink}.kiface"
COMMENT "kicad.app ${symlink} symlink"
)
endforeach()
endif()
if( APPLE ) if( APPLE )
set_target_properties( kicad PROPERTIES set_target_properties( kicad PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist

View File

@ -2,54 +2,36 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key> <string>Editor</string>
<string>Editor</string> <key>CFBundleTypeIconFile</key> <string>kicad_doc.icns</string>
<key>CFBundleTypeIconFile</key>
<string>kicad_doc.icns</string> <key>CFBundleTypeExtensions</key> <array>
<key>CFBundleTypeExtensions</key> <string>pro</string>
<array> </array>
<string>pro</string>
</array> <key>CFBundleTypeName</key> <string>kicad project files</string>
<key>CFBundleTypeName</key> <key>LSHandlerRank</key> <string>Owner</string>
<string>kicad project files</string> </dict>
<key>LSHandlerRank</key> </array>
<string>Owner</string>
</dict> <key>CFBundleDevelopmentRegion</key> <string>English</string>
</array> <key>CFBundleExecutable</key> <string>kicad</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleGetInfoString</key> <string></string>
<string>English</string> <key>CFBundleIconFile</key> <string>kicad.icns</string>
<key>CFBundleExecutable</key> <key>CFBundleIdentifier</key> <string>org.kicad-eda.kicad</string>
<string>kicad</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleGetInfoString</key> <key>CFBundleLongVersionString</key> <string></string>
<string></string> <key>CFBundleName</key> <string>KiCad</string>
<key>CFBundleIconFile</key> <key>CFBundlePackageType</key> <string>APPL</string>
<string>kicad.icns</string> <key>CFBundleShortVersionString</key> <string></string>
<key>CFBundleIdentifier</key> <key>CFBundleSignature</key> <string>????</string>
<string>org.kicad-eda.kicad</string> <key>CFBundleVersion</key> <string></string>
<key>CFBundleInfoDictionaryVersion</key> <key>CSResourcesFileMapped</key> <true/>
<string>6.0</string> <key>LSRequiresCarbon</key> <true/>
<key>CFBundleLongVersionString</key> <key>NSHumanReadableCopyright</key> <string></string>
<string></string> <key>NSHighResolutionCapable</key> <string>True</string>
<key>CFBundleName</key>
<string>KiCad</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict> </dict>
</plist> </plist>

View File

@ -49,7 +49,20 @@ set( PL_EDITOR_EXTRA_SRCS
if( MINGW ) if( MINGW )
# PL_EDITOR_RESOURCES variable is set by the macro. # PL_EDITOR_RESOURCES variable is set by the macro.
mingw_resource_compiler(pl_editor) mingw_resource_compiler( pl_editor )
endif()
if( APPLE )
set( PL_EDITOR_RESOURCES pl_editor.icns pl_editor_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pl_editor.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pl_editor )
endif() endif()
@ -82,7 +95,6 @@ if( USE_KIWAY_DLLS )
${PL_EDITOR_SRCS} ${PL_EDITOR_SRCS}
${DIALOGS_SRCS} ${DIALOGS_SRCS}
${PL_EDITOR_EXTRA_SRCS} ${PL_EDITOR_EXTRA_SRCS}
# ${PL_EDITOR_RESOURCES}
) )
target_link_libraries( pl_editor_kiface target_link_libraries( pl_editor_kiface
common common
@ -114,18 +126,16 @@ if( USE_KIWAY_DLLS )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( TARGETS pl_editor_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE ) if( APPLE )
# copies kiface into the bundle # puts the *.kiface into the *.app bundle while linking
add_custom_target( _pleditor_kiface_copy ALL set_target_properties( pl_editor_kiface PROPERTIES
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pagelayout_editor/_pl_editor.kiface "${CMAKE_BINARY_DIR}/pagelayout_editor/pl_editor.app/Contents/MacOS/" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pl_editor.app/Contents/MacOS/
DEPENDS pl_editor_kiface )
COMMENT "Copying kiface into pleditor" else()
) install( TARGETS pl_editor_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
endif() endif()
else() else()
@ -137,13 +147,6 @@ else()
${PL_EDITOR_EXTRA_SRCS} ${PL_EDITOR_EXTRA_SRCS}
${PL_EDITOR_RESOURCES} ${PL_EDITOR_RESOURCES}
) )
if( APPLE )
set_target_properties( pl_editor PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
endif()
target_link_libraries( pl_editor target_link_libraries( pl_editor
common common
polygon polygon
@ -152,28 +155,15 @@ else()
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
) )
install( TARGETS pl_editor install( TARGETS pl_editor
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
endif() endif()
if( APPLE ) if( APPLE )
set( PL_EDITOR_RESOURCES pl_editor.icns pl_editor_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pl_editor.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pl_editor )
set_target_properties( pl_editor PROPERTIES set_target_properties( pl_editor PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
) )
endif() endif()

View File

@ -2,54 +2,36 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key> <string>Editor</string>
<string>Editor</string> <key>CFBundleTypeExtensions</key>
<key>CFBundleTypeExtensions</key> <array>
<array> <string>kicad_wks</string>
<string>kicad_wks</string> </array>
</array>
<key>CFBundleTypeIconFile</key> <key>CFBundleTypeIconFile</key> <string>pl_editor.icns</string>
<string>pl_editor.icns</string> <key>CFBundleTypeName</key> <string>pl_editor document</string>
<key>CFBundleTypeName</key> <key>LSHandlerRank</key> <string>Owner</string>
<string>pl_editor document</string> </dict>
<key>LSHandlerRank</key> </array>
<string>Owner</string>
</dict> <key>CFBundleDevelopmentRegion</key> <string>English</string>
</array> <key>CFBundleExecutable</key> <string>pl_editor</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleGetInfoString</key> <string></string>
<string>English</string> <key>CFBundleIconFile</key> <string>pl_editor.icns</string>
<key>CFBundleExecutable</key> <key>CFBundleIdentifier</key> <string>org.kicad-eda.pl_editor</string>
<string>pl_editor</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleGetInfoString</key> <key>CFBundleLongVersionString</key> <string></string>
<string></string> <key>CFBundleName</key> <string>pl_editor</string>
<key>CFBundleIconFile</key> <key>CFBundlePackageType</key> <string>APPL</string>
<string>pl_editor.icns</string> <key>CFBundleShortVersionString</key> <string></string>
<key>CFBundleIdentifier</key> <key>CFBundleSignature</key> <string>????</string>
<string>org.kicad-eda.pl_editor</string> <key>CFBundleVersion</key> <string></string>
<key>CFBundleInfoDictionaryVersion</key> <key>CSResourcesFileMapped</key> <true/>
<string>6.0</string> <key>LSRequiresCarbon</key> <true/>
<key>CFBundleLongVersionString</key> <key>NSHumanReadableCopyright</key> <string></string>
<string></string> <key>NSHighResolutionCapable</key> <string>True</string>
<key>CFBundleName</key>
<string>pl_editor</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict> </dict>
</plist> </plist>

View File

@ -122,14 +122,15 @@ if( USE_KIWAY_DLLS )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( TARGETS pcb_calculator_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE ) if( APPLE )
set_target_properties( pcb_calculator PROPERTIES # puts the *.kiface into the *.app bundle while linking
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist set_target_properties( pcb_calculator_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pcb_calculator.app/Contents/MacOS/
)
else()
install( TARGETS pcb_calculator_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
) )
endif() endif()
@ -156,13 +157,6 @@ else()
set_source_files_properties( pcb_calculator.cpp PROPERTIES set_source_files_properties( pcb_calculator.cpp PROPERTIES
COMPILE_DEFINITIONS "COMPILING_DLL" COMPILE_DEFINITIONS "COMPILING_DLL"
) )
if( APPLE )
set_target_properties( pcb_calculator PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
endif()
target_link_libraries( pcb_calculator target_link_libraries( pcb_calculator
common common
bitmaps bitmaps
@ -175,3 +169,10 @@ else()
) )
endif() endif()
if( APPLE )
set_target_properties( pcb_calculator PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
endif()

View File

@ -594,17 +594,15 @@ if( USE_KIWAY_DLLS )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( TARGETS pcbnew_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE ) if( APPLE )
# copies kiface into the bundle # puts the *.kiface into the *.app bundle while linking
add_custom_target( _pcbnew_kiface_copy ALL set_target_properties( pcbnew_kiface PROPERTIES
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.kiface "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.app/Contents/MacOS/" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.app/Contents/MacOS/
DEPENDS pcbnew_kiface )
COMMENT "Copying kiface into pcbnew" else()
install( TARGETS pcbnew_kiface
DESTINATION ${KICAD_BIN}
COMPONENT binary
) )
endif() endif()
@ -768,3 +766,4 @@ if( false ) # haven't been used in years.
) )
target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} ) target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} )
endif() endif()

View File

@ -2,53 +2,36 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key> <string>Editor</string>
<string>Editor</string> <key>CFBundleTypeIconFile</key> <string>pcbnew_doc.icns</string>
<key>CFBundleTypeIconFile</key> <key>CFBundleTypeExtensions</key>
<string>pcbnew_doc.icns</string> <array>
<key>CFBundleTypeExtensions</key> <string>kicad_pcb</string>
<array> <string>brd</string>
<string>kicad_pcb</string> </array>
<string>brd</string>
</array> <key>CFBundleTypeName</key> <string>pcbnew board</string>
<key>CFBundleTypeName</key> <key>LSHandlerRank</key> <string>Owner</string>
<string>pcbnew board</string> </dict>
<key>LSHandlerRank</key> </array>
<string>Owner</string>
</dict> <key>CFBundleExecutable</key> <string>pcbnew</string>
</array> <key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleExecutable</key> <key>CFBundleIconFile</key> <string>pcbnew.icns</string>
<string>pcbnew</string> <key>CFBundleIdentifier</key> <string>org.kicad-eda.pcbnew</string>
<key>CFBundleGetInfoString</key> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<string></string> <key>CFBundleLongVersionString</key> <string></string>
<key>CFBundleIconFile</key> <key>CFBundleName</key> <string>PCBNew</string>
<string>pcbnew.icns</string> <key>CFBundlePackageType</key> <string>APPL</string>
<key>CFBundleIdentifier</key> <key>CFBundleShortVersionString</key> <string></string>
<string>org.kicad-eda.pcbnew</string> <key>CFBundleSignature</key> <string>????</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleVersion</key> <string></string>
<string>6.0</string> <key>CSResourcesFileMapped</key> <true/>
<key>CFBundleLongVersionString</key> <key>LSRequiresCarbon</key> <true/>
<string></string> <key>NSHumanReadableCopyright</key> <string></string>
<key>CFBundleName</key> <key>NSHighResolutionCapable</key> <string>True</string>
<string>PCBNew</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict> </dict>
</plist> </plist>

View File

@ -175,10 +175,15 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME()
} }
FP_LIB_TABLE* PCB_BASE_FRAME::FootprintLibs() const FP_LIB_TABLE* PROJECT::PcbFootprintLibs()
{ {
PROJECT& prj = Prj(); // This is a lazy loading function, it loads the project specific table when
FP_LIB_TABLE* tbl = dynamic_cast<FP_LIB_TABLE*>( prj.Elem( PROJECT::FPTBL ) ); // that table is asked for, not before.
FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL );
// its gotta be NULL or a FP_LIB_TABLE, or a bug.
wxASSERT( !tbl || dynamic_cast<FP_LIB_TABLE*>( tbl ) );
if( !tbl ) if( !tbl )
{ {
@ -187,7 +192,18 @@ FP_LIB_TABLE* PCB_BASE_FRAME::FootprintLibs() const
// stack this way, all using the same global fallback table. // stack this way, all using the same global fallback table.
tbl = new FP_LIB_TABLE( &GFootprintTable ); tbl = new FP_LIB_TABLE( &GFootprintTable );
prj.Elem( PROJECT::FPTBL, tbl ); SetElem( ELEM_FPTBL, tbl );
wxString projectFpLibTableFileName = FootprintLibTblName();
try
{
tbl->Load( projectFpLibTableFileName );
}
catch( const IO_ERROR& ioe )
{
DisplayError( NULL, ioe.errorText );
}
} }
return tbl; return tbl;

View File

@ -1231,7 +1231,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
} }
bool TRACK::HitTest( const wxPoint& aPosition ) bool TRACK::HitTest( const wxPoint& aPosition ) const
{ {
return TestSegmentHit( aPosition, m_Start, m_End, m_Width / 2 ); return TestSegmentHit( aPosition, m_Start, m_End, m_Width / 2 );
} }

View File

@ -223,7 +223,7 @@ public:
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
virtual bool HitTest( const wxPoint& aPosition ); virtual bool HitTest( const wxPoint& aPosition ) const;
/** @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect, /** @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect,
* bool aContained = true, int aAccuracy ) const * bool aContained = true, int aAccuracy ) const

View File

@ -25,7 +25,7 @@
/** /**
* @file clean.cpp * @file clean.cpp
* @brief functions to clean tracks: remove null lenght and redundant segments * @brief functions to clean tracks: remove null length and redundant segments
*/ */
@ -44,7 +44,7 @@
class TRACKS_CLEANER: CONNECTIONS class TRACKS_CLEANER: CONNECTIONS
{ {
private: private:
BOARD * m_Brd; BOARD *m_Brd;
public: public:
TRACKS_CLEANER( BOARD * aPcb ); TRACKS_CLEANER( BOARD * aPcb );
@ -53,8 +53,8 @@ public:
* the cleanup function. * the cleanup function.
* return true if some item was modified * return true if some item was modified
*/ */
bool CleanupBoard(PCB_EDIT_FRAME *aFrame, bool aCleanVias, bool CleanupBoard( PCB_EDIT_FRAME *aFrame, bool aCleanVias,
bool aMergeSegments, bool aDeleteUnconnected); bool aMergeSegments, bool aDeleteUnconnected);
private: private:
@ -64,13 +64,30 @@ private:
*/ */
bool clean_vias(); bool clean_vias();
/**
* Removes all the following THT vias on the same position of the
* specified one
*/
bool remove_duplicates_of_via( const VIA *aVia );
/**
* Removes all the following duplicates tracks of the specified one
*/
bool remove_duplicates_of_track( const TRACK *aTrack );
/** /**
* Removes dangling tracks * Removes dangling tracks
*/ */
bool deleteUnconnectedTracks(); bool deleteUnconnectedTracks();
/// Delete null length track segments
bool delete_null_segments();
/// Try to merge the segment to a following collinear one
bool merge_collinear_of_track( TRACK *aSegment );
/** /**
* Merge colinear segments and remove null len segments * Merge collinear segments and remove duplicated and null len segments
*/ */
bool clean_segments(); bool clean_segments();
@ -194,6 +211,30 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
} }
} }
bool TRACKS_CLEANER::remove_duplicates_of_via( const VIA *aVia )
{
bool modified = false;
// Search and delete others vias at same location
VIA* next_via;
for( VIA* alt_via = GetFirstVia( aVia->Next() ); alt_via != NULL;
alt_via = next_via )
{
next_via = GetFirstVia( alt_via->Next() );
if( (alt_via->GetViaType() == VIA_THROUGH) &&
(alt_via->GetStart() == aVia->GetStart()) )
{
// delete via
m_Brd->GetRatsnest()->Remove( alt_via );
alt_via->ViewRelease();
alt_via->DeleteStructure();
modified = true;
}
}
return modified;
}
bool TRACKS_CLEANER::clean_vias() bool TRACKS_CLEANER::clean_vias()
{ {
bool modified = false; bool modified = false;
@ -212,23 +253,7 @@ bool TRACKS_CLEANER::clean_vias()
* (yet) handle high density interconnects */ * (yet) handle high density interconnects */
if( via->GetViaType() != VIA_THROUGH ) if( via->GetViaType() != VIA_THROUGH )
{ {
// Search and delete others vias at same location modified |= remove_duplicates_of_via( via );
VIA* next_via;
for( VIA* alt_via = GetFirstVia( via->Next() ); alt_via != NULL;
alt_via = next_via )
{
next_via = GetFirstVia( alt_via->Next() );
if( (alt_via->GetViaType() == VIA_THROUGH) &&
(alt_via->GetStart() == via->GetStart()) )
{
// delete via
m_Brd->GetRatsnest()->Remove( alt_via );
alt_via->ViewRelease();
alt_via->DeleteStructure();
modified = true;
}
}
/* To delete through Via on THT pads at same location /* To delete through Via on THT pads at same location
* Examine the list of connected pads: * Examine the list of connected pads:
@ -367,16 +392,14 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
return modified; return modified;
} }
// Delete null length track segments
// Delete null length segments, and intermediate points .. bool TRACKS_CLEANER::delete_null_segments()
bool TRACKS_CLEANER::clean_segments()
{ {
TRACK *nextsegment;
bool modified = false; bool modified = false;
TRACK* segment, * nextsegment;
TRACK* other;
// Delete null segments // Delete null segments
for( segment = m_Brd->m_Track; segment; segment = nextsegment ) for( TRACK *segment = m_Brd->m_Track; segment; segment = nextsegment )
{ {
nextsegment = segment->Next(); nextsegment = segment->Next();
@ -388,151 +411,217 @@ bool TRACKS_CLEANER::clean_segments()
modified = true; modified = true;
} }
} }
return modified;
}
// Delete redundant segments, i.e. segments having the same end points bool TRACKS_CLEANER::remove_duplicates_of_track( const TRACK *aTrack )
// and layers {
for( segment = m_Brd->m_Track; segment; segment = segment->Next() ) bool modified = false;
TRACK *nextsegment;
for( TRACK *other = aTrack->Next(); other; other = nextsegment )
{ {
for( other = segment->Next(); other; other = nextsegment ) nextsegment = other->Next();
// New netcode, break out (can't be there any other)
if( aTrack->GetNetCode() != other->GetNetCode() )
break;
// Must be of the same type, on the same layer and the endpoints
// must be the same (maybe swapped)
if( (aTrack->Type() != other->Type()) &&
(aTrack->GetLayer() != other->GetLayer()) )
{ {
nextsegment = other->Next(); if( ((aTrack->GetStart() == other->GetStart()) &&
bool erase = false; (aTrack->GetEnd() == other->GetEnd())) ||
((aTrack->GetStart() == other->GetEnd()) &&
if( segment->Type() != other->Type() ) (aTrack->GetEnd() == other->GetStart())))
continue;
if( segment->GetLayer() != other->GetLayer() )
continue;
if( segment->GetNetCode() != other->GetNetCode() )
break;
if( ( segment->GetStart() == other->GetStart() ) &&
( segment->GetEnd() == other->GetEnd() ) )
erase = true;
if( ( segment->GetStart() == other->GetEnd() ) &&
( segment->GetEnd() == other->GetStart() ) )
erase = true;
// Delete redundant point
if( erase )
{ {
m_Brd->GetRatsnest()->Remove( other ); m_Brd->GetRatsnest()->Remove( other );
other->ViewRelease(); other->ViewRelease();
other->DeleteStructure(); other->DeleteStructure();
modified = true; modified = true;
} }
} }
} }
return modified;
}
// merge collinear segments: bool TRACKS_CLEANER::merge_collinear_of_track( TRACK *aSegment )
for( segment = m_Brd->m_Track; segment; segment = nextsegment ) {
bool merged_this = false;
bool flag = false; // If there are connections to this on the endpoint
// search for a possible point connected to the START point of the current segment
TRACK *segStart = aSegment->Next();
while( true )
{ {
TRACK* segStart; segStart = aSegment->GetTrack( segStart, NULL, ENDPOINT_START );
TRACK* segEnd;
TRACK* segDelete;
nextsegment = segment->Next(); if( segStart )
if( segment->Type() != PCB_TRACE_T )
continue;
unsigned flag = 0;
bool no_inc = false;
// search for a possible point connected to the START point of the current segment
for( segStart = segment->Next(); ; )
{ {
segStart = segment->GetTrack( segStart, NULL, ENDPOINT_START ); // the two segments must have the same width
if( aSegment->GetWidth() != segStart->GetWidth() )
if( segStart )
{
// the two segments must have the same width
if( segment->GetWidth() != segStart->GetWidth() )
break;
// it cannot be a via
if( segStart->Type() != PCB_TRACE_T )
break;
// We must have only one segment connected
segStart->SetState( BUSY, true );
other = segment->GetTrack( m_Brd->m_Track, NULL, ENDPOINT_START );
segStart->SetState( BUSY, false );
if( other == NULL )
flag = 1; // OK
break; break;
}
// it cannot be a via
if( segStart->Type() != PCB_TRACE_T )
break;
// We must have only one segment connected
segStart->SetState( BUSY, true );
TRACK *other = aSegment->GetTrack( m_Brd->m_Track, NULL, ENDPOINT_START );
segStart->SetState( BUSY, false );
if( other == NULL )
flag = true; // OK
break; break;
} }
break;
}
if( flag ) // We have the starting point of the segment is connected to an other segment if( flag ) // We have the starting point of the segment is connected to an other segment
{
TRACK *segDelete = mergeCollinearSegmentIfPossible( aSegment, segStart, ENDPOINT_START );
if( segDelete )
{ {
segDelete = mergeCollinearSegmentIfPossible( segment, segStart, ENDPOINT_START ); m_Brd->GetRatsnest()->Remove( segDelete );
segDelete->ViewRelease();
if( segDelete ) segDelete->DeleteStructure();
{ merged_this = true;
no_inc = 1;
m_Brd->GetRatsnest()->Remove( segDelete );
segDelete->ViewRelease();
segDelete->DeleteStructure();
modified = true;
}
} }
}
// search for a possible point connected to the END point of the current segment: // Do the same with the other endpoint
for( segEnd = segment->Next(); ; ) flag = false;
// search for a possible point connected to the END point of the current segment:
TRACK *segEnd = aSegment->Next();
while( true )
{
segEnd = aSegment->GetTrack( segEnd, NULL, ENDPOINT_END );
if( segEnd )
{ {
segEnd = segment->GetTrack( segEnd, NULL, ENDPOINT_END ); if( aSegment->GetWidth() != segEnd->GetWidth() )
if( segEnd )
{
if( segment->GetWidth() != segEnd->GetWidth() )
break;
if( segEnd->Type() != PCB_TRACE_T )
break;
// We must have only one segment connected
segEnd->SetState( BUSY, true );
other = segment->GetTrack( m_Brd->m_Track, NULL, ENDPOINT_END );
segEnd->SetState( BUSY, false );
if( other == NULL )
flag |= 2; // Ok
break; break;
}
else if( segEnd->Type() != PCB_TRACE_T )
{
break; break;
}
}
if( flag & 2 ) // We have the ending point of the segment is connected to an other segment // We must have only one segment connected
segEnd->SetState( BUSY, true );
TRACK *other = aSegment->GetTrack( m_Brd->m_Track, NULL, ENDPOINT_END );
segEnd->SetState( BUSY, false );
if( other == NULL )
flag = true; // Ok
break;
}
else
{ {
segDelete = mergeCollinearSegmentIfPossible( segment, segEnd, ENDPOINT_END ); break;
if( segDelete )
{
no_inc = true;
m_Brd->GetRatsnest()->Remove( segDelete );
segDelete->ViewRelease();
segDelete->DeleteStructure();
modified = true;
}
} }
}
if( no_inc ) // The current segment was modified, retry to merge it if( flag ) // We have the ending point of the segment is connected to an other segment
nextsegment = segment->Next(); {
TRACK *segDelete = mergeCollinearSegmentIfPossible( aSegment, segEnd, ENDPOINT_END );
if( segDelete )
{
m_Brd->GetRatsnest()->Remove( segDelete );
segDelete->ViewRelease();
segDelete->DeleteStructure();
merged_this = true;
}
}
return merged_this;
}
// Delete null length segments, and intermediate points ..
bool TRACKS_CLEANER::clean_segments()
{
bool modified = false;
// Easy things first
modified |= delete_null_segments();
// Delete redundant segments, i.e. segments having the same end points
// and layers
for( TRACK *segment = m_Brd->m_Track; segment; segment = segment->Next() )
{
modified |= remove_duplicates_of_track( segment );
}
// merge collinear segments:
TRACK *nextsegment;
for( TRACK *segment = m_Brd->m_Track; segment; segment = nextsegment )
{
nextsegment = segment->Next();
if( segment->Type() == PCB_TRACE_T )
{
bool merged_this = merge_collinear_of_track( segment );
modified |= merged_this;
if( merged_this ) // The current segment was modified, retry to merge it
nextsegment = segment->Next();
}
} }
return modified; return modified;
} }
/* Utility: check for parallelism between two segments */
static bool parallelism_test( int dx1, int dy1, int dx2, int dy2 )
{
// The following condition tree is ugly and repetitive, but I have
// not a better way to express clearly the trivial cases. Hope the
// compiler optimize it better than always doing the product
// below...
// test for vertical alignment (easy to handle)
if( dx1 == 0 )
{
if( dx2 != 0 )
return false;
else
return true;
}
if( dx2 == 0 )
{
if( dx1 != 0 )
return false;
else
return true;
}
// test for horizontal alignment (easy to handle)
if( dy1 == 0 )
{
if( dy2 != 0 )
return false;
else
return true;
}
if( dy2 == 0 )
{
if( dy1 != 0 )
return false;
else
return true;
}
/* test for alignment in other cases: Do the usual cross product test
* (the same as testing the slope, but without a division) */
return ((double)dy1 * dx2 == (double)dx1 * dy2);
}
/** Function used by clean_segments. /** Function used by clean_segments.
* Test if aTrackRef and aCandidate (which must have a common end) are collinear. * Test if aTrackRef and aCandidate (which must have a common end) are collinear.
@ -549,63 +638,32 @@ bool TRACKS_CLEANER::clean_segments()
TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK* aCandidate, TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK* aCandidate,
ENDPOINT_T aEndType ) ENDPOINT_T aEndType )
{ {
if( aTrackRef->GetWidth() != aCandidate->GetWidth() ) // First of all, they must be of the same width and must be both actual tracks
if( (aTrackRef->GetWidth() != aCandidate->GetWidth()) ||
(aTrackRef->Type() != PCB_TRACE_T) ||
(aCandidate->Type() != PCB_TRACE_T) )
return NULL; return NULL;
bool is_colinear = false; // Trivial case: exactly the same track
if( ( aTrackRef->GetStart() == aCandidate->GetStart() ) &&
( aTrackRef->GetEnd() == aCandidate->GetEnd() ) )
return aCandidate;
// Trivial case: superimposed tracks ( tracks, not vias ): if( ( aTrackRef->GetStart() == aCandidate->GetEnd() ) &&
if( aTrackRef->Type() == PCB_TRACE_T && aCandidate->Type() == PCB_TRACE_T ) ( aTrackRef->GetEnd() == aCandidate->GetStart() ) )
{ return aCandidate;
if( ( aTrackRef->GetStart() == aCandidate->GetStart() ) &&
( aTrackRef->GetEnd() == aCandidate->GetEnd() ) )
return aCandidate;
if( ( aTrackRef->GetStart() == aCandidate->GetEnd() ) && // Weed out non-parallel tracks
( aTrackRef->GetEnd() == aCandidate->GetStart() ) ) if ( !parallelism_test( aTrackRef->GetEnd().x - aTrackRef->GetStart().x,
return aCandidate; aTrackRef->GetEnd().y - aTrackRef->GetStart().y,
} aCandidate->GetEnd().x - aCandidate->GetStart().x,
aCandidate->GetEnd().y - aCandidate->GetStart().y ) )
int refdx = aTrackRef->GetEnd().x - aTrackRef->GetStart().x; return NULL;
int refdy = aTrackRef->GetEnd().y - aTrackRef->GetStart().y;
int segmdx = aCandidate->GetEnd().x - aCandidate->GetStart().x;
int segmdy = aCandidate->GetEnd().y - aCandidate->GetStart().y;
// test for vertical alignment (easy to handle)
if( refdx == 0 )
{
if( segmdx != 0 )
return NULL;
else
is_colinear = true;
}
// test for horizontal alignment (easy to handle)
if( refdy == 0 )
{
if( segmdy != 0 )
return NULL;
else
is_colinear = true;
}
/* test if alignment in other cases
* We must have refdy/refdx == segmdy/segmdx, (i.e. same slope)
* or refdy * segmdx == segmdy * refdx
*/
if( is_colinear == false )
{
if( ( double)refdy * segmdx != (double)refdx * segmdy )
return NULL;
is_colinear = true;
}
/* Here we have 2 aligned segments: /* Here we have 2 aligned segments:
* We must change the pt_ref common point only if not on a pad * We must change the pt_ref common point only if not on a pad
* (this function) is called when there is only 2 connected segments, * (this function) is called when there is only 2 connected segments,
*and if this point is not on a pad, it can be removed and the 2 segments will be merged * and if this point is not on a pad, it can be removed and the 2 segments will be merged
*/ */
if( aEndType == ENDPOINT_START ) if( aEndType == ENDPOINT_START )
{ {

View File

@ -173,7 +173,7 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
Clear_Pcb( true ); Clear_Pcb( true );
// Clear footprint library table for the new board. // Clear footprint library table for the new board.
FootprintLibs()->Clear(); Prj().PcbFootprintLibs()->Clear();
wxFileName fn; wxFileName fn;
@ -603,7 +603,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
return false; return false;
// Save the project specific footprint library table. // Save the project specific footprint library table.
if( !FootprintLibs()->IsEmpty( false ) ) if( !Prj().PcbFootprintLibs()->IsEmpty( false ) )
{ {
wxString fp_lib_tbl = Prj().FootprintLibTblName(); wxString fp_lib_tbl = Prj().FootprintLibTblName();
@ -613,7 +613,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
{ {
try try
{ {
FootprintLibs()->Save( fp_lib_tbl ); Prj().PcbFootprintLibs()->Save( fp_lib_tbl );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {

View File

@ -469,7 +469,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
{ {
wxString nickname = getLibNickName(); wxString nickname = getLibNickName();
if( !FootprintLibs()->IsFootprintLibWritable( nickname ) ) if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) )
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format(
_( "Library '%s' is read only" ), _( "Library '%s' is read only" ),
@ -481,7 +481,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
} }
wxString fpid_txt = PCB_BASE_FRAME::SelectFootprint( this, nickname, wxString fpid_txt = PCB_BASE_FRAME::SelectFootprint( this, nickname,
wxEmptyString, wxEmptyString, FootprintLibs() ); wxEmptyString, wxEmptyString, Prj().PcbFootprintLibs() );
if( !fpid_txt ) if( !fpid_txt )
return false; return false;
@ -497,7 +497,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
try try
{ {
FootprintLibs()->FootprintDelete( nickname, fpname ); Prj().PcbFootprintLibs()->FootprintDelete( nickname, fpname );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
@ -545,22 +545,24 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
try try
{ {
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
// Delete old library if we're replacing it entirely. // Delete old library if we're replacing it entirely.
if( !aNewModulesOnly ) if( !aNewModulesOnly )
{ {
FootprintLibs()->FootprintLibDelete( nickname ); tbl->FootprintLibDelete( nickname );
FootprintLibs()->FootprintLibCreate( nickname ); tbl->FootprintLibCreate( nickname );
for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() ) for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() )
{ {
FootprintLibs()->FootprintSave( nickname, m, true ); tbl->FootprintSave( nickname, m, true );
} }
} }
else else
{ {
for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() ) for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() )
{ {
FootprintLibs()->FootprintSave( nickname, m, false ); tbl->FootprintSave( nickname, m, false );
// Check for request to stop backup (ESCAPE key actuated) // Check for request to stop backup (ESCAPE key actuated)
if( m_canvas->GetAbortRequest() ) if( m_canvas->GetAbortRequest() )
@ -627,7 +629,9 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
try try
{ {
MODULE* m = FootprintLibs()->FootprintLoad( aLibrary, footprintName ); FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
MODULE* m = tbl->FootprintLoad( aLibrary, footprintName );
if( m ) if( m )
{ {
@ -653,7 +657,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
// this always overwrites any existing footprint, but should yell on its // this always overwrites any existing footprint, but should yell on its
// own if the library or footprint is not writable. // own if the library or footprint is not writable.
FootprintLibs()->FootprintSave( aLibrary, aModule ); tbl->FootprintSave( aLibrary, aModule );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
@ -738,7 +742,7 @@ wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting )
headers.Add( _( "Nickname" ) ); headers.Add( _( "Nickname" ) );
headers.Add( _( "Description" ) ); headers.Add( _( "Description" ) );
FP_LIB_TABLE* fptbl = FootprintLibs(); FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
std::vector< wxArrayString > itemsToDisplay; std::vector< wxArrayString > itemsToDisplay;
std::vector< wxString > nicknames = fptbl->GetLogicalLibs(); std::vector< wxString > nicknames = fptbl->GetLogicalLibs();

View File

@ -135,7 +135,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
wxString fpid; wxString fpid;
viewer->ShowModal( &fpid ); viewer->ShowModal( &fpid, this );
//DBG(printf("%s: fpid:'%s'\n", __func__, TO_UTF8( fpid ) );) //DBG(printf("%s: fpid:'%s'\n", __func__, TO_UTF8( fpid ) );)
@ -274,7 +274,6 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
module->SetTimeStamp( GetNewTimeStamp() ); module->SetTimeStamp( GetNewTimeStamp() );
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
// Put it on FRONT layer, // Put it on FRONT layer,
// (Can be stored flipped if the lib is an archive built from a board) // (Can be stored flipped if the lib is an archive built from a board)
if( module->IsFlipped() ) if( module->IsFlipped() )
@ -316,7 +315,7 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const FPID& aFootprintId )
MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId ) MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId )
throw( IO_ERROR, PARSE_ERROR ) throw( IO_ERROR, PARSE_ERROR )
{ {
FP_LIB_TABLE* fptbl = FootprintLibs(); FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) ); wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) );

View File

@ -491,7 +491,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Clear_Pcb( true ); Clear_Pcb( true );
SetCrossHairPosition( wxPoint( 0, 0 ) ); SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadModuleFromLibrary( getLibNickName(), FootprintLibs(), true ); LoadModuleFromLibrary( getLibNickName(), Prj().PcbFootprintLibs(), true );
redraw = true; redraw = true;
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )

View File

@ -31,7 +31,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>
//#include <kiface_i.h> #include <kiway.h>
#include <project.h> #include <project.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
@ -50,7 +50,6 @@
#include <hotkeys.h> #include <hotkeys.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <kiway.h>
static PCB_SCREEN* s_screenModule; // the PCB_SCREEN used by the footprint editor static PCB_SCREEN* s_screenModule; // the PCB_SCREEN used by the footprint editor
@ -275,7 +274,7 @@ wxString FOOTPRINT_EDIT_FRAME::getLibPath()
{ {
const wxString& nickname = getLibNickName(); const wxString& nickname = getLibNickName();
const FP_LIB_TABLE::ROW* row = FootprintLibs()->FindRow( nickname ); const FP_LIB_TABLE::ROW* row = Prj().PcbFootprintLibs()->FindRow( nickname );
return row->GetFullURI( true ); return row->GetFullURI( true );
} }
@ -296,7 +295,8 @@ BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const
{ {
// get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD. // get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); // @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
wxASSERT( parentFrame ); wxASSERT( parentFrame );
@ -308,7 +308,8 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett
{ {
// set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD. // set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); // @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
wxASSERT( parentFrame ); wxASSERT( parentFrame );
@ -320,7 +321,8 @@ const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const
{ {
// get the settings from the parent editor, not our BOARD. // get the settings from the parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); // @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
wxASSERT( parentFrame ); wxASSERT( parentFrame );
@ -332,7 +334,8 @@ void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
{ {
// set the settings into parent editor, not our BOARD. // set the settings into parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); // @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
wxASSERT( parentFrame ); wxASSERT( parentFrame );
@ -478,7 +481,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent
void FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent ) void FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent )
{ {
FP_LIB_TABLE* fptbl = FootprintLibs(); FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
aEvent.Enable( fptbl && !fptbl->IsEmpty() ); aEvent.Enable( fptbl && !fptbl->IsEmpty() );
} }
@ -618,7 +621,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
{ {
try try
{ {
bool writable = FootprintLibs()->IsFootprintLibWritable( nickname ); bool writable = Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname );
// no exception was thrown, this means libPath is valid, but it may be read only. // no exception was thrown, this means libPath is valid, but it may be read only.
title = _( "Module Editor (active library: " ) + nickname + wxT( ")" ); title = _( "Module Editor (active library: " ) + nickname + wxT( ")" );

View File

@ -309,7 +309,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
{ {
m_libList->Clear(); m_libList->Clear();
std::vector< wxString > nicknames = FootprintLibs()->GetLogicalLibs(); std::vector< wxString > nicknames = Prj().PcbFootprintLibs()->GetLogicalLibs();
for( unsigned ii = 0; ii < nicknames.size(); ii++ ) for( unsigned ii = 0; ii < nicknames.size(); ii++ )
m_libList->Append( nicknames[ii] ); m_libList->Append( nicknames[ii] );
@ -348,7 +348,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
FOOTPRINT_LIST fp_info_list; FOOTPRINT_LIST fp_info_list;
fp_info_list.ReadFootprintFiles( FootprintLibs(), &m_libraryName ); fp_info_list.ReadFootprintFiles( Prj().PcbFootprintLibs(), &m_libraryName );
if( fp_info_list.GetErrorCount() ) if( fp_info_list.GetErrorCount() )
{ {
@ -509,7 +509,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty();
// Ensure we have the right library list: // Ensure we have the right library list:
std::vector< wxString > libNicknames = FootprintLibs()->GetLogicalLibs(); std::vector< wxString > libNicknames = Prj().PcbFootprintLibs()->GetLogicalLibs();
if( libNicknames.size() == m_libList->GetCount() ) if( libNicknames.size() == m_libList->GetCount() )
{ {
@ -742,13 +742,16 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
{ {
#if 0 // cannot remember why this is here
// The PCB_EDIT_FRAME may not be the FOOTPRINT_VIEW_FRAME's parent, // The PCB_EDIT_FRAME may not be the FOOTPRINT_VIEW_FRAME's parent,
// so use Kiway().Player() to fetch. // so use Kiway().Player() to fetch.
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, true ); PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, true );
(void*) parent;
#endif
wxString libname = m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension; wxString libname = m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension;
MODULE* oldmodule = GetBoard()->m_Modules; MODULE* oldmodule = GetBoard()->m_Modules;
MODULE* module = LoadModuleFromLibrary( libname, parent->FootprintLibs(), false ); MODULE* module = LoadModuleFromLibrary( libname, Prj().PcbFootprintLibs(), false );
if( module ) if( module )
{ {
@ -808,7 +811,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
MODULE* footprint = FootprintLibs()->FootprintLoad( m_libraryName, m_footprintName ); MODULE* footprint = Prj().PcbFootprintLibs()->FootprintLoad( m_libraryName, m_footprintName );
if( footprint ) if( footprint )
GetBoard()->Add( footprint, ADD_APPEND ); GetBoard()->Add( footprint, ADD_APPEND );

View File

@ -192,7 +192,7 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
MODULE* module = 0; MODULE* module = 0;
MODULE* fpOnBoard; MODULE* fpOnBoard;
if( aNetlist.IsEmpty() || FootprintLibs()->IsEmpty() ) if( aNetlist.IsEmpty() || Prj().PcbFootprintLibs()->IsEmpty() )
return; return;
aNetlist.SortByFPID(); aNetlist.SortByFPID();

View File

@ -37,6 +37,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_zone.h> #include <class_zone.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <project.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
@ -355,7 +356,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
DrawStruct = (BOARD_ITEM*) LoadModuleFromLibrary( DrawStruct = (BOARD_ITEM*) LoadModuleFromLibrary(
wxEmptyString, FootprintLibs(), true, aDC ); wxEmptyString, Prj().PcbFootprintLibs(), true, aDC );
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );

View File

@ -96,7 +96,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
case ID_PCB_LIB_TABLE_EDIT: case ID_PCB_LIB_TABLE_EDIT:
{ {
bool tableChanged = false; bool tableChanged = false;
int r = InvokePcbLibTableEditor( this, &GFootprintTable, FootprintLibs() ); int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
if( r & 1 ) if( r & 1 )
{ {
@ -126,7 +126,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
try try
{ {
FootprintLibs()->Save( tblName ); Prj().PcbFootprintLibs()->Save( tblName );
tableChanged = true; tableChanged = true;
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
@ -259,18 +259,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
SetElementVisibility( RATSNEST_VISIBLE, showRats ); SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif #endif
wxString projectFpLibTableFileName = Prj().FootprintLibTblName(); Prj().ElemClear( PROJECT::ELEM_FPTBL ); // Force it to be reloaded on demand.
FootprintLibs()->Clear();
try
{
FootprintLibs()->Load( projectFpLibTableFileName );
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.errorText );
}
// Load the page layout decr file, from the filename stored in // Load the page layout decr file, from the filename stored in
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file

View File

@ -27,6 +27,7 @@
#include "common_actions.h" #include "common_actions.h"
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <project.h>
#include <id.h> #include <id.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <confirm.h> #include <confirm.h>
@ -711,7 +712,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
{ {
// Init the new item attributes // Init the new item attributes
module = m_frame->LoadModuleFromLibrary( wxEmptyString, module = m_frame->LoadModuleFromLibrary( wxEmptyString,
m_frame->FootprintLibs(), m_frame->Prj().PcbFootprintLibs(),
true, NULL ); true, NULL );
if( module == NULL ) if( module == NULL )
continue; continue;

View File

@ -38,6 +38,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <project.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <dialog_exchange_modules_base.h> #include <dialog_exchange_modules_base.h>
@ -492,7 +493,7 @@ void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
wxString newname; wxString newname;
newname = m_parent->SelectFootprint( m_parent, wxEmptyString, wxEmptyString, wxEmptyString, newname = m_parent->SelectFootprint( m_parent, wxEmptyString, wxEmptyString, wxEmptyString,
m_parent->FootprintLibs() ); Prj().PcbFootprintLibs() );
if( newname != wxEmptyString ) if( newname != wxEmptyString )
m_NewModule->SetValue( newname ); m_NewModule->SetValue( newname );

View File

@ -30,7 +30,7 @@ def checkvalue(self):
if v.isdigit(): if v.isdigit():
i = int(v) i = int(v)
if (i > 1000000): if (i > 1000000):
i = i / 100000 i = i / 1000000
v = str(i) + "M" v = str(i) + "M"
if (i > 1000): if (i > 1000):
i = i / 1000 i = i / 1000

View File

@ -34,6 +34,17 @@
# Set where the 3 source trees will go, use a full path # Set where the 3 source trees will go, use a full path
WORKING_TREES=~/kicad_sources WORKING_TREES=~/kicad_sources
STABLE=tag:pre-kiway # currently the best mix of features and stabilty
TESTING=last:1 # the most recent
# Set this to STABLE or TESTING or other known revision number:
REVISION=$STABLE
# For info on revision syntax:
# $ bzr help revisionspec
# CMake Options # CMake Options
#OPTS="$OPTS -DBUILD_GITHUB_PLUGIN=OFF" #OPTS="$OPTS -DBUILD_GITHUB_PLUGIN=OFF"
@ -45,9 +56,6 @@ WORKING_TREES=~/kicad_sources
# https results in read only access. # https results in read only access.
REPOS=https://code.launchpad.net REPOS=https://code.launchpad.net
# This is no longer maintained, is old
#LEGACY_LIB_REPO=$REPOS/~dickelbeck/kicad/library-read-only
# This branch is a bzr/launchpad import of the Git repository # This branch is a bzr/launchpad import of the Git repository
# at https://github.com/KiCad/kicad-library.git. # at https://github.com/KiCad/kicad-library.git.
# It has schematic parts and 3D models in it. # It has schematic parts and 3D models in it.
@ -212,11 +220,11 @@ install_or_update()
echo "step 3) checking out the source code from launchpad repo..." echo "step 3) checking out the source code from launchpad repo..."
if [ ! -d "$WORKING_TREES/kicad.bzr" ]; then if [ ! -d "$WORKING_TREES/kicad.bzr" ]; then
bzr checkout $SRCS_REPO kicad.bzr bzr checkout -r $REVISION $SRCS_REPO kicad.bzr
echo " source repo to local working tree." echo " source repo to local working tree."
else else
cd kicad.bzr cd kicad.bzr
bzr up bzr up -r $REVISION
echo " local source working tree updated." echo " local source working tree updated."
cd ../ cd ../
fi fi