Commit 5fd409f8 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Add user write permission tests to CVPcb and other minor fixes.

* Check user write permissions before saving project and net list files.
* Append read only to file name and path in title bar when the user
  does not have write privileges.
* Don't display file dialog every time the net list or project file is
  saved.
* Add save as and save project file as commands.
* Make capitalization of CVPcb consistent in all user strings.
* Doxygen comment and coding style policy fixes.
parent 8f1b5697
Loading
Loading
Loading
Loading
+20 −35
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

#include "fctsys.h"
#include "appl_wxstruct.h"
#include "id.h"
#include "common.h"
#include "gestfich.h"
#include "param_config.h"
@@ -16,15 +17,6 @@
#define GROUPEQU wxT("/cvpcb/libraries")


/**
 * Return project file parameter list for CVPcb.
 *
 * Populate the project file parameter array specific to CVPcb if it hasn't
 * already been populated and return a reference to the array to the caller.
 * Creating the parameter list at run time has the advantage of being able
 * to define local variables.  The old method of statically building the array
 * at compile time requiring global variable definitions.
 */
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters( void )
{
    if( !m_projectFileParams.empty() )
@@ -48,19 +40,9 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters( void )
}


/**
 * Reads the configuration
 * 1 - bed cvpcb.cnf
 * 2 - if not in path of  <cvpcb.exe> / cvpcb.cnf
 * 3 - If not found: init variables to default values
 *
 * Note:
 * The path of the executable must be in cvpcb.exe.
 *
 */
void CVPCB_MAINFRAME::LoadProjectFile( const wxString& FileName )
void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
{
    wxFileName fn = FileName;
    wxFileName fn = aFileName;

    m_ModuleLibNames.Clear();
    m_AliasLibNames.Clear();
@@ -70,8 +52,7 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& FileName )

    wxGetApp().RemoveLibraryPath( m_UserLibraryPath );

    wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP,
                                  GetProjectFileParameters(), FALSE );
    wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );

    if( m_NetlistFileExtension.IsEmpty() )
        m_NetlistFileExtension = wxT( "net" );
@@ -81,24 +62,28 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& FileName )
}


void CVPCB_MAINFRAME::Update_Config( wxCommandEvent& event )
void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
{
    SaveProjectFile( m_NetlistFileName.GetFullPath() );
}


void CVPCB_MAINFRAME::SaveProjectFile( const wxString& fileName )
{
    wxFileName fn = fileName;
    wxFileName fn = m_NetlistFileName;

    fn.SetExt( ProjectFileExtension );

    if( aEvent.GetId() == ID_SAVE_PROJECT_AS || !m_NetlistFileName.IsOk() )
    {
        wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(),
                      fn.GetFullName(), ProjectFileWildcard, wxFD_SAVE );
                          wxEmptyString, ProjectFileWildcard, wxFD_SAVE );

        if( dlg.ShowModal() == wxID_CANCEL )
            return;

    wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP,
                                   GetProjectFileParameters() );
        fn = dlg.GetPath();

        if( !fn.HasExt() )
            fn.SetExt( ProjectFileExtension );
    }

    if( !IsWritable( fn ) )
        return;

    wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
}
+111 −123
Original line number Diff line number Diff line
@@ -35,31 +35,22 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
    EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, CVPCB_MAINFRAME::LoadNetList )

    // Menu events
EVT_MENU( ID_LOAD_PROJECT,
          CVPCB_MAINFRAME::LoadNetList )
EVT_MENU( ID_SAVE_PROJECT,
          CVPCB_MAINFRAME::SaveQuitCvpcb )
EVT_MENU( wxID_EXIT,
          CVPCB_MAINFRAME::OnQuit )
EVT_MENU( wxID_HELP,
          CVPCB_MAINFRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT,
          CVPCB_MAINFRAME::GetKicadAbout )
EVT_MENU( wxID_PREFERENCES,
          CVPCB_MAINFRAME::ConfigCvpcb )
EVT_MENU( ID_CONFIG_SAVE,
          CVPCB_MAINFRAME::Update_Config )
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
          CVPCB_MAINFRAME::OnKeepOpenOnSave )

EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
                ID_LANGUAGE_CHOICE_END,
                CVPCB_MAINFRAME::SetLanguage )
    EVT_MENU( ID_LOAD_PROJECT, CVPCB_MAINFRAME::LoadNetList )
    EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::SaveQuitCvpcb )
    EVT_MENU( wxID_SAVEAS, CVPCB_MAINFRAME::SaveQuitCvpcb )
    EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
    EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
    EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
    EVT_MENU( wxID_PREFERENCES, CVPCB_MAINFRAME::ConfigCvpcb )
    EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile )
    EVT_MENU( ID_SAVE_PROJECT_AS, CVPCB_MAINFRAME::SaveProjectFile )
    EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )

    EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, CVPCB_MAINFRAME::SetLanguage )

    // Toolbar events
    EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
    EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST, CVPCB_MAINFRAME::LoadNetList )
EVT_TOOL( ID_CVPCB_SAVEQUITCVPCB, CVPCB_MAINFRAME::SaveQuitCvpcb )
    EVT_TOOL( ID_CVPCB_CREATE_CONFIGWINDOW, CVPCB_MAINFRAME::ConfigCvpcb )
    EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
    EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
@@ -83,9 +74,11 @@ EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, CVPCB_MAINFRAME::OnLeftClick )
    EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, CVPCB_MAINFRAME::OnLeftDClick )
    EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, CVPCB_MAINFRAME::OnSelectComponent )

EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
               CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
END_EVENT_TABLE() CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
    EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
END_EVENT_TABLE()


CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
    EDA_BASE_FRAME( NULL, CVPCB_FRAME, title, wxDefaultPosition, wxDefaultSize, style )
{
    m_FrameName = wxT( "CvpcbFrame" );
@@ -116,8 +109,10 @@ END_EVENT_TABLE() CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long
    SetAutoLayout( true );

    LoadSettings();

    if( m_FrameSize.x < FRAME_MIN_SIZE_X )
        m_FrameSize.x = FRAME_MIN_SIZE_X;

    if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
        m_FrameSize.y = FRAME_MIN_SIZE_Y;

@@ -175,8 +170,7 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME()

    if( config )
    {
        int state = m_HToolBar->GetToolState(
            ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
        int state = m_HToolBar->GetToolState( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
        config->Write( wxT( FILTERFOOTPRINTKEY ), state );
    }

@@ -184,12 +178,6 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
}


/**
 * Load Cvpcb main frame specific configuration settings.
 *
 * Don't forget to call this base method from any derived classes or the
 * settings will not get loaded.
 */
void CVPCB_MAINFRAME::LoadSettings()
{
    wxASSERT( wxGetApp().m_EDA_Config != NULL );
@@ -203,12 +191,6 @@ void CVPCB_MAINFRAME::LoadSettings()
}


/**
 * Save Cvpcb frame specific configuration settings.
 *
 * Don't forget to call this base method from any derived classes or the
 * settings will not get saved.
 */
void CVPCB_MAINFRAME::SaveSettings()
{
    wxASSERT( wxGetApp().m_EDA_Config != NULL );
@@ -243,8 +225,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
        wxMessageDialog dialog( this,
                                _( "Net and component list modified.\nSave before exit ?" ),
                                _( "Confirmation" ),
                                wxYES_NO | wxCANCEL | wxICON_EXCLAMATION |
                                wxYES_DEFAULT );
                                wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );

        ii = dialog.ShowModal();

@@ -259,9 +240,12 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )

        case wxID_OK:
        case wxID_YES:
            diag = SaveNetList( wxEmptyString );
            diag = SaveNetList( m_NetlistFileName.GetFullPath() );

            if( diag > 0 )
            {
                m_modified = false;
            }
            else if( diag == 0 )
            {
                if( !IsOK( this, _( "Problem when saving files, exit anyway ?" ) ) )
@@ -277,8 +261,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
    // Close the help frame
    if( wxGetApp().m_HtmlCtrl )
    {
        if( wxGetApp().m_HtmlCtrl->GetFrame() )     // returns NULL if no help
                                                    // frame active
        if( wxGetApp().m_HtmlCtrl->GetFrame() )     // returns NULL if no help frame active
            wxGetApp().m_HtmlCtrl->GetFrame()->Close( true );
    }

@@ -290,6 +273,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
    // Close module display frame
    if( m_DisplayFootprintFrame )
        m_DisplayFootprintFrame->Close( true );

    m_modified = false;
    SaveSettings();
    Destroy();
@@ -331,7 +315,8 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
    if( selection < 0 )
        selection = 0;

    BOOST_FOREACH( COMPONENT & component, m_components ) {
    BOOST_FOREACH( COMPONENT & component, m_components )
    {
        if( component.m_Module.IsEmpty() && ii > selection )
        {
            m_ListCmp->SetSelection( ii );
@@ -340,6 +325,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )

        ii++;
    }

    m_ListCmp->SetSelection( selection );
}

@@ -358,32 +344,36 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
    if( selection < 0 )
        selection = m_ListCmp->GetCount() - 1;

    BOOST_REVERSE_FOREACH( COMPONENT & component, m_components ) {
    BOOST_REVERSE_FOREACH( COMPONENT & component, m_components )
    {
        if( component.m_Module.IsEmpty() && ii < selection )
        {
            m_ListCmp->SetSelection( ii );
            return;
        }

        ii--;
    }

    m_ListCmp->SetSelection( selection );
}


void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& event )
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
{
    if( SaveNetList( wxEmptyString ) > 0 )
    if( aEvent.GetId() == wxID_SAVEAS )
        m_NetlistFileName.Clear();

    if( SaveNetList( m_NetlistFileName.GetFullPath() ) > 0 )
    {
        m_modified = false;

        if( !m_KeepCvpcbOpen )
            Close( true );
    }
}


/* Removes all associations already made
 */

void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
{
    wxString Line;
@@ -392,7 +382,8 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
    {
        m_ListCmp->SetSelection( 0 );

        BOOST_FOREACH( COMPONENT & component, m_components ) {
        BOOST_FOREACH( COMPONENT & component, m_components )
        {
            component.m_Module.Empty();
            SetNewPkg( wxEmptyString );
        }
@@ -405,10 +396,6 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
}


/*
 * Called when click on Load Netlist button or by file history menu entries
 * Read a netlist selected by user
 */
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
{
    wxString   oldPath;
@@ -440,18 +427,10 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
    /* Update the library search path list. */
    if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
        wxGetApp().GetLibraryPathList().Remove( oldPath );

    wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
    m_NetlistFileName = newFileName;

    if( ReadNetList() )
    {
        SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
                 wxT( " " ) + m_NetlistFileName.GetFullPath() );
    }
    else
    {
        SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() );
    }
    ReadNetList();
}


@@ -476,9 +455,6 @@ void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
}


/** Vitual function SetLanguage
 * called on a language menu selection
 */
void CVPCB_MAINFRAME::SetLanguage( wxCommandEvent& event )
{
    EDA_BASE_FRAME::SetLanguage( event );
@@ -487,8 +463,7 @@ void CVPCB_MAINFRAME::SetLanguage( wxCommandEvent& event )

void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
{
    GetAssociatedDocument( this, m_DocModulesFileName,
                          &wxGetApp().GetLibraryPathList() );
    GetAssociatedDocument( this, m_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
}


@@ -515,6 +490,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
    }

    selection = m_ListCmp->GetSelection();

    if( selection < 0 )
    {
        m_FootprintList->SetActiveFootprintList( true, true );
@@ -527,14 +503,11 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
        return;
    }

    m_FootprintList->SetFootprintFilteredList( &m_components[ selection ],
                                               m_footprints );
    m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], m_footprints );
    DisplayStatus();
}


/* Select full/filtered footprint display on tool click
 */
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
{
    switch( event.GetId() )
@@ -563,15 +536,11 @@ void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
}


/** DisplayStatus()
 * Displays info to the status line at bottom of the main frame
 */
void CVPCB_MAINFRAME::DisplayStatus()
{
    wxString msg;

    msg.Printf( _( "Components: %d (free: %d)" ),
                m_components.size(), m_undefinedComponentCnt );
    msg.Printf( _( "Components: %d (free: %d)" ), m_components.size(), m_undefinedComponentCnt );
    SetStatusText( msg, 0 );

    SetStatusText( wxEmptyString, 1 );
@@ -586,19 +555,14 @@ void CVPCB_MAINFRAME::DisplayStatus()
                        m_FootprintList->m_ActiveFootprintList->GetCount() );
    }
    else
    {
        msg.Empty();
    }

    SetStatusText( msg, 2 );
}


/*
 * Read the list of libraries (*.mod files) and populates m_footprints
 * ( list of availaible modules in libs ).
 * for each module are stored
 *      the module name
 *      documentation string
 *      associated keywords
 */
bool CVPCB_MAINFRAME::LoadFootprintFiles()
{
    /* Check if there are footprint libraries in project file */
@@ -615,6 +579,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
    if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() )
    {
        DIALOG_LOAD_ERROR dialog( NULL );

        if( !m_footprints.m_filesNotFound.IsEmpty() )
        {
            wxString message = _( "Some files could not be found!" );
@@ -628,8 +593,31 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
            dialog.MessageSet( _( "Some files are invalid!" ) );
            dialog.ListSet( m_footprints.m_filesInvalid );
        }

        dialog.ShowModal();
    }

    return true;
}


void CVPCB_MAINFRAME::UpdateTitle()
{
    wxString title;

    if( m_NetlistFileName.IsOk() && m_NetlistFileName.FileExists() )
    {
        title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
                wxT( " " ) + m_NetlistFileName.GetFullPath();

        if( !m_NetlistFileName.IsFileWritable() )
            title += _( " [Read Only]" );
    }
    else
    {
        title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
                wxT( " " ) + _( " [no file]" );
    }

    SetTitle( title );
}
+14 −23
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ void WinEDA_App::MacOpenFile(const wxString &fileName)
{
    wxFileName filename = fileName;
    wxString oldPath;
    CVPCB_MAINFRAME * frame = ((CVPCB_MAINFRAME*)GetTopWindow());
    CVPCB_MAINFRAME* frame = (CVPCB_MAINFRAME*) GetTopWindow();

    if( !filename.FileExists() )
        return;
@@ -54,24 +54,17 @@ void WinEDA_App::MacOpenFile(const wxString &fileName)
    /* Update the library search path list. */
    if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
        wxGetApp().GetLibraryPathList().Remove( oldPath );

    wxGetApp().GetLibraryPathList().Insert( filename.GetPath(), 0 );

    frame->m_NetlistFileName = filename;

    if( frame->ReadNetList() )
    {
        frame->SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
                  wxT( " " ) + filename.GetFullPath() );
    }
    else
    {
        frame->SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() );
    }
    frame->ReadNetList();
}

// Create a new application object
IMPLEMENT_APP( WinEDA_App )


/************************************/
/* Called to initialize the program */
/************************************/
@@ -82,11 +75,11 @@ bool WinEDA_App::OnInit()
    wxString         message;
    CVPCB_MAINFRAME* frame = NULL;

    InitEDA_Appl( wxT( "CvPCB" ), APP_TYPE_CVPCB );
    InitEDA_Appl( wxT( "CVPcb" ), APP_TYPE_CVPCB );

    if( m_Checker && m_Checker->IsAnotherRunning() )
    {
        if( !IsOK( NULL, _( "Cvpcb is already running, Continue?" ) ) )
        if( !IsOK( NULL, _( "CVPcb is already running, Continue?" ) ) )
            return false;
    }

@@ -126,9 +119,7 @@ bool WinEDA_App::OnInit()
    frame->LoadFootprintFiles();
    frame->m_NetlistFileExtension = wxT( "net" );
    frame->m_NetlistFileName.Clear();
    frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() +
                     wxGetCwd() + wxFileName::GetPathSeparator() +
                     _( " [no file]" ) );
    frame->UpdateTitle();

    return true;
}
+108 −13
Original line number Diff line number Diff line
@@ -44,60 +44,130 @@ protected:
    bool            m_isEESchemaNetlist;
    PARAM_CFG_ARRAY m_projectFileParams;

public: CVPCB_MAINFRAME( const wxString& title,
                         long            style = KICAD_DEFAULT_DRAWFRAME_STYLE );
public:
    CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
    ~CVPCB_MAINFRAME();

    void             OnLeftClick( wxListEvent& event );
    void             OnLeftDClick( wxListEvent& event );
    void             OnSelectComponent( wxListEvent& event );

    void             Update_Config( wxCommandEvent& event );
    void             OnQuit( wxCommandEvent& event );
    void             OnCloseWindow( wxCloseEvent& Event );
    void             OnSize( wxSizeEvent& SizeEvent );
    void             OnChar( wxKeyEvent& event );
    void             ReCreateHToolbar();
    virtual void     ReCreateMenuBar();

    /**
     * Function SetLanguage
     * is called on a language menu selection.
     */
    void             SetLanguage( wxCommandEvent& event );

    void             ToFirstNA( wxCommandEvent& event );
    void             ToPreviousNA( wxCommandEvent& event );

    /**
     * Function DelAssociations
     * removes all component footprint associations already made
     */
    void             DelAssociations( wxCommandEvent& event );

    void             SaveProjectFile( wxCommandEvent& aEvent );
    void             SaveQuitCvpcb( wxCommandEvent& event );

    /**
     * Function LoadNetList
     * reads a netlist selected by user when clicking on load netlist button or any entry
     * in the file history menu.
     */
    void             LoadNetList( wxCommandEvent& event );

    void             ConfigCvpcb( wxCommandEvent& event );
    void             OnKeepOpenOnSave( wxCommandEvent& event );
    void             DisplayModule( wxCommandEvent& event );
    void             AssocieModule( wxCommandEvent& event );
    void             WriteStuffList( wxCommandEvent& event );
    void             DisplayDocFile( wxCommandEvent& event );

    /**
     * Function OnSelectFilteringFootprint
     * is the command event handler for enabling and disabling footprint filtering.
     */
    void             OnSelectFilteringFootprint( wxCommandEvent& event );

    void             OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );

    /**
     * Function SetNewPkg
     * set the module to the selected component and selects the next component.
     */
    void             SetNewPkg( const wxString& package );
    void             BuildCmpListBox();
    void             BuildFOOTPRINTS_LISTBOX();
    void             CreateScreenCmp();
    int              SaveNetList( const wxString& FullFileName );
    int              SaveComponentList( const wxString& FullFileName );

    /**
     * Function SaveNetList
     * backup and save netlist (.net) file to \a aFullFileName.
     *
     * @param aFullFileName A reference wxString object containing the full path and
     *                      file name of the netlist to save.
     * @return 0 if an error occurred saving the netlist to \a aFullFileName.
     */
    int              SaveNetList( const wxString& aFullFileName );

    /**
     * Function SaveComponentList
     * backup modules to file \a aFullFileName.
     *
     * @param aFullFileName Name of net list file to save.
     * @returns 1 if OK, 0 if error.
     */
    int              SaveComponentList( const wxString& aFullFileName );

    /**
     * Function ReadNetList
     * reads the netlist (.net) file defined by #m_NetlistFileName.
     */
    bool             ReadNetList();

    int              ReadSchematicNetlist();
    void             LoadProjectFile( const wxString& FileName );
    void             SaveProjectFile( const wxString& fileName );

    /**
     * Function LoadProjectFile
     * reads the configuration parameter from the project (.pro) file \a aFileName
     */
    void             LoadProjectFile( const wxString& aFileName );

    /**
     * Function LoadSettings
     * loads the CVPcb main frame specific configuration settings.
     *
     * Don't forget to call this base method from any derived classes or the
     * settings will not get loaded.
     */
    virtual void     LoadSettings();

    /**
     * Function SaveSettings
     * save the CVPcb frame specific configuration settings.
     *
     * Don't forget to call this base method from any derived classes or the
     * settings will not get saved.
     */
    virtual void     SaveSettings();

    /**
     * Function DisplayStatus()
     * Displays info to the status line at bottom of the main frame
     * Function DisplayStatus
     * displays info to the status line at bottom of the main frame.
     */
    void             DisplayStatus();

    /**
     * Function LoadFootprintFiles
     * Read the list of libraries (*.mod files) and generate the list of modules.
     * reads the list of footprint (*.mod files) and generate the list of footprints.
     * for each module are stored
     *      the module name
     *      documentation string
@@ -117,13 +187,38 @@ public: CVPCB_MAINFRAME( const wxString& title,

    /**
     * Function LoadComponentFile
     * Loads the .cmp file that stores the component/footprint association.
     * @param aCmpFileName = the full filename of .cmp file to load
     * loads the .cmp file \a aCmpFileName that stores the component/footprint association.
     *
     * @param aFileName The full filename of .cmp file to load
     */
    bool             LoadComponentFile( const wxString& aCmpFileName );
    bool             LoadComponentFile( const wxString& aFileName );

    /**
     * Function GetProjectFileParameters
     * return project file parameter list for CVPcb.
     * <p>
     * Populate the project file parameter array specific to CVPcb if it hasn't
     * already been populated and return a reference to the array to the caller.
     * Creating the parameter list at run time has the advantage of being able
     * to define local variables.  The old method of statically building the array
     * at compile time requiring global variable definitions.
     * </p>
     *
     * @return A reference to a PARAM_CFG_ARRAY contain the project settings for CVPcb.
     */
    PARAM_CFG_ARRAY& GetProjectFileParameters( void );

    /**
     * Function UpdateTitle
     * sets the main window title bar text.
     * <p>
     * If file name defined by CVPCB_MAINFRAME::m_NetlistFileName is not set, the title is
     * set to the application name appended with no file.  Otherwise, the title is set to
     * the full path and file name and read only is appended to the title if the user does
     * not have write access to the file.
     */
    void UpdateTitle();

    DECLARE_EVENT_TABLE()
};

+45 −16

File changed.

Preview size limit exceeded, changes collapsed.

Loading