2013-09-14 16:33:22 -04:00
|
|
|
/*
|
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
|
*
|
2015-01-11 18:22:45 +01:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2013-09-14 16:33:22 -04:00
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @file cfg.cpp
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <fctsys.h>
|
2014-04-07 23:55:53 -05:00
|
|
|
#include <kiface_i.h>
|
2014-03-19 19:42:08 -05:00
|
|
|
#include <fp_lib_table.h>
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <id.h>
|
|
|
|
|
#include <common.h>
|
|
|
|
|
#include <gestfich.h>
|
2014-03-19 19:42:08 -05:00
|
|
|
#include <config_params.h>
|
2013-05-31 13:33:46 -04:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2013-09-14 16:33:22 -04:00
|
|
|
#include <fp_lib_table.h>
|
|
|
|
|
#include <confirm.h>
|
2013-05-31 13:33:46 -04:00
|
|
|
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <cvpcb.h>
|
|
|
|
|
#include <cvpcb_mainframe.h>
|
2013-10-13 12:29:20 -04:00
|
|
|
#include <class_DisplayFootprintsFrame.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
2014-03-19 19:42:08 -05:00
|
|
|
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
if( !m_projectFileParams.empty() )
|
2009-04-23 15:02:18 +00:00
|
|
|
return m_projectFileParams;
|
|
|
|
|
|
2014-04-07 23:55:53 -05:00
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) );
|
2014-03-19 19:42:08 -05:00
|
|
|
|
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
2015-01-11 18:22:45 +01:00
|
|
|
wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
|
2014-03-19 19:42:08 -05:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
return m_projectFileParams;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-08-13 15:28:54 -05:00
|
|
|
void CVPCB_MAINFRAME::LoadProjectFile()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2014-08-13 15:28:54 -05:00
|
|
|
PROJECT& prj = Prj();
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_ModuleLibNames.Clear();
|
2015-01-11 18:22:45 +01:00
|
|
|
m_EquFilesNames.Clear();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-08-13 15:28:54 -05:00
|
|
|
prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-02-25 14:57:59 +01:00
|
|
|
void CVPCB_MAINFRAME::SaveProjectFile()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2014-08-13 15:28:54 -05:00
|
|
|
PROJECT& prj = Prj();
|
2015-01-11 18:22:45 +01:00
|
|
|
wxFileName fn = prj.GetProjectFullName();
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2011-08-24 15:44:05 -04:00
|
|
|
if( !IsWritable( fn ) )
|
2015-01-11 18:22:45 +01:00
|
|
|
{
|
|
|
|
|
wxMessageBox( _( "Project file '%s' is not writable" ), fn.GetFullPath() );
|
2008-03-04 04:22:27 +00:00
|
|
|
return;
|
2015-01-11 18:22:45 +01:00
|
|
|
}
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2014-08-13 15:28:54 -05:00
|
|
|
wxString pro_name = fn.GetFullPath();
|
2014-03-19 19:42:08 -05:00
|
|
|
|
2014-08-13 15:28:54 -05:00
|
|
|
prj.ConfigSave( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters(), pro_name );
|
2008-03-04 04:22:27 +00:00
|
|
|
}
|
2014-04-07 23:55:53 -05:00
|
|
|
|