Modular KiCad Blueprint Milestone B), major portions:

*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
     get disassociated from their true PROJECT.
  *) Allow loading eeschema library editor from kicad.exe
  *) Allow loading pcbnew library editor from kicad.exe
  *) Rename LIB_COMPONENT to LIB_PART.
  *) Add class PART_LIBS, and PART_LIB.
  *) Make PART_LIBS non-global, i.e. PROJECT specific.
  *) Implement "data on demand" for PART_LIBS
  *) Implement "data on demand" for schematic SEARCH_STACK.
  *) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
  *) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
     a weak pointer.
  *) Remove all chdir() calls so projects don't need to be CWD.
  *) Romove APPEND support from OpenProjectFiles().
  *) Make OpenProjectFiles() robust, even for creating new projects.
  *) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
     and save them in the .eeschema config file, not in the project file.
  *) Fix bug with wxDir() while accessing protected dirs in kicad.exe
  *) Consolidate template copying into PROJECT class, not in kicad.exe source.
  *) Generally untangle eeschema, making its libraries not global but rather
     held in the PROJECT.
This commit is contained in:
Dick Hollenbeck
2014-08-13 15:28:54 -05:00
parent c63459653a
commit 7e483f69bd
163 changed files with 5839 additions and 5589 deletions
+30 -20
View File
@@ -46,12 +46,13 @@
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
{
LIB_COMPONENT* cmp = GetComponent();
wxString FullFileName;
wxString fullFileName;
wxString file_ext;
wxString mask;
if( cmp == NULL )
LIB_PART* part = GetCurPart();
if( !part )
{
wxMessageBox( _( "No component" ) );
return;
@@ -65,20 +66,22 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
wxFileName fn( part->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
fullFileName = EDA_FileSelector( _( "Filename:" ), pro_dir,
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
if( fullFileName.IsEmpty() )
return;
// calling wxYield is mandatory under Linux, after closing the file selector dialog
// to refresh the screen before creating the PNG or JPEG image from screen
wxYield();
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
CreatePNGorJPEGFile( fullFileName, fmt_is_jpeg );
}
break;
@@ -86,26 +89,29 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
{
file_ext = wxT( "svg" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
wxFileName fn( part->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
fullFileName = EDA_FileSelector( _( "Filename:" ), pro_dir,
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
if( fullFileName.IsEmpty() )
return;
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
wxSize componentSize = part->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
GetScreen()->SetPageSettings( pageTemp );
SVG_PlotComponent( FullFileName );
SVG_PlotComponent( fullFileName );
GetScreen()->SetPageSettings( pageSave );
}
break;
@@ -165,18 +171,20 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
plotter->StartPlot();
if( m_component )
LIB_PART* part = GetCurPart();
if( part )
{
TRANSFORM temp; // Uses default transform
wxPoint plotPos;
TRANSFORM temp; // Uses default transform
wxPoint plotPos;
plotPos.x = pageInfo.GetWidthIU() /2;
plotPos.y = pageInfo.GetHeightIU()/2;
m_component->Plot( plotter, GetUnit(), GetConvert(), plotPos, temp );
part->Plot( plotter, GetUnit(), GetConvert(), plotPos, temp );
// Plot lib fields, not plotted by m_component->Plot():
m_component->PlotLibFields( plotter, GetUnit(), GetConvert(),
plotPos, temp );
part->PlotLibFields( plotter, GetUnit(), GetConvert(), plotPos, temp );
}
plotter->EndPlot();
@@ -185,7 +193,9 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData)
{
if( ! m_component )
LIB_PART* part = GetCurPart();
if( !part )
return;
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
@@ -198,7 +208,7 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMod
plot_offset.x = pagesize.x/2;
plot_offset.y = pagesize.y/2;
m_component->Draw( m_canvas, aDC, plot_offset, m_unit, m_convert, GR_DEFAULT_DRAWMODE );
part->Draw( m_canvas, aDC, plot_offset, m_unit, m_convert, GR_DEFAULT_DRAWMODE );
}