Commit 7e483f69 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

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.
parent c6345965
Loading
Loading
Loading
Loading
+8 −13
Original line number Original line Diff line number Diff line
@@ -64,18 +64,13 @@ PCBNew


Dick's Final TODO List:
Dick's Final TODO List:
======================
======================
*)  Get licensing cleaned up.
*)  Milestone B of Modular KiCad Blueprint:

    * Put SEARCH_STACK::LastVisitedPath() out of its misery.
*)  DLL-ization of pcbnew & eeschema
    * Combine CVPCB into PCBNEW.
    http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
    https://blueprints.launchpad.net/kicad/+spec/modular-kicad

    Issues as a result of minimal testing:
    *   If eeschema launched from C++ project manager and does not find all libraries,
        then the dialog showing the names of missing libraries is shown twice.


    *   Clear all/some? retained strings on project change.
*)  Milestone C of Modular KiCad Blueprint
    *   Clear the FP_LIB_TABLE when the last KIWAY_PLAYER using it is closed.
    * SWIG class KIWAY, PROJECT, and KIWAY_MGR and fill out KIWAY_MGR as needed.
    * Implement PROJECT::Substitute().
    * Other stuff in blueprint milestone.



*)  Get licensing cleaned up.
Fix export gencad
 No newline at end of file
+23 −24
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>




void wxConfigSaveParams( wxConfigBase* aCfg,
void wxConfigLoadParams( wxConfigBase* aCfg,
            const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
            const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
{
{
    wxASSERT( aCfg );
    wxASSERT( aCfg );
@@ -55,32 +55,18 @@ void wxConfigSaveParams( wxConfigBase* aCfg,
        if( param.m_Setup )
        if( param.m_Setup )
            continue;
            continue;


        if( param.m_Type == PARAM_COMMAND_ERASE )       // Erase all data
        param.ReadParam( aCfg );
        {
            if( !!param.m_Ident )
                aCfg->DeleteGroup( param.m_Ident );
        }
        else
        {
            param.SaveParam( aCfg );
        }
    }
    }
}
}




void wxConfigLoadParams( wxConfigBase* aCfg,
void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
            const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
{
{
    wxASSERT( aCfg );
    wxASSERT( aCfg );


    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
    {
    {
        if( !!param.m_Group )
        if( !param.m_Setup )
            aCfg->SetPath( param.m_Group );
        else
            aCfg->SetPath( aGroup );

        if( param.m_Setup )
            continue;
            continue;


        param.ReadParam( aCfg );
        param.ReadParam( aCfg );
@@ -88,13 +74,19 @@ void wxConfigLoadParams( wxConfigBase* aCfg,
}
}




void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
void wxConfigSaveParams( wxConfigBase* aCfg,
        const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
{
{
    wxASSERT( aCfg );
    wxASSERT( aCfg );


    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
    BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
    {
    {
        if( !param.m_Setup )
        if( !!param.m_Group )
            aCfg->SetPath( param.m_Group );
        else
            aCfg->SetPath( aGroup );

        if( param.m_Setup )
            continue;
            continue;


        if( param.m_Type == PARAM_COMMAND_ERASE )       // Erase all data
        if( param.m_Type == PARAM_COMMAND_ERASE )       // Erase all data
@@ -110,7 +102,7 @@ void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
}
}




void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
{
{
    wxASSERT( aCfg );
    wxASSERT( aCfg );


@@ -119,10 +111,17 @@ void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
        if( !param.m_Setup )
        if( !param.m_Setup )
            continue;
            continue;


        param.ReadParam( aCfg );
        if( param.m_Type == PARAM_COMMAND_ERASE )       // Erase all data
        {
            if( !!param.m_Ident )
                aCfg->DeleteGroup( param.m_Ident );
        }
        else
        {
            param.SaveParam( aCfg );
        }
    }
    }
}
}





void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
+1 −2
Original line number Original line Diff line number Diff line
@@ -62,8 +62,7 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
    // pray that aParent is either a KIWAY_PLAYER or DIALOG_SHIM derivation.
    // pray that aParent is either a KIWAY_PLAYER or DIALOG_SHIM derivation.
    KIWAY_HOLDER* h = dynamic_cast<KIWAY_HOLDER*>( aParent );
    KIWAY_HOLDER* h = dynamic_cast<KIWAY_HOLDER*>( aParent );


    wxASSERT_MSG( h,
    // wxASSERT_MSG( h, wxT( "DIALOG_SHIM's parent is NULL or not derived from KIWAY_PLAYER nor DIALOG_SHIM" ) );
        wxT( "DIALOG_SHIM's parent is NULL or not derived from KIWAY_PLAYER nor DIALOG_SHIM" ) );


    if( h )
    if( h )
        SetKiway( this, &h->Kiway() );
        SetKiway( this, &h->Kiway() );
+12 −6
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include <fctsys.h>
#include <fctsys.h>
#include <macros.h>              // DIM()
#include <macros.h>              // DIM()
#include <common.h>
#include <common.h>
#include <project.h>
#include <confirm.h>
#include <confirm.h>
#include <gr_basic.h>
#include <gr_basic.h>
#include <base_struct.h>
#include <base_struct.h>
@@ -781,9 +782,11 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog()
// Called on .kicad_wks file description selection change
// Called on .kicad_wks file description selection change
void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
{
{
    wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );

    // Display a file picker dialog
    // Display a file picker dialog
    wxFileDialog fileDialog( this, _( "Select Page Layout Descr File" ),
    wxFileDialog fileDialog( this, _( "Select Page Layout Descr File" ),
                             wxGetCwd(), GetWksFileName(),
                             pro_dir, GetWksFileName(),
                             PageLayoutDescrFileWildcard,
                             PageLayoutDescrFileWildcard,
                             wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
                             wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );


@@ -800,11 +803,14 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
    // For Win/Linux/macOS compatibility, a relative path is a good idea
    // For Win/Linux/macOS compatibility, a relative path is a good idea
    if( fn.IsAbsolute() && fileName != GetWksFileName() )
    if( fn.IsAbsolute() && fileName != GetWksFileName() )
    {
    {
        fn.MakeRelativeTo( wxGetCwd() );
        fn.MakeRelativeTo( pro_dir );
        wxString msg;

        msg.Printf( _( "The page layout descr filename has changed\n"
        wxString msg = wxString::Format( _(
                       "Do you want to use the relative path:\n%s"),
                "The page layout descr filename has changed.\n"
                       fn.GetFullPath().GetData() );
                "Do you want to use the relative path:\n"
                "'%s'" ),
                GetChars( fn.GetFullPath() )
                );
        if( IsOK( this, msg ) )
        if( IsOK( this, msg ) )
            shortFileName = fn.GetFullPath();
            shortFileName = fn.GetFullPath();
    }
    }
+7 −6
Original line number Original line Diff line number Diff line
@@ -37,12 +37,14 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
                                  const wxArrayString& aItemHeaders,
                                  const wxArrayString& aItemHeaders,
                                  const std::vector<wxArrayString>& aItemList,
                                  const std::vector<wxArrayString>& aItemList,
                                  const wxString& aSelection,
                                  const wxString& aSelection,
                                  void( *aCallBackFunction )( wxString& ),
                                  void( *aCallBackFunction )( wxString&, void* ),
                                  void* aCallBackFunctionData,
                                  bool aSortList ) :
                                  bool aSortList ) :
    EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
    EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
{
{
    m_sortList    = aSortList;
    m_sortList    = aSortList;
    m_callBackFct = aCallBackFunction;
    m_cb_func     = aCallBackFunction;
    m_cb_data     = aCallBackFunctionData;
    m_itemsListCp = &aItemList;
    m_itemsListCp = &aItemList;


    for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
    for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
@@ -57,7 +59,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl


    InsertItems( aItemList, 0 );
    InsertItems( aItemList, 0 );


    if( m_callBackFct == NULL )
    if( m_cb_func == NULL )
    {
    {
        m_messages->Show( false );
        m_messages->Show( false );
        m_staticTextMsg->Show( false );
        m_staticTextMsg->Show( false );
@@ -231,12 +233,11 @@ void EDA_LIST_DIALOG::onCancelClick( wxCommandEvent& event )


void EDA_LIST_DIALOG::onListItemSelected( wxListEvent& event )
void EDA_LIST_DIALOG::onListItemSelected( wxListEvent& event )
{
{

    if( m_cb_func )
    if( m_callBackFct )
    {
    {
        m_messages->Clear();
        m_messages->Clear();
        wxString text = GetTextSelection();
        wxString text = GetTextSelection();
        m_callBackFct( text );
        m_cb_func( text, m_cb_data );
        m_messages->WriteText( text );
        m_messages->WriteText( text );
    }
    }
}
}
Loading