kicad/pcbnew/dialog_netlist.cpp

278 lines
8.7 KiB
C++
Raw Normal View History

2007-05-06 16:03:28 +00:00
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_netlist.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 26/02/2006 17:42:19
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 26/02/2006 17:42:19
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
////@end includes
#include "dialog_netlist.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_NetlistFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_NetlistFrame, wxDialog )
/*!
* WinEDA_NetlistFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog )
////@begin WinEDA_NetlistFrame event table entries
EVT_BUTTON( ID_OPEN_NELIST, WinEDA_NetlistFrame::OnOpenNelistClick )
EVT_BUTTON( ID_READ_NETLIST_FILE, WinEDA_NetlistFrame::OnReadNetlistFileClick )
EVT_BUTTON( ID_TEST_NETLIST, WinEDA_NetlistFrame::OnTestNetlistClick )
EVT_BUTTON( ID_COMPILE_RATSNEST, WinEDA_NetlistFrame::OnCompileRatsnestClick )
2007-11-13 09:35:39 +00:00
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
2007-05-06 16:03:28 +00:00
////@end WinEDA_NetlistFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_NetlistFrame constructors
*/
WinEDA_NetlistFrame::WinEDA_NetlistFrame( )
{
}
WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_PcbFrame* parent, wxDC * DC,
wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
2007-11-13 09:35:39 +00:00
m_Parent = parent;
m_DC = DC;
/* Setup the NETLIST file name according to the board file name */
NetNameBuffer = m_Parent->m_CurrentScreen->m_FileName;
ChangeFileNameExt(NetNameBuffer, NetExtBuffer);
2007-05-06 16:03:28 +00:00
Create(parent, id, caption, pos, size, style);
2007-05-06 16:03:28 +00:00
wxString title = GetTitle() + NetNameBuffer;
2007-11-13 09:35:39 +00:00
SetTitle(title);
2007-05-06 16:03:28 +00:00
}
/*!
* WinEDA_NetlistFrame creator
*/
bool WinEDA_NetlistFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_NetlistFrame member initialisation
m_Select_By_Timestamp = NULL;
m_DeleteBadTracks = NULL;
m_ChangeExistantModuleCtrl = NULL;
m_DisplayWarningCtrl = NULL;
m_MessageWindow = NULL;
2007-11-13 09:35:39 +00:00
StdDialogButtonSizer = NULL;
2007-05-06 16:03:28 +00:00
////@end WinEDA_NetlistFrame member initialisation
////@begin WinEDA_NetlistFrame creation
2007-11-13 09:35:39 +00:00
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
2007-11-13 09:35:39 +00:00
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
2007-05-06 16:03:28 +00:00
////@end WinEDA_NetlistFrame creation
return true;
}
/*!
* Control creation for WinEDA_NetlistFrame
*/
void WinEDA_NetlistFrame::CreateControls()
{
2007-11-13 09:35:39 +00:00
SetFont( *g_DialogFont );
2007-05-06 16:03:28 +00:00
////@begin WinEDA_NetlistFrame content construction
2007-11-13 09:35:39 +00:00
// Generated by DialogBlocks, 13/11/2007 15:31:19 (unregistered)
WinEDA_NetlistFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
2007-11-13 09:35:39 +00:00
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
2007-11-13 09:35:39 +00:00
itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
2007-11-13 09:35:39 +00:00
wxArrayString m_Select_By_TimestampStrings;
m_Select_By_TimestampStrings.Add(_("Reference"));
m_Select_By_TimestampStrings.Add(_("Timestamp"));
m_Select_By_Timestamp = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Module Selection:"), wxDefaultPosition, wxDefaultSize, m_Select_By_TimestampStrings, 1, wxRA_SPECIFY_COLS );
m_Select_By_Timestamp->SetSelection(0);
itemBoxSizer4->Add(m_Select_By_Timestamp, 0, wxGROW|wxALL, 5);
2007-11-13 09:35:39 +00:00
wxArrayString m_DeleteBadTracksStrings;
m_DeleteBadTracksStrings.Add(_("Keep"));
m_DeleteBadTracksStrings.Add(_("Delete"));
m_DeleteBadTracks = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Bad Tracks Deletion:"), wxDefaultPosition, wxDefaultSize, m_DeleteBadTracksStrings, 1, wxRA_SPECIFY_COLS );
m_DeleteBadTracks->SetSelection(0);
itemBoxSizer4->Add(m_DeleteBadTracks, 0, wxGROW|wxALL, 5);
2007-11-13 09:35:39 +00:00
wxArrayString m_ChangeExistantModuleCtrlStrings;
m_ChangeExistantModuleCtrlStrings.Add(_("Keep"));
m_ChangeExistantModuleCtrlStrings.Add(_("Change"));
m_ChangeExistantModuleCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Exchange Module:"), wxDefaultPosition, wxDefaultSize, m_ChangeExistantModuleCtrlStrings, 1, wxRA_SPECIFY_COLS );
m_ChangeExistantModuleCtrl->SetSelection(0);
itemBoxSizer4->Add(m_ChangeExistantModuleCtrl, 0, wxGROW|wxALL, 5);
m_DisplayWarningCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Display Warnings"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DisplayWarningCtrl->SetValue(false);
2007-11-13 09:35:39 +00:00
itemBoxSizer4->Add(m_DisplayWarningCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
2007-11-13 09:35:39 +00:00
itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
2007-11-13 09:35:39 +00:00
itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
wxButton* itemButton11 = new wxButton( itemDialog1, ID_OPEN_NELIST, _("Select"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton11->SetForegroundColour(wxColour(217, 0, 0));
itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5);
wxButton* itemButton12 = new wxButton( itemDialog1, ID_READ_NETLIST_FILE, _("Read"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton12->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5);
wxButton* itemButton13 = new wxButton( itemDialog1, ID_TEST_NETLIST, _("Module Test"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton13->SetForegroundColour(wxColour(0, 128, 128));
itemBoxSizer10->Add(itemButton13, 0, wxGROW|wxALL, 5);
wxButton* itemButton14 = new wxButton( itemDialog1, ID_COMPILE_RATSNEST, _("Compile"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton14->SetForegroundColour(wxColour(0, 0, 132));
itemBoxSizer10->Add(itemButton14, 0, wxGROW|wxALL, 5);
m_MessageWindow = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 120), wxTE_MULTILINE|wxTE_READONLY );
2007-11-13 09:35:39 +00:00
itemBoxSizer2->Add(m_MessageWindow, 1, wxGROW|wxALL, 10);
wxStaticLine* itemStaticLine16 = new wxStaticLine( itemDialog1, ID_STATICLINE, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
itemBoxSizer2->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxRIGHT, 5);
StdDialogButtonSizer = new wxStdDialogButtonSizer;
itemBoxSizer2->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
wxButton* itemButton18 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton18->SetForegroundColour(wxColour(0, 0, 255));
StdDialogButtonSizer->AddButton(itemButton18);
StdDialogButtonSizer->Realize();
// Set validators
m_DisplayWarningCtrl->SetValidator( wxGenericValidator(& DisplayWarning) );
2007-05-06 16:03:28 +00:00
////@end WinEDA_NetlistFrame content construction
}
/*!
* Should we show tooltips?
*/
bool WinEDA_NetlistFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_NetlistFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_NetlistFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
2007-05-06 16:03:28 +00:00
////@end WinEDA_NetlistFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_NetlistFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_NetlistFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
2007-05-06 16:03:28 +00:00
////@end WinEDA_NetlistFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_OPEN_NELIST
*/
void WinEDA_NetlistFrame::OnOpenNelistClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
Set_NetlisteName(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_READ_NETLIST_FILE
*/
void WinEDA_NetlistFrame::OnReadNetlistFileClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
ReadPcbNetlist(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_TEST_NETLIST
*/
void WinEDA_NetlistFrame::OnTestNetlistClick( wxCommandEvent& event )
{
ModulesControle(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMPILE_RATSNEST
*/
void WinEDA_NetlistFrame::OnCompileRatsnestClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
m_Parent->Compile_Ratsnest(m_DC, TRUE);
}
/*!
2007-11-13 09:35:39 +00:00
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
2007-11-13 09:35:39 +00:00
void WinEDA_NetlistFrame::OnCancelClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
EndModal( -1 );
}