~cern-kicad/kicad/kicad-pns-tom

« back to all changes in this revision

Viewing changes to pcbnew/pcbnew_config.cpp

  • Committer: Maciej Suminski
  • Date: 2013-08-02 13:57:24 UTC
  • mfrom: (4024.1.238 kicad)
  • mto: This revision was merged to the branch mainline in revision 4221.
  • Revision ID: maciej.suminski@cern.ch-20130802135724-gix6orezshkukodv
Upstream merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include <dialog_hotkeys_editor.h>
44
44
#include <fp_lib_table.h>
45
45
#include <fp_lib_table_lexer.h>
 
46
#include <worksheet_shape_builder.h>
46
47
 
47
48
#include <class_board.h>
48
49
#include <pcbplot.h>
125
126
        break;
126
127
 
127
128
    case ID_CONFIG_SAVE:
128
 
        SaveProjectSettings();
 
129
        SaveProjectSettings( true );
129
130
        break;
130
131
 
131
132
    case ID_CONFIG_READ:
221
222
    SetElementVisibility( RATSNEST_VISIBLE, showRats );
222
223
#endif
223
224
 
 
225
    // Load the page layout decr file, from the filename stored in
 
226
    // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
 
227
    // If empty, the default descr is loaded
 
228
    WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
 
229
    pglayout.SetPageLayout(BASE_SCREEN::m_PageLayoutDescrFileName);
 
230
 
224
231
    loadFootprintLibTable();
225
232
 
226
233
    return true;
227
234
}
228
235
 
229
236
 
230
 
void PCB_EDIT_FRAME::SaveProjectSettings()
 
237
void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
231
238
{
232
239
    wxFileName fn;
233
240
 
234
241
    fn = GetBoard()->GetFileName();
235
242
    fn.SetExt( ProjectFileExtension );
236
243
 
237
 
    wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(), fn.GetFullName(),
238
 
                      ProjectFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR );
239
 
 
240
 
    if( dlg.ShowModal() == wxID_CANCEL )
241
 
        return;
242
 
 
243
 
    wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, GetProjectFileParameters() );
 
244
    if( aAskForSave )
 
245
    {
 
246
        wxFileDialog dlg( this, _( "Save Project File" ),
 
247
                          fn.GetPath(), fn.GetFullName(),
 
248
                          ProjectFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR );
 
249
 
 
250
        if( dlg.ShowModal() == wxID_CANCEL )
 
251
            return;
 
252
 
 
253
        wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, GetProjectFileParameters() );
 
254
    }
 
255
 
 
256
    else
 
257
        wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
244
258
}
245
259
 
246
260
 
248
262
{
249
263
    PARAM_CFG_ARRAY         pca;
250
264
 
 
265
    pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
 
266
                                          &BASE_SCREEN::m_PageLayoutDescrFileName ) );
 
267
 
251
268
    pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
252
 
                                                           GROUPLIB ) );
 
269
                                           GROUPLIB ) );
253
270
    pca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
254
 
                                                               &g_LibraryNames,
255
 
                                                               GROUPLIB ) );
 
271
                                               &g_LibraryNames,  GROUPLIB ) );
256
272
 
257
273
    pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
258
 
                                                           &m_lastNetListRead ) );
 
274
                                           &m_lastNetListRead ) );
259
275
 
260
276
    pca.push_back( new PARAM_CFG_BOOL( wxT( "UseCmpFile" ),
261
 
                                            &m_useCmpFileForFpNames, true ) );
 
277
                                       &m_useCmpFileForFpNames, true ) );
262
278
    GetBoard()->GetDesignSettings().AppendConfigs( &pca );
263
279
 
264
280
    return pca;