Pcbnew: fixed a double deletion that crashes pcbnew. Starting my work on net classes (moving target)

This commit is contained in:
charras 2009-09-27 11:00:21 +00:00
parent ee6615252d
commit e8fef505f8
35 changed files with 5619 additions and 5574 deletions

View File

@ -4,6 +4,45 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-sept-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
* make pcbnew compatible with last changes
(Delete base screen in WinEDA_DrawFrame destructor to prevent potential memory leak.)
* Starting complementary work on Net Classes (moving target)
2009-sept-25 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Component library editor improvements and minor bug fixes.
* Component library objects renamed for improved readability.
* Fields now move when selected in library editor.
* Add copy constructor to all library draw and library component objects.
* Added copy constructor to EDA_BaseStruct.
* Delete base screen in WinEDA_DrawFrame destructor to prevent potential memory leak.
* Fixed memory access bug when replacing and adding a component to library.
* Moved library component block manipulation code into component object.
* Removed all of the global variables used by the library editor main window object.
* The usual code cleaning and refactoring.
2009-sept-22:
Command ID refactoring and other minor improvements.
* Split out application specific command IDs to prevent unnecessary rebuilding.
* Eliminate duplicate menu and tool bar command IDs.
* Split component library editor and viewer definitions to separate header files.
* More component library and document file merge code.
* A bunch of minor string readability and consistency fixes.
2009-sept-18:
Component library object and other minor improvements.
* Create static component library methods to manage library list.
* Rename component library, component, and alias objects to more readable name.
* Use pointer to component instead of root name to prevent redundant library searches.
* Add append message helper to message panel that calculates string length.
* Initial ground work for merging library and library document files.
* Improved component library file load error checking.
* Minor component library editor improvements.
2009-sept-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew

View File

@ -75,9 +75,6 @@ enum KICAD_T {
COMPONENT_FIELD_DRAW_TYPE,
COMPONENT_BEZIER_DRAW_TYPE,
// Special id used to store clearance values (this is not a good idea: TODO: change it)
TYPE_CLEARANCE,
// End value
MAX_STRUCT_TYPE_ID
};

View File

@ -281,6 +281,11 @@ public:
* returns the NETCLASS for this item.
*/
NETCLASS* GetNetClass() const;
/** function GetNetClassName
* @return the Net Class name of this item
*/
wxString GetNetClassName( ) const;
};

View File

@ -156,7 +156,6 @@ public:
int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackClearance; // track to track and track to pads clearance
int m_TrackClearanceHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used track widths
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter

View File

@ -53,12 +53,12 @@ class WinEDA_PcbFrame: public WinEDA_BasePcbFrame
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox;
WinEDAChoiceBox* m_SelClrWidthBox;
wxTextCtrl* m_ClearanceBox;
wxTextCtrl* m_NetClassSelectedBox;
WinEDAChoiceBox* m_SelViaSizeBox;
private:
bool m_SelTrackWidthBox_Changed;
bool m_SelClrWidthBox_Changed;
bool m_SelViaSizeBox_Changed;
DRC* m_drc; ///< the DRC controller, see drc.cpp
@ -112,6 +112,7 @@ public:
*/
void ShowDesignRulesEditor( wxCommandEvent& event );
/* toolbars update UI functions: */
/**
* Function UpdateToolbarLayerInfo
* updates the currently selected layer in the layer listbox and
@ -120,6 +121,22 @@ public:
void UpdateToolbarLayerInfo();
void PrepareLayerIndicator();
/**
* Function AuxiliaryToolBar_Update_UI
* update the displayed values on auxiliary horizontal toolbar
* (track width, via sizes, clearance ...
*/
void AuxiliaryToolBar_Update_UI( );
/**
* Function AuxiliaryToolBar_DesignRules_Update_UI
* update the displayed values: track width, via sizes, clearance
* used when a ne netclass is selected
*/
void AuxiliaryToolBar_DesignRules_Update_UI( );
/* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -136,6 +136,7 @@ set(PCBNEW_SRCS
tool_modedit.cpp
tool_onrightclick.cpp
tool_pcb.cpp
toolbars_update_user_interface.cpp
tracepcb.cpp
track.cpp
tr_modif.cpp

View File

@ -20,7 +20,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
/* Constructor */
BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
BOARD_ITEM( (BOARD_ITEM*)parent, TYPE_PCB ),
m_NetClasses(this)
m_NetClasses( this )
{
m_PcbFrame = frame;
m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule
@ -42,7 +42,8 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
// within g_DesignSettings via the NETCLASS() constructor.
// Should user eventually load a board from a disk file, then these defaults
// will get overwritten during load.
m_NetClasses.GetDefault()->SetDescription( _("This is the default net class.") );
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
m_CurrentNetClassName = m_NetClasses.GetDefault()->GetName( );
}
@ -239,6 +240,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
else
m_Modules.PushFront( (MODULE*) aBoardItem );
aBoardItem->SetParent( this );
// Because the list of pads has changed, reset the status
// This indicate the list of pad and nets must be recalculated before use
m_Status_Pcb = 0;
@ -263,7 +265,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
msg.Printf(
wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
aBoardItem->Type() );
wxFAIL_MSG(msg );
wxFAIL_MSG( msg );
}
break;
}
@ -840,7 +842,10 @@ NETINFO_ITEM* BOARD::FindNet( int anetcode ) const
#if defined(DEBUG)
if( net ) // item can be NULL if anetcode is not valid
{
wxASSERT( anetcode == net->GetNet() );
if( anetcode != net->GetNet() )
{
printf("FindNet() anetcode %d != GetNet() %d\n", anetcode, net->GetNet());
}
}
#endif
@ -862,25 +867,26 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
return NULL;
int ncount = m_NetInfo->GetCount();
// Search for a netname = aNetname
#if 0
// Use a sequencial search: easy to understand, but slow
printf("\nsearch %s, nets %d\n", CONV_TO_UTF8(aNetname), ncount);
// Use a sequencial search: easy to understand, but slow
for( int ii = 1; ii < ncount; ii++ )
{
NETINFO_ITEM* item = m_NetInfo->GetNetItem( ii );
if( item && item->GetNetname() == aNetname )
{
printf(" found\n");
return item;
}
}
#else
// Use a fast binary search,
// this is possible because Nets are alphabetically ordered in list
// see NETINFO_LIST::BuildListOfNets() and NETINFO_LIST::Build_Pads_Full_List()
int imax = ncount-1;
int imax = ncount - 1;
int index = imax;
while( ncount > 0 )
{
@ -893,24 +899,28 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
NETINFO_ITEM* item = m_NetInfo->GetNetItem( index );
if( item == NULL )
return NULL;
int icmp = item->GetNetname().Cmp(aNetname);
int icmp = item->GetNetname().Cmp( aNetname );
if (icmp == 0 ) // found !
if( icmp == 0 ) // found !
{
printf(" found\n");
return item;
}
if( icmp < 0 ) // must search after item
{
index += ncount;
if( index > imax )
index = imax;
continue;
}
if( icmp > 0 ) // must search before item
{
index -= ncount;
if( index < 1 )
index = 1;
continue;
}
}
#endif
return NULL;
}

View File

@ -98,6 +98,9 @@ public:
* (used while moving a footprint) */
NETCLASSES m_NetClasses; ///< List of current netclasses. There is always the default netclass
wxString m_CurrentNetClassName; /* Current net class name used to display netclass info.
* this is also the last used netclass after starting a track
*/
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
@ -259,6 +262,7 @@ public:
return m_NetInfo->GetPadsCount();
}
// Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox();
@ -534,7 +538,7 @@ public:
* 1 if intersecting sides
* Also sets areas->utility1 flags if areas are modified
*/
int ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList,
ZONE_CONTAINER* aCurrArea,
bool bMessageBoxArc,
bool bMessageBoxInt,
@ -569,7 +573,10 @@ public:
* Sets utility flag = 1 for any areas modified
* If an area has self-intersecting arcs, doesn't try to combine it
*/
int CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, bool bMessageBox, bool bUseUtility );
int CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList,
int aNetCode,
bool bMessageBox,
bool bUseUtility );
/** Function RemoveArea
* remove copper area from net, and put it in a deleted list (if exists)
@ -611,7 +618,9 @@ public:
* 1 if intersection
* 2 if arcs intersect
*/
int CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine );
int CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
ZONE_CONTAINER* area_ref,
ZONE_CONTAINER* area_to_combine );
/**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines

View File

@ -146,3 +146,22 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
return NULL;
}
/** function GetNetClassName
* @return the Net Class name of this item
*/
wxString BOARD_CONNECTED_ITEM::GetNetClassName( ) const
{
wxString name;
NETCLASS* myclass = GetNetClass();
if( myclass )
name = myclass->GetName();
else
{
BOARD* board = GetBoard();
name = board->m_NetClasses.GetDefault()->GetName();
}
return name;
}

View File

@ -1007,6 +1007,14 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
}
else
Affiche_1_Parametre( frame, text_pos, _( "Width" ), msg, DARKCYAN );
NETCLASS* netclass = GetNetClass();
if( netclass )
{
msg = netclass->GetName();
text_pos += 10;
Affiche_1_Parametre( frame, text_pos, _( "Net Class" ), msg, DARKCYAN );
}
}

View File

@ -206,7 +206,6 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
m_TrackWidthHistory[ii] = 0; // Last HISTORY_NUMBER used track widths
m_TrackClearanceHistory[ii] = 0;
m_ViaSizeHistory[ii] = 0; // Last HISTORY_NUMBER used via sizes
}

View File

@ -42,11 +42,8 @@ private:
NETCUPS m_AllNets;
private:
// void OnLayerCountClick( wxCommandEvent& event );
// void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
// void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesNameRightClick( wxGridEvent& event ){ event.Skip(); }
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );

View File

@ -59,7 +59,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_grid->SetToolTip( _("Net Class parameters") );
m_grid->SetMinSize( wxSize( -1,150 ) );
sbSizer1->Add( m_grid, 1, wxALL|wxEXPAND, 5 );
sbSizer1->Add( m_grid, 1, wxEXPAND, 5 );
wxBoxSizer* buttonBoxSizer;
buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
@ -67,21 +67,21 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_addButton = new wxButton( this, wxID_ADD_NETCLASS, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
m_addButton->SetToolTip( _("Add another Net Class") );
buttonBoxSizer->Add( m_addButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
buttonBoxSizer->Add( m_addButton, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
m_removeButton = new wxButton( this, wxID_REMOVE_NETCLASS, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
m_removeButton->SetToolTip( _("Remove the currently select Net Class") );
buttonBoxSizer->Add( m_removeButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
buttonBoxSizer->Add( m_removeButton, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
m_moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
m_moveUpButton->SetToolTip( _("Move the currently selected Net Class up one row") );
buttonBoxSizer->Add( m_moveUpButton, 0, wxALL, 5 );
buttonBoxSizer->Add( m_moveUpButton, 0, wxRIGHT|wxLEFT, 5 );
sbSizer1->Add( buttonBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( sbSizer1, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Membership:") ), wxHORIZONTAL );
@ -92,12 +92,12 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
wxArrayString m_leftClassChoiceChoices;
m_leftClassChoice = new wxChoice( this, ID_LEFT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_leftClassChoiceChoices, 0 );
m_leftClassChoice->SetSelection( 0 );
leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxALL|wxEXPAND, 5 );
leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_leftListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES );
m_leftListCtrl->SetMinSize( wxSize( 220,-1 ) );
m_leftListCtrl->SetMinSize( wxSize( 220,300 ) );
leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxALL|wxEXPAND, 5 );
leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
sbSizer4->Add( leftNetSelectBoxSizer, 1, wxALL|wxEXPAND, 5 );
@ -129,12 +129,12 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
wxArrayString m_rightClassChoiceChoices;
m_rightClassChoice = new wxChoice( this, ID_RIGHT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_rightClassChoiceChoices, 0 );
m_rightClassChoice->SetSelection( 0 );
rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxALL|wxEXPAND, 5 );
rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_rightListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES );
m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) );
rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxALL|wxEXPAND, 5 );
rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
sbSizer4->Add( rghtNetSelectBoxSizer, 0, wxALL|wxEXPAND, 5 );
@ -144,9 +144,9 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxHORIZONTAL );
m_MessagesList = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxSUNKEN_BORDER );
m_MessagesList->SetMinSize( wxSize( -1,100 ) );
m_MessagesList->SetMinSize( wxSize( -1,90 ) );
sbSizer2->Add( m_MessagesList, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
sbSizer2->Add( m_MessagesList, 1, wxEXPAND, 5 );
bMainSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
@ -162,8 +162,8 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
this->Layout();
// Connect Events
m_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridLeftClick ), NULL, this );
m_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridRightClick ), NULL, this );
m_grid->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameLeftClick ), NULL, this );
m_grid->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameRightClick ), NULL, this );
m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveUpSelectedNetClass ), NULL, this );
@ -180,8 +180,8 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
DIALOG_DESIGN_RULES_BASE::~DIALOG_DESIGN_RULES_BASE()
{
// Disconnect Events
m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridLeftClick ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridRightClick ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameLeftClick ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameRightClick ), NULL, this );
m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveUpSelectedNetClass ), NULL, this );

View File

@ -77,9 +77,9 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Net Classes:</property>
<property name="minimum_size"></property>
@ -89,7 +89,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="1">
<property name="autosize_cols">0</property>
@ -145,9 +145,9 @@
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick">OnNetClassesGridLeftClick</event>
<event name="OnGridCellLeftClick"></event>
<event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick">OnNetClassesGridRightClick</event>
<event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event>
<event name="OnGridCmdCellChange"></event>
<event name="OnGridCmdCellLeftClick"></event>
@ -169,9 +169,9 @@
<event name="OnGridEditorCreated"></event>
<event name="OnGridEditorHidden"></event>
<event name="OnGridEditorShown"></event>
<event name="OnGridLabelLeftClick"></event>
<event name="OnGridLabelLeftClick">OnNetClassesNameLeftClick</event>
<event name="OnGridLabelLeftDClick"></event>
<event name="OnGridLabelRightClick"></event>
<event name="OnGridLabelRightClick">OnNetClassesNameRightClick</event>
<event name="OnGridLabelRightDClick"></event>
<event name="OnGridRangeSelect"></event>
<event name="OnGridRowSize"></event>
@ -209,7 +209,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -261,7 +261,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -313,7 +313,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
@ -390,7 +390,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="bg"></property>
@ -441,7 +441,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxListCtrl" expanded="1">
<property name="bg"></property>
@ -452,7 +452,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">220,-1</property>
<property name="minimum_size">220,300</property>
<property name="name">m_leftListCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
@ -751,7 +751,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="bg"></property>
@ -802,7 +802,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxListCtrl" expanded="1">
<property name="bg"></property>
@ -887,7 +887,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxHtmlWindow" expanded="1">
<property name="bg"></property>
@ -898,7 +898,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,100</property>
<property name="minimum_size">-1,90</property>
<property name="name">m_MessagesList</property>
<property name="permission">protected</property>
<property name="pos"></property>

View File

@ -59,8 +59,8 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesNameRightClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnAddNetclassClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveNetclassClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnMoveUpSelectedNetClass( wxCommandEvent& event ){ event.Skip(); }

View File

@ -224,7 +224,6 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UnitMetric = INCHES;
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
UpdateStatusBar(); /* Reaffichage des coord curseur */
ReCreateAuxiliaryToolbar();
DisplayUnitsMsg();

View File

@ -119,7 +119,6 @@ void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
m_Parent->AddHistory( g_DesignSettings.m_TrackClearance, TYPE_CLEARANCE );
EndModal( 1 );
}
@ -171,42 +170,6 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
}
break;
case TYPE_CLEARANCE:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearanceHistory[ii] == value )
{
addhistory = FALSE;
break;
}
}
if( !addhistory )
break;
for( ii = HISTORY_NUMBER - 1; ii > 0; ii-- )
{
g_DesignSettings.m_TrackClearanceHistory[ii] =
g_DesignSettings.m_TrackClearanceHistory[ii - 1];
}
g_DesignSettings.m_TrackClearanceHistory[0] = value;
// Reclassement par valeur croissante
for( ii = 0; ii < HISTORY_NUMBER - 1; ii++ )
{
if( g_DesignSettings.m_TrackClearanceHistory[ii + 1] == 0 )
break; // Fin de liste
if( g_DesignSettings.m_TrackClearanceHistory[ii] >
g_DesignSettings.m_TrackClearanceHistory[ii + 1] )
{
EXCHG( g_DesignSettings.m_TrackClearanceHistory[ii],
g_DesignSettings.m_TrackClearanceHistory[ii + 1] );
}
}
break;
case TYPE_VIA:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{

View File

@ -50,7 +50,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case wxID_CUT:
case wxID_COPY:
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT:
@ -1004,19 +1003,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
{
int ii = m_SelClrWidthBox->GetChoice();
g_DesignSettings.m_TrackClearance =
g_DesignSettings.m_TrackClearanceHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = false;
m_SelClrWidthBox_Changed = false;
m_SelViaSizeBox_Changed = false;
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH3:

View File

@ -34,7 +34,6 @@ void WinEDA_PcbFrame::DisplayTrackSettings()
buftrc.GetData(), bufvia.GetData() );
Affiche_Message( msg );
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE;
}

View File

@ -140,8 +140,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
else // no starting point, but a filled zone area can exist. This is also a good starting point.
{
ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos,
GetScreen()->
m_Active_Layer );
GetScreen()->m_Active_Layer );
if( zone )
g_HightLigth_NetCode = zone->GetNet();
}
@ -154,7 +153,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
Hight_Light( DC );
g_CurrentTrackSegment->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_DesignSettings.m_UseConnectedTrackWidth )
@ -170,6 +169,10 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->m_End = pos;
g_CurrentTrackSegment->SetNet( g_HightLigth_NetCode );
// Display info about track Net class:
GetBoard()->m_CurrentNetClassName = g_CurrentTrackSegment->GetNetClassName();
AuxiliaryToolBar_DesignRules_Update_UI();
if( pt_pad )
{
g_CurrentTrackSegment->start = pt_pad;

View File

@ -102,11 +102,11 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
}
case ID_APPEND_FILE:
LoadOnePcbFile( wxEmptyString, TRUE );
LoadOnePcbFile( wxEmptyString, true );
break;
case ID_NEW_BOARD:
Clear_Pcb( TRUE );
Clear_Pcb( true );
GetScreen()->m_FileName.Printf( wxT( "%s%cnoname%s" ),
wxGetCwd().GetData(), DIR_SEP,
PcbExtBuffer.GetData() );
@ -148,9 +148,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
return false;
}
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE;
m_SelTrackWidthBox_Changed = true;
m_SelViaSizeBox_Changed = true;
if( Append )
{
@ -300,7 +299,7 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
wxString lowerTxt;
wxString msg;
bool saveok = TRUE;
bool saveok = true;
FILE* dest;
if( FileName == wxEmptyString )

View File

@ -178,13 +178,11 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
for( int ii = 1; ii < HISTORY_NUMBER; ii++ )
{
g_DesignSettings.m_ViaSizeHistory[ii] =
g_DesignSettings.m_ViaSizeHistory[ii] = 0;
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_TrackClearanceHistory[ii] = 0;
}
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_TrackClearanceHistory[0] = g_DesignSettings.m_TrackClearance;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
g_DesignSettings.m_CopperLayerCount = 2; // Default copper layers count set to 2: double layer board

View File

@ -380,13 +380,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "TrackClearenceHistory" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPE_CLEARANCE );
continue;
}
if( stricmp( Line, "ZoneClearence" ) == 0 )
{
g_Zone_Default_Setting.m_ZoneClearance = atoi( data );
@ -561,13 +554,6 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearance );
for( int ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearanceHistory[ii] == 0 )
break;
fprintf( aFile, "TrackClearenceHistory %d\n",
g_DesignSettings.m_TrackClearanceHistory[ii] );
}
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
fprintf( aFile, "TrackMinWidth %d\n" , g_DesignSettings.m_TrackMinWidth );
@ -959,6 +945,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
board->SynchronizeNetsAndNetClasses( );
board->m_Status_Pcb = 0;
SetToolbars();
return 1;
}

View File

@ -22,119 +22,123 @@
// Keys used in read/write config
#define MODEDIT_CURR_GRID wxT( "ModEditCurrGrid" )
// local variables:
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor
/********************************/
/* class WinEDA_ModuleEditFrame */
/********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB,
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_PART,
EVT_TOOL( ID_MODEDIT_DELETE_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE,
EVT_TOOL( ID_MODEDIT_NEW_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_IMPORT_PART,
EVT_TOOL( ID_MODEDIT_IMPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EXPORT_PART,
EVT_TOOL( ID_MODEDIT_EXPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET,
EVT_TOOL( ID_MODEDIT_SHEET_SET,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK,
EVT_TOOL( ID_MODEDIT_CHECK,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
WinEDA_ModuleEditFrame::LoadModuleFromBoard )
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UNDO,
EVT_TOOL( ID_MODEDIT_UNDO,
WinEDA_ModuleEditFrame::GetComponentFromUndoList )
EVT_TOOL( ID_MODEDIT_REDO,
EVT_TOOL( ID_MODEDIT_REDO,
WinEDA_ModuleEditFrame::GetComponentFromRedoList )
// Vertical toolbar (left click):
EVT_TOOL( ID_NO_SELECT_BUTT,
EVT_TOOL( ID_NO_SELECT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_ADD_PAD,
EVT_TOOL( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT,
EVT_TOOL( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT,
EVT_TOOL( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (right click):
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
// Options Toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
// popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Transformations du module
EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_PAD_SETUP,
EVT_MENU( ID_PCB_PAD_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP,
EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions )
// Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
// PopUp Menu Zoom trait<69>s dans drawpanel.cpp
END_EVENT_TABLE()
@ -163,21 +167,16 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
SetTitle( wxT( "Module Editor (lib: " ) + m_CurrentLib + wxT( ")" ) );
if( ScreenModule == NULL )
{
ScreenModule = new PCB_SCREEN();
ActiveScreen = ScreenModule;
}
ScreenModule->m_UndoRedoCountMax = 10;
if( g_ModuleEditor_Pcb == NULL )
g_ModuleEditor_Pcb = new BOARD( NULL, this );
SetBoard( g_ModuleEditor_Pcb );
GetBoard()->m_PcbFrame = this;
SetBaseScreen( ScreenModule );
if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN();
SetBaseScreen( s_screenModule );
ActiveScreen = GetScreen();
GetScreen()->SetCurItem( NULL );
LoadSettings();
@ -206,9 +205,16 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
/****************************************************/
{
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*)GetParent();
/* g_ModuleEditor_Pcb and its correspondinf PCB_SCREEN are not deleted here,
* because if we reopen the Footprint editor, we expect to find the last edited item
*/
SetBaseScreen( NULL ); /* Do not delete (by the destructor of WinEDA_DrawFrame)
* the PCB_SCREEN handling g_ModuleEditor_Pcb
*/
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
frame->m_ModuleEditFrame = NULL;
SetBaseScreen( ScreenPcb );
ActiveScreen = frame->GetScreen();
}
@ -293,8 +299,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( GetScreen() )
{
m_HToolBar->EnableTool( ID_MODEDIT_UNDO, GetScreen()->GetUndoCommandCount( )>0 && active );
m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->GetRedoCommandCount( )>0 && active );
m_HToolBar->EnableTool( ID_MODEDIT_UNDO, GetScreen()->GetUndoCommandCount()>0 && active );
m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->GetRedoCommandCount()>0 && active );
}
if( frame->GetBoard()->m_Modules )
@ -364,7 +370,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
break;
}
}
if ( not_found )
if( not_found )
m_SelZoomBox->SetSelection( -1 );
}
@ -375,9 +382,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
{
if( ( GetScreen()->GetGrid() == GetScreen()->m_GridList[i].m_Size ) )
{
if( kk != ( int ) i )
m_SelGridBox->SetSelection( ( int ) i );
kk = ( int ) i;
if( kk != (int) i )
m_SelGridBox->SetSelection( (int) i );
kk = (int) i;
break;
}
}
@ -387,6 +394,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
DisplayUnitsMsg();
}
/**
* Display 3D frame of footprint (module) being edited.
*/
@ -402,6 +410,7 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
m_Draw3DFrame->Show( TRUE );
}
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{
wxRealPoint delta;
@ -437,25 +446,25 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
Mouse.y -= wxRound(delta.y);
Mouse.y -= wxRound( delta.y );
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN:
Mouse.y += wxRound(delta.y);
Mouse.y += wxRound( delta.y );
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT:
Mouse.x -= wxRound(delta.x);
Mouse.x -= wxRound( delta.x );
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT:
Mouse.x += wxRound(delta.x);
Mouse.x += wxRound( delta.x );
DrawPanel->MouseTo( Mouse );
break;
@ -503,6 +512,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/*****************************************************************/
void WinEDA_ModuleEditFrame::OnSelectGrid( wxCommandEvent& event )
/******************************************************************/
// Virtual function
{
if( m_SelGridBox == NULL )
@ -514,7 +524,7 @@ void WinEDA_ModuleEditFrame::OnSelectGrid( wxCommandEvent& event )
// If the user grid is the current selection , ensure grid size value = new user grid value
int ii = m_SelGridBox->GetSelection();
if ( ii == (int)(m_SelGridBox->GetCount() - 1) )
if( ii == (int) ( m_SelGridBox->GetCount() - 1 ) )
{
GetScreen()->SetGrid( ID_POPUP_GRID_USER );
DrawPanel->Refresh();

View File

@ -188,13 +188,11 @@ bool Read_Config( const wxString& projectFileName )
// Some parameters must be reinitialized after loading a new board or config
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_TrackClearanceHistory[0] = g_DesignSettings.m_TrackClearance;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_TrackClearanceHistory[ii] = 0;
g_DesignSettings.m_ViaSizeHistory[ii] = 0;
}

View File

@ -145,8 +145,6 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_CLR_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
@ -224,11 +222,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine
m_Draw_Auxiliary_Axis = TRUE;
m_SelTrackWidthBox = NULL;
m_SelClrWidthBox = NULL;
m_SelViaSizeBox = NULL;
m_SelLayerBox = NULL;
m_SelTrackWidthBox_Changed = FALSE;
m_SelClrWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
SetBoard( new BOARD( NULL, this ) );
@ -287,13 +283,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
{
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
SetBaseScreen( ScreenPcb );
delete m_drc;
if( GetBoard() != g_ModuleEditor_Pcb )
delete GetBoard();
}
@ -301,20 +291,11 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
/********************************************************/
{
PCB_SCREEN* screen;
wxConfig * config = wxGetApp().m_EDA_Config;
DrawPanel->m_AbortRequest = TRUE;
screen = ScreenPcb;
while( screen )
{
if( screen->IsModify() )
break;
screen = screen->Next();
}
if( screen )
if( ScreenPcb->IsModify() )
{
unsigned ii;
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
@ -340,15 +321,6 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
}
}
while( screen ) // Remove modify flag, to avoi others messages
{
screen->ClrModify();
screen = screen->Next();
}
/* Reselection de l'ecran de base,
* pour les evenements de refresh generes par wxWindows */
SetBaseScreen( ActiveScreen = ScreenPcb );
SaveSettings();
if( config )
@ -360,268 +332,14 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
config->Write( SHOW_MICROWAVE_TOOLS, (long) m_AuxVToolBar ? 1 : 0 );
}
// do not show the window because ScreenPcb will be deleted and we do not want any paint event
Show(false);
ActiveScreen = ScreenPcb;
Destroy();
}
/***************************************/
void WinEDA_PcbFrame::SetToolbars()
/***************************************/
/*
* Active ou desactive les tools des toolbars, en fonction des commandes
* en cours
*/
{
size_t i;
int ii, jj;
bool state;
if( m_ID_current_state == ID_TRACK_BUTT )
{
if( Drc_On )
DrawPanel->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
else
DrawPanel->SetCursor( wxCursor( wxCURSOR_QUESTION_ARROW ) );
}
if( m_HToolBar == NULL )
return;
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
state = GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE;
m_HToolBar->EnableTool( wxID_CUT, state );
m_HToolBar->EnableTool( wxID_COPY, state );
m_HToolBar->EnableTool( wxID_PASTE, FALSE );
state = GetScreen()->GetUndoCommandCount() > 0;
m_HToolBar->EnableTool( ID_UNDO_BUTT, state );
state = GetScreen()->GetRedoCommandCount() > 0;
m_HToolBar->EnableTool( ID_REDO_BUTT, state );
if( m_OptionsToolBar )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
!Drc_On );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Drc_On ?
_( "DRC Off (Disable !!!), Currently: DRC is active" ) :
_( "DRC On (Currently: DRC is inactive !!!)" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Polar Coords not show" ) :
_( "Display Polar Coords" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ?
_( "Hide General ratsnest" ) :
_( "Show General ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ?
_( "Hide Module ratsnest" ) :
_( "Show Module ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ?
_( "Disable Auto Delete old Track" ) :
_( "Enable Auto Delete old Track" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show Pads Sketch mode" ) :
_( "Show pads filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
!m_DisplayPcbTrackFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
m_DisplayPcbTrackFill ?
_( "Show Tracks Sketch mode" ) :
_( "Show Tracks filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ?
_( "Normal Contrast Mode Display" ) :
_( "High Contrast Mode Display" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & (ITEM_NOT_SHOW) ?
_( "Show Invisible Text" ) :
_( "Hide Invisible Text" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false );
}
if( m_AuxiliaryToolBar )
{
wxString msg;
m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
g_DesignSettings.m_UseConnectedTrackWidth );
if( m_SelTrackWidthBox && m_SelTrackWidthBox_Changed )
{
m_SelTrackWidthBox_Changed = FALSE;
m_SelTrackWidthBox->Clear();
wxString format = _( "Track" );
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
break; // Fin de liste
double value = To_User_Unit( g_UnitMetric,
g_DesignSettings.m_TrackWidthHistory[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
m_SelTrackWidthBox->Append( msg );
if( g_DesignSettings.m_TrackWidthHistory[ii] ==
g_DesignSettings.m_CurrentTrackWidth )
m_SelTrackWidthBox->SetSelection( ii );
}
}
if( m_SelClrWidthBox && m_SelClrWidthBox_Changed )
{
m_SelClrWidthBox_Changed = FALSE;
m_SelClrWidthBox->Clear();
wxString format = _( "Clearance" );
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearanceHistory[ii] == 0 )
break; // Fin de liste
double value = To_User_Unit( g_UnitMetric,
g_DesignSettings.m_TrackClearanceHistory[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
m_SelClrWidthBox->Append( msg );
if( g_DesignSettings.m_TrackClearanceHistory[ii] ==
g_DesignSettings.m_TrackClearance )
m_SelClrWidthBox->SetSelection( ii );
}
}
if( m_SelViaSizeBox && m_SelViaSizeBox_Changed )
{
m_SelViaSizeBox_Changed = FALSE;
m_SelViaSizeBox->Clear();
wxString format = _( "Via" );
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
break; // Fin de liste
double value = To_User_Unit( g_UnitMetric,
g_DesignSettings.m_ViaSizeHistory[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
m_SelViaSizeBox->Append( msg );
if( g_DesignSettings.m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize )
m_SelViaSizeBox->SetSelection( ii );
}
}
if( m_SelZoomBox )
{
bool not_found = true;
for( jj = 0; jj < (int)GetScreen()->m_ZoomList.GetCount(); jj++ )
{
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
{
m_SelZoomBox->SetSelection( jj + 1 );
not_found = false;
break;
}
}
if ( not_found )
m_SelZoomBox->SetSelection( -1 );
}
if( m_SelGridBox && GetScreen() )
{
int kk = m_SelGridBox->GetChoice();
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
if( GetScreen()->GetGrid() == GetScreen()->m_GridList[i].m_Size )
{
if( kk != ( int ) i )
m_SelGridBox->SetSelection( ( int ) i );
kk = ( int ) i;
break;
}
}
}
}
UpdateToolbarLayerInfo();
PrepareLayerIndicator();
DisplayUnitsMsg();
}
/**
* Display 3D frame of current printed circuit board.
*/

View File

@ -54,8 +54,6 @@ wxSize ModuleTextSize; /* Default footprint texts size */
wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
wxString g_Current_PadName; // Last used pad name (pad num)
PCB_SCREEN* ScreenModule = NULL;
// Wildcard for footprint libraries filesnames
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) );

View File

@ -102,8 +102,6 @@ extern int g_MagneticTrackOption;
extern bool g_HightLigt_Status;
extern int g_HightLigth_NetCode;
extern PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */
extern wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
extern wxString g_Current_PadName; // Last used pad name (pad num)

View File

@ -227,7 +227,7 @@ enum pcbnew_ids
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
ID_AUX_TOOLBAR_PCB_CLR_WIDTH,
ID_AUX_TOOLBAR_PCB_UNUSED2,
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
ID_AUX_TOOLBAR_PCB_UNUSED3,

View File

@ -112,7 +112,6 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event )
SetLocaleTo_Default( ); // revert to the current locale
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE;
GetScreen()->SetModify();

View File

@ -558,12 +558,14 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_CLR_WIDTH,
m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar,
-1,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelClrWidthBox );
m_SelClrWidthBox_Changed = TRUE;
wxSize( LISTBOX_WIDTH + 20, -1 ),
wxTE_READONLY );
m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
@ -575,12 +577,20 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ) );
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator();
m_NetClassSelectedBox = new wxTextCtrl( m_AuxiliaryToolBar,
-1,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxTE_READONLY );
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
// Boite de selection du pas de grille
m_AuxiliaryToolBar->AddSeparator();
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ),
@ -642,7 +652,6 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_SelViaSizeBox_Changed = TRUE;
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
ReCreateLayerBox( NULL );

View File

@ -0,0 +1,273 @@
/****************************************************************
toolbars_update_user_interface.cpp
****************************************************************/
/*
function to update toolbars UI after changing parameters
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "bitmaps.h"
#include "pcbnew_id.h"
#include "drc_stuff.h"
#include "3d_viewer.h"
/* helper to convert an integer value to a string, using mils or mm
* according to g_UnitMetric value
*/
static wxString ReturnStringValue(int aValue)
{
wxString text;
const wxChar * format;
double value = To_User_Unit( g_UnitMetric, aValue, PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
{
format = wxT( " %.1f" );
value *= 1000;
}
else
format = wxT( " %.3f" );
text.Printf( format, value );
if( g_UnitMetric == INCHES )
text += _(" mils");
else
text += _(" mm");
return text;
}
/**
* Function AuxiliaryToolBar_DesignRules_Update_UI
* update the displayed values: track widths, via sizes, clearance, Netclass name
* used when a netclass is selected
*/
void WinEDA_PcbFrame::AuxiliaryToolBar_DesignRules_Update_UI( )
{
wxString nclname = GetBoard()->m_CurrentNetClassName;
wxString msg = _("NetClass: ") + nclname;
m_NetClassSelectedBox->Clear();
m_NetClassSelectedBox->AppendText( msg );
NETCLASS* netclass = GetBoard()->m_NetClasses.Find( nclname );
if( m_ClearanceBox )
{
wxString msg = _( "Clearance" ) + ReturnStringValue(netclass->GetClearance());
m_ClearanceBox->Clear();
m_ClearanceBox->AppendText( msg );
}
}
/**
* Function AuxiliaryToolBar_Update_UI
* update the displayed values on auxiliary horizontal toolbar
* (track width, via sizes, clearance ...
*/
void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI( )
{
wxString msg;
m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
g_DesignSettings.m_UseConnectedTrackWidth );
if( m_SelTrackWidthBox && m_SelTrackWidthBox_Changed )
{
m_SelTrackWidthBox_Changed = false;
m_SelTrackWidthBox->Clear();
for( int ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
break; // Fin de liste
msg = _( "Track" ) + ReturnStringValue(g_DesignSettings.m_TrackWidthHistory[ii]);
m_SelTrackWidthBox->Append( msg );
if( g_DesignSettings.m_TrackWidthHistory[ii] ==
g_DesignSettings.m_CurrentTrackWidth )
m_SelTrackWidthBox->SetSelection( ii );
}
}
AuxiliaryToolBar_DesignRules_Update_UI( );
if( m_SelViaSizeBox && m_SelViaSizeBox_Changed )
{
m_SelViaSizeBox_Changed = false;
m_SelViaSizeBox->Clear();
for( int ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
break; // Fin de liste
msg = _( "Via" ) + ReturnStringValue(g_DesignSettings.m_ViaSizeHistory[ii]);
m_SelViaSizeBox->Append( msg );
if( g_DesignSettings.m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize )
m_SelViaSizeBox->SetSelection( ii );
}
}
if( m_SelZoomBox )
{
bool not_found = true;
for( int jj = 0; jj < (int)GetScreen()->m_ZoomList.GetCount(); jj++ )
{
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
{
m_SelZoomBox->SetSelection( jj + 1 );
not_found = false;
break;
}
}
if ( not_found )
m_SelZoomBox->SetSelection( -1 );
}
if( m_SelGridBox && GetScreen() )
{
int kk = m_SelGridBox->GetChoice();
for( int ii = 0; ii < (int) GetScreen()->m_GridList.GetCount(); ii++ )
{
if( GetScreen()->GetGrid() == GetScreen()->m_GridList[ii].m_Size )
{
if( kk != ii )
m_SelGridBox->SetSelection( ii );
kk = ii;
break;
}
}
}
}
/***************************************/
void WinEDA_PcbFrame::SetToolbars()
/***************************************/
/*
* Active ou desactive les tools des toolbars, en fonction des commandes
* en cours
*/
{
bool state;
if( m_ID_current_state == ID_TRACK_BUTT )
{
if( Drc_On )
DrawPanel->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
else
DrawPanel->SetCursor( wxCursor( wxCURSOR_QUESTION_ARROW ) );
}
if( m_HToolBar == NULL )
return;
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
state = GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE;
m_HToolBar->EnableTool( wxID_CUT, state );
m_HToolBar->EnableTool( wxID_COPY, state );
m_HToolBar->EnableTool( wxID_PASTE, false );
state = GetScreen()->GetUndoCommandCount() > 0;
m_HToolBar->EnableTool( ID_UNDO_BUTT, state );
state = GetScreen()->GetRedoCommandCount() > 0;
m_HToolBar->EnableTool( ID_REDO_BUTT, state );
if( m_OptionsToolBar )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
!Drc_On );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Drc_On ?
_( "DRC Off (Disable !!!), Currently: DRC is active" ) :
_( "DRC On (Currently: DRC is inactive !!!)" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Polar Coords not show" ) :
_( "Display Polar Coords" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ?
_( "Hide General ratsnest" ) :
_( "Show General ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ?
_( "Hide Module ratsnest" ) :
_( "Show Module ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ?
_( "Disable Auto Delete old Track" ) :
_( "Enable Auto Delete old Track" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show Pads Sketch mode" ) :
_( "Show pads filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
!m_DisplayPcbTrackFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
m_DisplayPcbTrackFill ?
_( "Show Tracks Sketch mode" ) :
_( "Show Tracks filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ?
_( "Normal Contrast Mode Display" ) :
_( "High Contrast Mode Display" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & (ITEM_NOT_SHOW) ?
_( "Show Invisible Text" ) :
_( "Hide Invisible Text" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false );
}
if( m_AuxiliaryToolBar )
AuxiliaryToolBar_Update_UI( );
UpdateToolbarLayerInfo();
PrepareLayerIndicator();
DisplayUnitsMsg();
}

View File

@ -797,12 +797,15 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r
#endif
// add holes
bool show_error = true;
while( booleng->StartPolygonGet() )
{
if( booleng->GetPolygonPointEdgeType() != KB_INSIDE_EDGE )
if( booleng->GetPolygonPointEdgeType() != KB_INSIDE_EDGE ) // we expect all vertex are holes inside the main outline
{
if( show_error ) // show this error only once, if happens
DisplayError( NULL,
wxT( "BOARD::CombineAreas() error: unexpected outside contour descriptor" ) );
show_error = false;
continue;
}
while( booleng->PolygonHasMorePoints() )