code cleaning

This commit is contained in:
charras 2009-06-20 19:09:43 +00:00
parent db6630b81c
commit 96e0bebd0e
16 changed files with 1691 additions and 881 deletions

View File

@ -218,9 +218,8 @@ public:
MODULE* module,
int angle,
bool incremental );
void Place_Module( MODULE* module, wxDC* DC );
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule,
wxDC* DC, const wxPoint& pos );
void Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest = false );
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule );
// Graphic items edition:
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,8 @@ set(PCBNEW_SRCS
dialog_drc.cpp
dialog_edit_module_text.cpp
dialog_edit_module_text_base.cpp
# dialog_edit_module.cpp
dialog_edit_module.cpp
dialog_exchange_modules_base.cpp
dialog_freeroute_exchange.cpp
# dialog_gendrill.cpp
dialog_general_options.cpp

View File

@ -68,9 +68,8 @@ class NETINFO_LIST
{
private:
BOARD* m_Parent;
// boost::ptr_vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
std::vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
public:
std::vector<D_PAD*> m_PadsFullList; // Entry for a sorted pad list (used in ratsnest calculations)
@ -115,17 +114,19 @@ public:
return m_PadsFullList.size();
}
/** Function GetPad
* @return the pad idx from m_PadsFullList
*/
D_PAD* GetPad( unsigned aIdx)
D_PAD* GetPad( unsigned aIdx )
{
if (aIdx < m_PadsFullList.size() )
if( aIdx < m_PadsFullList.size() )
return m_PadsFullList[aIdx];
else
return NULL;
}
private:
/** Function Build_Pads_Full_List
@ -156,10 +157,12 @@ public:
int m_NbNodes; // Pads count for this net
int m_NbLink; // Ratsnets count for this net
int m_NbNoconn; // Ratsnets remaining to route count
int m_ForceWidth; // specific width (O = default width)
int m_ForceWidth; // specific width (0 = default width)
std::vector <D_PAD*> m_ListPad; // List of pads connected to this net
unsigned m_RatsnestStart; // debut de liste ratsnests du net (included)
unsigned m_RatsnestEnd; // fin de liste ratsnests du net (excluded)
unsigned m_RatsnestStartIdx; /* Starting point of ratsnests of this net (included)
* in a general buffer of ratsnest (a vector<RATSNEST_ITEM*> buffer)
*/
unsigned m_RatsnestEndIdx; // Ending point of ratsnests of this net (excluded) in this buffer
NETINFO_ITEM( BOARD_ITEM* aParent );
~NETINFO_ITEM();

View File

@ -19,8 +19,8 @@ NETINFO_ITEM::NETINFO_ITEM( BOARD_ITEM* aParent )
SetNet( 0 );
m_NbNodes = m_NbLink = m_NbNoconn = 0;
m_ForceWidth = 0;
m_RatsnestStart = 0; // debut de liste ratsnests du net
m_RatsnestEnd = 0; // fin de liste ratsnests du net
m_RatsnestStartIdx = 0; // Starting point of ratsnests of this net in a general buffer of ratsnest
m_RatsnestEndIdx = 0; // Ending point of ratsnests of this net
}

View File

@ -86,7 +86,8 @@ void NETINFO_LIST::BuildListOfNets()
DeleteData(); // Remove all nets info and free memory
// Create and add the "unconnected net"
// Create and add the "unconnected net", always existing,
// used to handle pads and tracks that are not member of a "real" net
net_item = new NETINFO_ITEM( m_Parent );
AppendNet( net_item );

View File

@ -4,10 +4,18 @@
/* include in modedit.cpp */
/************************************************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
#include "appl_wxstruct.h"
#include "gestfich.h"
#include "3d_struct.h"
#include "3d_viewer.h"
#include "dialog_edit_module.h"
#include <wx/version.h>
extern bool GoToEditor;
/**************************************/
/* class WinEDA_ModulePropertiesFrame */
@ -652,8 +660,7 @@ void WinEDA_ModulePropertiesFrame::GotoModuleEditor( wxCommandEvent& event )
void WinEDA_ModulePropertiesFrame::ExchangeModule( wxCommandEvent& event )
/**********************************************************************/
{
m_Parent->InstallExchangeModuleFrame( m_CurrentModule,
m_DC, wxPoint( -1, -1 ) );
m_Parent->InstallExchangeModuleFrame( m_CurrentModule );
// Attention: si il y a eu echange, m_CurrentModule a été delete!
m_Parent->SetCurItem( NULL );

View File

@ -0,0 +1,97 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_exchange_modules_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Current Module"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
bLeftSizer->Add( m_staticText6, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OldModule = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bLeftSizer->Add( m_OldModule, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Current Value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
bLeftSizer->Add( m_staticText7, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OldValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bLeftSizer->Add( m_OldValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("New Module"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
bLeftSizer->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NewModule = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_NewModule, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bUpperSizer->Add( bLeftSizer, 1, 0, 5 );
wxBoxSizer* bMiddleSizer;
bMiddleSizer = new wxBoxSizer( wxVERTICAL );
wxString m_SelectionChoices[] = { _("Change module"), _("Change same modules"), _("Ch. same module+value"), _("Change all") };
int m_SelectionNChoices = sizeof( m_SelectionChoices ) / sizeof( wxString );
m_Selection = new wxRadioBox( this, ID_SELECTION_CLICKED, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_SelectionNChoices, m_SelectionChoices, 1, wxRA_SPECIFY_COLS );
m_Selection->SetSelection( 0 );
bMiddleSizer->Add( m_Selection, 0, wxALL, 5 );
bUpperSizer->Add( bMiddleSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_OKbutton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_OKbutton, 0, wxALL, 5 );
m_Quitbutton = new wxButton( this, wxID_CANCEL, _("Quit"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_Quitbutton, 0, wxALL, 5 );
m_Browsebutton = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_Browsebutton, 0, wxALL, 5 );
bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 );
m_WinMessages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_WinMessages->SetMinSize( wxSize( 450,300 ) );
bMainSizer->Add( m_WinMessages, 1, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_Selection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this );
m_OKbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_Quitbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
m_Browsebutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this );
}
DIALOG_EXCHANGE_MODULE_BASE::~DIALOG_EXCHANGE_MODULE_BASE()
{
// Disconnect Events
m_Selection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this );
m_OKbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_Quitbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
m_Browsebutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this );
}

View File

@ -0,0 +1,708 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="9" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_exchange_modules_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_exchange_modules_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_EXCHANGE_MODULE_BASE</property>
<property name="pos"></property>
<property name="size">416,469</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Exchange Modules</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bUpperSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bLeftSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Current Module</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText6</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_OldModule</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_READONLY</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Current Value</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText7</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_OldValue</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_READONLY</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">New Module</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText8</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_NewModule</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMiddleSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Change module&quot; &quot;Change same modules&quot; &quot;Ch. same module+value&quot; &quot;Change all&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_SELECTION_CLICKED</property>
<property name="label">wxRadioBox</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_Selection</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox">OnSelectionClicked</event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">OK</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_OKbutton</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOkClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Quit</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_Quitbutton</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnQuit</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Browse</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_Browsebutton</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">BrowseAndSelectFootprint</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size">450,300</property>
<property name="name">m_WinMessages</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE|wxTE_READONLY</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,62 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_exchange_modules_base__
#define __dialog_exchange_modules_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_SELECTION_CLICKED 1000
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EXCHANGE_MODULE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EXCHANGE_MODULE_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticText6;
wxTextCtrl* m_OldModule;
wxStaticText* m_staticText7;
wxTextCtrl* m_OldValue;
wxStaticText* m_staticText8;
wxTextCtrl* m_NewModule;
wxRadioBox* m_Selection;
wxButton* m_OKbutton;
wxButton* m_Quitbutton;
wxButton* m_Browsebutton;
wxTextCtrl* m_WinMessages;
// Virtual event handlers, overide them in your derived class
virtual void OnSelectionClicked( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); }
virtual void BrowseAndSelectFootprint( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Exchange Modules"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,469 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXCHANGE_MODULE_BASE();
};
#endif //__dialog_exchange_modules_base__

View File

@ -15,14 +15,12 @@
#include "3d_struct.h"
#include "3d_viewer.h"
#include "dialog_edit_module.h"
#include "protos.h"
/* Variables locales: */
bool GoToEditor = FALSE;
/* class WinEDA_ModulePropertiesFrame */
#include "dialog_edit_module.cpp"
/*******************************************************************/
void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC * DC )
/*******************************************************************/

View File

@ -265,8 +265,11 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
/* Rebuild the new pad list (for drc and ratsnet control ...) */
GetBoard()->m_Status_Pcb = 0;
// Display the loaded board:
DrawPanel->Refresh( true);
wxSafeYield(); // Needed if we want to see the board now.
// Compile rastnest and displays net info
Compile_Ratsnest( NULL, true );
GetBoard()->DisplayInfo( this );

View File

@ -642,7 +642,7 @@ int ChangeSideNumLayer( int oldlayer )
/*****************************************************************/
void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest )
/*****************************************************************/
/* Place a l'endroit pointe par la souris le module deja existant selectionne
@ -688,8 +688,8 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
EraseDragListe();
}
/* affichage chevelu general si necessaire */
Compile_Ratsnest( DC, true );
if( !aDoNotRecreateRatsnest )
Compile_Ratsnest( DC, true );
module->DisplayInfo( this );

View File

@ -13,6 +13,7 @@
#include "protos.h"
#define DBG_BUID_NETINFO
/* local variables */
static std::vector <D_PAD*> s_localPadBuffer; // for local ratsnest calculations when moving a footprint: buffer of pads to consider
@ -107,7 +108,10 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
GetBoard()->m_Status_Pcb = 0; /* we want a full ratnest computation, from the scratch */
MsgPanel->EraseMsgBox();
MsgPanel->EraseMsgBox();
#ifdef DBG_BUID_NETINFO
wxSafeYield();
#endif
// Rebuild the full pads and net info list
@ -124,6 +128,9 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
msg.Printf( wxT( " %d" ), m_Pcb->m_NetInfo->GetNetsCount() );
Affiche_1_Parametre( this, 8, wxT( "Nets" ), msg, CYAN );
}
#ifdef DBG_BUID_NETINFO
wxSafeYield();
#endif
/* Compute the full ratsnest
* which can be see like all the possible links or logical connections.
@ -449,7 +456,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
DisplayError(this,wxT("Build_Board_Ratsnest() error: net not found") );
return;
}
net->m_RatsnestStart = m_Pcb->GetRatsnestsCount();
net->m_RatsnestStartIdx = m_Pcb->GetRatsnestsCount();
int num_block = 0;
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
@ -473,14 +480,14 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
icnt = gen_rats_block_to_block( DrawPanel, m_Pcb->m_FullRatsnest, pstart, pend );
}
net->m_RatsnestEnd = m_Pcb->GetRatsnestsCount();
net->m_RatsnestEndIdx = m_Pcb->GetRatsnestsCount();
/* sort by lenght */
if( (net->m_RatsnestEnd - net->m_RatsnestStart) > 1 )
if( (net->m_RatsnestEndIdx - net->m_RatsnestStartIdx) > 1 )
{
RATSNEST_ITEM* rats = &m_Pcb->m_FullRatsnest[0];
qsort( rats + net->m_RatsnestStart,
net->m_RatsnestEnd - net->m_RatsnestStart,
qsort( rats + net->m_RatsnestStartIdx,
net->m_RatsnestEndIdx - net->m_RatsnestStartIdx,
sizeof(RATSNEST_ITEM), sort_by_length );
}
}
@ -555,7 +562,7 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net, vector<RATSNEST_ITEM>& aR
/* Search a link from a block to an other block */
min_rats = NULL;
for( unsigned ii = net->m_RatsnestStart; ii < net->m_RatsnestEnd; ii++ )
for( unsigned ii = net->m_RatsnestStartIdx; ii < net->m_RatsnestEndIdx; ii++ )
{
rats = &aRatsnestBuffer[ii];
if( rats->m_PadStart->GetSubRatsnest() == rats->m_PadEnd->GetSubRatsnest() ) // Same block
@ -691,14 +698,14 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
num_block = MAX( num_block, subnet );
}
for( unsigned ii = net->m_RatsnestStart; ii < net->m_RatsnestEnd; ii++ )
for( unsigned ii = net->m_RatsnestStartIdx; ii < net->m_RatsnestEndIdx; ii++ )
{
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_ACTIF;
}
/* a - tst connection between pads */
rats = &m_Pcb->m_FullRatsnest[0];
int icnt = tst_rats_pad_to_pad( num_block, rats + net->m_RatsnestStart, rats + net->m_RatsnestEnd );
int icnt = tst_rats_pad_to_pad( num_block, rats + net->m_RatsnestStartIdx, rats + net->m_RatsnestEndIdx );
/* b - test connexion between blocks (Iteration) */
while( icnt > 1 )

View File

@ -5,196 +5,136 @@
/* Fichier xchmod.cpp */
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "pcbnew.h"
#include "autorout.h"
#include "protos.h"
#include "dialog_exchange_modules_base.h"
/* variables locales */
enum id_ExchangeModule {
ID_EXEC_EXCHANGE_MODULE = 1900,
ID_EXEC_EXCHANGE_ID_MODULES,
ID_EXEC_EXCHANGE_ID_MODULE_AND_VALUE,
ID_EXEC_EXCHANGE_ALL_MODULES,
ID_CLOSE_EXCHANGE_MODULE,
ID_BROWSE_LIB_MODULES
};
// Local variables:
int s_SelectionMode = 0; // Remember the last exchange option, when exit dialog.
/************************************/
/* class WinEDA_ExchangeModuleFrame */
/* class DIALOG_EXCHANGE_MODULE */
/************************************/
class WinEDA_ExchangeModuleFrame : public wxDialog
class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE
{
private:
WinEDA_BasePcbFrame* m_Parent;
wxDC* m_DC;
MODULE* m_CurrentModule;
WinEDA_EnterText* m_OldModule;
WinEDA_EnterText* m_OldValue;
WinEDA_EnterText* m_NewModule;
wxTextCtrl* m_WinMsg;
public:
// Constructor and destructor
WinEDA_ExchangeModuleFrame( WinEDA_BasePcbFrame* parent,
MODULE* Module, wxDC* DC, const wxPoint& pos );
~WinEDA_ExchangeModuleFrame()
{
}
DIALOG_EXCHANGE_MODULE( WinEDA_BasePcbFrame* aParent, MODULE* aModule );
~DIALOG_EXCHANGE_MODULE() { };
private:
void OnSelectionClicked( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void Change_Module( wxCommandEvent& event );
void Change_ModuleId( wxCommandEvent& event );
void Change_ModuleAll( wxCommandEvent& event );
void BrowseAndSelectFootprint( wxCommandEvent& event );
void Init();
void Change_Module();
void Change_ModuleId( bool aUseValue );
void Change_ModuleAll();
int Maj_ListeCmp( const wxString& reference, const wxString& old_name,
const wxString& new_name, bool ShowError );
MODULE* Change_1_Module( MODULE* Module,
const wxString& new_module,
bool ShowError );
void Sel_NewMod_By_Liste( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( WinEDA_ExchangeModuleFrame, wxDialog )
EVT_BUTTON( ID_EXEC_EXCHANGE_MODULE,
WinEDA_ExchangeModuleFrame::Change_Module )
EVT_BUTTON( ID_EXEC_EXCHANGE_ID_MODULES,
WinEDA_ExchangeModuleFrame::Change_ModuleId )
EVT_BUTTON( ID_EXEC_EXCHANGE_ID_MODULE_AND_VALUE,
WinEDA_ExchangeModuleFrame::Change_ModuleId )
EVT_BUTTON( ID_EXEC_EXCHANGE_ALL_MODULES,
WinEDA_ExchangeModuleFrame::Change_ModuleAll )
EVT_BUTTON( ID_CLOSE_EXCHANGE_MODULE,
WinEDA_ExchangeModuleFrame::OnQuit )
EVT_BUTTON( ID_BROWSE_LIB_MODULES,
WinEDA_ExchangeModuleFrame::Sel_NewMod_By_Liste )
END_EVENT_TABLE()
WinEDA_ExchangeModuleFrame::WinEDA_ExchangeModuleFrame(
WinEDA_BasePcbFrame* parent,
MODULE* Module,
wxDC* DC,
const wxPoint&
framepos ) :
wxDialog( parent, -1, _( "Exchange Modules" ), framepos, wxSize( 360, 460 ),
DIALOG_STYLE )
DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( WinEDA_BasePcbFrame* parent, MODULE* Module ) :
DIALOG_EXCHANGE_MODULE_BASE( parent )
{
wxButton* Button;
m_Parent = parent;
m_DC = DC;
Centre();
m_CurrentModule = Module;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( MainBoxSizer );
wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
UpperBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
UpperBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Creation des boutons de commande */
Button = new wxButton( this, ID_EXEC_EXCHANGE_MODULE,
_( "Change module" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
Button = new wxButton( this, ID_EXEC_EXCHANGE_ID_MODULES,
_( "Change same modules" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT, 5 );
Button = new wxButton( this, ID_EXEC_EXCHANGE_ID_MODULE_AND_VALUE,
_( "Ch. same module+value" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT, 5 );
Button = new wxButton( this, ID_EXEC_EXCHANGE_ALL_MODULES,
_( "Change all" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT, 5 );
Button = new wxButton( this, ID_BROWSE_LIB_MODULES,
_( "Browse Libs modules" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT, 5 );
Button = new wxButton( this, ID_CLOSE_EXCHANGE_MODULE,
_( "Close" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_OldModule = new WinEDA_EnterText( this, _( "Current Module" ),
m_CurrentModule ?
m_CurrentModule->m_LibRef.GetData() :
wxEmptyString,
LeftBoxSizer, wxSize( 150, -1 ) );
m_OldModule->Enable( FALSE );
m_OldValue = new WinEDA_EnterText( this, _( "Current Value" ),
m_CurrentModule ?
m_CurrentModule->m_Value->m_Text.GetData() :
wxEmptyString,
LeftBoxSizer, wxSize( 150, -1 ) );
m_OldValue->Enable( FALSE );
m_NewModule = new WinEDA_EnterText( this, _( "New Module" ),
m_OldModule->GetValue(),
LeftBoxSizer, wxSize( 150, -1 ) );
m_WinMsg = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
wxSize( 340, 230 ),
wxTE_READONLY | wxTE_MULTILINE );
MainBoxSizer->Add( m_WinMsg, 0, wxGROW | wxALL, 5 );
Init();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
void WinEDA_BasePcbFrame::InstallExchangeModuleFrame( MODULE* Module,
wxDC* DC,
const wxPoint& pos )
void WinEDA_BasePcbFrame::InstallExchangeModuleFrame( MODULE* Module )
{
WinEDA_ExchangeModuleFrame* frame =
new WinEDA_ExchangeModuleFrame( this, Module, DC, pos );
DIALOG_EXCHANGE_MODULE dialog( this, Module );
frame->ShowModal();
frame->Destroy();
dialog.ShowModal();
}
void WinEDA_ExchangeModuleFrame::OnQuit( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& WXUNUSED(event) )
{
s_SelectionMode = m_Selection->GetSelection();
Close( true ); // true is to force the frame to close
}
void DIALOG_EXCHANGE_MODULE::Init()
{
SetFocus();
m_OldModule->AppendText( m_CurrentModule->m_LibRef );
m_NewModule->AppendText( m_CurrentModule->m_LibRef );
m_OldValue->AppendText( m_CurrentModule->m_Value->m_Text );
m_Selection->SetSelection( s_SelectionMode );
// Enable/disable widgets:
wxCommandEvent event;
OnSelectionClicked( event );
}
void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event )
{
s_SelectionMode = m_Selection->GetSelection();
switch( m_Selection->GetSelection() )
{
case 0:
Change_Module();
break;
case 1:
Change_ModuleId( false );
break;
case 2:
Change_ModuleId( true );
break;
case 3:
Change_ModuleAll();
break;
}
}
void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event )
{
switch( m_Selection->GetSelection() )
{
case 0:
case 1:
case 2:
m_NewModule->Enable( true );
break;
case 3:
m_NewModule->Enable( false );
break;
}
}
/************************************************************************/
/*
* Met a jour le fichier name.CMP (s'il existe) apres un echange de module
* (par la commande changeMod), si les modules sont geres par ce fichier
@ -203,10 +143,10 @@ void WinEDA_ExchangeModuleFrame::OnQuit( wxCommandEvent& WXUNUSED( event ) )
* trouve.
* Retoure 1 si erreur
*/
int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( const wxString& reference,
const wxString& old_name,
const wxString& new_name,
bool ShowError )
int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
const wxString& old_name,
const wxString& new_name,
bool ShowError )
{
wxFileName fn;
wxFileName tmpFileName;
@ -228,7 +168,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( const wxString& reference,
if( ShowError )
{
msg.Printf( _( "file %s not found" ), fn.GetFullPath().c_str() );
m_WinMsg->WriteText( msg );
m_WinMessages->AppendText( msg );
}
return 1;
}
@ -242,15 +182,15 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( const wxString& reference,
if( ShowError )
{
msg.Printf( _( "Unable to create file %s" ),
tmpFileName.GetFullPath().c_str() );
m_WinMsg->WriteText( msg );
tmpFileName.GetFullPath().c_str() );
m_WinMessages->AppendText( msg );
}
return 1;
}
fgets( Line, sizeof(Line), FichCmp );
fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n",
DateAndTime( Line ) );
DateAndTime( Line ) );
bool start_descr = FALSE;
while( fgets( Line, sizeof(Line), FichCmp ) != NULL )
@ -267,7 +207,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( const wxString& reference,
}
if( (strnicmp( Line, "Begin", 5 ) == 0)
|| (strnicmp( Line, "End", 3 ) == 0) )
|| (strnicmp( Line, "End", 3 ) == 0) )
{
start_descr = FALSE;
}
@ -277,7 +217,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( const wxString& reference,
sprintf( Line + 8, " = %s;\n", CONV_TO_UTF8( new_name ) );
msg = wxT( " * in <" ) + fn.GetFullPath() + wxT( ">.\n" );
m_WinMsg->WriteText( msg );
m_WinMessages->AppendText( msg );
start_descr = FALSE;
}
@ -300,7 +240,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( const wxString& reference,
* - memes textes valeur et ref
* - memes netnames pour pads de meme nom
*/
void WinEDA_ExchangeModuleFrame::Change_Module( wxCommandEvent& event )
void DIALOG_EXCHANGE_MODULE::Change_Module()
{
wxString newmodulename = m_NewModule->GetValue();
@ -309,7 +249,8 @@ void WinEDA_ExchangeModuleFrame::Change_Module( wxCommandEvent& event )
if( Change_1_Module( m_CurrentModule, newmodulename, TRUE ) )
{
m_Parent->Compile_Ratsnest( m_DC, true );
m_Parent->Compile_Ratsnest( NULL, true );
m_Parent->DrawPanel->Refresh();
}
}
@ -325,7 +266,7 @@ void WinEDA_ExchangeModuleFrame::Change_Module( wxCommandEvent& event )
* Attention: m_CurrentModule ne pointe plus sur le module de reference
* puisque celui ci a ete change!!
*/
void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
{
wxString msg;
MODULE* Module, * PtBack;
@ -341,19 +282,19 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
return;
lib_reference = m_CurrentModule->m_LibRef;
if( event.GetId() == ID_EXEC_EXCHANGE_ID_MODULE_AND_VALUE )
if( aUseValue )
{
check_module_value = TRUE;
value = m_CurrentModule->m_Value->m_Text;
msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ),
m_CurrentModule->m_LibRef.GetData(),
newmodulename.GetData(),
m_CurrentModule->m_Value->m_Text.GetData() );
m_CurrentModule->m_LibRef.GetData(),
newmodulename.GetData(),
m_CurrentModule->m_Value->m_Text.GetData() );
}
else
{
msg.Printf( _( "Change modules <%s> -> <%s> ?" ),
lib_reference.GetData(), newmodulename.GetData() );
lib_reference.GetData(), newmodulename.GetData() );
}
if( !IsOK( this, msg ) )
@ -363,17 +304,10 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
* Change_1_Module() modifie le dernier module de la liste
*/
Module = m_Parent->GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
if( Module->Next() == NULL )
break;
}
/* Ici Module pointe le dernier module de la liste */
for( ;
Module && ( (BOARD*) Module != m_Parent->GetBoard() );
Module = PtBack )
/* note: for the first module in chain (the last here), Module->Back() points the board or is NULL
*/
Module = m_Parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack )
{
MODULE* module;
PtBack = Module->Back();
@ -393,7 +327,8 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
if( change )
{
m_Parent->Compile_Ratsnest( m_DC, true );
m_Parent->Compile_Ratsnest( NULL, true );
m_Parent->DrawPanel->Refresh();
}
}
@ -406,7 +341,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
* - memes textes valeur et ref
* - memes netnames pour pads de meme nom
*/
void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
{
MODULE* Module, * PtBack;
bool change = FALSE;
@ -422,17 +357,10 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
* Change_1_Module() modifie le dernier module de la liste
*/
Module = m_Parent->GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
if( Module->Next() == NULL )
break;
}
/* Ici Module pointe le dernier module de la liste */
for( ;
Module && ( (BOARD*) Module != m_Parent->GetBoard() );
Module = PtBack )
/* note: for the first module in chain (the last here), Module->Back() points the board or is NULL
*/
Module = m_Parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack )
{
PtBack = Module->Back();
if( Change_1_Module( Module, Module->m_LibRef.GetData(), ShowErr ) )
@ -443,7 +371,8 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
if( change )
{
m_Parent->Compile_Ratsnest( m_DC, true );
m_Parent->Compile_Ratsnest( NULL, true );
m_Parent->DrawPanel->Refresh();
}
}
@ -458,10 +387,11 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
* Retourne :
* 0 si pas de changement ( si le nouveau module n'est pas en libr)
* 1 si OK
* Ratsnest *must be recalculated* after modules changes
*/
MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* Module,
const wxString& new_module,
bool ShowError )
MODULE* DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
const wxString& new_module,
bool ShowError )
{
wxString namecmp, oldnamecmp;
MODULE* NewModule;
@ -479,7 +409,7 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* Module,
/* Chargement du module */
Line.Printf( _( "Change module %s (%s) " ),
Module->m_Reference->m_Text.GetData(), oldnamecmp.GetData() );
m_WinMsg->WriteText( Line );
m_WinMessages->AppendText( Line );
namecmp.Trim( TRUE );
namecmp.Trim( FALSE );
@ -488,24 +418,16 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* Module,
ShowError );
if( NewModule == NULL ) /* Nouveau module NON trouve, reaffichage de l'ancien */
{
m_WinMsg->WriteText( wxT( "No\n" ) );
m_WinMessages->AppendText( wxT( "No\n" ) );
return NULL;
}
if( Module == m_CurrentModule )
m_CurrentModule = NewModule;
m_WinMsg->WriteText( wxT( "Ok\n" ) );
/* Effacement a l'ecran de l'ancien module */
if ( m_DC )
Module->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
m_WinMessages->AppendText( wxT( "Ok\n" ) );
m_Parent->Exchange_Module( this, Module, NewModule );
/* Affichage du nouveau module */
if ( m_DC )
NewModule->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
Maj_ListeCmp( NewModule->m_Reference->m_Text,
oldnamecmp,
namecmp,
@ -527,12 +449,11 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
wxPoint oldpos; /* memorisation temporaire pos curseur */
D_PAD* pad, * old_pad;
if( (OldModule->Type() != TYPE_MODULE)
|| (NewModule->Type() != TYPE_MODULE) )
{
DisplayError( winaff,
wxT( "WinEDA_BasePcbFrame::Exchange_Module() StuctType error" ) );
wxT( "WinEDA_BasePcbFrame::Exchange_Module() StuctType error" ) );
}
NewModule->SetParent( GetBoard() );
@ -540,7 +461,11 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
GetBoard()->m_Status_Pcb = 0;
oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = OldModule->m_Pos;
Place_Module( NewModule, NULL );
/* place module without ratsnets refresh: this will be made later
* when all modules are on board
*/
Place_Module( NewModule, NULL, true );
GetScreen()->m_Curseur = oldpos;
/* Changement eventuel de couche */
@ -573,7 +498,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
for( ; old_pad != NULL; old_pad = old_pad->Next() )
{
if( strnicmp( pad->m_Padname, old_pad->m_Padname,
sizeof(pad->m_Padname) ) == 0 )
sizeof(pad->m_Padname) ) == 0 )
{
pad->SetNetname( old_pad->GetNetname() );
pad->SetNet( old_pad->GetNet() );
@ -595,7 +520,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
/*
* affiche la liste des modules en librairie et selectione 1 nom
*/
void WinEDA_ExchangeModuleFrame::Sel_NewMod_By_Liste( wxCommandEvent& event )
void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
{
wxString newname;
@ -654,7 +579,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
fgets( Line, sizeof(Line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n",
DateAndTime( Line ) );
DateAndTime( Line ) );
for( ; Module != NULL; Module = Module->Next() )
{
@ -668,7 +593,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
!Module->m_Value->m_Text.IsEmpty() ?
CONV_TO_UTF8( Module->m_Value->m_Text ) : "[NoVal]" );
fprintf( FichCmp, "IdModule = %s;\n",
CONV_TO_UTF8( Module->m_LibRef ) );
CONV_TO_UTF8( Module->m_LibRef ) );
fprintf( FichCmp, "EndCmp\n" );
}