Commit 23b579cf authored by charras's avatar charras

cvpcb: code cleaning and remove obsolete features

parent 8080a2c9
......@@ -5,9 +5,9 @@
# configuration to use. wxWidgets is a modular library. To specify the
# modules that you will use, you need to name them as components to
# the package:
#
#
# FIND_PACKAGE(wxWidgets COMPONENTS base core ...)
#
#
# There are two search branches: a windows style and a unix style. For
# windows, the following variables are searched for and set to
# defaults in case of multiple choices. Change them if the defaults
......@@ -20,7 +20,7 @@
# (e.g., C:/wxWidgets-2.6.3/lib/vc_lib).
# wxWidgets_CONFIGURATION - Configuration to use
# (e.g., msw, mswd, mswu, mswunivud, etc.)
#
#
# For unix style it uses the wx-config utility. You can select between
# debug/release, unicode/ansi, universal/non-universal, and
# static/shared in the QtDialog or ccmake interfaces by turning ON/OFF
......@@ -30,7 +30,7 @@
# wxWidgets_USE_UNICODE
# wxWidgets_USE_UNIVERSAL
# wxWidgets_USE_STATIC
#
#
# The following are set after the configuration is done for both
# windows and unix style:
#
......@@ -115,7 +115,7 @@
# FIXME: This and all the DBG_MSG calls should be removed after the
# module stabilizes.
#
#
# Helper macro to control the debugging output globally. There are
# two versions for controlling how verbose your output should be.
MACRO(DBG_MSG _MSG)
......@@ -378,7 +378,7 @@ IF(WIN32_STYLE_FIND)
#-------------------------------------------------------------------
# Look for an installation tree.
FIND_PATH(wxWidgets_ROOT_DIR
FIND_PATH(wxWidgets_ROOT_DIR
NAMES include/wx/wx.h
PATHS
$ENV{wxWidgets_ROOT_DIR}
......@@ -387,7 +387,8 @@ IF(WIN32_STYLE_FIND)
C:/
D:/
$ENV{ProgramFiles}
PATH_SUFFIXES
PATH_SUFFIXES
wxWidgets-2.8.8
wxWidgets-2.8.7
wxWidgets-2.8.6
wxWidgets-2.8.5
......@@ -396,19 +397,9 @@ IF(WIN32_STYLE_FIND)
wxWidgets-2.8.2
wxWidgets-2.8.1
wxWidgets-2.8.0
wxWidgets-2.7.4
wxWidgets-2.7.3
wxWidgets-2.7.2
wxWidgest-2.7.1
wxWidgets-2.7.0
wxWidgets-2.7.0-1
wxWidgets-2.6.3
wxWidgets-2.6.2
wxWidgets-2.6.1
wxWidgets-2.5.4
wxWidgets-2.5.3
wxWidgets-2.5.2
wxWidgets-2.5.1
wxWidgets
DOC "wxWidgets base/installation directory?"
)
......@@ -600,7 +591,7 @@ ELSE(WIN32_STYLE_FIND)
ENDIF(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0)
ENDMACRO(WX_CONFIG_SELECT_QUERY_BOOL)
#
#
# Set wxWidgets_SELECT_OPTIONS to wx-config options for selecting
# among multiple builds.
#
......@@ -766,18 +757,18 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# #
# # wxWidgets_wxrc_EXECUTABLE
# #=====================================================================
#
#
# # Resource file compiler.
# FIND_PROGRAM(wxWidgets_wxrc_EXECUTABLE wxrc
# ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw
# )
#
# #
#
# #
# # WX_SPLIT_ARGUMENTS_ON(<keyword> <left> <right> <arg1> <arg2> ...)
# #
# #
# # Sets <left> and <right> to contain arguments to the left and right,
# # respectively, of <keyword>.
# #
# #
# # Example usage:
# # FUNCTION(WXWIDGETS_ADD_RESOURCES outfiles)
# # WX_SPLIT_ARGUMENTS_ON(OPTIONS wxrc_files wxrc_options ${ARGN})
......@@ -785,7 +776,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# # ENDFUNCTION(WXWIDGETS_ADD_RESOURCES)
# #
# # WXWIDGETS_ADD_RESOURCES(sources ${xrc_files} OPTIONS -e -o file.C)
# #
# #
# # NOTE: This is a generic piece of code that should be renamed to
# # SPLIT_ARGUMENTS_ON and put in a file serving the same purpose as
# # FindPackageStandardArgs.cmake. At the time of this writing
......@@ -799,7 +790,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# #LIST(APPEND ${_rightvar} "")
# SET(${_leftvar} "")
# SET(${_rightvar} "")
#
#
# SET(_doing_right FALSE)
# FOREACH(element ${ARGN})
# IF("${element}" STREQUAL "${_keyword}")
......@@ -812,11 +803,11 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# ENDIF(_doing_right)
# ENDIF("${element}" STREQUAL "${_keyword}")
# ENDFOREACH(element)
#
#
# RAISE_SCOPE(${_leftvar})
# RAISE_SCOPE(${_rightvar})
# ENDFUNCTION(WX_SPLIT_ARGUMENTS_ON)
#
#
# #
# # WX_GET_DEPENDENCIES_FROM_XML(
# # <depends>
......@@ -835,7 +826,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# _xml_contents
# _depends_path
# )
#
#
# STRING(REGEX MATCHALL
# ${_match_patt}
# dep_file_list
......@@ -843,46 +834,46 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# )
# FOREACH(dep_file ${dep_file_list})
# STRING(REGEX REPLACE ${_clean_patt} "" dep_file "${dep_file}")
#
#
# # make the file have an absolute path
# IF(NOT IS_ABSOLUTE "${dep_file}")
# SET(dep_file "${${_depends_path}}/${dep_file}")
# ENDIF(NOT IS_ABSOLUTE "${dep_file}")
#
#
# # append file to dependency list
# LIST(APPEND ${_depends} "${dep_file}")
# ENDFOREACH(dep_file)
#
#
# RAISE_SCOPE(${_depends})
# ENDFUNCTION(WX_GET_DEPENDENCIES_FROM_XML)
#
# #
#
# #
# # WXWIDGETS_ADD_RESOURCES(<sources> <xrc_files>
# # OPTIONS <options> [NO_CPP_CODE])
# #
# #
# # Adds a custom command for resource file compilation of the
# # <xrc_files> and appends the output files to <sources>.
# #
# #
# # Example usages:
# # WXWIDGETS_ADD_RESOURCES(sources xrc/main_frame.xrc)
# # WXWIDGETS_ADD_RESOURCES(sources ${xrc_files} OPTIONS -e -o altname.cxx)
# #
# FUNCTION(WXWIDGETS_ADD_RESOURCES _outfiles)
# WX_SPLIT_ARGUMENTS_ON(OPTIONS rc_file_list rc_options ${ARGN})
#
#
# # Parse files for dependencies.
# SET(rc_file_list_abs "")
# SET(rc_depends "")
# FOREACH(rc_file ${rc_file_list})
# GET_FILENAME_COMPONENT(depends_path ${rc_file} PATH)
#
#
# GET_FILENAME_COMPONENT(rc_file_abs ${rc_file} ABSOLUTE)
# LIST(APPEND rc_file_list_abs "${rc_file_abs}")
#
#
# # All files have absolute paths or paths relative to the location
# # of the rc file.
# FILE(READ "${rc_file_abs}" rc_file_contents)
#
#
# # get bitmap/bitmap2 files
# WX_GET_DEPENDENCIES_FROM_XML(
# rc_depends
......@@ -891,7 +882,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# rc_file_contents
# depends_path
# )
#
#
# # get url files
# WX_GET_DEPENDENCIES_FROM_XML(
# rc_depends
......@@ -900,7 +891,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# rc_file_contents
# depends_path
# )
#
#
# # get wxIcon files
# WX_GET_DEPENDENCIES_FROM_XML(
# rc_depends
......@@ -910,10 +901,10 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# depends_path
# )
# ENDFOREACH(rc_file)
#
#
# #
# # Parse options.
# #
# #
# # If NO_CPP_CODE option specified, then produce .xrs file rather
# # than a .cpp file (i.e., don't add the default --cpp-code option).
# LIST(FIND rc_options NO_CPP_CODE index)
......@@ -926,7 +917,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# # wxrc's default output filename for xrs file.
# SET(outfile resource.xrs)
# ENDIF(index EQUAL -1)
#
#
# # Get output name for use in ADD_CUSTOM_COMMAND.
# # - short option scanning
# LIST(FIND rc_options -o index)
......@@ -942,7 +933,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# ENDIF(outfile_opt)
# #STRING(REGEX REPLACE "--output=[^;]*;?" "" rc_options "${rc_options}")
# #STRING(REGEX REPLACE ";$" "" rc_options "${rc_options}")
#
#
# IF(NOT IS_ABSOLUTE "${outfile}")
# SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
# ENDIF(NOT IS_ABSOLUTE "${outfile}")
......@@ -951,7 +942,7 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# COMMAND ${wxWidgets_wxrc_EXECUTABLE} ${rc_options} ${rc_file_list_abs}
# DEPENDS ${rc_file_list_abs} ${rc_depends}
# )
#
#
# # Add generated header to output file list.
# LIST(FIND rc_options -e short_index)
# LIST(FIND rc_options --extra-cpp-code long_index)
......@@ -963,9 +954,9 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
# "${outfile_header}" PROPERTIES GENERATED TRUE
# )
# ENDIF(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1)
#
#
# # Add generated file to output file list.
# LIST(APPEND ${_outfiles} "${outfile}")
#
#
# RAISE_SCOPE(${_outfiles})
# ENDFUNCTION(WXWIDGETS_ADD_RESOURCES)
......@@ -23,13 +23,10 @@ set(CVPCB_SRCS
loadcmp.cpp
memoire.cpp
menucfg.cpp
rdpcad.cpp
readschematicnetlist.cpp
savecmp.cpp
setvisu.cpp
tool_cvpcb.cpp
viewlnet.cpp
viewlogi.cpp
writenetlistpcbnew.cpp)
set(CVPCB_EXTRA_SRCS
......
......@@ -39,9 +39,6 @@ void Read_Config( const wxString& FileName )
g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE );
if( PkgInExtBuffer.IsEmpty() )
PkgInExtBuffer = wxT( ".pkg" );
if( NetInExtBuffer.IsEmpty() )
NetInExtBuffer = wxT( ".net" );
......
......@@ -35,27 +35,12 @@ static PARAM_CFG_LIBNAME_LIST EquivNameBufCfg
GROUPEQU
);
static PARAM_CFG_INT NetInTypeCfg // format Netliste ( 0= auto 1=ORCADPCB2 3,4=VIEWLOGIC)
(
wxT("NetITyp"), /* identification */
&g_NetType, /* Adresse du parametre */
0, 4, /* Valeurs extremes */
1 /* Valeur par defaut */
);
static PARAM_CFG_WXSTRING NetInExtBufCfg
(
wxT("NetIExt"), /* identification */
&NetInExtBuffer
);
static PARAM_CFG_WXSTRING PkgInExtBufCfg
(
wxT("PkgIExt"), /* identification */
&PkgInExtBuffer /* Adresse du parametre */
);
static PARAM_CFG_WXSTRING NetDirBufCfg
(
wxT("NetDir"), /* identification */
......@@ -70,14 +55,6 @@ static PARAM_CFG_WXSTRING UserLibDirBufCfg
GROUPLIB
);
static PARAM_CFG_INT NetTypeCfg
(
wxT("NetType"), /* identification */
&g_NetType, /* Adresse du parametre */
0, /* Valeur par defaut */
0, 1 /* Valeurs extremes */
);
static PARAM_CFG_BOOL DisplayPadFillCfg
(
INSETUP,
......@@ -139,14 +116,11 @@ static PARAM_CFG_BOOL DisplayPcbTrackFillCfg
static PARAM_CFG_BASE * ParamCfgList[] =
{
& CommandCfg,
& NetInTypeCfg,
& NetInExtBufCfg,
& PkgInExtBufCfg,
& NetDirBufCfg,
& UserLibDirBufCfg,
& LibNameBufCfg,
& EquivNameBufCfg,
& NetTypeCfg,
& DisplayPadFillCfg,
& DisplayPadNumCfg,
& DisplayPadNoConnCfg,
......
......@@ -137,7 +137,6 @@ eda_global int composants_non_affectes; /* nbre de composants non af
eda_global wxString NameBuffer;
eda_global wxString NetInNameBuffer;
eda_global wxString NetInExtBuffer;
eda_global wxString PkgInExtBuffer;
eda_global wxString NetDirBuffer;
eda_global wxString ExtRetroBuffer
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cvpcb_config.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 17/02/2006 18:43:13
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 17/02/2006 18:43:13
......@@ -41,8 +41,6 @@ BEGIN_EVENT_TABLE( KiConfigCvpcbFrame, wxDialog )
EVT_BUTTON( wxID_OK, KiConfigCvpcbFrame::OnOkClick )
EVT_RADIOBOX( FORMAT_NETLIST, KiConfigCvpcbFrame::OnFormatNetlistSelected )
EVT_BUTTON( DEL_LIB, KiConfigCvpcbFrame::OnDelLibClick )
EVT_BUTTON( ADD_LIB, KiConfigCvpcbFrame::OnAddLibClick )
......@@ -86,14 +84,12 @@ bool KiConfigCvpcbFrame::Create( wxWindow* parent, wxWindowID id, const wxString
{
////@begin KiConfigCvpcbFrame member initialisation
m_OkButton = NULL;
m_NetFormatBox = NULL;
m_FileExtList = NULL;
m_RightBoxSizer = NULL;
m_ListLibr = NULL;
m_ListEquiv = NULL;
m_FileExtBoxSizerH = NULL;
m_NetExtBoxSizer = NULL;
m_PkgExtBoxSizer = NULL;
////@end KiConfigCvpcbFrame member initialisation
////@begin KiConfigCvpcbFrame creation
......@@ -115,11 +111,11 @@ bool KiConfigCvpcbFrame::Create( wxWindow* parent, wxWindowID id, const wxString
*/
void KiConfigCvpcbFrame::CreateControls()
{
{
SetFont(*g_DialogFont);
////@begin KiConfigCvpcbFrame content construction
// Generated by DialogBlocks, 11/06/2008 14:26:13 (unregistered)
// Generated by DialogBlocks, 31/07/2008 20:39:18 (unregistered)
KiConfigCvpcbFrame* itemDialog1 = this;
......@@ -137,19 +133,13 @@ void KiConfigCvpcbFrame::CreateControls()
itemButton5->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer3->Add(itemButton5, 0, wxGROW|wxLEFT|wxRIGHT, 5);
itemBoxSizer3->Add(5, 5, 0, wxGROW|wxALL, 5);
m_OkButton = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_OkButton->SetDefault();
m_OkButton->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer3->Add(m_OkButton, 0, wxGROW|wxALL, 5);
wxArrayString m_NetFormatBoxStrings;
m_NetFormatBoxStrings.Add(_("&PcbNew"));
m_NetFormatBoxStrings.Add(_("&ViewLogic"));
m_NetFormatBoxStrings.Add(_("View &Net + Pkg"));
m_NetFormatBox = new wxRadioBox( itemDialog1, FORMAT_NETLIST, _("NetList Formats:"), wxDefaultPosition, wxDefaultSize, m_NetFormatBoxStrings, 1, wxRA_SPECIFY_COLS );
m_NetFormatBox->SetSelection(0);
itemBoxSizer3->Add(m_NetFormatBox, 0, wxGROW|wxALL, 5);
wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Files ext:"));
m_FileExtList = new wxStaticBoxSizer(itemStaticBoxSizer8Static, wxVERTICAL);
itemBoxSizer3->Add(m_FileExtList, 0, wxGROW|wxALL, 5);
......@@ -230,9 +220,6 @@ void KiConfigCvpcbFrame::CreateControls()
m_NetExtBoxSizer = new wxBoxSizer(wxVERTICAL);
m_FileExtBoxSizerH->Add(m_NetExtBoxSizer, 0, wxGROW|wxRIGHT, 5);
m_PkgExtBoxSizer = new wxBoxSizer(wxVERTICAL);
m_FileExtBoxSizerH->Add(m_PkgExtBoxSizer, 0, wxGROW|wxLEFT|wxRIGHT, 5);
////@end KiConfigCvpcbFrame content construction
SetDialogDatas();
......@@ -356,13 +343,4 @@ void KiConfigCvpcbFrame::OnInsertEquClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for FORMAT_NETLIST
*/
void KiConfigCvpcbFrame::OnFormatNetlistSelected( wxCommandEvent& event )
{
ReturnNetFormat(event);
}
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cvpcb_config.h
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 17/02/2006 18:43:13
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 17/02/2006 18:43:13
......@@ -37,7 +37,6 @@ class wxBoxSizer;
#define ID_DIALOG 10000
#define SAVE_CFG 10001
#define ID_READ_OLDCFG 10002
#define FORMAT_NETLIST 10003
#define DEL_LIB 10004
#define ADD_LIB 10005
#define INSERT_LIB 10006
......@@ -66,7 +65,7 @@ class wxBoxSizer;
*/
class KiConfigCvpcbFrame: public wxDialog
{
{
DECLARE_DYNAMIC_CLASS( KiConfigCvpcbFrame )
DECLARE_EVENT_TABLE()
......@@ -92,9 +91,6 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for FORMAT_NETLIST
void OnFormatNetlistSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for DEL_LIB
void OnDelLibClick( wxCommandEvent& event );
......@@ -135,20 +131,17 @@ public:
void LibAddFct(wxCommandEvent& event);
void EquDelFct(wxCommandEvent& event);
void EquAddFct(wxCommandEvent& event);
void ReturnNetFormat(wxCommandEvent& event);
void SetDialogDatas();
////@begin KiConfigCvpcbFrame member variables
wxButton* m_OkButton;
wxRadioBox* m_NetFormatBox;
wxStaticBoxSizer* m_FileExtList;
wxBoxSizer* m_RightBoxSizer;
wxListBox* m_ListLibr;
wxListBox* m_ListEquiv;
wxBoxSizer* m_FileExtBoxSizerH;
wxBoxSizer* m_NetExtBoxSizer;
wxBoxSizer* m_PkgExtBoxSizer;
////@end KiConfigCvpcbFrame member variables
WinEDA_CvpcbFrame * m_Parent;
......
......@@ -456,6 +456,32 @@
<string name="proxy-Custom arguments">""</string>
<string name="proxy-Custom ctor arguments">""</string>
</document>
<document>
<string name="title">"Spacer"</string>
<string name="type">"dialog-control-document"</string>
<string name="filename">""</string>
<string name="icon-name">"spacer"</string>
<long name="is-transient">0</long>
<long name="owns-file">1</long>
<long name="title-mode">0</long>
<long name="locked">0</long>
<string name="created">"31/7/2008"</string>
<string name="proxy-type">"wbSpacerProxy"</string>
<long name="proxy-Width">5</long>
<long name="proxy-Height">5</long>
<string name="proxy-AlignH">"Expand"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
</document>
<document>
<string name="title">"wxButton: wxID_OK"</string>
<string name="type">"dialog-control-document"</string>
......@@ -523,71 +549,6 @@
<string name="proxy-Custom arguments">""</string>
<string name="proxy-Custom ctor arguments">""</string>
</document>
<document>
<string name="title">"wxRadioBox: FORMAT_NETLIST"</string>
<string name="type">"dialog-control-document"</string>
<string name="filename">""</string>
<string name="icon-name">"radiobox"</string>
<long name="is-transient">0</long>
<long name="owns-file">1</long>
<long name="title-mode">0</long>
<long name="locked">0</long>
<string name="created">"17/11/2006"</string>
<string name="proxy-type">"wbRadioBoxProxy"</string>
<string name="event-handler-0">"wxEVT_COMMAND_RADIOBOX_SELECTED|OnFormatNetlistSelected"</string>
<string name="proxy-Id name">"FORMAT_NETLIST"</string>
<long name="proxy-Id value">10003</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxRadioBox"</string>
<string name="proxy-Base class">"wxRadioBox"</string>
<bool name="proxy-External implementation">1</bool>
<bool name="proxy-Separate files">0</bool>
<string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_NetFormatBox"</string>
<string name="proxy-Label">"NetList Formats:"</string>
<long name="proxy-Major dimension count">1</long>
<string name="proxy-Items">"&amp;PcbNew|&amp;ViewLogic|View &amp;Net + Pkg"</string>
<long name="proxy-Initial value">0</long>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
<bool name="proxy-Hidden">0</bool>
<bool name="proxy-Enabled">1</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<bool name="proxy-wxRA_SPECIFY_ROWS">0</bool>
<bool name="proxy-wxRA_SPECIFY_COLS">1</bool>
<bool name="proxy-wxWANTS_CHARS">0</bool>
<bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool>
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool>
<string name="proxy-Custom styles">""</string>
<long name="proxy-X">-1</long>
<long name="proxy-Y">-1</long>
<long name="proxy-Width">-1</long>
<long name="proxy-Height">-1</long>
<string name="proxy-AlignH">"Expand"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
<string name="proxy-Custom arguments">""</string>
<string name="proxy-Custom ctor arguments">""</string>
</document>
<document>
<string name="title">"wxStaticBoxSizer V"</string>
<string name="type">"dialog-control-document"</string>
......@@ -1622,32 +1583,6 @@
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
</document>
<document>
<string name="title">"wxBoxSizer V"</string>
<string name="type">"dialog-control-document"</string>
<string name="filename">""</string>
<string name="icon-name">"sizer"</string>
<long name="is-transient">0</long>
<long name="owns-file">1</long>
<long name="title-mode">0</long>
<long name="locked">0</long>
<string name="created">"28/4/2006"</string>
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">"m_PkgExtBoxSizer"</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Expand"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">0</bool>
<bool name="proxy-wxBOTTOM">0</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
</document>
</document>
</document>
</document>
......
......@@ -75,33 +75,11 @@ void WinEDA_CvpcbFrame::ReadNetListe()
STORECMP * Composant;
wxString msg;
int ii;
int error_level = -1;
int error_level;
switch( g_NetType )
{
case TYPE_NON_SPECIFIE:
case TYPE_ORCADPCB2:
error_level = ReadSchematicNetlist();
break;
case TYPE_PCAD:
error_level = rdpcad() ;
break;
case TYPE_VIEWLOGIC_WIR:
error_level = ReadViewlogicWirList() ;
break;
case TYPE_VIEWLOGIC_NET:
error_level = ReadViewlogicNetList() ;
break;
default:
DisplayError(this, _("Unknown Netlist Format") );
break;
}
error_level = ReadSchematicNetlist();
if ( error_level < 0 ) return;
if ( error_level < 0 ) return;
/* lecture des correspondances */
loadcmp();
......@@ -151,7 +129,7 @@ int WinEDA_CvpcbFrame::SaveNetList(const wxString & FullFilename)
*/
{
wxString NetlistFullFileName = FullFilename;
if ( NetlistFullFileName.IsEmpty() )
{
wxString Mask = wxT("*") + NetExtBuffer;
......@@ -160,7 +138,7 @@ wxString NetlistFullFileName = FullFilename;
NetlistFullFileName = NetNameBuffer;
ChangeFileNameExt(NetlistFullFileName, NetExtBuffer);
}
NetlistFullFileName = EDA_FileSelector( _("Save NetList and Components List files"),
NetDirBuffer, /* Chemin par defaut */
NetlistFullFileName, /* nom fichier par defaut */
......
......@@ -26,16 +26,17 @@ OBJECTS = $(TARGET).o \
class_mire.o\
displayframe.o\
drawpanel.o \
init.o rdpcad.o \
init.o\
readschematicnetlist.o\
viewlogi.o viewlnet.o \
loadcmp.o savecmp.o \
loadcmp.o\
savecmp.o \
tool_cvpcb.o \
writenetlistpcbnew.o\
genequiv.o \
ioascii.o \
menucfg.o \
cfg.o listlib.o \
cfg.o\
listlib.o \
autosel.o \
setvisu.o\
dialog_display_options.o\
......
......@@ -48,28 +48,6 @@ void KiConfigCvpcbFrame::SetDialogDatas()
m_ListLibr->InsertItems(g_LibName_List,0);
m_ListEquiv->InsertItems(g_ListName_Equ,0);
switch( g_NetType )
{
case TYPE_NON_SPECIFIE:
case TYPE_ORCADPCB2:
m_NetFormatBox->SetSelection(0);
break;
case TYPE_PCAD:
break;
case TYPE_VIEWLOGIC_WIR:
m_NetFormatBox->SetSelection(1);
break;
case TYPE_VIEWLOGIC_NET:
m_NetFormatBox->SetSelection(2);
break;
default:
break;
}
m_LibDirCtrl = new WinEDA_EnterText(this,
_("Lib Dir:"), g_UserLibDirBuffer,
m_RightBoxSizer, wxDefaultSize);
......@@ -78,10 +56,6 @@ void KiConfigCvpcbFrame::SetDialogDatas()
_("Net Input Ext:"),NetInExtBuffer,
m_NetExtBoxSizer, wxDefaultSize);
m_PkgExtCtrl = new WinEDA_EnterText(this,
_("Pkg Ext:"), PkgInExtBuffer,
m_PkgExtBoxSizer, wxDefaultSize);
wxString DocModuleFileName =
g_EDA_Appl->m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY, DEFAULT_FOOTPRINTS_LIST_FILENAME);
m_TextHelpModulesFileName = new WinEDA_EnterText(this,
......@@ -125,10 +99,9 @@ void KiConfigCvpcbFrame::Update()
/**********************************/
{
wxString msg;
if ( ! m_DoUpdate ) return;
NetInExtBuffer = m_NetInputExtCtrl->GetValue();
PkgInExtBuffer = m_PkgExtCtrl->GetValue();
g_EDA_Appl->m_EDA_CommonConfig->Write( DOC_FOOTPRINTS_LIST_KEY,
m_TextHelpModulesFileName->GetValue());
......@@ -159,9 +132,9 @@ void KiConfigCvpcbFrame::ReadOldCfg(wxCommandEvent& event)
wxString line;
NetInNameBuffer.Replace(WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP);
wxString FullFileName = NetInNameBuffer.AfterLast('/');
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"),
......@@ -191,7 +164,7 @@ void KiConfigCvpcbFrame::LibDelFct(wxCommandEvent& event)
/*******************************************************/
{
int ii;
ii = m_ListLibr->GetSelection();
if ( ii < 0 ) return;
......@@ -200,7 +173,7 @@ int ii;
/* suppression de la reference dans la liste des librairies */
m_ListLibr->Delete(ii);
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
......@@ -233,7 +206,7 @@ wxString FullFileName, ShortLibName, mask;
FilesDialog.ShowModal();
wxArrayString Filenames;
FilesDialog.GetPaths(Filenames);
if ( Filenames.GetCount() == 0 )
return;
......@@ -255,7 +228,7 @@ wxString FullFileName, ShortLibName, mask;
DisplayError(this, msg);
}
}
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
......@@ -302,7 +275,7 @@ wxString FullFileName, ShortLibName, mask;
FilesDialog.ShowModal();
wxArrayString Filenames;
FilesDialog.GetFilenames(Filenames);
if ( Filenames.GetCount() == 0 )
return;
......@@ -328,24 +301,9 @@ wxString FullFileName, ShortLibName, mask;
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
m_ListEquiv->Clear();
m_ListEquiv->InsertItems(g_ListName_Equ, 0);
}
/*****************************************************************/
void KiConfigCvpcbFrame::ReturnNetFormat(wxCommandEvent& event)
/*****************************************************************/
{
int ii;
ii = m_NetFormatBox->GetSelection();
g_NetType = TYPE_ORCADPCB2;
if ( ii == 1 ) g_NetType = TYPE_VIEWLOGIC_WIR;
if ( ii == 2 ) g_NetType = TYPE_VIEWLOGIC_NET;
}
......@@ -5,38 +5,22 @@
#ifndef PROTOS_H
#define PROTOS_H
class DESCR_EDGE;
int reaffect( char *ib, char *net) ;
int GenNetlistPcbnew() ;
int loadcmp() ;
int listlib() ;
STOREMOD * GetModuleDescrByName(const wxString & FootprintName);
/***********/
/* CVPCB.CPP */
/***********/
void ModListProcedure(wxListBox& list, wxCommandEvent& event);
/***********/
/* CFG.CPP */
/***********/
void Save_Config(wxWindow * parent);
void Read_Config( const wxString & FullFileName ); /* lit la configuration */
/**************/
/* VISUMOD.CC */
/**************/
void AfficheModule(WinEDA_DrawPanel * panel, wxDC * DC); /* Affiche le module courant dans un cadre */
void Set_Rectangle_Encadrement(MODULE * PtModule);
/* Mise a jour du rectangle d'encadrement du module
Entree : pointeur sur module */
/**************/
/* MEMOIRE.CC */
/**************/
/***************/
/* MEMOIRE.CPP */
/***************/
void FreeMemoryComponants();
/* Routine de liberation memoire de la liste des composants
- remet a NULL BaseListeMod
......@@ -47,81 +31,5 @@ void FreeMemoryModules();
- remet a NULL g_BaseListePkg
- rement a 0 NbLib; */
/***************/
/* TRACEMOD.CC */
/***************/
void Trace_empreinte(WinEDA_DrawPanel * panel, wxDC * DC,
MODULE * Module,int ox, int oy,int mode_color);
void Trace_1_Pad(WinEDA_DrawPanel * panel, wxDC * DC,
D_PAD* ptr_pad,int ox, int oy,int mode_color);
void Trace_Ancre_Module(WinEDA_DrawPanel * panel,
wxDC * DC, MODULE * Module, int ox, int oy, int dim, int mode_color);
void Trace_DrawSegmentModule(WinEDA_DrawPanel * panel, wxDC * DC, DESCR_EDGE* PtDrawSegment,
int ox, int oy, int mode_color);
void Gr_E_texte(WinEDA_DrawPanel * panel, wxDC * DC,
MODULE * Module, TEXTE_MODULE * ptr,int ox,int oy,int mode_color) ;
void Trace_Contour_Module(WinEDA_DrawPanel * panel, wxDC * DC,
EDA_BaseStruct * PtStruct,
int ox, int oy, int mode_color);
void Affiche_1_Segment(WinEDA_DrawPanel * panel, wxDC * DC,
int ux0, int uy0, int dx, int dy,
int width, int mode, int color);
/**************/
/* RDORCAD.CC */
/**************/
STORECMP * TriListeComposantss(STORECMP * BaseListe, int nbitems);
/* Tri la liste des composants par ordre alphabetique et me a jour
le nouveau chainage avant/arriere
retourne un pointeur sur le 1er element de la liste */
int CmpCompare( void * cmp1, void * cmp2); /* routine pour qsort()
de tri de liste des composants */
/***************/
/* viewlogi.cc */
/***************/
int ReadViewlogicWirList();
/***************/
/* viewlnet.cc */
/***************/
int ReadViewlogicNetList();
/***************/
/* TRACEMOD.CC */
/***************/
void Display_1_Texte(WinEDA_DrawPanel * panel, wxDC * DC,
const char * Text, int Nmax, int ox, int oy,
int size_h, int size_v, int width, int orient, int Color);
/* Affichage de 1 texte a l'ecran. Parametres:
char * Text = pointeur sur le texte a afficher
int Nmax = Nombre max de caracteres a afficher
int ox, int oy = coord de trace relatives ( absolue - offset )
int size_h = taille H, si < 0: affichage en miroir.
int size_v = taille V
int width = epaisseur; si = 0 ou 1: affichage en filaire.
int orient = orientation en 0,1 degre
int Color = couleur | mode */
/**********/
/* COLORS */
/**********/
void BuildPensBrushes();
void FreePensBrushes();
int GetNewColor(wxWindow * Frame, int OldColor = -1); /* Routine de selection d'une couleur */
/***********/
/* OPTIONS */
/***********/
void CreateOptionsWindow(WinEDA_DrawFrame * parent);
/* Creation de la fenetre d'options de la fenetre de visu */
#endif // PROTOS_H
/****************/
/* rdpcad() */
/***************/
/* convertit la netliste PCAD en netliste standard (fichier temporaire)
* assure la reaffectation des alimentations selon le format :
* {I VALEUR<SEPARATEUR>(pin1,pin2,...=newalim).PRT ID
*/
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "colors.h"
#include "cvpcb.h"
#include "protos.h"
#define SEPARATEUR '|'
/* routines locales : */
int pin();
/***************************************/
int WinEDA_CvpcbFrame::rdpcad()
/***************************************/
{
int i, j, k, l;
char Line[1024];
char label[80]; /* buffer des references composants */
char val[80]; /* buffer des valeurs */
char* ptchar; /* pointeur de service */
STORECMP* Cmp;
modified = 0;
Rjustify = 0;
/* Raz buffer et variable de gestion */
if( g_BaseListeCmp )
FreeMemoryComponants();
/* Ouverture du fichier source */
source = wxFopen( FFileName, wxT( "rt" ) );
if( source == 0 )
{
wxString msg;
msg.Printf( _( "File <%s> not found" ), FFileName.GetData() );
DisplayError( this, msg ); return -1;
}
/* Lecture entete qui doit etre "{COMPONENT ORCAD.PCB" ou "{ OrCAD PCB"*/
fgets( Line, 255, source );
i = strncmp( Line, "{COMPONENT ORCAD.PCB", 9 ); /* net type PCAD */
if( i != 0 )
{
wxString msg, Lineconv = CONV_FROM_UTF8( Line );
msg.Printf( _( "Unknown file format <%s>" ), Lineconv.GetData() );
DisplayError( this, msg );
fclose( source ); return -3;
}
SetStatusText( _( "Netlist Format: Pcad" ), 0 );
/* Lecture de la liste */
for( ; ; )
{
/* recherche du debut de la description d'un composant */
if( fgets( Line, 80, source ) == 0 )
break;
/* suppression des blancs en d‚but de ligne */
i = 0; while( Line[i] == ' ' )
i++;
/* elimination des lignes vides : */
if( Line[i] < ' ' )
continue;
if( strncmp( &Line[i], "{I", 2 ) != 0 )
continue;
/****************************/
/* debut description trouv‚ */
/****************************/
i += 3; /* i pointe le 1er caractere de la valeur du composant */
for( j = 0; j < 20; j++ )
{
label[j] = 0; val[j] = ' ';
}
val[16] = 0;
for( j = 0; j < 80; j++ )
alim[j] = 0;
/* lecture valeur du composant ( toujours reecrire sur 8 caracteres) */
/* recherche fin de valeur (.PRT) */
ptchar = strstr( Line, ".PRT" );
if( ptchar == 0 )
{
//Netlist error: todo: display a message error
}
k = ptchar - Line;
for( j = 0; i < k; i++ )
{
if( Line[i] == SEPARATEUR )
break;
if( j < 8 )
val[j++] = Line[i];
}
if( (Line[++i] == '(') && (Line[k - 1] == ')' ) )
{
i++; l = 0; while( k - 1 > i )
alim[l++] = Line[i++];
}
else
i = k;
/* recherche reference du composant */
while( Line[i] != ' ' )
i++; /* elimination fin valeur */
while( Line[i] == ' ' )
i++; /* recherche debut reference */
/* debut reference trouv‚ */
for( k = 0; k < 8; i++, k++ )
{
if( Line[i] <= ' ' )
break;
label[k] = Line[i];
}
/* classement du composant ,suivi de sa valeur */
Cmp = new STORECMP();
Cmp->Pnext = g_BaseListeCmp;
g_BaseListeCmp = Cmp;
Cmp->m_Reference = CONV_FROM_UTF8( label );
Cmp->m_Valeur = CONV_FROM_UTF8( val );
pin();
nbcomp++;
}
fclose( source );
/* reclassement alpab‚tique : */
g_BaseListeCmp = TriListeComposantss( g_BaseListeCmp, nbcomp );
return 0;
}
/***********************************/
/* pin() : analyse liste des pines */
/***********************************/
int pin()
{
int i, j, k;
char numpin[9], net[9];
char Line[1024];
for( ; ; )
{
/* recherche du debut de la description des pins d'un composant */
if( fgets( Line, 80, source ) == 0 )
return -1;
/* suppression des blancs en d‚but de ligne */
i = 0; while( Line[i] == ' ' )
i++;
/* elimination des lignes vides : */
if( Line[i] < ' ' )
continue;
if( strncmp( &Line[i], "{CN", 3 ) != 0 )
continue;
/* debut description trouv‚ */
for( ; ; )
{
if( fgets( Line, 80, source ) == 0 )
return -1;
/* suppression des blancs en d‚but de ligne */
i = 0; while( Line[i] == ' ' )
i++;
/* elimination des lignes vides : */
if( Line[i] < ' ' )
continue;
/* fin de description ? */
if( Line[i] == '}' )
return 0;
memset( net, 0, sizeof(net) );
memset( numpin, 0, sizeof(numpin) );
/* lecture name pin , 4 lettres */
for( j = 0; j < 4; j++, i++ )
{
if( Line[i] == ' ' )
break;
numpin[j] = Line[i];
}
j = 0;
/* recherche affectation forc‚e de net */
if( reaffect( &numpin[j], net ) != 0 )
{
// fprintf(dest,"%s:%s\n",&numpin[j],net) ;
continue;
}
/* recherche netname */
while( Line[i] == ' ' )
i++; /* recherche debut reference */
/* debut netname trouv‚ */
for( k = 0; k < 8; i++, k++ )
{
if( Line[i] <= ' ' )
break;
net[k] = Line[i];
}
/* les pins non connect‚es sont ‚limin‚es :*/
if( net[0] == '?' )
continue;
// fprintf(dest,"%s:%s\n",&numpin[j],net) ;
}
}
}
/**************************************/
int reaffect( char* ib, char* net )
/**************************************/
/* force un nom de net pour une pin
* ib = reference de pin , net = nouveau net ; alim = ligne de consigne
*/
{
char* pt, * pt0, npin[12];
int i;
pt = alim;
while( *pt != 0 )
{
memset( npin, 0, sizeof(npin) );
/* recherche separateur (':' ou ',') */
while( (*pt != ':') && (*pt != ',') )
{
pt++; if( *pt == 0 )
return 0;
}
/* suppression des blancs eventuels */
pt0 = pt; /* save position du nom du net */
pt0--; while( *pt0 == ' ' )
pt0--;
for( i = 3; i >= 0; i-- )
{
if( (*pt0 == ',') || (*pt0 ==' ') )
break;
npin[i] = *pt0;
if( pt0 == alim )
break;
pt0--;
}
while( npin[0] == ' ' ) /* suppression des espaces a gauche */
{
npin[0] = npin[1];
npin[1] = npin[2];
npin[2] = npin[3];
npin[3] = ' ';
}
if( strncmp( npin, ib, 4 ) == 0 ) /* pin trouv‚e */
{
pt++; while( (*pt == ' ' ) && (*pt != 0 ) )
pt++;
i = 0;
while( (*pt != 0) && (*pt != ',') && ( i < 8 ) )
{
net[i++] = *pt++;
}
net[i] = 0;
return 1;
}
pt++;
}
return 0;
}
......@@ -19,21 +19,78 @@
/* routines locales : */
static int ReadPinConnection( STORECMP* CurrentCmp );
static int ReadPinConnection( STORECMP* CurrentCmp );
static int CmpCompare( void* cmp1, void* cmp2 ); /* routine pour qsort() de tri de liste des composants */
static STORECMP* TriListeComposants( STORECMP* BaseListe, int nbitems );
/* Tri la liste des composants par ordre alphabetique et met a jour le nouveau chainage avant/arriere
* retourne un pointeur sur le 1er element de la liste */
#define BUFFER_CHAR_SIZE 1024 // Size of buffers used to store netlist datas
/************************************************/
int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/************************************************/
/** Function ReadSchematicNetlist
* Read a Eeschema (or OrcadPCB) netlist
* like:
* # EESchema Netlist Version 1.1 created 15/5/2008-12:09:21
* (
* ( /32568D1E $noname JP1 CONN_8X2 {Lib=CONN_8X2}
* ( 1 GND )
* ( 2 /REF10 )
* ( 3 GND )
* ( 4 /REF11 )
* ( 5 GND )
* ( 6 /REF7 )
* ( 7 GND )
* ( 8 /REF9 )
* ( 9 GND )
* ( 10 /REF6 )
* ( 11 GND )
* ( 12 /REF8 )
* ( 13 GND )
* ( 14 /REF4 )
* ( 15 GND )
* ( 16 /REF5 )
* )
* ( /325679C1 $noname RR1 9x1K {Lib=RR9}
* ( 1 VCC )
* ( 2 /REF5 )
* ( 3 /REF4 )
* ( 4 /REF8 )
* ( 5 /REF6 )
* ( 6 /REF9 )
* ( 7 /REF7 )
* ( 8 /REF11 )
* ( 9 /REF10 )
* ( 10 ? )
* )
* )
* *
* { Allowed footprints by component:
* $component R5
* R?
* SM0603
* SM0805
* $endlist
* $component C2
* SM*
* C?
* C1-1
* $endlist
* $endfootprintlist
* }
*/
{
int i, j, k, l;
int i, k, l;
char* LibName;
char Line[BUFFER_CHAR_SIZE + 1];
char component_reference[BUFFER_CHAR_SIZE + 1]; /* buffer for component reference (U1, R4...) */
char schematic_timestamp[BUFFER_CHAR_SIZE + 1]; /* buffer for component time stamp */
char footprint_name[BUFFER_CHAR_SIZE + 1]; /* buffer for component footprint field */
char component_value[BUFFER_CHAR_SIZE + 1]; /* buffer for component values (470K, 22nF ...) */
wxString component_reference; /* buffer for component reference (U1, R4...) */
wxString schematic_timestamp; /* buffer for component time stamp */
wxString footprint_name; /* buffer for component footprint field */
wxString component_value; /* buffer for component values (470K, 22nF ...) */
char* ptchar; /* pointeur de service */
STORECMP* Cmp;
......@@ -116,11 +173,9 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/* i points the beginning of the schematic time stamp */
memset( schematic_timestamp, 0, sizeof(schematic_timestamp) );
j = 0; while( Line[i] != ' ' )
schematic_timestamp[j++] = Line[i++];
schematic_timestamp[j] = 0;
schematic_timestamp.Empty();
while( Line[i] != ' ' )
schematic_timestamp.Append( Line[i++] );
/* search val/ref.lib */
while( Line[i] == ' ' )
......@@ -129,9 +184,9 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/* i points the component value */
LibName = Line + i;
memset( component_reference, 0, sizeof(component_reference) );
memset( footprint_name, 0, sizeof(footprint_name) );
memset( component_value, 0, sizeof(component_value) );
component_reference.Empty();
footprint_name.Empty();
component_value.Empty();
memset( alim, 0, sizeof(alim) );
/* Read value */
......@@ -141,18 +196,17 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
{
wxString msg;
msg.Printf( _( "Netlist error: %s" ), Line );
DisplayError( NULL, msg );
DisplayError( this, msg );
k = 0;
}
else
k = ptchar - Line;
for( j = 0; i < k; i++ )
for( ; i < k; i++ )
{
if( Line[i] == SEPARATEUR )
break;
if( j < (int) (sizeof(footprint_name) - 1) )
footprint_name[j++] = Line[i];
footprint_name.Append( Line[i] );
}
if( (Line[++i] == '(') && (Line[k - 1] == ')' ) )
......@@ -174,11 +228,11 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/* goto beginning of reference */
/* debut reference trouv */
for( k = 0; k < (int) (sizeof(component_reference) - 1); i++, k++ )
for( ; ; i++ )
{
if( Line[i] <= ' ' )
break;
component_reference[k] = Line[i];
component_reference.Append( Line[i] );
}
/* Search component value */
......@@ -187,19 +241,19 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
/** goto beginning of value */
for( k = 0; k < (int) (sizeof(component_value) - 1); i++, k++ )
for( ; ; i++ )
{
if( Line[i] <= ' ' )
break;
component_value[k] = Line[i];
component_value.Append( Line[i] );
}
/* Store info for this component */
Cmp = new STORECMP();
Cmp->Pnext = g_BaseListeCmp;
g_BaseListeCmp = Cmp;
Cmp->m_Reference = CONV_FROM_UTF8( component_reference );
Cmp->m_Valeur = CONV_FROM_UTF8( component_value );
Cmp->m_Reference = component_reference;
Cmp->m_Valeur = component_value;
if( g_FlagEESchema ) /* copy footprint name: */
{
......@@ -212,7 +266,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
}
}
}
Cmp->m_TimeStamp = CONV_FROM_UTF8( schematic_timestamp );
Cmp->m_TimeStamp = schematic_timestamp;
ReadPinConnection( Cmp );
......@@ -222,7 +276,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
fclose( source );
/* Alpabetic sorting : */
g_BaseListeCmp = TriListeComposantss( g_BaseListeCmp, nbcomp );
g_BaseListeCmp = TriListeComposants( g_BaseListeCmp, nbcomp );
return 0;
}
......@@ -276,7 +330,8 @@ int ReadPinConnection( STORECMP* Cmp )
/***********************************/
{
int i, jj;
char numpin[BUFFER_CHAR_SIZE + 1], net[BUFFER_CHAR_SIZE + 1];
wxString numpin;
wxString net;
char Line[BUFFER_CHAR_SIZE + 1];
STOREPIN* Pin = NULL;
STOREPIN** LastPin = &Cmp->m_Pins;
......@@ -307,49 +362,39 @@ int ReadPinConnection( STORECMP* Cmp )
if( Line[i] == ')' )
return 0;
memset( net, 0, sizeof(net) );
memset( numpin, 0, sizeof(numpin) );
net.Empty();
numpin.Empty();
/* Read pin name , 4 letters */
for( jj = 0; jj < 4; jj++, i++ )
{
if( Line[i] == ' ' )
break;
numpin[jj] = Line[i];
}
/* Search for a net attribute */
if( reaffect( numpin, net ) != 0 )
{
Pin = new STOREPIN();
*LastPin = Pin; LastPin = &Pin->Pnext;
Pin->m_PinNum = CONV_FROM_UTF8( numpin );
Pin->m_PinNet = CONV_FROM_UTF8( net );
continue;
numpin.Append( Line[i] );
}
/* Read netname */
while( Line[i] == ' ' )
i++;
for( jj = 0; jj < (int) sizeof(net) - 1; i++, jj++ )
for( ; ; i++ )
{
if( Line[i] <= ' ' )
break;
net[jj] = Line[i];
net.Append( Line[i] );
}
Pin = new STOREPIN();
*LastPin = Pin; LastPin = &Pin->Pnext;
Pin->m_PinNum = CONV_FROM_UTF8( numpin );
Pin->m_PinNet = CONV_FROM_UTF8( net );
Pin->m_PinNum = numpin;
Pin->m_PinNet = net;
}
}
}
/****************************************************************/
STORECMP* TriListeComposantss( STORECMP* BaseListe, int nbitems )
STORECMP* TriListeComposants( STORECMP* BaseListe, int nbitems )
/****************************************************************/
/* Sort the component list( this is a linked list)
......
/*************************************************************/
/* Traitement des netlistes VIEWLOGIC , Format NETLISt + PKG */
/*************************************************************/
/* Traite la netliste VIEWLOGIC au format .net, avec fichiers .pkg
format .pkg
ex:
valeur;package;liste des composants
74LS00;14PDIP;U8,U9
74LS04;14PDIP;U2
CAP_NPOL;;CP1,CP2,CP3,CP4,CP5,CP6,CP7
RVERT;R_250MW;R11,R12,R13,R14,R15,R16,R17,R21,R22,R23,R24,R25,R26,R27,R31,R32,
R33,R34,R35,R36,R37
..
format .net
netname;cmp^pin,...
ex:
$1I1\$1N2;U2^8,U3^10
$1I1\$1N6;U3^9,U6^9
$1N30;J2_8^2,Q1^2,Q2^2,Q3^2,Q4^2,Q5^2,Q6^2,Q7^2,R21^2,R22^2,R23^2,R24^2,R25^2,
R26^2,R27^2,RP1^1,RP2^1,RP3^1,RP4^1,RP5^1,RP6^1,RP7^1
*/
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "cvpcb.h"
#include "protos.h"
/* routines locales : */
static void GenPin( STORECMP *BaseCmp,char *CmpName, char *PinNum, char *PinNet);
static int GenListeComposants(FILE * PkgFile);
/* Variables Locales */
/******************************/
/* int ReadViewlogicNet() */
/******************************/
int WinEDA_CvpcbFrame::ReadViewlogicNetList()
{
int ii, LineNum;
char Line[1024], *Text;
wxString PkgFileName;
char PinName[256], NetName[256], RefName[256], *Data;
STORECMP * Cmp;
wxString msg;
modified = 0;
Rjustify = 1;
/* Raz buffer et variable de gestion */
if( g_BaseListeCmp ) FreeMemoryComponants();
Cmp = NULL; LineNum = 0;
memset(Line, 0, sizeof(Line) );
/* Tst de la presence du fichier principal Netliste, et son format:
Si format = PCBNEW, appel de ReadSchematicNetlist
*/
source = wxFopen(FFileName, wxT("rt") );
if (source == 0)
{
msg = _("File not found ") + FFileName;
DisplayError(this, msg); return(-1);
}
if ( fgets(Line, sizeof(Line)-1, source) == 0 )
{ /* fichier vide */
fclose(source); return(-1);
}
fclose(source);
Text = StrPurge(Line);
ii = strnicmp(Line,"( { ",4) ; /* net type PCB2 */
if( ii != 0 ) ii = strnicmp(Line,"# EESchema",4) ; /* net type EESchema */
if( ii == 0 )
{
ii = ReadSchematicNetlist(); return(ii);
}
/* Traitement reel de la netliste Viewlogic ( .net et .pkg ) */
SetStatusText( _("Format Netlist: ViewLogic net&pkg"), 0);
/* Calcul du nom (full file name) du fichier .pkg */
PkgFileName = FFileName;
ChangeFileNameExt(PkgFileName, PkgInExtBuffer);
/* Ouverture du fichier .pkg */
source = wxFopen(PkgFileName, wxT("rt"));
if (source == 0)
{
msg = _("File not found ") + PkgFileName;
DisplayError(this, msg);
return(-1);
}
nbcomp = GenListeComposants(source);
fclose(source);
/* reclassement alpabtique : */
g_BaseListeCmp = TriListeComposantss( g_BaseListeCmp, nbcomp);
/* Ouverture du fichier netliste */
source = wxFopen(FFileName, wxT("rt"));
if (source == 0)
{
msg = _("File not found ") + FFileName;
DisplayError(this, msg);
return(-1);
}
/* Lecture de la liste ( fichier netliste ) */
LineNum = 0;
for ( ;; )
{
LineNum++;
if ( fgets(Line, sizeof(Line)-1, source) == 0 ) break ;
Text = StrPurge(Line);
if (*Text < ' ' ) continue; /* Ligne vide */
/* Lecture du NetName */
for( ii = 0; ii < 80; ii++, Text++)
{
if( *Text == 0 ) break;
if( *Text == ';' ) break;
NetName[ii] = *Text;
}
NetName[ii] = 0; if ( *Text == ';' ) Text++;
if( NetName[0] == 0 )
{
msg.Printf( wxT("Err. Pin Name ligne %s"),Line);
DisplayError(this, msg, 20);
}
/* Lecture des attributions de pins */
while( *Text != 0 )
{
Data = RefName; RefName[0] = PinName[0] = 0;
for( ii = 0; ii < 1000; ii++, Text++ )
{
if( *Text == 0 ) break;
if( *Text == ',' ) break;
if( *Text == '^' )
{
*Data = 0; Data = PinName; continue;
}
*Data = *Text; Data++;
}
*Data = 0;
if( (PinName[0] == 0 ) || (PinName[0] == 0 ) )
{
msg.Printf( wxT("Err. Pin Name ligne %s"),Line);
DisplayError(this, msg, 20); break;
}
GenPin( g_BaseListeCmp, RefName, PinName, NetName);
if ( *Text == ',' ) /* Autre element a traiter, ou nouvelle */
/* ligne a lire ( continuation de ligne ) */
{
Text++; Text = StrPurge(Text);
if( *Text == 0 ) /* Nouvelle ligne a lire */
{
LineNum++;
if ( fgets(Line, sizeof(Line)-1, source) == 0 ) break ;
Text = StrPurge(Line);
}
}
}
}
fclose(source);
return(0);
}
/******************************************************************************/
static void GenPin( STORECMP *BaseCmp, char * CmpName,
char *PinNum, char *PinNet)
/******************************************************************************/
/* Routine de creation d'une pin pour le composant de ref CmpName.
la pin a pour "numero" PinNum, et pour Net PinNet
*/
{
STORECMP *Cmp;
STOREPIN * Pin;
wxString StrCmpName = CONV_FROM_UTF8(CmpName);
/* Recherche du composant */
Cmp = BaseCmp;
for( ; Cmp != NULL; Cmp = Cmp->Pnext )
{
if( Cmp->m_Reference.CmpNoCase(StrCmpName) == 0 ) break;
}
if( Cmp == NULL )
{
wxString msg;
msg.Printf( _("Component [%s] not found in .pkg file"), CmpName);
DisplayError(NULL, msg, 1);
return;
}
/* Creation de la Pin */
Pin = new STOREPIN();
Pin->Pnext = Cmp->m_Pins; Cmp->m_Pins = Pin;
Pin->m_PinNum = CONV_FROM_UTF8(PinNum);
Pin->m_PinNet = CONV_FROM_UTF8(PinNet);
}
/******************************************/
static int GenListeComposants(FILE * PkgFile)
/******************************************/
/* Cree la liste des composants cites dans le fichier .pkg
Retourne le nombre de composants
*/
{
int ii, LineNum, NbComp;
char Line[1024], *Text;
char Valeur[256], Package[256], Name[256];
STORECMP * Cmp;
LineNum = 0; NbComp = 0;
/* Lecture de la liste ( fichier .pkg ) */
for ( ;; )
{
LineNum++;
if ( fgets(Line, sizeof(Line)-1, PkgFile) == 0 ) break ;
Text = StrPurge(Line);
if (*Text < ' ' ) continue; /* Ligne vide */
/* Lecture de la Valeur */
for( ii = 0; ii < 80; ii++, Text++)
{
if( *Text == 0 ) break;
if( *Text == ';' ) break;
Valeur[ii] = *Text;
}
Valeur[ii] = 0; if ( *Text == ';' ) Text++;
/* Lecture du type du boitier */
for( ii = 0; ii < 80; ii++, Text++)
{
if( *Text == 0 ) break;
if( *Text == ';' ) break;
Package[ii] = *Text;
}
Package[ii] = 0; if ( *Text == ';' ) Text++;
/* Lecture des composants */
while( *Text )
{
/* Lecture du nom du composant */
for( ii = 0; ii < 80; ii++, Text++)
{
if( *Text <= ' ' ) break;
if( *Text == ',' ) break;
Name[ii] = *Text;
}
Name[ii] = 0;
Cmp = new STORECMP();
Cmp->Pnext = g_BaseListeCmp;
g_BaseListeCmp = Cmp;
NbComp++ ;
Cmp->m_Reference = CONV_FROM_UTF8( StrPurge(Name) );
Cmp->m_Valeur = CONV_FROM_UTF8( StrPurge(Valeur) );
Cmp->m_Module = CONV_FROM_UTF8( StrPurge(Package) );
Cmp->m_TimeStamp = wxT("00000000");
if ( *Text == ',' ) /* Autre element a traiter, ou nouvelle */
/* ligne a lire ( continuation de ligne ) */
{
Text++; Text = StrPurge(Text);
if( *Text == 0 ) /* Nouvelle ligne a lire */
{
LineNum++;
if ( fgets(Line, sizeof(Line)-1, PkgFile) == 0 ) break ;
Text = StrPurge(Line);
}
}
}
}
return(NbComp);
}
This diff is collapsed.
......@@ -196,8 +196,6 @@ eda_global wxString g_Shapes3DExtBuffer //3D shape file extension
#endif
;
eda_global int g_NetType; // for cvpcb: Net type identifier
eda_global int g_CurrentVersionPCB
#ifdef MAIN
= 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment