You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

664 lines
22 KiB

  1. /**********************************/
  2. /* Dialog box for netlist outputs */
  3. /**********************************/
  4. /* Functions relatives to the dialog creating the netlist for pcbnew.
  5. * The dialog is a notebook with 4 fixed netlist format:
  6. * PCBNEW ORCADPCB2 CADSTAR and SPICE
  7. * and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
  8. * calling an external converter with convert an intermediate format to the
  9. * user specific format.
  10. * these external converters are referred there as plugins,
  11. * but there are not really plugins, there are only external binaries
  12. */
  13. #include "fctsys.h"
  14. #include "appl_wxstruct.h"
  15. #include "common.h"
  16. #include "confirm.h"
  17. #include "gestfich.h"
  18. #include "program.h"
  19. #include "general.h"
  20. #include "netlist.h"
  21. #include "protos.h"
  22. #include "netlist_control.h"
  23. // ID for configuration:
  24. #define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
  25. #define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
  26. /****************************************************/
  27. wxString ReturnUserNetlistTypeName( bool first_item )
  28. /****************************************************/
  29. /** Function ReturnUserNetlistTypeName
  30. * to retrieve user netlist type names
  31. * @param first = true: return first name of the list, false = return next
  32. * @return a wxString : name of the type netlist or empty string
  33. * this function must be called first with "first_item" = true
  34. * and after with "first_item" = false to get all the other existing netlist names
  35. */
  36. {
  37. static int index;
  38. wxString name, msg;
  39. if( first_item )
  40. index = 0;
  41. else
  42. index++;
  43. msg = CUSTOM_NETLIST_TITLE;
  44. msg << index + 1;
  45. if( wxGetApp().m_EDA_Config )
  46. name = wxGetApp().m_EDA_Config->Read( msg );
  47. return name;
  48. }
  49. BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog )
  50. EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
  51. EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist )
  52. EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData )
  53. EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel )
  54. EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel )
  55. EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
  56. WinEDA_NetlistFrame::SelectNetlistType )
  57. EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator )
  58. END_EVENT_TABLE()
  59. /*******************************/
  60. /* Functions for these classes */
  61. /*******************************/
  62. /*****************************************************************************/
  63. EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent,
  64. const wxString& title,
  65. int id_NetType,
  66. int idCheckBox,
  67. int idCreateFile,
  68. bool selected ) :
  69. wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL |
  70. wxBORDER_SUNKEN )
  71. /*****************************************************************************/
  72. /** Contructor to create a setup page for one netlist format.
  73. * Used in Netlist format Dialog box creation
  74. * @param parent = wxNotebook * parent
  75. * @param title = title (name) of the notebook page
  76. * @param id_NetType = netlist type id
  77. * @param idCheckBox = event ID attached to the "format is default" check box
  78. * @param idCreateFile = event ID attached to the "create netlist" button
  79. */
  80. {
  81. m_IdNetType = id_NetType;
  82. m_CommandStringCtrl = NULL;
  83. m_TitleStringCtrl = NULL;
  84. m_IsCurrentFormat = NULL;
  85. m_ButtonCancel = NULL;
  86. parent->AddPage( this, title, selected );
  87. wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
  88. SetSizer( MainBoxSizer );
  89. wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
  90. m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
  91. MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
  92. MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
  93. m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
  94. m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
  95. m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
  96. UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
  97. UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
  98. UpperBoxSizer->Add( m_RightOptionsBoxSizer,
  99. 0,
  100. wxALIGN_CENTER_VERTICAL | wxALL,
  101. 5 );
  102. if( idCheckBox )
  103. {
  104. wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
  105. m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
  106. m_IsCurrentFormat =
  107. new wxCheckBox( this, idCheckBox, _( "Default format" ) );
  108. m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
  109. m_IsCurrentFormat->SetValue( selected );
  110. }
  111. /* Create the buttons: Create Neltist or browse Plugin and Cancel
  112. * and a third button for plugins : Remove or Ok button */
  113. if( idCreateFile )
  114. {
  115. wxButton* Button;
  116. if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel */
  117. Button = new wxButton( this, idCreateFile, _( "&Browse Plugin" ) );
  118. else
  119. Button = new wxButton( this, idCreateFile, _( "&Netlist" ) );
  120. m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  121. m_ButtonCancel =
  122. Button = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
  123. m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  124. /* Add special buttons to plugin panels:
  125. * for panel plugins: added the "delete" button
  126. * for the last panel (add plugin) a Ok button is added
  127. */
  128. if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel: add Ok button */
  129. {
  130. Button = new wxButton( this, ID_VALIDATE_PLUGIN, _( "&Ok" ) );
  131. m_RightOptionsBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  132. }
  133. else if( id_NetType >= PANELCUSTOMBASE ) /* This is a plugin panel: add delete button */
  134. {
  135. Button = new wxButton( this, ID_DELETE_PLUGIN, _( "&Delete" ) );
  136. m_RightOptionsBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  137. }
  138. }
  139. }
  140. /*************************************************************************************/
  141. WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) :
  142. wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
  143. wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
  144. /*************************************************************************************/
  145. /* Constructor for the netlist generation dialog box
  146. */
  147. {
  148. int ii;
  149. m_Parent = parent;
  150. for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
  151. {
  152. m_PanelNetType[ii] = NULL;
  153. }
  154. Centre();
  155. wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
  156. SetSizer( GeneralBoxSizer );
  157. m_NoteBook = new wxNotebook( this, ID_NETLIST_NOTEBOOK,
  158. wxDefaultPosition, wxDefaultSize );
  159. GeneralBoxSizer->Add( m_NoteBook, 0, wxGROW | wxALL, 5 );
  160. // Add notebook pages:
  161. // Add Panel FORMAT PCBNEW
  162. m_PanelNetType[PANELPCBNEW] =
  163. new EDA_NoteBookPage( m_NoteBook,
  164. wxT( "Pcbnew" ),
  165. NET_TYPE_PCBNEW,
  166. ID_CURRENT_FORMAT_IS_DEFAULT,
  167. ID_CREATE_NETLIST,
  168. m_Parent->m_NetlistFormat == NET_TYPE_PCBNEW );
  169. // Add Panel FORMAT ORCADPCB2
  170. m_PanelNetType[PANELORCADPCB2] =
  171. new EDA_NoteBookPage( m_NoteBook,
  172. wxT( "OrcadPCB2" ),
  173. NET_TYPE_ORCADPCB2,
  174. ID_CURRENT_FORMAT_IS_DEFAULT,
  175. ID_CREATE_NETLIST,
  176. m_Parent->m_NetlistFormat == NET_TYPE_ORCADPCB2 );
  177. // Add Panel FORMAT CADSTAR
  178. m_PanelNetType[PANELCADSTAR] =
  179. new EDA_NoteBookPage( m_NoteBook,
  180. wxT( "CadStar" ),
  181. NET_TYPE_CADSTAR,
  182. ID_CURRENT_FORMAT_IS_DEFAULT,
  183. ID_CREATE_NETLIST,
  184. m_Parent->m_NetlistFormat == NET_TYPE_CADSTAR );
  185. // Add Panel spice
  186. InstallPageSpice();
  187. // Add custom panels:
  188. InstallCustomPages();
  189. GetSizer()->Fit( this );
  190. GetSizer()->SetSizeHints( this );
  191. }
  192. /*************************************************/
  193. void WinEDA_NetlistFrame::InstallPageSpice()
  194. /*************************************************/
  195. /* Create the spice page
  196. */
  197. {
  198. wxButton* Button;
  199. EDA_NoteBookPage* page;
  200. page = m_PanelNetType[PANELSPICE] =
  201. new EDA_NoteBookPage( m_NoteBook,
  202. wxT( "Spice" ),
  203. NET_TYPE_SPICE,
  204. 0, 0,
  205. m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
  206. page->m_IsCurrentFormat =
  207. new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
  208. _( "Default format" ) );
  209. page->m_IsCurrentFormat->SetValue( m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
  210. page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
  211. wxString netlist_opt[2] = { _( "Use Net Names" ), _( "Use Net Numbers" ) };
  212. m_UseNetNamesInNetlist = new wxRadioBox( page, -1, _( "Netlist Options:" ),
  213. wxDefaultPosition, wxDefaultSize,
  214. 2, netlist_opt, 1,
  215. wxRA_SPECIFY_COLS );
  216. if( !g_OptNetListUseNames )
  217. m_UseNetNamesInNetlist->SetSelection( 1 );
  218. page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
  219. page->m_CommandStringCtrl = new WinEDA_EnterText( page,
  220. _( "Simulator command:" ),
  221. g_SimulatorCommandLine,
  222. page->m_LowBoxSizer,
  223. wxDefaultSize );
  224. // Add buttons
  225. Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
  226. page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  227. Button = new wxButton( page, ID_RUN_SIMULATOR, _( "&Run Simulator" ) );
  228. page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  229. Button = new wxButton( page, wxID_CANCEL, _( "&Cancel" ) );
  230. page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
  231. }
  232. /*************************************************/
  233. void WinEDA_NetlistFrame::InstallCustomPages()
  234. /*************************************************/
  235. /* create the pages for custom netlist format selection:
  236. */
  237. {
  238. bool selected;
  239. int ii, CustomCount;
  240. wxString title, previoustitle, msg;
  241. EDA_NoteBookPage* CurrPage;
  242. CustomCount = CUSTOMPANEL_COUNTMAX;
  243. previoustitle = wxT( "dummy_title" );
  244. for( ii = 0; ii < CustomCount; ii++ )
  245. {
  246. title = ReturnUserNetlistTypeName( ii == 0 ? true : false );
  247. if( title.IsEmpty() && previoustitle.IsEmpty() )
  248. break; // No more panel to install
  249. selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii );
  250. /* Install the panel "Add Plugin" after
  251. * the last initialized panel */
  252. previoustitle = title;
  253. if( title.IsEmpty() )
  254. CurrPage =
  255. m_PanelNetType[PANELCUSTOMBASE + ii] =
  256. new EDA_NoteBookPage( m_NoteBook,
  257. _( "Add Plugin" ),
  258. NET_TYPE_CUSTOM1 + ii,
  259. ID_CURRENT_FORMAT_IS_DEFAULT,
  260. ID_SETUP_PLUGIN,
  261. selected );
  262. else /* Install a plugin panel */
  263. CurrPage =
  264. m_PanelNetType[PANELCUSTOMBASE + ii] =
  265. new EDA_NoteBookPage( m_NoteBook,
  266. title,
  267. NET_TYPE_CUSTOM1 + ii,
  268. ID_CURRENT_FORMAT_IS_DEFAULT,
  269. ID_CREATE_NETLIST,
  270. selected );
  271. msg = CUSTOM_NETLIST_COMMAND;
  272. msg << ii + 1;
  273. wxString Command = wxGetApp().m_EDA_Config->Read( msg );
  274. CurrPage->m_CommandStringCtrl =
  275. new WinEDA_EnterText( CurrPage,
  276. _( "Netlist command:" ), Command,
  277. CurrPage->m_LowBoxSizer,
  278. wxDefaultSize );
  279. CurrPage->m_TitleStringCtrl =
  280. new WinEDA_EnterText( CurrPage,
  281. _( "Title:" ), title,
  282. CurrPage->m_LowBoxSizer,
  283. wxDefaultSize );
  284. }
  285. }
  286. /***********************************************************/
  287. void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
  288. /***********************************************************/
  289. /* Browse the plugin files and set the m_CommandStringCtrl field
  290. */
  291. {
  292. wxString FullFileName, Mask, Path;
  293. Mask = wxT( "*" );
  294. Path = wxGetApp().m_BinDir;
  295. FullFileName = EDA_FileSelector( _( "Plugin files:" ),
  296. Path,
  297. FullFileName,
  298. wxEmptyString,
  299. Mask,
  300. this,
  301. wxFD_OPEN,
  302. TRUE
  303. );
  304. if( FullFileName.IsEmpty() )
  305. return;
  306. EDA_NoteBookPage* CurrPage;
  307. CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
  308. if( CurrPage == NULL )
  309. return;
  310. CurrPage->m_CommandStringCtrl->SetValue( FullFileName );
  311. /* Get a title for this page */
  312. wxString title = CurrPage->m_TitleStringCtrl->GetValue();
  313. if( title.IsEmpty() )
  314. DisplayInfoMessage( this,
  315. _( "Do not forget to choose a title for this \
  316. netlist control page" ) );
  317. }
  318. /*****************************************************************/
  319. void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event )
  320. /*****************************************************************/
  321. /* Called when the check box "default format" is clicked
  322. */
  323. {
  324. int ii;
  325. EDA_NoteBookPage* CurrPage;
  326. for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
  327. if( m_PanelNetType[ii] )
  328. m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( FALSE );
  329. CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
  330. if( CurrPage == NULL )
  331. return;
  332. m_Parent->m_NetlistFormat = CurrPage->m_IdNetType;
  333. CurrPage->m_IsCurrentFormat->SetValue( TRUE );
  334. }
  335. /***********************************************/
  336. void WinEDA_NetlistFrame::NetlistUpdateOpt()
  337. /***********************************************/
  338. {
  339. int ii;
  340. g_SimulatorCommandLine =
  341. m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
  342. m_Parent->m_NetlistFormat = NET_TYPE_PCBNEW;
  343. for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
  344. {
  345. if( m_PanelNetType[ii] == NULL )
  346. break;
  347. if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == TRUE )
  348. m_Parent->m_NetlistFormat = m_PanelNetType[ii]->m_IdNetType;
  349. }
  350. g_OptNetListUseNames = TRUE; // Used for pspice, gnucap
  351. if( m_UseNetNamesInNetlist->GetSelection() == 1 )
  352. g_OptNetListUseNames = FALSE;
  353. }
  354. /**********************************************************/
  355. void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
  356. /**********************************************************/
  357. /** Function GenNetlist
  358. * Create the netlist file:
  359. * calculate the filename with the suitable extensions
  360. * and run the netlist creator
  361. */
  362. {
  363. wxFileName fn;
  364. wxString FileWildcard, FileExt;
  365. wxString msg, Command;
  366. int netformat_tmp = m_Parent->m_NetlistFormat;
  367. NetlistUpdateOpt();
  368. EDA_NoteBookPage* CurrPage;
  369. CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
  370. m_Parent->m_NetlistFormat = CurrPage->m_IdNetType;
  371. /* Calculate the netlist filename */
  372. fn = g_RootSheet->m_AssociatedScreen->m_FileName;
  373. switch( m_Parent->m_NetlistFormat )
  374. {
  375. case NET_TYPE_SPICE:
  376. FileExt = wxT( "cir" );
  377. FileWildcard = _( "SPICE netlist file (.cir)|*.cir" );
  378. break;
  379. case NET_TYPE_CADSTAR:
  380. FileExt = wxT( "frp" );
  381. FileWildcard = _( "CadStar netlist file (.frp)|*.frp" );
  382. break;
  383. default:
  384. FileExt = NetlistFileExtension;
  385. FileWildcard = NetlistFileWildcard;
  386. break;
  387. }
  388. fn.SetExt( FileExt );
  389. wxFileDialog dlg( this, _( "Save Netlist Files" ), fn.GetPath(),
  390. fn.GetFullName(), FileWildcard,
  391. wxFD_SAVE /*| wxFD_OVERWRITE_PROMPT*/ );
  392. if( dlg.ShowModal() == wxID_CANCEL )
  393. return;
  394. m_Parent->ClearMsgPanel();
  395. ReAnnotatePowerSymbolsOnly();
  396. if( m_Parent->CheckAnnotate( NULL, 0 ) )
  397. {
  398. if( !IsOK( this, _( "Must be Annotated, Continue ?" ) ) )
  399. return;
  400. }
  401. /* Cleanup the entire hierarchy */
  402. EDA_ScreenList ScreenList;
  403. for( SCH_SCREEN* screen = ScreenList.GetFirst();
  404. screen != NULL;
  405. screen = ScreenList.GetNext() )
  406. {
  407. bool ModifyWires;
  408. ModifyWires = screen->SchematicCleanUp( NULL );
  409. // if wire list has changed, delete the Undo Redo list to avoid
  410. // pointer problems with deleted data
  411. if( ModifyWires )
  412. screen->ClearUndoRedoList();
  413. }
  414. m_Parent->BuildNetListBase();
  415. if( CurrPage->m_CommandStringCtrl )
  416. g_NetListerCommandLine = CurrPage->m_CommandStringCtrl->GetValue();
  417. else
  418. g_NetListerCommandLine.Empty();
  419. switch( m_Parent->m_NetlistFormat )
  420. {
  421. default:
  422. WriteNetList( m_Parent, dlg.GetPath(), TRUE );
  423. break;
  424. case NET_TYPE_CADSTAR:
  425. case NET_TYPE_ORCADPCB2:
  426. WriteNetList( m_Parent, dlg.GetPath(), FALSE );
  427. case NET_TYPE_SPICE:
  428. g_OptNetListUseNames = TRUE; // Used for pspice, gnucap
  429. if( m_UseNetNamesInNetlist->GetSelection() == 1 )
  430. g_OptNetListUseNames = FALSE;
  431. WriteNetList( m_Parent, dlg.GetPath(), g_OptNetListUseNames );
  432. break;
  433. }
  434. m_Parent->m_NetlistFormat = netformat_tmp;
  435. WriteCurrentNetlistSetup();
  436. EndModal( NET_OK );
  437. }
  438. /***********************************************************/
  439. void WinEDA_NetlistFrame::OnCancelClick( wxCommandEvent& event )
  440. /***********************************************************/
  441. {
  442. EndModal( NET_ABORT );
  443. }
  444. /***********************************************************/
  445. void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
  446. /***********************************************************/
  447. {
  448. wxFileName fn;
  449. wxString ExecFile, CommandLine;
  450. g_SimulatorCommandLine =
  451. m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
  452. g_SimulatorCommandLine.Trim( FALSE );
  453. g_SimulatorCommandLine.Trim( TRUE );
  454. ExecFile = g_SimulatorCommandLine.BeforeFirst( ' ' );
  455. CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
  456. /* Calculate the netlist filename */
  457. fn = g_RootSheet->m_AssociatedScreen->m_FileName;
  458. fn.SetExt( wxT( "cir" ) );
  459. CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
  460. ExecuteFile( this, ExecFile, CommandLine );
  461. }
  462. /*********************************************************/
  463. void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
  464. /*********************************************************/
  465. /** Function WriteCurrentNetlistSetup
  466. * Write the current netlist options setup in the configuration
  467. */
  468. {
  469. wxString msg, Command;
  470. wxConfig* config = wxGetApp().m_EDA_Config;
  471. NetlistUpdateOpt();
  472. // Update the new titles
  473. for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
  474. {
  475. EDA_NoteBookPage* CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE];
  476. if( CurrPage == NULL )
  477. break;
  478. msg = wxT( "Custom" );
  479. msg << ii + 1;
  480. if( CurrPage->m_TitleStringCtrl )
  481. {
  482. wxString title = CurrPage->m_TitleStringCtrl->GetValue();
  483. if( msg != title ) // Title has changed, Update config
  484. {
  485. msg = CUSTOM_NETLIST_TITLE;
  486. msg << ii + 1;
  487. config->Write( msg, title );
  488. }
  489. }
  490. if( CurrPage->m_CommandStringCtrl )
  491. {
  492. Command = CurrPage->m_CommandStringCtrl->GetValue();
  493. msg = CUSTOM_NETLIST_COMMAND;
  494. msg << ii + 1;
  495. config->Write( msg, Command );
  496. }
  497. }
  498. }
  499. /******************************************************************/
  500. void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event )
  501. /******************************************************************/
  502. /** Function DeletePluginPanel
  503. * Remove a panel relative to a netlist plugin
  504. */
  505. {
  506. EDA_NoteBookPage* CurrPage =
  507. (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
  508. CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString );
  509. CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString );
  510. if( CurrPage->m_IsCurrentFormat->IsChecked() )
  511. {
  512. CurrPage->m_IsCurrentFormat->SetValue( FALSE );
  513. m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( TRUE );
  514. }
  515. WriteCurrentNetlistSetup();
  516. EndModal( NET_PLUGIN_CHANGE );
  517. }
  518. /******************************************************************/
  519. void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event )
  520. /******************************************************************/
  521. /** Function ValidatePluginPanel
  522. * Validate the panel info relative to a new netlist plugin
  523. */
  524. {
  525. EDA_NoteBookPage* CurrPage =
  526. (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
  527. if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString )
  528. {
  529. DisplayError( this, _( "Error. You must provide a command String" ) );
  530. return;
  531. }
  532. if( CurrPage->m_TitleStringCtrl->GetValue() == wxEmptyString )
  533. {
  534. DisplayError( this, _( "Error. You must provide a Title" ) );
  535. return;
  536. }
  537. WriteCurrentNetlistSetup();
  538. EndModal( NET_PLUGIN_CHANGE );
  539. }