Commit 9e32b2ab authored by g_harland's avatar g_harland

Assorted changes; see change_log.txt

parent ee68d20e
...@@ -4,6 +4,54 @@ Started 2007-June-11 ...@@ -4,6 +4,54 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-07 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ all
* Various dialog boxes can now (otherwise) be cancelled by pressing the "Esc" key.
(Some dialog boxes still require attention in that regard though, so that task
is not yet complete.) And the captions of the "OK" button within various dialog
boxes have been fully capitalised (meaning that an icon is now provided within
each of those buttons within the Linux version of KiCad).
* DIALOG_STYLE (defined within include/wxstruct.h) now includes MAYBE_RESIZE_BORDER
field. (Refer to 2007-Oct-2 UPDATE notes for the relevance of this.)
* Beautification and house keeping.
+ eeschema
* The editpart.cpp and editpart.cpp files (which are no longer used) have been
removed, and replaced with editpart.cpp.notused and editpart.cpp.notused
+ cvpcb
* Additional "OK", "Cancel", and "Apply" buttons have now been provided for the
"Options" dialog box which lists various display options for footprints.
+ pcbnew
* Invoking the "Select Layer Pair:" dialog box is no longer possible whenever only
one (copper) layer is currently enabled. And it is no longer possible to select
the same layer to be both the Top Layer and Bottom Layer (for any Layer Pair).
* Deselecting layers during the "Swap layers" command is now more user-friendly,
due to the provision of an additional "(Deselect)" radiobutton within the (child)
"Select Layer:" dialog box (which is always invoked whenever a different
radiobutton within the "Swap Layers:" dialog box is clicked on). (It had
previously been necessary to cancel the "Select Layer:" dialog box before being
able to click on the "Deselect" button within the "Swap Layers:" dialog box.)
* Definition for NB_LAYERS changed from (EDGE_N + 1) to (LAST_NO_COPPER_LAYER + 1)
(Although EDGE_N is currently the "last" layer, that wouldn't necessarily still
be true if any additional layers are ever defined in the future.) And comparisons
to 29 (or 28) have been replaced with comparisons to NB_LAYERS (when appropriate).
+ gerbview
* The previously provided "Exit" button within the "GerbView Layer Colors" dialog
box has been replaced with "OK", "Cancel", and "Apply" buttons; and both the
visibility and color of the Grid layer can now be edited from the same dialog.
* Deselecting (Gerber) layers during the "Export to Pcbnew" command is now more
user-friendly, due to the provision of an additional "(Deselect)" radiobutton
within the (child) "Select Layer:" dialog box (which is always invoked whenever
a different radiobutton within the "Layer selection:" dialog box is clicked on).
(It had previously been necessary to cancel the "Select Layer:" dialog box before
being able to click on the "Deselect" button within the "Layer selection:" dialog
box.)
* The "Export to Pcbnew" command now requires at least one Gerber file to have been
already loaded. And Gerber files can now be loaded into any of the 32 (Gerber)
layers provided. (It had previously been necessary to avoid having any gaps within
the sequence of used Gerber layers.)
2007-Oct-6 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Oct-6 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+ pcbnew + pcbnew
...@@ -11,7 +59,6 @@ email address. ...@@ -11,7 +59,6 @@ email address.
move RemoteCommand() and SendMessageToEESCHEMA() to cross-probing.cpp move RemoteCommand() and SendMessageToEESCHEMA() to cross-probing.cpp
2007-Oct-3 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Oct-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ pcbnew + pcbnew
......
...@@ -16,14 +16,12 @@ ...@@ -16,14 +16,12 @@
/***********************/ /***********************/
enum listbox { enum listbox {
ID_LISTBOX_CANCEL = 8000, ID_LISTBOX_LIST = 8000
ID_LISTBOX_LIST,
ID_LISTBOX_OK
}; };
BEGIN_EVENT_TABLE(WinEDAListBox, wxDialog) BEGIN_EVENT_TABLE(WinEDAListBox, wxDialog)
EVT_BUTTON(ID_LISTBOX_OK, WinEDAListBox::Ok) EVT_BUTTON(wxID_OK, WinEDAListBox::OnOkClick)
EVT_BUTTON(ID_LISTBOX_CANCEL, WinEDAListBox::Cancel) EVT_BUTTON(wxID_CANCEL, WinEDAListBox::OnCancelClick)
EVT_LISTBOX(ID_LISTBOX_LIST, WinEDAListBox::ClickOnList) EVT_LISTBOX(ID_LISTBOX_LIST, WinEDAListBox::ClickOnList)
EVT_LISTBOX_DCLICK(ID_LISTBOX_LIST, WinEDAListBox::D_ClickOnList) EVT_LISTBOX_DCLICK(ID_LISTBOX_LIST, WinEDAListBox::D_ClickOnList)
EVT_CHAR(WinEDAListBox::OnKeyEvent) EVT_CHAR(WinEDAListBox::OnKeyEvent)
...@@ -98,11 +96,11 @@ int ii; ...@@ -98,11 +96,11 @@ int ii;
m_List->Append(*names); m_List->Append(*names);
} }
wxButton * butt = new wxButton(this, ID_LISTBOX_OK, _("Ok")); wxButton * butt = new wxButton(this, wxID_OK, _("OK"));
RightBoxSizer->Add(butt, 0, wxGROW|wxALL, 5); RightBoxSizer->Add(butt, 0, wxGROW|wxALL, 5);
butt->SetDefault(); butt->SetDefault();
butt = new wxButton(this, ID_LISTBOX_CANCEL, _("Cancel")); butt = new wxButton(this, wxID_CANCEL, _("Cancel"));
RightBoxSizer->Add(butt, 0, wxGROW|wxALL, 5); RightBoxSizer->Add(butt, 0, wxGROW|wxALL, 5);
if (m_MoveFct ) if (m_MoveFct )
...@@ -110,7 +108,7 @@ int ii; ...@@ -110,7 +108,7 @@ int ii;
size.x = -1; size.y = 60; size.x = -1; size.y = 60;
m_WinMsg = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, size, m_WinMsg = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, size,
wxTE_READONLY|wxTE_MULTILINE); wxTE_READONLY|wxTE_MULTILINE);
GeneralBoxSizer->Add(m_WinMsg, 0, wxGROW|wxALL, 5); GeneralBoxSizer->Add(m_WinMsg, 0, wxGROW|wxALL, 5);
} }
GetSizer()->Fit(this); GetSizer()->Fit(this);
...@@ -174,7 +172,7 @@ void WinEDAListBox::InsertItems(const wxArrayString & itemlist, int position) ...@@ -174,7 +172,7 @@ void WinEDAListBox::InsertItems(const wxArrayString & itemlist, int position)
} }
/************************************************/ /************************************************/
void WinEDAListBox::Cancel(wxCommandEvent& event) void WinEDAListBox::OnCancelClick(wxCommandEvent& event)
/************************************************/ /************************************************/
{ {
EndModal(-1); EndModal(-1);
...@@ -205,7 +203,7 @@ int ii = m_List->GetSelection(); ...@@ -205,7 +203,7 @@ int ii = m_List->GetSelection();
/***********************************************/ /***********************************************/
void WinEDAListBox::Ok(wxCommandEvent& event) void WinEDAListBox::OnOkClick(wxCommandEvent& event)
/***********************************************/ /***********************************************/
{ {
int ii = m_List->GetSelection(); int ii = m_List->GetSelection();
...@@ -224,8 +222,8 @@ void WinEDAListBox::OnClose(wxCloseEvent& event) ...@@ -224,8 +222,8 @@ void WinEDAListBox::OnClose(wxCloseEvent& event)
static int SortItems( const wxString ** ptr1, const wxString ** ptr2 ) static int SortItems( const wxString ** ptr1, const wxString ** ptr2 )
/********************************************************************/ /********************************************************************/
/* Routines de comparaison pour le tri tri alphabetique, /* Routines de comparaison pour le tri tri alphabetique,
avec traitement des nombres en tant que valeur numerique * avec traitement des nombres en tant que valeur numerique
*/ */
{ {
return StrNumICmp( (*ptr1)->GetData(), (*ptr2)->GetData() ); return StrNumICmp( (*ptr1)->GetData(), (*ptr2)->GetData() );
} }
......
...@@ -47,7 +47,8 @@ void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event) ...@@ -47,7 +47,8 @@ void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event)
/* Creation de la fenetre d'options de la fenetre de visu */ /* Creation de la fenetre d'options de la fenetre de visu */
{ {
KiDisplayOptionsFrame * OptionWindow = new KiDisplayOptionsFrame(this); KiDisplayOptionsFrame * OptionWindow = new KiDisplayOptionsFrame(this);
OptionWindow->ShowModal(); OptionWindow->Destroy(); OptionWindow->ShowModal();
OptionWindow->Destroy();
} }
...@@ -65,15 +66,13 @@ IMPLEMENT_DYNAMIC_CLASS( KiDisplayOptionsFrame, wxDialog ) ...@@ -65,15 +66,13 @@ IMPLEMENT_DYNAMIC_CLASS( KiDisplayOptionsFrame, wxDialog )
BEGIN_EVENT_TABLE( KiDisplayOptionsFrame, wxDialog ) BEGIN_EVENT_TABLE( KiDisplayOptionsFrame, wxDialog )
////@begin KiDisplayOptionsFrame event table entries ////@begin KiDisplayOptionsFrame event table entries
EVT_CHECKBOX( PADNUM_OPT, KiDisplayOptionsFrame::OnPadnumOptClick )
EVT_BUTTON( ID_SAVE_CONFIG, KiDisplayOptionsFrame::OnSaveConfigClick ) EVT_BUTTON( ID_SAVE_CONFIG, KiDisplayOptionsFrame::OnSaveConfigClick )
EVT_CHECKBOX( PADFILL_OPT, KiDisplayOptionsFrame::OnPadfillOptClick ) EVT_BUTTON( wxID_OK, KiDisplayOptionsFrame::OnOkClick )
EVT_RADIOBOX( EDGE_SELECT, KiDisplayOptionsFrame::OnEdgeSelectSelected ) EVT_BUTTON( wxID_CANCEL, KiDisplayOptionsFrame::OnCancelClick )
EVT_RADIOBOX( TEXT_SELECT, KiDisplayOptionsFrame::OnTextSelectSelected ) EVT_BUTTON( wxID_APPLY, KiDisplayOptionsFrame::OnApplyClick )
////@end KiDisplayOptionsFrame event table entries ////@end KiDisplayOptionsFrame event table entries
...@@ -101,10 +100,10 @@ KiDisplayOptionsFrame::KiDisplayOptionsFrame( WinEDA_BasePcbFrame* parent, wxWin ...@@ -101,10 +100,10 @@ KiDisplayOptionsFrame::KiDisplayOptionsFrame( WinEDA_BasePcbFrame* parent, wxWin
bool KiDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool KiDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{ {
////@begin KiDisplayOptionsFrame member initialisation ////@begin KiDisplayOptionsFrame member initialisation
m_IsShowPadNum = NULL;
m_IsShowPadFill = NULL;
m_EdgesDisplayOption = NULL; m_EdgesDisplayOption = NULL;
m_TextDisplayOption = NULL; m_TextDisplayOption = NULL;
m_IsShowPadNum = NULL;
m_IsShowPadFill = NULL;
////@end KiDisplayOptionsFrame member initialisation ////@end KiDisplayOptionsFrame member initialisation
////@begin KiDisplayOptionsFrame creation ////@begin KiDisplayOptionsFrame creation
...@@ -132,24 +131,16 @@ void KiDisplayOptionsFrame::CreateControls() ...@@ -132,24 +131,16 @@ void KiDisplayOptionsFrame::CreateControls()
KiDisplayOptionsFrame* itemDialog1 = this; KiDisplayOptionsFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2); itemDialog1->SetSizer(itemBoxSizer2);
wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(3, 2, 0, 0); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_TOP|wxALL, 5);
m_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Pad &Num"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
m_IsShowPadNum->SetValue(false); // itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemFlexGridSizer3->Add(m_IsShowPadNum, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer2->Add(itemBoxSizer4, 0, wxGROW|wxALIGN_TOP|wxALL, 5);
wxButton* itemButton5 = new wxButton( itemDialog1, ID_SAVE_CONFIG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer3->Add(itemButton5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, _("&Pad Fill"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_IsShowPadFill->SetValue(false);
itemFlexGridSizer3->Add(m_IsShowPadFill, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
wxString m_EdgesDisplayOptionStrings[] = { wxString m_EdgesDisplayOptionStrings[] = {
_("&Filaire"), _("&Filaire"),
...@@ -157,7 +148,8 @@ void KiDisplayOptionsFrame::CreateControls() ...@@ -157,7 +148,8 @@ void KiDisplayOptionsFrame::CreateControls()
_("&Sketch") _("&Sketch")
}; };
m_EdgesDisplayOption = new wxRadioBox( itemDialog1, EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, 3, m_EdgesDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); m_EdgesDisplayOption = new wxRadioBox( itemDialog1, EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, 3, m_EdgesDisplayOptionStrings, 1, wxRA_SPECIFY_COLS );
itemFlexGridSizer3->Add(m_EdgesDisplayOption, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); // itemBoxSizer3->Add(m_EdgesDisplayOption, 0, wxGROW|wxALL, 5);
itemBoxSizer3->Add(m_EdgesDisplayOption, 0, wxALIGN_LEFT|wxALL, 5);
wxString m_TextDisplayOptionStrings[] = { wxString m_TextDisplayOptionStrings[] = {
_("&Filaire"), _("&Filaire"),
...@@ -165,13 +157,54 @@ void KiDisplayOptionsFrame::CreateControls() ...@@ -165,13 +157,54 @@ void KiDisplayOptionsFrame::CreateControls()
_("&Sketch") _("&Sketch")
}; };
m_TextDisplayOption = new wxRadioBox( itemDialog1, TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, 3, m_TextDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); m_TextDisplayOption = new wxRadioBox( itemDialog1, TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, 3, m_TextDisplayOptionStrings, 1, wxRA_SPECIFY_COLS );
itemFlexGridSizer3->Add(m_TextDisplayOption, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); // itemBoxSizer3->Add(m_TextDisplayOption, 0, wxGROW|wxALL, 5);
itemBoxSizer3->Add(m_TextDisplayOption, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
// itemBoxSizer3->Add(itemBoxSizer5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer3->Add(itemBoxSizer5, 0, wxGROW|wxALL, 0);
// Provide a spacer to improve appearance of dialog box
itemBoxSizer5->AddSpacer(5);
m_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Pad &Num"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_IsShowPadNum->SetValue(false);
// itemBoxSizer5->Add(m_IsShowPadNum, 0, wxGROW|wxALL, 5);
itemBoxSizer5->Add(m_IsShowPadNum, 0, wxALIGN_TOP|wxALL, 5);
m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, _("&Pad Fill"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_IsShowPadFill->SetValue(false);
// itemBoxSizer5->Add(m_IsShowPadFill, 0, wxGROW|wxALL, 5);
itemBoxSizer5->Add(m_IsShowPadFill, 0, wxALIGN_TOP|wxALL, 5);
// Provide a stretch spacer to improve appearance of dialog box
itemBoxSizer5->AddStretchSpacer();
wxButton* itemButton6 = new wxButton( itemDialog1, ID_SAVE_CONFIG, _("Save Cfg..."), wxDefaultPosition, wxDefaultSize, 0 );
// itemBoxSizer5->Add(itemButton6, 0, wxGROW|wxALL, 5);
itemBoxSizer5->Add(itemButton6, 0, wxALIGN_BOTTOM|wxALL, 5);
// itemBoxSizer4->AddStretchSpacer();
wxButton* itemButton7 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton7->SetForegroundColour(*wxRED);
// itemBoxSizer4->Add(itemButton7, 0, wxGROW|wxALL, 5);
itemBoxSizer4->Add(itemButton7, 0, wxALIGN_RIGHT|wxALL, 5);
wxButton* itemButton8 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton8->SetForegroundColour(*wxBLUE);
// itemBoxSizer4->Add(itemButton8, 0, wxGROW|wxALL, 5);
itemBoxSizer4->Add(itemButton8, 0, wxALIGN_RIGHT|wxALL, 5);
wxButton* itemButton9 = new wxButton( itemDialog1, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
// itemBoxSizer4->Add(itemButton9, 0, wxGROW|wxALL, 5);
itemBoxSizer4->Add(itemButton9, 0, wxALIGN_RIGHT|wxALL, 5);
// Set validators // Set validators
m_IsShowPadNum->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadNum) );
m_IsShowPadFill->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadFill) );
m_EdgesDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModEdge) ); m_EdgesDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModEdge) );
m_TextDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModText) ); m_TextDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModText) );
m_IsShowPadNum->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadNum) );
m_IsShowPadFill->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadFill) );
////@end KiDisplayOptionsFrame content construction ////@end KiDisplayOptionsFrame content construction
} }
...@@ -210,57 +243,65 @@ wxIcon KiDisplayOptionsFrame::GetIconResource( const wxString& name ) ...@@ -210,57 +243,65 @@ wxIcon KiDisplayOptionsFrame::GetIconResource( const wxString& name )
////@end KiDisplayOptionsFrame icon retrieval ////@end KiDisplayOptionsFrame icon retrieval
} }
/*! /*!
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for PADFILL_OPT * Update settings related to edges, text strings, and pads
*/ */
void KiDisplayOptionsFrame::OnPadfillOptClick( wxCommandEvent& event ) void KiDisplayOptionsFrame::UpdateObjectSettings()
{ {
// Update settings
////@begin KiDisplayOptionsFrame update settings
DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge =
m_EdgesDisplayOption->GetSelection();
DisplayOpt.DisplayModText = m_Parent->m_DisplayModText =
m_TextDisplayOption->GetSelection();
DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum =
m_IsShowPadNum->GetValue();
DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill = DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill =
m_IsShowPadFill->GetValue(); m_IsShowPadFill->GetValue();
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
////@end KiDisplayOptionsFrame update settings
} }
/*! /*!
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for PADNUM_OPT * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG
*/ */
void KiDisplayOptionsFrame::OnPadnumOptClick( wxCommandEvent& event ) void KiDisplayOptionsFrame::OnSaveConfigClick( wxCommandEvent& event )
{ {
DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); Save_Config(this);
m_Parent->ReDrawPanel();
} }
/*! /*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for EDGE_SELECT * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/ */
void KiDisplayOptionsFrame::OnEdgeSelectSelected( wxCommandEvent& event ) void KiDisplayOptionsFrame::OnOkClick( wxCommandEvent& event )
{ {
DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge = UpdateObjectSettings();
m_EdgesDisplayOption->GetSelection(); EndModal( 1 );
m_Parent->ReDrawPanel();
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
void KiDisplayOptionsFrame::OnSaveConfigClick( wxCommandEvent& event ) void KiDisplayOptionsFrame::OnCancelClick( wxCommandEvent& event )
{ {
Save_Config(this); EndModal( -1 );
} }
/*! /*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for TEXT_SELECT * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY
*/ */
void KiDisplayOptionsFrame::OnTextSelectSelected( wxCommandEvent& event ) void KiDisplayOptionsFrame::OnApplyClick( wxCommandEvent& event )
{ {
DisplayOpt.DisplayModText = m_Parent->m_DisplayModText = UpdateObjectSettings();
m_TextDisplayOption->GetSelection();
m_Parent->ReDrawPanel();
} }
...@@ -81,20 +81,17 @@ public: ...@@ -81,20 +81,17 @@ public:
////@begin KiDisplayOptionsFrame event handler declarations ////@begin KiDisplayOptionsFrame event handler declarations
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for PADNUM_OPT
void OnPadnumOptClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG
void OnSaveConfigClick( wxCommandEvent& event ); void OnSaveConfigClick( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for PADFILL_OPT /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnPadfillOptClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for EDGE_SELECT /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnEdgeSelectSelected( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for TEXT_SELECT /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY
void OnTextSelectSelected( wxCommandEvent& event ); void OnApplyClick( wxCommandEvent& event );
////@end KiDisplayOptionsFrame event handler declarations ////@end KiDisplayOptionsFrame event handler declarations
...@@ -105,16 +102,19 @@ public: ...@@ -105,16 +102,19 @@ public:
/// Retrieves icon resources /// Retrieves icon resources
wxIcon GetIconResource( const wxString& name ); wxIcon GetIconResource( const wxString& name );
/// Updates settings related to edges, text strings, and pads
void UpdateObjectSettings();
////@end KiDisplayOptionsFrame member function declarations ////@end KiDisplayOptionsFrame member function declarations
/// Should we show tooltips? /// Should we show tooltips?
static bool ShowToolTips(); static bool ShowToolTips();
////@begin KiDisplayOptionsFrame member variables ////@begin KiDisplayOptionsFrame member variables
wxCheckBox* m_IsShowPadNum;
wxCheckBox* m_IsShowPadFill;
wxRadioBox* m_EdgesDisplayOption; wxRadioBox* m_EdgesDisplayOption;
wxRadioBox* m_TextDisplayOption; wxRadioBox* m_TextDisplayOption;
wxCheckBox* m_IsShowPadNum;
wxCheckBox* m_IsShowPadFill;
////@end KiDisplayOptionsFrame member variables ////@end KiDisplayOptionsFrame member variables
WinEDA_BasePcbFrame * m_Parent; WinEDA_BasePcbFrame * m_Parent;
......
...@@ -194,7 +194,7 @@ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( ...@@ -194,7 +194,7 @@ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame(
pos.x += MButton->GetDefaultSize().x + 10; pos.x += MButton->GetDefaultSize().x + 10;
wxButton* Button = new wxButton( this, ID_ACCEPT_CMP_PROPERTIES, wxButton* Button = new wxButton( this, ID_ACCEPT_CMP_PROPERTIES,
_( "Ok" ), pos ); _( "OK" ), pos );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
c = new wxLayoutConstraints; c = new wxLayoutConstraints;
c->left.SameAs( MButton, wxRight, 20 ); c->left.SameAs( MButton, wxRight, 20 );
......
...@@ -232,7 +232,7 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par ...@@ -232,7 +232,7 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par
pos.x += Button->GetDefaultSize().x + 70; pos.x += Button->GetDefaultSize().x + 70;
Button = new wxButton( this, ID_ACCEPT_PART_PROPERTIES, Button = new wxButton( this, ID_ACCEPT_PART_PROPERTIES,
_( "Ok" ), pos ); _( "OK" ), pos );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
c = new wxLayoutConstraints; c = new wxLayoutConstraints;
......
...@@ -30,11 +30,6 @@ static wxString shape_list[NBSHAPES] = ...@@ -30,11 +30,6 @@ static wxString shape_list[NBSHAPES] =
wxT( "Input" ), wxT( "Output" ), wxT( "Bidi" ), wxT( "TriState" ), wxT( "Passive" ) wxT( "Input" ), wxT( "Output" ), wxT( "Bidi" ), wxT( "TriState" ), wxT( "Passive" )
}; };
enum id_Textdit {
ID_ACCEPT_PINSHEET_PROPERTIES = 1970,
ID_CANCEL_PINSHEET_PROPERTIES
};
/*****************************************************/ /*****************************************************/
class WinEDA_PinSheetPropertiesFrame : public wxDialog class WinEDA_PinSheetPropertiesFrame : public wxDialog
...@@ -57,16 +52,15 @@ public: ...@@ -57,16 +52,15 @@ public:
~WinEDA_PinSheetPropertiesFrame() { }; ~WinEDA_PinSheetPropertiesFrame() { };
private: private:
void PinSheetPropertiesAccept( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog )
EVT_BUTTON( ID_ACCEPT_PINSHEET_PROPERTIES, EVT_BUTTON( wxID_OK, WinEDA_PinSheetPropertiesFrame::OnOkClick )
WinEDA_PinSheetPropertiesFrame::PinSheetPropertiesAccept ) EVT_BUTTON( wxID_CANCEL, WinEDA_PinSheetPropertiesFrame::OnCancelClick )
EVT_BUTTON( ID_CANCEL_PINSHEET_PROPERTIES, WinEDA_PinSheetPropertiesFrame::OnQuit )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -96,13 +90,11 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame( ...@@ -96,13 +90,11 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
m_CurrentPinSheet = curr_pinsheet; m_CurrentPinSheet = curr_pinsheet;
/* Creation des boutons de commande */ /* Creation des boutons de commande */
Button = new wxButton( this, ID_ACCEPT_PINSHEET_PROPERTIES, Button = new wxButton( this, wxID_OK, _( "OK" ) );
_( "Ok" ) );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, ID_CANCEL_PINSHEET_PROPERTIES, Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
_( "Cancel" ) );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
...@@ -123,23 +115,22 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame( ...@@ -123,23 +115,22 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
/************************************************************************/ /************************************************************************/
void WinEDA_PinSheetPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/************************************************************************/ /************************************************************************/
{ {
// true is to force the frame to close EndModal( -1 );
Close( true );
} }
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_PinSheetPropertiesFrame::PinSheetPropertiesAccept( wxCommandEvent& event ) void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_CurrentPinSheet->m_Text = m_TextWin->GetText(); m_CurrentPinSheet->m_Text = m_TextWin->GetText();
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize(); m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize();
m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection(); m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection();
Close( TRUE ); EndModal( 0 );
} }
......
...@@ -25,6 +25,23 @@ void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event ) ...@@ -25,6 +25,23 @@ void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event )
/* Export data in pcbnew format /* Export data in pcbnew format
*/ */
{ {
int ii = 0;
bool no_used_layers = true; // Changed to false if any used layer found
// Check whether any of the Gerber layers are actually currently used
while( no_used_layers && ii < 32 )
{
if( g_GERBER_Descr_List[ii] != NULL )
no_used_layers = false;
ii++;
}
if( no_used_layers )
{
DisplayInfo( this, _( "None of the Gerber layers contain any data" ) );
return;
}
wxString FullFileName, msg; wxString FullFileName, msg;
wxString PcbExt( wxT( ".brd" ) ); wxString PcbExt( wxT( ".brd" ) );
......
...@@ -211,7 +211,7 @@ wxString list_scales[2] = { _("format: 2.3"), _("format 3.4") }; ...@@ -211,7 +211,7 @@ wxString list_scales[2] = { _("format: 2.3"), _("format 3.4") };
void WinEDA_GerberGeneralOptionsFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event)) void WinEDA_GerberGeneralOptionsFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/************************************************************************/ /************************************************************************/
{ {
EndModal(0); EndModal( -1 );
} }
...@@ -227,7 +227,7 @@ void WinEDA_GerberGeneralOptionsFrame::OnOkClick(wxCommandEvent& event) ...@@ -227,7 +227,7 @@ void WinEDA_GerberGeneralOptionsFrame::OnOkClick(wxCommandEvent& event)
g_Default_GERBER_Format = g_Default_GERBER_Format =
(m_GerberDefaultScale->GetSelection() == 0) ? 23 : 34; (m_GerberDefaultScale->GetSelection() == 0) ? 23 : 34;
EndModal(1); EndModal( 1 );
} }
...@@ -334,7 +334,7 @@ wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") }; ...@@ -334,7 +334,7 @@ wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") };
void WinEDA_LookFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event)) void WinEDA_LookFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/**************************************************************/ /**************************************************************/
{ {
EndModal(0); EndModal( -1 );
} }
...@@ -363,7 +363,7 @@ void WinEDA_LookFrame::OnOkClick(wxCommandEvent& event) ...@@ -363,7 +363,7 @@ void WinEDA_LookFrame::OnOkClick(wxCommandEvent& event)
m_Parent->GetScreen()->SetRefreshReq(); m_Parent->GetScreen()->SetRefreshReq();
EndModal(1); EndModal( 1 );
} }
...@@ -395,4 +395,3 @@ void WinEDA_GerberFrame::InstallPcbOptionsFrame(const wxPoint & pos, int id) ...@@ -395,4 +395,3 @@ void WinEDA_GerberFrame::InstallPcbOptionsFrame(const wxPoint & pos, int id)
break; break;
} }
} }
...@@ -154,7 +154,7 @@ void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event)) ...@@ -154,7 +154,7 @@ void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event))
g_PhotoFilenameExt = TextPhotoExt->GetValue(); g_PhotoFilenameExt = TextPhotoExt->GetValue();
g_PenFilenameExt = TextPenExt->GetValue(); g_PenFilenameExt = TextPenExt->GetValue();
EndModal(1); EndModal( 1 );
} }
...@@ -162,7 +162,7 @@ void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event)) ...@@ -162,7 +162,7 @@ void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event))
void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event)) void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/******************************************************************/ /******************************************************************/
{ {
EndModal(0); EndModal( -1 );
} }
...@@ -172,4 +172,3 @@ void WinEDA_ConfigFrame::SaveCfg(wxCommandEvent& event) ...@@ -172,4 +172,3 @@ void WinEDA_ConfigFrame::SaveCfg(wxCommandEvent& event)
{ {
m_Parent->Update_config(); m_Parent->Update_config();
} }
...@@ -12,14 +12,13 @@ ...@@ -12,14 +12,13 @@
/* Variables locales */ /* Variables locales */
static int LayerLookUpTable[32]; static int RadioButtonTable[32]; // Indexes radiobuttons to Gerber layers
static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers
enum swap_layer_id { enum swap_layer_id {
ID_SWAP_LAYER_EXECUTE = 1800, ID_SWAP_LAYER_BUTTON_SELECT = 1800,
ID_SWAP_LAYER_CANCEL, ID_SWAP_LAYER_DESELECT,
ID_SWAP_LAYER_BUTTON_SELECT, ID_SWAP_LAYER_SELECT
ID_SWAP_LAYER_DESELECT,
ID_SWAP_LAYER_SELECT
}; };
...@@ -40,19 +39,21 @@ public: ...@@ -40,19 +39,21 @@ public:
~WinEDA_SwapLayerFrame() {}; ~WinEDA_SwapLayerFrame() {};
private: private:
void Sel_Layer(wxCommandEvent& event); void Sel_Layer(wxCommandEvent& event);
void Cancel(wxCommandEvent& event); void OnOkClick(wxCommandEvent& event);
void Execute(wxCommandEvent& event); void OnCancelClick(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SwapLayerFrame */ /* Table des evenements pour WinEDA_SwapLayerFrame */
BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog) BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog)
EVT_BUTTON(ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute) EVT_BUTTON(wxID_OK, WinEDA_SwapLayerFrame::OnOkClick)
EVT_BUTTON(ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel) EVT_BUTTON(wxID_CANCEL, WinEDA_SwapLayerFrame::OnCancelClick)
EVT_BUTTON(ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_BUTTON(ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer)
EVT_BUTTON(ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_BUTTON(ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer)
EVT_RADIOBOX(ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_RADIOBOX(ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer)
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -60,90 +61,133 @@ END_EVENT_TABLE() ...@@ -60,90 +61,133 @@ END_EVENT_TABLE()
int * InstallDialogLayerPairChoice(WinEDA_GerberFrame * parent) int * InstallDialogLayerPairChoice(WinEDA_GerberFrame * parent)
/*************************************************************/ /*************************************************************/
/* Install a dialog frame to choose the equivalence /* Install a dialog frame to choose the equivalence
between gerber layers and pcbnew layers * between gerber layers and pcbnew layers
return the "lookup table" if ok, or NULL * return the "lookup table" if ok, or NULL
*/ */
{ {
WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(parent); WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(parent);
int ii = frame->ShowModal(); frame->Destroy(); int ii = frame->ShowModal();
if ( ii >= 0 ) return LayerLookUpTable; frame->Destroy();
else return NULL; if( ii >= 0 )
return LayerLookUpTable;
else
return NULL;
} }
/*************************************************************************/ /*************************************************************************/
WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent): WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent):
wxDialog(parent, -1, _("Layer selection:"),wxPoint(-1,-1), wxDialog( parent, -1, _("Layer selection:"), wxPoint(-1, -1),
wxDefaultSize, DIALOG_STYLE ) wxDefaultSize, DIALOG_STYLE )
/*************************************************************************/ /*************************************************************************/
{ {
wxButton * Button; wxButton * Button;
int ii, nb_items; int ii, nb_items;
wxString g_Layer_Name_Pair[32]; wxString g_Layer_Name_Pair[32];
m_Parent = parent; m_Parent = parent;
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
/* Compute a resonnable number of copper layers */ // Compute a reasonable number of copper layers
g_DesignSettings.m_CopperLayerCount = 0; g_DesignSettings.m_CopperLayerCount = 0;
for ( ii = 0; ii < NB_LAYERS; ii++ ) for( ii = 0; ii < 32; ii++ )
{ {
if ( g_GERBER_Descr_List[ii] != NULL) if( g_GERBER_Descr_List[ii] != NULL )
g_DesignSettings.m_CopperLayerCount++; g_DesignSettings.m_CopperLayerCount++;
// Specify the default value for each member of these arrays.
RadioButtonTable[ii] = -1;
LayerLookUpTable[ii] = NB_LAYERS; // Value associated with deselected Gerber layer
} }
int pcb_layer_number = 0; int pcb_layer_number = 0;
for ( nb_items = 0, ii = 0; ii < NB_LAYERS; ii++ ) for( nb_items = 0, ii = 0; ii < 32; ii++ )
{ {
if ( g_GERBER_Descr_List[ii] == NULL ) if( g_GERBER_Descr_List[ii] == NULL )
{
LayerLookUpTable[ii] = -1;
continue; continue;
}
if ( (pcb_layer_number == g_DesignSettings.m_CopperLayerCount-1) if( (pcb_layer_number == g_DesignSettings.m_CopperLayerCount - 1)
&& (g_DesignSettings.m_CopperLayerCount > 1) ) && (g_DesignSettings.m_CopperLayerCount > 1) )
pcb_layer_number = CMP_N; pcb_layer_number = CMP_N;
RadioButtonTable[nb_items] = ii;
LayerLookUpTable[ii] = pcb_layer_number; LayerLookUpTable[ii] = pcb_layer_number;
g_Layer_Name_Pair[ii] = _("Gerber layer ");
g_Layer_Name_Pair[ii] << ii+1 // Specify initial (temporary) caption for associated radiobutton,
<< wxT(" -> ") << ReturnPcbLayerName(pcb_layer_number); // which will be appropriately updated after dialog box has been sized.
// (If the radiobuttons' captions are not changed in this way, some of
// each radiobutton's caption could be truncated if the associated
// (Gerber) layer is ever subsequently deselected by the user.)
g_Layer_Name_Pair[nb_items] = _("Gerber layer ");
g_Layer_Name_Pair[nb_items] << ii + 1 << wxT(" -> ") << _("Do not export");
nb_items++; nb_items++;
pcb_layer_number++; pcb_layer_number++;
} }
wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxVERTICAL);
SetSizer(FrameBoxSizer); SetSizer(FrameBoxSizer);
wxBoxSizer* LeftBoxSizer = new wxBoxSizer(wxVERTICAL);
FrameBoxSizer->Add(LeftBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* RightBoxSizer = new wxBoxSizer(wxVERTICAL); FrameBoxSizer->Add(MainBoxSizer, 0, wxGROW|wxALIGN_LEFT|wxALL, 5);
FrameBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_LayerList = new wxRadioBox(this, ID_SWAP_LAYER_SELECT, _("Layers"), m_LayerList = new wxRadioBox(this, ID_SWAP_LAYER_SELECT, _("Layers"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
nb_items, g_Layer_Name_Pair, nb_items, g_Layer_Name_Pair,
nb_items < 16 ? nb_items :16, nb_items < 16 ? nb_items : 16,
wxRA_SPECIFY_ROWS); wxRA_SPECIFY_ROWS);
LeftBoxSizer->Add(m_LayerList, 0, wxGROW|wxALL, 5);
Button = new wxButton(this,ID_SWAP_LAYER_CANCEL, _("Cancel")); // Specify a minimum size for this radiobox (with the objective
Button->SetForegroundColour(*wxRED); // of attempting to prevent any radiobutton's caption from being
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); // truncated if any of the layers are subsequently deselected)
m_LayerList->SetMinSize( m_LayerList->GetSize() );
Button = new wxButton(this,ID_SWAP_LAYER_EXECUTE, _("OK")); MainBoxSizer->Add(m_LayerList, 0, wxALIGN_TOP|wxALL, 5);
Button->SetForegroundColour(*wxBLUE);
wxBoxSizer* RightBoxSizer = new wxBoxSizer(wxVERTICAL);
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_TOP|wxALL, 0);
RightBoxSizer->AddSpacer(10);
Button = new wxButton(this, ID_SWAP_LAYER_BUTTON_SELECT, _("Select..."));
Button->SetForegroundColour(wxColour(0,100,100));
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton(this,ID_SWAP_LAYER_DESELECT, _("Deselect")); Button = new wxButton(this, ID_SWAP_LAYER_DESELECT, _("Deselect"));
Button->SetForegroundColour(wxColour(0,100,0)); Button->SetForegroundColour(wxColour(0,100,0));
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton(this,ID_SWAP_LAYER_BUTTON_SELECT, _("Select")); wxBoxSizer* BottomBoxSizer = new wxBoxSizer(wxHORIZONTAL);
Button->SetForegroundColour(wxColour(0,100,100)); FrameBoxSizer->Add(BottomBoxSizer, 0, wxGROW|wxALIGN_RIGHT|wxALL, 5);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
// The following stretch spacer ensures that the "OK" and "Cancel" buttons
// will be positioned at the lower right corner of the dialog box.
BottomBoxSizer->AddStretchSpacer();
Button = new wxButton(this, wxID_OK, _("OK"));
Button->SetForegroundColour(*wxRED);
BottomBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
if (GetSizer()) Button = new wxButton(this, wxID_CANCEL, _("Cancel"));
Button->SetForegroundColour(*wxBLUE);
BottomBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints(this);
} }
// Now specify the correct caption for each radiobutton.
// (Regrettably though there are still problems with the Windows
// version; captions for each radiobutton can still be truncated.) :-(
for( ii = 0; ii < nb_items; ii++ )
{
g_Layer_Name_Pair[ii] = _("Gerber layer ");
g_Layer_Name_Pair[ii] << RadioButtonTable[ii] + 1 << wxT(" -> ")
<< ReturnPcbLayerName(LayerLookUpTable[RadioButtonTable[ii]]);
m_LayerList->SetString( ii, g_Layer_Name_Pair[ii] );
}
} }
...@@ -152,82 +196,87 @@ void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event) ...@@ -152,82 +196,87 @@ void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event)
/***************************************************************/ /***************************************************************/
{ {
int ii, jj; int ii, jj;
int gerber_layer_number; // int gerber_layer_number;
wxString msg; wxString msg;
ii = m_LayerList->GetSelection(); ii = m_LayerList->GetSelection();
if ( ii < 0 ) return; if( ii < 0 )
/* Search the gerber layer number correspondint to the selection */ return;
for ( jj = 0, gerber_layer_number = 0; gerber_layer_number < 32; gerber_layer_number++ )
{
if ( g_GERBER_Descr_List[gerber_layer_number] == NULL) continue;
if (jj == ii ) break;
jj++;
}
switch ( event.GetId()) switch ( event.GetId() )
{ {
case ID_SWAP_LAYER_DESELECT: case ID_SWAP_LAYER_DESELECT:
if ( LayerLookUpTable[gerber_layer_number] != -1 ) if( LayerLookUpTable[RadioButtonTable[ii]] != NB_LAYERS )
{ {
LayerLookUpTable[gerber_layer_number] = -1; LayerLookUpTable[RadioButtonTable[ii]] = NB_LAYERS;
msg = _("Gerber layer "); msg = _("Gerber layer ");
msg << gerber_layer_number+1 << wxT(" -> ") << _("Do not export"); msg << RadioButtonTable[ii] + 1
m_LayerList->SetString(ii, msg ); << wxT(" -> ") << _("Do not export");
} m_LayerList->SetString( ii, msg );
break; }
break;
case ID_SWAP_LAYER_BUTTON_SELECT:
case ID_SWAP_LAYER_SELECT: case ID_SWAP_LAYER_BUTTON_SELECT:
jj = m_Parent->SelectLayer(ii, -1, -1); case ID_SWAP_LAYER_SELECT:
if ( (jj < 0) || (jj >= 29) ) return; jj = LayerLookUpTable[RadioButtonTable[ii]];
if( (jj < 0) || (jj > NB_LAYERS) )
if ( ii != jj ) jj = 0; // (Defaults to "Copper" layer.)
{ jj = m_Parent->SelectLayer(jj, -1, -1, true);
LayerLookUpTable[gerber_layer_number] = jj; if( (jj < 0) || (jj > NB_LAYERS) )
msg = _("Gerber layer "); return;
msg << gerber_layer_number+1 << wxT(" -> ") << ReturnPcbLayerName(jj);
m_LayerList->SetString(ii, msg ); if( jj != LayerLookUpTable[RadioButtonTable[ii]] )
} {
break; LayerLookUpTable[RadioButtonTable[ii]] = jj;
msg = _("Gerber layer ");
msg << RadioButtonTable[ii] + 1 << wxT(" -> ");
if( jj == NB_LAYERS )
msg << _("Do not export");
else
msg << ReturnPcbLayerName(jj);
m_LayerList->SetString( ii, msg );
}
break;
} }
} }
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Cancel(wxCommandEvent& event) void WinEDA_SwapLayerFrame::OnCancelClick(wxCommandEvent& event)
/*********************************************************/ /*********************************************************/
{ {
EndModal(-1); EndModal( -1 );
} }
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Execute(wxCommandEvent& event) void WinEDA_SwapLayerFrame::OnOkClick(wxCommandEvent& event)
/*********************************************************/ /*********************************************************/
{ {
int ii; int ii;
bool AsCmpLayer = false; bool AsCmpLayer = false;
/* Compute the number of copper layers /* Compute the number of copper layers
this is the max layer number + 1 (if some internal layers exists) * this is the max layer number + 1 (if some internal layers exist)
*/ */
g_DesignSettings.m_CopperLayerCount = 1; g_DesignSettings.m_CopperLayerCount = 1;
for ( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < 32; ii++ )
{ {
if ( LayerLookUpTable[ii] == CMP_N ) AsCmpLayer = true; if( LayerLookUpTable[ii] == CMP_N )
AsCmpLayer = true;
else else
{ {
if ( LayerLookUpTable[ii] >= CMP_N ) continue; // not a copper layer if( LayerLookUpTable[ii] >= CMP_N )
if ( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount ) continue; // not a copper layer
if( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount )
g_DesignSettings.m_CopperLayerCount++; g_DesignSettings.m_CopperLayerCount++;
} }
} }
if ( AsCmpLayer ) g_DesignSettings.m_CopperLayerCount++;
if ( g_DesignSettings.m_CopperLayerCount > CMP_N+1 ) // should not occur.
g_DesignSettings.m_CopperLayerCount = CMP_N+1;
EndModal(1);
}
if( AsCmpLayer )
g_DesignSettings.m_CopperLayerCount++;
if( g_DesignSettings.m_CopperLayerCount > CMP_N + 1 ) // should not occur.
g_DesignSettings.m_CopperLayerCount = CMP_N + 1;
EndModal( 1 );
}
...@@ -9,11 +9,13 @@ ...@@ -9,11 +9,13 @@
#include "protos.h" #include "protos.h"
#define BUTT_SIZE_X 20
#define BUTT_SIZE_Y 16
/* Variables locales */ /* Variables locales */
int CurrentColor; const int BUTT_SIZE_X = 20;
const int BUTT_SIZE_Y = 16;
const int COLOR_COUNT = 37; // 37 = 32 (layers) + 2 (others) + 3 (headings)
// Is there a better way to determine how many elements CurrentColor requires?
int CurrentColor[COLOR_COUNT]; // Holds color for each layer while dialog box open
/* Fonctions locales: */ /* Fonctions locales: */
...@@ -23,7 +25,6 @@ int CurrentColor; ...@@ -23,7 +25,6 @@ int CurrentColor;
enum col_sel_id { enum col_sel_id {
ID_COLOR_RESET_SHOW_LAYER_ON = 1800, ID_COLOR_RESET_SHOW_LAYER_ON = 1800,
ID_COLOR_RESET_SHOW_LAYER_OFF, ID_COLOR_RESET_SHOW_LAYER_OFF,
ID_COLOR_EXIT,
ID_COLOR_CHECKBOX_ONOFF, ID_COLOR_CHECKBOX_ONOFF,
ID_COLOR_SETUP ID_COLOR_SETUP
}; };
...@@ -35,12 +36,12 @@ enum col_sel_id { ...@@ -35,12 +36,12 @@ enum col_sel_id {
struct ColorButton struct ColorButton
{ {
wxString m_Name; wxString m_Name;
int * m_Color; // Pointeur sur la variable couleur int * m_Color; // Pointeur sur la variable couleur
bool m_NoDisplayIsColor; // TRUE si bit ITEM_NON_VISIBLE de la variable Color bool m_NoDisplayIsColor; // TRUE si bit ITEM_NON_VISIBLE de la variable Color
bool * m_NoDisplay; // Pointeur sur la variable Display on/off si ce n'est pas la var bool * m_NoDisplay; // Pointeur sur la variable Display on/off si ce
// Color // n'est pas la var Color
int m_Id; int m_Id;
wxBitmapButton * m_Button; wxBitmapButton * m_Button; // Button to display/change color assigned to this layer
int m_State; int m_State;
wxCheckBox * m_CheckBox; // Option Display ON/OFF wxCheckBox * m_CheckBox; // Option Display ON/OFF
}; };
...@@ -65,8 +66,10 @@ public: ...@@ -65,8 +66,10 @@ public:
private: private:
void SetColor(wxCommandEvent& event); void SetColor(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event); void OnOkClick(wxCommandEvent& event);
void SetDisplayOnOff(wxCommandEvent& event); void OnCancelClick(wxCommandEvent& event);
void OnApplyClick(wxCommandEvent& event);
void UpdateLayerSettings();
void ResetDisplayLayersCu(wxCommandEvent& event); void ResetDisplayLayersCu(wxCommandEvent& event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
...@@ -75,8 +78,9 @@ private: ...@@ -75,8 +78,9 @@ private:
BEGIN_EVENT_TABLE(WinEDA_SetColorsFrame, wxDialog) BEGIN_EVENT_TABLE(WinEDA_SetColorsFrame, wxDialog)
EVT_BUTTON(ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu) EVT_BUTTON(ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu)
EVT_BUTTON(ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu) EVT_BUTTON(ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu)
EVT_BUTTON(ID_COLOR_EXIT, WinEDA_SetColorsFrame::OnQuit) EVT_BUTTON(wxID_OK, WinEDA_SetColorsFrame::OnOkClick)
EVT_CHECKBOX(ID_COLOR_CHECKBOX_ONOFF, WinEDA_SetColorsFrame::SetDisplayOnOff) EVT_BUTTON(wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick)
EVT_BUTTON(wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick)
EVT_BUTTON(ID_COLOR_SETUP, WinEDA_SetColorsFrame::SetColor) EVT_BUTTON(ID_COLOR_SETUP, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+1, WinEDA_SetColorsFrame::SetColor) EVT_BUTTON(ID_COLOR_SETUP+1, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+2, WinEDA_SetColorsFrame::SetColor) EVT_BUTTON(ID_COLOR_SETUP+2, WinEDA_SetColorsFrame::SetColor)
...@@ -114,18 +118,18 @@ BEGIN_EVENT_TABLE(WinEDA_SetColorsFrame, wxDialog) ...@@ -114,18 +118,18 @@ BEGIN_EVENT_TABLE(WinEDA_SetColorsFrame, wxDialog)
EVT_BUTTON(ID_COLOR_SETUP+34, WinEDA_SetColorsFrame::SetColor) EVT_BUTTON(ID_COLOR_SETUP+34, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+35, WinEDA_SetColorsFrame::SetColor) EVT_BUTTON(ID_COLOR_SETUP+35, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+36, WinEDA_SetColorsFrame::SetColor) EVT_BUTTON(ID_COLOR_SETUP+36, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+37, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+37, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+38, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+38, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+39, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+39, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+40, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+40, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+41, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+41, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+42, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+42, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+43, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+43, WinEDA_SetColorsFrame::SetColor)
EVT_BUTTON(ID_COLOR_SETUP+44, WinEDA_SetColorsFrame::SetColor) // EVT_BUTTON(ID_COLOR_SETUP+44, WinEDA_SetColorsFrame::SetColor)
END_EVENT_TABLE() END_EVENT_TABLE()
/**************************************************************/ /**************************************************************/
/* void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, */ /* void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, */
/* const wxPoint & pos) */ /* const wxPoint & pos) */
/**************************************************************/ /**************************************************************/
...@@ -142,9 +146,10 @@ void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, ...@@ -142,9 +146,10 @@ void DisplayColorSetupFrame(WinEDA_DrawFrame * parent,
/**********************************************************************/ /**********************************************************************/
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent,
const wxPoint& framepos): const wxPoint& framepos):
wxDialog(parent, -1, _("Gerbview Layer Colors:"), framepos, wxDialog(parent, -1, _("GerbView Layer Colors:"), framepos,
wxSize(390, 380), wxSize(390, 380),
wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT ) wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|
MAYBE_RESIZE_BORDER )
/**********************************************************************/ /**********************************************************************/
{ {
wxBitmapButton * ButtonB; wxBitmapButton * ButtonB;
...@@ -152,7 +157,7 @@ int ii, butt_ID, buttcolor; ...@@ -152,7 +157,7 @@ int ii, butt_ID, buttcolor;
wxString msg; wxString msg;
wxStaticText * text; wxStaticText * text;
wxBoxSizer * CurrBoxSizer = NULL; wxBoxSizer * CurrBoxSizer = NULL;
m_Parent = parent; m_Parent = parent;
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
...@@ -166,7 +171,7 @@ wxBoxSizer * CurrBoxSizer = NULL; ...@@ -166,7 +171,7 @@ wxBoxSizer * CurrBoxSizer = NULL;
CurrBoxSizer = new wxBoxSizer(wxVERTICAL); CurrBoxSizer = new wxBoxSizer(wxVERTICAL);
MainBoxSizer->Add(CurrBoxSizer, 0, wxGROW|wxALL, 5); MainBoxSizer->Add(CurrBoxSizer, 0, wxGROW|wxALL, 5);
msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData()); msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData());
text = new wxStaticText(this,-1, msg ); text = new wxStaticText( this, -1, msg );
CurrBoxSizer->Add(text, 0, wxGROW|wxALL, 5); CurrBoxSizer->Add(text, 0, wxGROW|wxALL, 5);
continue; continue;
} }
...@@ -178,7 +183,7 @@ wxBoxSizer * CurrBoxSizer = NULL; ...@@ -178,7 +183,7 @@ wxBoxSizer * CurrBoxSizer = NULL;
wxBoxSizer * LineBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer * LineBoxSizer = new wxBoxSizer(wxHORIZONTAL);
wxCheckBox * Checkb; wxCheckBox * Checkb;
CurrBoxSizer->Add(LineBoxSizer, 0, wxGROW|wxALL, 0); CurrBoxSizer->Add(LineBoxSizer, 0, wxGROW|wxALL, 0);
laytool_list[ii]->m_CheckBox = Checkb = new wxCheckBox(this, laytool_list[ii]->m_CheckBox = Checkb = new wxCheckBox( this,
ID_COLOR_CHECKBOX_ONOFF, wxEmptyString ); ID_COLOR_CHECKBOX_ONOFF, wxEmptyString );
LineBoxSizer->Add(Checkb, 0, wxGROW|wxALL, 1); LineBoxSizer->Add(Checkb, 0, wxGROW|wxALL, 1);
...@@ -189,16 +194,16 @@ wxBoxSizer * CurrBoxSizer = NULL; ...@@ -189,16 +194,16 @@ wxBoxSizer * CurrBoxSizer = NULL;
else else
laytool_list[ii]->m_CheckBox->SetValue(TRUE); laytool_list[ii]->m_CheckBox->SetValue(TRUE);
} }
else if ( laytool_list[ii]->m_NoDisplay ) else if ( laytool_list[ii]->m_NoDisplay )
laytool_list[ii]->m_CheckBox->SetValue(*laytool_list[ii]->m_NoDisplay); laytool_list[ii]->m_CheckBox->SetValue(*laytool_list[ii]->m_NoDisplay);
if( laytool_list[ii]->m_Color ) if( laytool_list[ii]->m_Color )
{ {
wxMemoryDC iconDC; int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; wxMemoryDC iconDC;
wxBitmap ButtBitmap(w,h); wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
buttcolor = *laytool_list[ii]->m_Color & MASKCOLOR; buttcolor = *laytool_list[ii]->m_Color & MASKCOLOR;
CurrentColor[ii] = buttcolor;
wxBrush Brush; wxBrush Brush;
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
iconDC.SetPen(*wxBLACK_PEN); iconDC.SetPen(*wxBLACK_PEN);
...@@ -210,47 +215,75 @@ wxBoxSizer * CurrBoxSizer = NULL; ...@@ -210,47 +215,75 @@ wxBoxSizer * CurrBoxSizer = NULL;
Brush.SetStyle(wxSOLID); Brush.SetStyle(wxSOLID);
iconDC.SetBrush(Brush); iconDC.SetBrush(Brush);
iconDC.DrawRectangle(0,0, w, h); iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y);
ButtonB = new wxBitmapButton(this, butt_ID, ButtonB = new wxBitmapButton( this, butt_ID,
ButtBitmap, wxDefaultPosition, ButtBitmap, wxDefaultPosition,
wxSize(w,h) ); wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) );
laytool_list[ii]->m_Button = ButtonB; laytool_list[ii]->m_Button = ButtonB;
LineBoxSizer->Add(ButtonB, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); LineBoxSizer->Add(ButtonB, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
} }
msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData()); msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData());
text = new wxStaticText(this,-1, msg); text = new wxStaticText( this, -1, msg );
LineBoxSizer->Add(text, 0, wxGROW|wxALL, 1); LineBoxSizer->Add(text, 0, wxGROW|wxALL, 1);
} }
CurrBoxSizer->AddSpacer(20); CurrBoxSizer->AddSpacer(20);
wxButton * Button = new wxButton(this,ID_COLOR_RESET_SHOW_LAYER_ON, wxButton * Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON,
_("Show All")); _("Show All") );
Button->SetForegroundColour(*wxBLUE); Button->SetForegroundColour(*wxBLUE);
CurrBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5);
Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF,
_("Show None") );
Button->SetForegroundColour(*wxRED);
CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5);
// Following stretch spacer ensures "OK", "Cancel", and "Apply"
// buttons will be located at lower right corner of dialog box
CurrBoxSizer->AddStretchSpacer();
Button = new wxButton(this,ID_COLOR_RESET_SHOW_LAYER_OFF, Button = new wxButton( this, wxID_OK, _("OK") );
_("Show None"));
Button->SetForegroundColour(*wxRED); Button->SetForegroundColour(*wxRED);
CurrBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5);
Button = new wxButton(this,ID_COLOR_EXIT, Button = new wxButton( this, wxID_CANCEL, _("Cancel") );
_("Exit")); Button->SetForegroundColour(*wxBLUE);
Button->SetForegroundColour(*wxBLACK); CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5);
CurrBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton( this, wxID_APPLY, _("Apply") );
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5);
GetSizer()->Fit(this); GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints(this);
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_SetColorsFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void WinEDA_SetColorsFrame::OnOkClick(wxCommandEvent& WXUNUSED(event))
/*******************************************************************/
{
UpdateLayerSettings();
m_Parent->GetScreen()->SetRefreshReq();
EndModal( 1 );
}
/*******************************************************************/
void WinEDA_SetColorsFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/*******************************************************************/
{
EndModal( -1 );
}
/*******************************************************************/
void WinEDA_SetColorsFrame::OnApplyClick(wxCommandEvent& WXUNUSED(event))
/*******************************************************************/ /*******************************************************************/
{ {
// true is to force the frame to close UpdateLayerSettings();
Close(true); m_Parent->ReDrawPanel();
} }
...@@ -261,10 +294,9 @@ void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event) ...@@ -261,10 +294,9 @@ void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event)
int ii; int ii;
int id = event.GetId(); int id = event.GetId();
int color; int color;
int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
color = DisplayColorFrame( this, color = DisplayColorFrame( this,
*laytool_list[id - ID_COLOR_SETUP]->m_Color ); CurrentColor[id - ID_COLOR_SETUP] );
if ( color < 0 ) if ( color < 0 )
return; return;
...@@ -276,17 +308,17 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; ...@@ -276,17 +308,17 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
if( laytool_list[ii]->m_Color == NULL ) if( laytool_list[ii]->m_Color == NULL )
continue; continue;
if( *laytool_list[ii]->m_Color == color ) if( CurrentColor[ii] == color )
break; break;
*laytool_list[ii]->m_Color = color; CurrentColor[ii] = color;
wxMemoryDC iconDC; wxMemoryDC iconDC;
wxBitmapButton * Button = laytool_list[ii]->m_Button; wxBitmapButton * Button = laytool_list[ii]->m_Button;
wxBitmap ButtBitmap = Button->GetBitmapLabel(); wxBitmap ButtBitmap = Button->GetBitmapLabel();
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
int buttcolor = *laytool_list[ii]->m_Color; int buttcolor = CurrentColor[ii];
wxBrush Brush; wxBrush Brush;
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
iconDC.SetPen(*wxBLACK_PEN); iconDC.SetPen(*wxBLACK_PEN);
...@@ -298,23 +330,19 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; ...@@ -298,23 +330,19 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
Brush.SetStyle(wxSOLID); Brush.SetStyle(wxSOLID);
iconDC.SetBrush(Brush); iconDC.SetBrush(Brush);
iconDC.DrawRectangle(0,0, w, h); iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y);
Button->SetBitmapLabel(ButtBitmap); Button->SetBitmapLabel(ButtBitmap);
SetDisplayOnOff(event);
m_Parent->GetScreen()->SetRefreshReq();
} }
Refresh(FALSE); Refresh( FALSE );
} }
/******************************************************************/ /******************************************************************/
void WinEDA_SetColorsFrame::SetDisplayOnOff(wxCommandEvent& event) void WinEDA_SetColorsFrame::UpdateLayerSettings()
/******************************************************************/ /******************************************************************/
{ {
for ( int ii = 0; laytool_list[ii] != NULL; ii++ ) for( int ii = 0; laytool_list[ii] != NULL; ii++ )
{ {
if ( laytool_list[ii]->m_CheckBox == NULL )
continue;
if ( ! laytool_list[ii]->m_NoDisplayIsColor && if ( ! laytool_list[ii]->m_NoDisplayIsColor &&
(laytool_list[ii]->m_NoDisplay == NULL) ) (laytool_list[ii]->m_NoDisplay == NULL) )
continue; continue;
...@@ -322,16 +350,21 @@ void WinEDA_SetColorsFrame::SetDisplayOnOff(wxCommandEvent& event) ...@@ -322,16 +350,21 @@ void WinEDA_SetColorsFrame::SetDisplayOnOff(wxCommandEvent& event)
if ( laytool_list[ii]->m_NoDisplayIsColor ) if ( laytool_list[ii]->m_NoDisplayIsColor )
{ {
if ( laytool_list[ii]->m_CheckBox->GetValue() ) if ( laytool_list[ii]->m_CheckBox->GetValue() )
*laytool_list[ii]->m_Color &= ~ITEM_NOT_SHOW; *laytool_list[ii]->m_Color = CurrentColor[ii] & ~ITEM_NOT_SHOW;
else else
*laytool_list[ii]->m_Color |= ITEM_NOT_SHOW; *laytool_list[ii]->m_Color = CurrentColor[ii] | ITEM_NOT_SHOW;
} }
else else
{ {
*laytool_list[ii]->m_Color = CurrentColor[ii];
*laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue(); *laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue();
// A hack, we have both g_DrawGrid and m_Parent->m_Draw_Grid.
// A better way preferred, please.
if( laytool_list[ii]->m_NoDisplay == &g_ShowGrid )
m_Parent->m_Draw_Grid = g_ShowGrid;
} }
} }
m_Parent->GetScreen()->SetRefreshReq();
} }
...@@ -347,7 +380,4 @@ bool NewState = (event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON) ? TRUE : FALSE; ...@@ -347,7 +380,4 @@ bool NewState = (event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON) ? TRUE : FALSE;
continue; continue;
laytool_list[ii]->m_CheckBox->SetValue(NewState); laytool_list[ii]->m_CheckBox->SetValue(NewState);
} }
SetDisplayOnOff(event);
} }
...@@ -2,236 +2,236 @@ ...@@ -2,236 +2,236 @@
static ColorButton Msg_Layers_Cu= static ColorButton Msg_Layers_Cu=
{ {
_("Layers 1-16") /* Title */ _("Layers 1-16") /* Title */
};
static ColorButton Msg_Layers_Tech=
{
_("Layers 17-32") /* Title */
}; };
static ColorButton Layer_1_Butt= static ColorButton Layer_1_Butt=
{ {
_("Layer 1"), /* Title */ _("Layer 1"), /* Title */
ADR(0), /* adr du parametre optionnel */ ADR(0), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_2_Butt= static ColorButton Layer_2_Butt=
{ {
_("Layer 2"), /* Title */ _("Layer 2"), /* Title */
ADR(1), /* adr du parametre optionnel */ ADR(1), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_3_Butt= static ColorButton Layer_3_Butt=
{ {
_("Layer 3"), /* Title */ _("Layer 3"), /* Title */
ADR(2), /* adr du parametre optionnel */ ADR(2), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_4_Butt= static ColorButton Layer_4_Butt=
{ {
_("Layer 4"), /* Title */ _("Layer 4"), /* Title */
ADR(3), /* adr du parametre optionnel */ ADR(3), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_5_Butt= static ColorButton Layer_5_Butt=
{ {
_("Layer 5"), /* Title */ _("Layer 5"), /* Title */
ADR(4), /* adr du parametre optionnel */ ADR(4), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_6_Butt= static ColorButton Layer_6_Butt=
{ {
_("Layer 6"), /* Title */ _("Layer 6"), /* Title */
ADR(5), /* adr du parametre optionnel */ ADR(5), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_7_Butt= static ColorButton Layer_7_Butt=
{ {
_("Layer 7"), /* Title */ _("Layer 7"), /* Title */
ADR(6), /* adr du parametre optionnel */ ADR(6), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_8_Butt= static ColorButton Layer_8_Butt=
{ {
_("Layer 8"), /* Title */ _("Layer 8"), /* Title */
ADR(7), /* adr du parametre optionnel */ ADR(7), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_9_Butt= static ColorButton Layer_9_Butt=
{ {
_("Layer 9"), /* Title */ _("Layer 9"), /* Title */
ADR(8), /* adr du parametre optionnel */ ADR(8), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_10_Butt= static ColorButton Layer_10_Butt=
{ {
_("Layer 10"), /* Title */ _("Layer 10"), /* Title */
ADR(9), /* adr du parametre optionnel */ ADR(9), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_11_Butt= static ColorButton Layer_11_Butt=
{ {
_("Layer 11"), /* Title */ _("Layer 11"), /* Title */
ADR(10), /* adr du parametre optionnel */ ADR(10), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_12_Butt= static ColorButton Layer_12_Butt=
{ {
_("Layer 12"), /* Title */ _("Layer 12"), /* Title */
ADR(11), /* adr du parametre optionnel */ ADR(11), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_13_Butt= static ColorButton Layer_13_Butt=
{ {
_("Layer 13"), /* Title */ _("Layer 13"), /* Title */
ADR(12), /* adr du parametre optionnel */ ADR(12), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_14_Butt= static ColorButton Layer_14_Butt=
{ {
_("Layer 14"), /* Title */ _("Layer 14"), /* Title */
ADR(13), /* adr du parametre optionnel */ ADR(13), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_15_Butt= static ColorButton Layer_15_Butt=
{ {
_("Layer 15"), /* Title */ _("Layer 15"), /* Title */
ADR(14), /* adr du parametre optionnel */ ADR(14), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_16_Butt= static ColorButton Layer_16_Butt=
{ {
_("Layer 16"), /* Title */ _("Layer 16"), /* Title */
ADR(15), /* adr du parametre optionnel */ ADR(15), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
};
static ColorButton Msg_Layers_Tech=
{
_("Layers 17-32") /* Title */
}; };
static ColorButton Layer_17_Butt= static ColorButton Layer_17_Butt=
{ {
_("Layer 17"), /* Title */ _("Layer 17"), /* Title */
ADR(16), /* adr du parametre optionnel */ ADR(16), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_18_Butt= static ColorButton Layer_18_Butt=
{ {
_("Layer 18"), /* Title */ _("Layer 18"), /* Title */
ADR(17), /* adr du parametre optionnel */ ADR(17), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_19_Butt= static ColorButton Layer_19_Butt=
{ {
_("Layer 19"), /* Title */ _("Layer 19"), /* Title */
ADR(18), /* adr du parametre optionnel */ ADR(18), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_20_Butt= static ColorButton Layer_20_Butt=
{ {
_("Layer 20"), /* Title */ _("Layer 20"), /* Title */
ADR(19), /* adr du parametre optionnel */ ADR(19), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_21_Butt= static ColorButton Layer_21_Butt=
{ {
_("Layer 21"), /* Title */ _("Layer 21"), /* Title */
ADR(20), /* adr du parametre optionnel */ ADR(20), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_22_Butt= static ColorButton Layer_22_Butt=
{ {
_("Layer 22"), /* Title */ _("Layer 22"), /* Title */
ADR(21), /* adr du parametre optionnel */ ADR(21), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_23_Butt= static ColorButton Layer_23_Butt=
{ {
_("Layer 23"), /* Title */ _("Layer 23"), /* Title */
ADR(22), /* adr du parametre optionnel */ ADR(22), /* adr du parametre optionnel */
TRUE /* adr du parametre display on/off */ TRUE /* adr du parametre display on/off */
}; };
static ColorButton Layer_24_Butt= static ColorButton Layer_24_Butt=
{ {
_("Layer 24"), /* Title */ _("Layer 24"), /* Title */
ADR(23), /* adr du parametre optionnel */ ADR(23), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_25_Butt= static ColorButton Layer_25_Butt=
{ {
_("Layer 25"), /* Title */ _("Layer 25"), /* Title */
ADR(24), /* adr du parametre optionnel */ ADR(24), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_26_Butt= static ColorButton Layer_26_Butt=
{ {
_("Layer 26"), /* Title */ _("Layer 26"), /* Title */
ADR(25), /* adr du parametre optionnel */ ADR(25), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_27_Butt= static ColorButton Layer_27_Butt=
{ {
_("Layer 27"), /* Title */ _("Layer 27"), /* Title */
ADR(26), /* adr du parametre optionnel */ ADR(26), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_28_Butt= static ColorButton Layer_28_Butt=
{ {
_("Layer 28"), /* Title */ _("Layer 28"), /* Title */
ADR(27), /* adr du parametre optionnel */ ADR(27), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_29_Butt= static ColorButton Layer_29_Butt=
{ {
_("Layer 29"), /* Title */ _("Layer 29"), /* Title */
ADR(28), /* adr du parametre optionnel */ ADR(28), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_30_Butt= static ColorButton Layer_30_Butt=
{ {
_("Layer 30"), /* Title */ _("Layer 30"), /* Title */
ADR(29), /* adr du parametre optionnel */ ADR(29), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_31_Butt= static ColorButton Layer_31_Butt=
{ {
_("Layer 31"), /* Title */ _("Layer 31"), /* Title */
ADR(30), /* adr du parametre optionnel */ ADR(30), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
static ColorButton Layer_32_Butt= static ColorButton Layer_32_Butt=
{ {
_("Layer 32"), /* Title */ _("Layer 32"), /* Title */
ADR(31), /* adr du parametre optionnel */ ADR(31), /* adr du parametre optionnel */
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */
}; };
...@@ -243,18 +243,18 @@ static ColorButton Msg_Others_Items= ...@@ -243,18 +243,18 @@ static ColorButton Msg_Others_Items=
static ColorButton Grid_Butt= static ColorButton Grid_Butt=
{ {
_("Grid"), /* Title */ _("Grid"), /* Title */
&g_DesignSettings.m_PcbGridColor, /* adr du parametre optionnel */ &g_GridColor, /* adr du parametre optionnel */
FALSE, FALSE,
&g_ShowGrid /* parametre display on/off = bool */ &g_ShowGrid /* parametre display on/off = bool */
}; };
static ColorButton Show_DCodes_Butt= static ColorButton Show_DCodes_Butt=
{ {
_("D codes id."), /* Title */ _("D codes id."), /* Title */
&g_DCodesColor, /* adr du parametre optionnel */ &g_DCodesColor, /* adr du parametre optionnel */
FALSE, FALSE,
&DisplayOpt.DisplayPadNum /* parametre display on/off = bool*/ &DisplayOpt.DisplayPadNum /* parametre display on/off = bool */
}; };
static ColorButton * laytool_list[] = { static ColorButton * laytool_list[] = {
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
#define ECO2_N 27 #define ECO2_N 27
#define EDGE_N 28 #define EDGE_N 28
#define LAST_NO_COPPER_LAYER 28 #define LAST_NO_COPPER_LAYER 28
#define NB_LAYERS (EDGE_N + 1) #define NB_LAYERS (LAST_NO_COPPER_LAYER + 1)
#define LAYER_COUNT 32 #define LAYER_COUNT 32
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#endif #endif
// Option d'affichage des fenetres de dialogue // Option d'affichage des fenetres de dialogue
//#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP // #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
#define EDA_DRAW_PANEL wxScrolledWindow #define EDA_DRAW_PANEL wxScrolledWindow
...@@ -274,8 +274,8 @@ public: ...@@ -274,8 +274,8 @@ public:
void OnPanning( int direction ); void OnPanning( int direction );
void OnGrid( int grid_type ); void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse ); void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord );/* corrige la valeur de la coordonnee coord void PutOnGrid( wxPoint* coord ); /* corrige la valeur de la coordonnee coord
* pour etre sur le point de grille le plus proche */ * pour etre sur le point de grille le plus proche */
void Zoom_Automatique( bool move_mouse_cursor ); void Zoom_Automatique( bool move_mouse_cursor );
/* Affiche le schema au meilleur zoom au meilleur centrage pour le dessin /* Affiche le schema au meilleur zoom au meilleur centrage pour le dessin
...@@ -303,7 +303,7 @@ public: ...@@ -303,7 +303,7 @@ public:
virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event ); virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars(); void AdjustScrollBars();
void Affiche_Status_Box();/* Affichage des coord curseur, zoom .. */ void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
void DisplayUnitsMsg(); void DisplayUnitsMsg();
/* Gestion generale des operations sur block */ /* Gestion generale des operations sur block */
...@@ -494,7 +494,7 @@ public: ...@@ -494,7 +494,7 @@ public:
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// Gestion des chevelus (ratsnest) // Gestion des chevelus (ratsnest)
void Compile_Ratsnest( wxDC* DC, bool affiche );/* Recalcul complet du chevelu */ void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
void ReCompile_Ratsnest_After_Changes( wxDC* DC ); void ReCompile_Ratsnest_After_Changes( wxDC* DC );
int Test_1_Net_Ratsnest( wxDC* DC, int net_code ); int Test_1_Net_Ratsnest( wxDC* DC, int net_code );
char* build_ratsnest_module( wxDC* DC, MODULE* Module ); char* build_ratsnest_module( wxDC* DC, MODULE* Module );
...@@ -502,8 +502,8 @@ public: ...@@ -502,8 +502,8 @@ public:
void Build_Board_Ratsnest( wxDC* DC ); void Build_Board_Ratsnest( wxDC* DC );
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC ); void trace_ratsnest_pad( wxDC* DC );
void recalcule_pad_net_code();/* Routine de void recalcule_pad_net_code(); /* Routine de
* calcul et de mise a jour des net_codes des PADS */ * calcul et de mise a jour des net_codes des PADS */
void build_liste_pads(); void build_liste_pads();
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init ); int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
...@@ -539,7 +539,9 @@ public: ...@@ -539,7 +539,9 @@ public:
void DelLimitesZone( wxDC* DC, bool Redraw ); void DelLimitesZone( wxDC* DC, bool Redraw );
// Gestion des layers: // Gestion des layers:
int SelectLayer( int default_layer, int min_layer, int max_layer ); // (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
int SelectLayer( int default_layer, int min_layer, int max_layer,
bool null_layer = false );
void SelectLayerPair(); void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer ); virtual void SwitchLayer( wxDC* DC, int layer );
...@@ -1620,8 +1622,8 @@ public: ...@@ -1620,8 +1622,8 @@ public:
private: private:
void OnClose( wxCloseEvent& event ); void OnClose( wxCloseEvent& event );
void Cancel( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void Ok( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void ClickOnList( wxCommandEvent& event ); void ClickOnList( wxCommandEvent& event );
void D_ClickOnList( wxCommandEvent& event ); void D_ClickOnList( wxCommandEvent& event );
void OnKeyEvent( wxKeyEvent& event ); void OnKeyEvent( wxKeyEvent& event );
......
...@@ -153,7 +153,7 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent, ...@@ -153,7 +153,7 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
m_button2 = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); m_button2 = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
m_button2->SetForegroundColour( *wxBLUE ); m_button2->SetForegroundColour( *wxBLUE );
fgSizer2->Add( m_button2, 0, wxALL, 5 ); fgSizer2->Add( m_button2, 0, wxALL, 5 );
m_button1 = new wxButton( this, wxID_OK, _( "Ok" ), wxDefaultPosition, wxDefaultSize, 0 ); m_button1 = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 );
m_button1->SetForegroundColour( *wxRED ); m_button1->SetForegroundColour( *wxRED );
m_button1->SetDefault(); m_button1->SetDefault();
fgSizer2->Add( m_button1, 0, wxALL, 5 ); fgSizer2->Add( m_button1, 0, wxALL, 5 );
...@@ -169,7 +169,7 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent, ...@@ -169,7 +169,7 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
void WinEDA_ExecBlockCmdFrame::Cancel( wxCommandEvent& WXUNUSED (event) ) void WinEDA_ExecBlockCmdFrame::Cancel( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
EndModal( 1 ); EndModal( -1 );
} }
......
...@@ -343,7 +343,7 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -343,7 +343,7 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN ); Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
ii = m_Layer; ii = m_Layer;
if( ii <= 28 ) if( ii < NB_LAYERS )
Affiche_1_Parametre( frame, 28, _( "Layer" ), ReturnPcbLayerName( ii ), DARKGREEN ); Affiche_1_Parametre( frame, 28, _( "Layer" ), ReturnPcbLayerName( ii ), DARKGREEN );
else else
{ {
......
...@@ -36,9 +36,7 @@ static int status_cotation; /* = 0 : pas de cotation en cours ...@@ -36,9 +36,7 @@ static int status_cotation; /* = 0 : pas de cotation en cours
enum id_Cotation_properties { enum id_Cotation_properties {
ID_ACCEPT_COTATION_PROPERTIES = 1900, ID_TEXTPCB_SELECT_LAYER = 1900
ID_CLOSE_COTATION_PROPERTIES,
ID_TEXTPCB_SELECT_LAYER
}; };
/************************************/ /************************************/
...@@ -69,17 +67,15 @@ public: ...@@ -69,17 +67,15 @@ public:
private: private:
void OnQuit( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void CotationPropertiesAccept( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_CotationPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_CotationPropertiesFrame, wxDialog )
EVT_BUTTON( ID_ACCEPT_COTATION_PROPERTIES, EVT_BUTTON( wxID_OK, WinEDA_CotationPropertiesFrame::OnOkClick )
WinEDA_CotationPropertiesFrame::CotationPropertiesAccept ) EVT_BUTTON( wxID_CANCEL, WinEDA_CotationPropertiesFrame::OnCancelClick )
EVT_BUTTON( ID_CLOSE_COTATION_PROPERTIES,
WinEDA_CotationPropertiesFrame::OnQuit )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -106,13 +102,11 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* ...@@ -106,13 +102,11 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Creation des boutons de commande */ /* Creation des boutons de commande */
Button = new wxButton( this, ID_ACCEPT_COTATION_PROPERTIES, Button = new wxButton( this, wxID_OK, _( "OK" ) );
_( "Ok" ) );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, ID_CLOSE_COTATION_PROPERTIES, Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
_( "Cancel" ) );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
...@@ -142,7 +136,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* ...@@ -142,7 +136,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
LeftBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); LeftBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
int ii; int ii;
for( ii = CMP_N + 1; ii < 29; ii++ ) for( ii = CMP_N + 1; ii < NB_LAYERS; ii++ )
{ {
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) ); m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
} }
...@@ -155,15 +149,15 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* ...@@ -155,15 +149,15 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
/**********************************************************************/ /**********************************************************************/
void WinEDA_CotationPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) void WinEDA_CotationPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
Close( true ); // true is to force the frame to close EndModal( -1 );
} }
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_CotationPropertiesFrame::CotationPropertiesAccept( wxCommandEvent& event ) void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
/***********************************************************************************/ /***********************************************************************************/
{ {
if( m_DC ) // Effacement ancien texte if( m_DC ) // Effacement ancien texte
...@@ -193,7 +187,7 @@ void WinEDA_CotationPropertiesFrame::CotationPropertiesAccept( wxCommandEvent& e ...@@ -193,7 +187,7 @@ void WinEDA_CotationPropertiesFrame::CotationPropertiesAccept( wxCommandEvent& e
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->m_CurrentScreen->SetModify();
Close( TRUE ); EndModal( 1 );
} }
...@@ -208,7 +202,7 @@ static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -208,7 +202,7 @@ static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Cotation->m_Flags & IS_NEW ) if( Cotation->m_Flags & IS_NEW )
{ {
Cotation->Draw( Panel, DC, wxPoint( 0, 0 ), GR_XOR ); Cotation->Draw( Panel, DC, wxPoint( 0, 0 ), GR_XOR );
Cotation ->DeleteStructure(); Cotation->DeleteStructure();
} }
else else
{ {
...@@ -365,7 +359,8 @@ void WinEDA_PcbFrame::Install_Edit_Cotation( COTATION* Cotation, ...@@ -365,7 +359,8 @@ void WinEDA_PcbFrame::Install_Edit_Cotation( COTATION* Cotation,
WinEDA_CotationPropertiesFrame* frame = new WinEDA_CotationPropertiesFrame( this, WinEDA_CotationPropertiesFrame* frame = new WinEDA_CotationPropertiesFrame( this,
Cotation, DC, pos ); Cotation, DC, pos );
frame->ShowModal(); frame->Destroy(); frame->ShowModal();
frame->Destroy();
} }
...@@ -378,7 +373,7 @@ void WinEDA_PcbFrame::Delete_Cotation( COTATION* Cotation, wxDC* DC ) ...@@ -378,7 +373,7 @@ void WinEDA_PcbFrame::Delete_Cotation( COTATION* Cotation, wxDC* DC )
if( DC ) if( DC )
Cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); Cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
Cotation ->DeleteStructure(); Cotation->DeleteStructure();
m_CurrentScreen->SetModify(); m_CurrentScreen->SetModify();
} }
......
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
/**************************************/ /**************************************/
BEGIN_EVENT_TABLE( WinEDA_ModulePropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_ModulePropertiesFrame, wxDialog )
EVT_BUTTON( ID_ACCEPT_MODULE_PROPERTIES, EVT_BUTTON( wxID_OK, WinEDA_ModulePropertiesFrame::OnOkClick )
WinEDA_ModulePropertiesFrame::ModulePropertiesAccept ) EVT_BUTTON( wxID_CANCEL, WinEDA_ModulePropertiesFrame::OnCancelClick )
EVT_BUTTON( ID_CLOSE_MODULE_PROPERTIES, WinEDA_ModulePropertiesFrame::OnQuit )
EVT_BUTTON( ID_MODULE_EDIT_ADD_TEXT, WinEDA_ModulePropertiesFrame::CreateTextModule ) EVT_BUTTON( ID_MODULE_EDIT_ADD_TEXT, WinEDA_ModulePropertiesFrame::CreateTextModule )
EVT_BUTTON( ID_MODULE_EDIT_EDIT_TEXT, WinEDA_ModulePropertiesFrame::EditOrDelTextModule ) EVT_BUTTON( ID_MODULE_EDIT_EDIT_TEXT, WinEDA_ModulePropertiesFrame::EditOrDelTextModule )
EVT_BUTTON( ID_MODULE_EDIT_DELETE_TEXT, WinEDA_ModulePropertiesFrame::EditOrDelTextModule ) EVT_BUTTON( ID_MODULE_EDIT_DELETE_TEXT, WinEDA_ModulePropertiesFrame::EditOrDelTextModule )
...@@ -115,13 +114,11 @@ void WinEDA_ModulePropertiesFrame::CreateControls() ...@@ -115,13 +114,11 @@ void WinEDA_ModulePropertiesFrame::CreateControls()
wxBoxSizer* ButtonsBoxSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* ButtonsBoxSizer = new wxBoxSizer( wxHORIZONTAL );
m_GeneralBoxSizer->Add( ButtonsBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_GeneralBoxSizer->Add( ButtonsBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
Button = new wxButton( this, ID_ACCEPT_MODULE_PROPERTIES, Button = new wxButton( this, wxID_OK, _( "OK" ) );
_( "Ok" ) );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
ButtonsBoxSizer->Add( Button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); ButtonsBoxSizer->Add( Button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
Button = new wxButton( this, ID_CLOSE_MODULE_PROPERTIES, Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
_( "Cancel" ) );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
ButtonsBoxSizer->Add( Button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); ButtonsBoxSizer->Add( Button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
} }
...@@ -486,15 +483,15 @@ void Panel3D_Ctrl::Browse3DLib( wxCommandEvent& event ) ...@@ -486,15 +483,15 @@ void Panel3D_Ctrl::Browse3DLib( wxCommandEvent& event )
/**********************************************************************/ /**********************************************************************/
void WinEDA_ModulePropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) void WinEDA_ModulePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
Close( true ); // true is to force the frame to close EndModal( -1 );
} }
/******************************************************************************/ /******************************************************************************/
void WinEDA_ModulePropertiesFrame::ModulePropertiesAccept( wxCommandEvent& event ) void WinEDA_ModulePropertiesFrame::OnOkClick( wxCommandEvent& event )
/******************************************************************************/ /******************************************************************************/
{ {
bool change_layer = FALSE; bool change_layer = FALSE;
...@@ -590,7 +587,7 @@ void WinEDA_ModulePropertiesFrame::ModulePropertiesAccept( wxCommandEvent& event ...@@ -590,7 +587,7 @@ void WinEDA_ModulePropertiesFrame::ModulePropertiesAccept( wxCommandEvent& event
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
Close( TRUE ); EndModal( 1 );
if( m_DC ) if( m_DC )
m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_OR ); m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_OR );
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
enum id_Module_properties enum id_Module_properties
{ {
ID_ACCEPT_MODULE_PROPERTIES = 1900, ID_GOTO_MODULE_EDITOR =1900,
ID_CLOSE_MODULE_PROPERTIES,
ID_GOTO_MODULE_EDITOR,
ID_MODULE_PROPERTIES_EXCHANGE, ID_MODULE_PROPERTIES_EXCHANGE,
ID_MODULE_EDIT_ADD_TEXT, ID_MODULE_EDIT_ADD_TEXT,
ID_MODULE_EDIT_EDIT_TEXT, ID_MODULE_EDIT_EDIT_TEXT,
...@@ -59,8 +57,8 @@ public: ...@@ -59,8 +57,8 @@ public:
private: private:
void CreateControls(); void CreateControls();
void OnQuit(wxCommandEvent& event); void OnCancelClick(wxCommandEvent& event);
void ModulePropertiesAccept(wxCommandEvent& event); void OnOkClick(wxCommandEvent& event);
void CreateTextModule(wxCommandEvent& event); void CreateTextModule(wxCommandEvent& event);
void EditOrDelTextModule(wxCommandEvent& event); void EditOrDelTextModule(wxCommandEvent& event);
void SelectTextListBox(wxCommandEvent& event); void SelectTextListBox(wxCommandEvent& event);
......
...@@ -284,10 +284,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type ) ...@@ -284,10 +284,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
/**************** Polygon Shapes ***********************/ /**************** Polygon Shapes ***********************/
enum id_mw_cmd { enum id_mw_cmd {
ID_ACCEPT_OPT = 1000, ID_READ_SHAPE_FILE = 1000
ID_CANCEL_OPT,
ID_READ_SHAPE_FILE
}; };
/*************************************************/ /*************************************************/
...@@ -309,8 +306,8 @@ public: ...@@ -309,8 +306,8 @@ public:
~WinEDA_SetParamShapeFrame() { }; ~WinEDA_SetParamShapeFrame() { };
private: private:
void OnCloseWindow( wxCloseEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void ReadDataShapeDescr( wxCommandEvent& event ); void ReadDataShapeDescr( wxCommandEvent& event );
void AcceptOptions( wxCommandEvent& event ); void AcceptOptions( wxCommandEvent& event );
...@@ -318,8 +315,8 @@ private: ...@@ -318,8 +315,8 @@ private:
}; };
/* Construction de la table des evenements pour WinEDA_SetParamShapeFrame */ /* Construction de la table des evenements pour WinEDA_SetParamShapeFrame */
BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog )
EVT_BUTTON( ID_ACCEPT_OPT, WinEDA_SetParamShapeFrame::AcceptOptions ) EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick )
EVT_BUTTON( ID_CANCEL_OPT, WinEDA_SetParamShapeFrame::OnCancel ) EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick )
EVT_BUTTON( ID_READ_SHAPE_FILE, WinEDA_SetParamShapeFrame::ReadDataShapeDescr ) EVT_BUTTON( ID_READ_SHAPE_FILE, WinEDA_SetParamShapeFrame::ReadDataShapeDescr )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -348,21 +345,21 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent, ...@@ -348,21 +345,21 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent,
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* Button = new wxButton( this, ID_ACCEPT_OPT, _( "Ok" ) ); wxButton* Button = new wxButton( this, wxID_OK, _( "OK" ) );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, ID_CANCEL_OPT, _( "Cancel" ) ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, ID_READ_SHAPE_FILE, _( "Read Shape Descr File" ) ); Button = new wxButton( this, ID_READ_SHAPE_FILE, _( "Read Shape Descr File..." ) );
Button->SetForegroundColour( wxColor( 0, 100, 0 ) ); Button->SetForegroundColour( wxColor( 0, 100, 0 ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
wxString shapelist[3] = { _( "Normal" ), _( "Symmetrical" ), _( "mirrored" ) }; wxString shapelist[3] = { _( "Normal" ), _( "Symmetrical" ), _( "Mirrored" ) };
m_ShapeOptionCtrl = new wxRadioBox( this, -1, _( m_ShapeOptionCtrl = new wxRadioBox( this, -1, _(
"ShapeOption" ), "Shape Option" ),
wxDefaultPosition, wxDefaultSize, 3, shapelist, 1, wxDefaultPosition, wxDefaultSize, 3, shapelist, 1,
wxRA_SPECIFY_COLS ); wxRA_SPECIFY_COLS );
LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 ); LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
...@@ -371,26 +368,25 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent, ...@@ -371,26 +368,25 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent,
ShapeSize, ShapeSize,
g_UnitMetric, LeftBoxSizer, PCB_INTERNAL_UNIT ); g_UnitMetric, LeftBoxSizer, PCB_INTERNAL_UNIT );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
} }
/**********************************************************************/ /**********************************************************************/
void WinEDA_SetParamShapeFrame::OnCancel( wxCommandEvent& WXUNUSED (event) ) void WinEDA_SetParamShapeFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
if( PolyEdges ) if( PolyEdges )
free( PolyEdges ); free( PolyEdges );
PolyEdges = NULL; PolyEdges = NULL;
PolyEdgesCount = 0; PolyEdgesCount = 0;
EndModal( 0 ); EndModal( -1 );
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_SetParamShapeFrame::AcceptOptions( wxCommandEvent& event ) void WinEDA_SetParamShapeFrame::OnOkClick( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
ShapeSize = m_SizeCtrl->GetValue(); ShapeSize = m_SizeCtrl->GetValue();
......
...@@ -577,7 +577,7 @@ wxString ext; ...@@ -577,7 +577,7 @@ wxString ext;
int mask = 1; int mask = 1;
s_SelectedLayers = 0; s_SelectedLayers = 0;
for( layer_to_plot = 0; layer_to_plot < 29; layer_to_plot++, mask <<= 1 ) for( layer_to_plot = 0; layer_to_plot < NB_LAYERS; layer_to_plot++, mask <<= 1 )
{ {
if( m_BoxSelecLayer[layer_to_plot]->GetValue() ) if( m_BoxSelecLayer[layer_to_plot]->GetValue() )
{ {
......
...@@ -21,9 +21,7 @@ static wxPoint old_pos; // position originelle du texte selecte ...@@ -21,9 +21,7 @@ static wxPoint old_pos; // position originelle du texte selecte
enum id_TextPCB_properties { enum id_TextPCB_properties {
ID_ACCEPT_TEXTE_PCB_PROPERTIES = 1900, ID_TEXTPCB_SELECT_LAYER = 1900
ID_CLOSE_TEXTE_PCB_PROPERTIES,
ID_TEXTPCB_SELECT_LAYER
}; };
/************************************/ /************************************/
...@@ -56,17 +54,15 @@ public: ...@@ -56,17 +54,15 @@ public:
private: private:
void TextPCBPropertiesAccept( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_TextPCBPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_TextPCBPropertiesFrame, wxDialog )
EVT_BUTTON( ID_ACCEPT_TEXTE_PCB_PROPERTIES, EVT_BUTTON( wxID_OK, WinEDA_TextPCBPropertiesFrame::OnOkClick )
WinEDA_TextPCBPropertiesFrame::TextPCBPropertiesAccept ) EVT_BUTTON( wxID_CANCEL, WinEDA_TextPCBPropertiesFrame::OnCancelClick )
EVT_BUTTON( ID_CLOSE_TEXTE_PCB_PROPERTIES,
WinEDA_TextPCBPropertiesFrame::OnQuit )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -78,7 +74,8 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, ...@@ -78,7 +74,8 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB,
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_TextPCBPropertiesFrame* frame = new WinEDA_TextPCBPropertiesFrame( this, WinEDA_TextPCBPropertiesFrame* frame = new WinEDA_TextPCBPropertiesFrame( this,
TextPCB, DC, pos ); TextPCB, DC, pos );
frame->ShowModal(); frame->Destroy(); frame->ShowModal();
frame->Destroy();
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
} }
...@@ -111,12 +108,12 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p ...@@ -111,12 +108,12 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Creation des boutons de commande */ /* Creation des boutons de commande */
Button = new wxButton( this, ID_ACCEPT_TEXTE_PCB_PROPERTIES, _( "Ok" ) ); Button = new wxButton( this, wxID_OK, _( "OK" ) );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button->SetDefault(); Button->SetDefault();
Button = new wxButton( this, ID_CLOSE_TEXTE_PCB_PROPERTIES, _( "Cancel" ) ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
...@@ -143,7 +140,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p ...@@ -143,7 +140,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
MiddleBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxALL, 5 ); MiddleBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxALL, 5 );
int ii; int ii;
for( ii = 0; ii < 29; ii++ ) for( ii = 0; ii < NB_LAYERS; ii++ )
{ {
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) ); m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
} }
...@@ -181,7 +178,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p ...@@ -181,7 +178,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg, wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg,
1, wxRA_SPECIFY_COLS ); 1, wxRA_SPECIFY_COLS );
if( !TextPCB->m_Miroir ) if( !TextPCB->m_Miroir )
m_Mirror->SetSelection( 1 );; m_Mirror->SetSelection( 1 );
MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
...@@ -190,16 +187,15 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p ...@@ -190,16 +187,15 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
/**********************************************************************/ /**********************************************************************/
void WinEDA_TextPCBPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) void WinEDA_TextPCBPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
// true is to force the frame to close EndModal( -1 );
Close( true );
} }
/**************************************************************************************/ /**************************************************************************************/
void WinEDA_TextPCBPropertiesFrame::TextPCBPropertiesAccept( wxCommandEvent& event ) void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
/**************************************************************************************/ /**************************************************************************************/
{ {
if( m_DC ) // Effacement ancien texte if( m_DC ) // Effacement ancien texte
...@@ -224,7 +220,7 @@ void WinEDA_TextPCBPropertiesFrame::TextPCBPropertiesAccept( wxCommandEvent& eve ...@@ -224,7 +220,7 @@ void WinEDA_TextPCBPropertiesFrame::TextPCBPropertiesAccept( wxCommandEvent& eve
CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_OR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_OR );
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->m_CurrentScreen->SetModify();
Close( TRUE ); EndModal( 1 );
} }
......
...@@ -14,12 +14,9 @@ ...@@ -14,12 +14,9 @@
/* Fonctions locales: */ /* Fonctions locales: */
enum layer_sel_id { enum layer_sel_id {
ID_LAYER_OK = 1800, ID_LAYER_SELECT_TOP = 1800,
ID_LAYER_CANCEL,
ID_LAYER_SELECT_TOP,
ID_LAYER_SELECT_BOTTOM, ID_LAYER_SELECT_BOTTOM,
ID_LAYER_SELECT ID_LAYER_SELECT
}; };
...@@ -32,64 +29,82 @@ class WinEDA_SelLayerFrame : public wxDialog ...@@ -32,64 +29,82 @@ class WinEDA_SelLayerFrame : public wxDialog
private: private:
WinEDA_BasePcbFrame* m_Parent; WinEDA_BasePcbFrame* m_Parent;
wxRadioBox* m_LayerList; wxRadioBox* m_LayerList;
int m_LayerId[NB_LAYERS]; int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer, WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer,
int min_layer, int max_layer ); int min_layer, int max_layer, bool null_layer );
~WinEDA_SelLayerFrame() { }; ~WinEDA_SelLayerFrame() { };
private: private:
void Sel_Layer( wxCommandEvent& event ); void Sel_Layer( wxCommandEvent& event );
void Cancel( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SelLayerFrame */ /* Table des evenements pour WinEDA_SelLayerFrame */
BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog )
EVT_BUTTON( ID_LAYER_OK, WinEDA_SelLayerFrame::Sel_Layer ) EVT_BUTTON( wxID_OK, WinEDA_SelLayerFrame::Sel_Layer )
EVT_BUTTON( ID_LAYER_CANCEL, WinEDA_SelLayerFrame::Cancel ) EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerFrame::OnCancelClick )
EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer ) EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer )
END_EVENT_TABLE() END_EVENT_TABLE()
/****************************************************************************************/ /****************************************************************************************/
int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer ) int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer,
bool null_layer )
/****************************************************************************************/ /****************************************************************************************/
/* Install the dialog box for layer selection /* Install the dialog box for layer selection
* @param default_layer = Preselection * @param default_layer = Preselection (NB_LAYERS for "(Deselect)" layer)
* @param min_layer = min layer value (-1 if no min value) * @param min_layer = min layer value (-1 if no min value)
* @param max_layer = max layer value (-1 si no max value) * @param max_layer = max layer value (-1 if no max value)
* @return new layer value, or <0 if aborted * @param null_layer = display a "(Deselect)" radiobutton (when set to true)
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if cancelled
*
* Providing the option to also display a "(Deselect)" radiobutton makes the
* "Swap Layers" command (and GerbView's "Export to Pcbnew" command) more "user
* friendly", by permitting any layer to be "deselected" immediately after its
* corresponding radiobutton has been clicked on. (It would otherwise be
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Swap Layers:" or "Layer selection:" dialog box).
*/ */
{ {
int layer; int layer;
WinEDA_SelLayerFrame* frame = WinEDA_SelLayerFrame* frame =
new WinEDA_SelLayerFrame( this, default_layer, min_layer, max_layer ); new WinEDA_SelLayerFrame( this, default_layer, min_layer, max_layer, null_layer );
layer = frame->ShowModal(); frame->Destroy(); layer = frame->ShowModal();
frame->Destroy();
return layer; return layer;
} }
/***********************************************************************/ /***********************************************************************/
WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
int default_layer, int min_layer, int max_layer ) : int default_layer, int min_layer,
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ), int max_layer, bool null_layer ) :
wxDialog( parent, -1, _("Select Layer:"), wxPoint( -1, -1 ),
wxSize( 470, 250 ), wxSize( 470, 250 ),
DIALOG_STYLE ) DIALOG_STYLE )
/***********************************************************************/ /***********************************************************************/
/*
* The "OK" and "Cancel" buttons are positioned (in a horizontal line)
* beneath the "Layer" radiobox, unless that contains only one column of
* radiobuttons, in which case they are positioned (in a vertical line)
* to the right of that radiobox.
*/
{ {
wxButton* Button; wxButton* Button;
int ii, yy, xx; int ii;
wxPoint pos; wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton
wxString LayerList[NB_LAYERS];
int LayerCount, LayerSelect = -1; int LayerCount, LayerSelect = -1;
m_Parent = parent; m_Parent = parent;
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
...@@ -104,42 +119,54 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, ...@@ -104,42 +119,54 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
{ {
if( min_layer > ii ) if( min_layer > ii )
continue; continue;
if( (max_layer >= 0) && (max_layer < ii) ) if( (max_layer >= 0) && (max_layer < ii) )
break; break;
LayerList[LayerCount] = ReturnPcbLayerName( ii ); LayerList[LayerCount] = ReturnPcbLayerName( ii );
if( ii == default_layer ) if( ii == default_layer )
LayerSelect = LayerCount; LayerSelect = LayerCount;
m_LayerId[LayerCount] = ii; m_LayerId[LayerCount] = ii;
LayerCount++; LayerCount++;
} }
} }
// When appropriate, also provide a "(Deselect)" radiobutton
if( null_layer )
{
LayerList[LayerCount] = _( "(Deselect)" );
if( NB_LAYERS == default_layer )
LayerSelect = LayerCount;
pos.x = 5; pos.y = 5; m_LayerId[LayerCount] = NB_LAYERS;
LayerCount++;
}
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ), m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _("Layer"),
pos, wxSize( -1, -1 ), LayerCount, LayerList, wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS ); (LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
if( LayerSelect >= 0 ) if( LayerSelect >= 0 )
m_LayerList->SetSelection( LayerSelect ); m_LayerList->SetSelection( LayerSelect );
m_LayerList->GetSize( &xx, &yy ); wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxHORIZONTAL);
pos.x += xx + 12; SetSizer(FrameBoxSizer);
Button = new wxButton( this, ID_LAYER_OK, FrameBoxSizer->Add(m_LayerList, 0, wxALIGN_TOP|wxALL, 5);
_( "OK" ), pos ); wxBoxSizer* ButtonBoxSizer = new wxBoxSizer(wxVERTICAL);
Button->SetForegroundColour( *wxBLUE ); FrameBoxSizer->Add(ButtonBoxSizer, 0, wxALIGN_BOTTOM|wxALL, 0);
pos.y += Button->GetSize().y + 5; Button = new wxButton( this, wxID_OK, _("OK") );
Button = new wxButton( this, ID_LAYER_CANCEL,
_( "Cancel" ), pos );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton( this, wxID_CANCEL, _("Cancel") );
Button->SetForegroundColour( *wxBLUE );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
/* Redimensionnement de la boite de dialogue: */ if( GetSizer() )
pos.x += Button->GetSize().x + 10; {
SetSize( -1, -1, pos.x, yy + 35 ); GetSizer()->SetSizeHints(this);
}
} }
...@@ -154,7 +181,7 @@ void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event ) ...@@ -154,7 +181,7 @@ void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
void WinEDA_SelLayerFrame::Cancel( wxCommandEvent& event ) void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
...@@ -180,8 +207,8 @@ public: ...@@ -180,8 +207,8 @@ public:
~WinEDA_SelLayerPairFrame() { }; ~WinEDA_SelLayerPairFrame() { };
private: private:
void Sel_Layer( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void Cancel( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
...@@ -189,11 +216,11 @@ private: ...@@ -189,11 +216,11 @@ private:
/* Table des evenements pour WinEDA_SelLayerPairFrame */ /* Table des evenements pour WinEDA_SelLayerPairFrame */
BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog )
EVT_BUTTON( ID_LAYER_OK, WinEDA_SelLayerPairFrame::Sel_Layer ) EVT_BUTTON( wxID_OK, WinEDA_SelLayerPairFrame::OnOkClick )
EVT_BUTTON( ID_LAYER_CANCEL, WinEDA_SelLayerPairFrame::Cancel ) EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerPairFrame::OnCancelClick )
EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerPairFrame::Sel_Layer )
END_EVENT_TABLE() END_EVENT_TABLE()
/***********************************************/ /***********************************************/
void WinEDA_BasePcbFrame::SelectLayerPair() void WinEDA_BasePcbFrame::SelectLayerPair()
/***********************************************/ /***********************************************/
...@@ -202,10 +229,23 @@ void WinEDA_BasePcbFrame::SelectLayerPair() ...@@ -202,10 +229,23 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
* pour autorutage, vias... * pour autorutage, vias...
*/ */
{ {
// Check whether more than one copper layer has been enabled for the
// current PCB file, as Layer Pairs can only meaningfully be defined
// within PCB files which contain at least two copper layers.
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 )
{
wxString InfoMsg;
InfoMsg = _( "Less than two copper layers are being used." );
InfoMsg << wxT( "\n" ) << _( "Hence Layer Pairs cannot be specified." );
DisplayInfo( this, InfoMsg );
return;
}
WinEDA_SelLayerPairFrame* frame = WinEDA_SelLayerPairFrame* frame =
new WinEDA_SelLayerPairFrame( this ); new WinEDA_SelLayerPairFrame( this );
frame->ShowModal(); frame->Destroy(); frame->ShowModal();
frame->Destroy();
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SetToolbars(); SetToolbars();
} }
...@@ -213,14 +253,12 @@ void WinEDA_BasePcbFrame::SelectLayerPair() ...@@ -213,14 +253,12 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
/*******************************************************************************/ /*******************************************************************************/
WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ) : WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ) :
wxDialog( parent, -1, _( "Select Layer Pair:" ), wxPoint( -1, -1 ), wxDialog( parent, -1, _("Select Layer Pair:"), wxPoint( -1, -1 ),
wxSize( 470, 250 ), DIALOG_STYLE ) wxSize( 470, 250 ), DIALOG_STYLE )
/*******************************************************************************/ /*******************************************************************************/
{ {
wxButton* Button; wxButton* Button;
int ii, LayerCount; int ii, LayerCount;
int yy, xx;
wxPoint pos;
wxString LayerList[NB_COPPER_LAYERS]; wxString LayerList[NB_COPPER_LAYERS];
int LayerTopSelect = 0, LayerBottomSelect = 0; int LayerTopSelect = 0, LayerBottomSelect = 0;
...@@ -246,48 +284,85 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ...@@ -246,48 +284,85 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
} }
} }
pos.x = 5; pos.y = 5; m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP, _("Top Layer"),
m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP, _( "Top Layer" ), wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
pos, wxSize( -1, -1 ), LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS ); (LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
m_LayerListTOP->SetSelection( LayerTopSelect ); m_LayerListTOP->SetSelection( LayerTopSelect );
m_LayerListTOP->GetSize( &xx, &yy ); m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM, _("Bottom Layer"),
pos.x += xx + 12; wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM, _( "Bottom Layer" ),
pos, wxSize( -1, -1 ), LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS ); (LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
m_LayerListBOTTOM->SetSelection( LayerBottomSelect ); m_LayerListBOTTOM->SetSelection( LayerBottomSelect );
m_LayerListBOTTOM->GetSize( &xx, &yy ); wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxVERTICAL);
pos.x += xx + 12; SetSizer(FrameBoxSizer);
Button = new wxButton( this, ID_LAYER_OK, _( "OK" ), pos );
Button->SetForegroundColour( *wxBLUE );
pos.y += Button->GetSize().y + 5; wxBoxSizer* RadioBoxSizer = new wxBoxSizer(wxHORIZONTAL);
Button = new wxButton( this, ID_LAYER_CANCEL, _( "Cancel" ), pos ); FrameBoxSizer->Add(RadioBoxSizer, 0, wxALIGN_LEFT|wxALL, 0);
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer(wxHORIZONTAL);
FrameBoxSizer->Add(ButtonBoxSizer, 0, wxALIGN_RIGHT|wxALL, 0);
RadioBoxSizer->Add(m_LayerListTOP, 0, wxALIGN_TOP|wxALL, 5);
RadioBoxSizer->Add(m_LayerListBOTTOM, 0, wxALIGN_TOP|wxALL, 5);
Button = new wxButton( this, wxID_OK, _("OK") );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
/* Redimensionnement de la boite de dialogue: */ Button = new wxButton( this, wxID_CANCEL, _("Cancel") );
pos.x += Button->GetSize().x + 10; Button->SetForegroundColour( *wxBLUE );
SetSize( -1, -1, pos.x, yy + 35 ); ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
}
} }
/***************************************************************/ /***************************************************************/
void WinEDA_SelLayerPairFrame::Sel_Layer( wxCommandEvent& event ) void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
// Check whether whichever layer has been specified as the "Top"
// layer is really "above" whichever layer has been specified as
// the "Bottom" layer; those values will only be updated (and the
// dialog box subsequently closed) when that condition is met.
// if( m_LayerId[m_LayerListTOP->GetSelection()]
// <= m_LayerId[m_LayerListBOTTOM->GetSelection()] )
// {
// DisplayError( this, _( "The Top Layer must be above the Bottom Layer" ) );
// return;
// }
// Code for previous test commented out because other code now
// transposes the assignment of the Top and Bottom layers if
// the former layer is actually "below" the latter. However,
// it is still desirable to check that those layers differ.
// Check whether whichever layer has been specified as the "Top"
// layer differs from whichever layer has been specified as the
// "Bottom" layer; those values will only be updated (and the
// dialog box subsequently closed) when that condition is met.
if( m_LayerId[m_LayerListTOP->GetSelection()]
== m_LayerId[m_LayerListBOTTOM->GetSelection()] )
{
DisplayError( this, _( "The Top Layer and Bottom Layer must differ" ) );
return;
}
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->m_CurrentScreen; PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->m_CurrentScreen;
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()]; screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()];
screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()]; screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()];
EndModal( 0 ); EndModal( 0 );
} }
/***************************************************************/ /***************************************************************/
void WinEDA_SelLayerPairFrame::Cancel( wxCommandEvent& event ) void WinEDA_SelLayerPairFrame::OnCancelClick( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
......
...@@ -11,12 +11,10 @@ ...@@ -11,12 +11,10 @@
#include "protos.h" #include "protos.h"
/* Variables locales */ /* Variables locales */
static int New_Layer[32]; static int New_Layer[NB_LAYERS];
enum swap_layer_id { enum swap_layer_id {
ID_SWAP_LAYER_EXECUTE = 1800, ID_SWAP_LAYER_BUTTON_SELECT = 1800,
ID_SWAP_LAYER_CANCEL,
ID_SWAP_LAYER_BUTTON_SELECT,
ID_SWAP_LAYER_DESELECT, ID_SWAP_LAYER_DESELECT,
ID_SWAP_LAYER_SELECT ID_SWAP_LAYER_SELECT
}; };
...@@ -40,15 +38,16 @@ public: ...@@ -40,15 +38,16 @@ public:
private: private:
void Sel_Layer( wxCommandEvent& event ); void Sel_Layer( wxCommandEvent& event );
void Cancel( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void Execute( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SwapLayerFrame */ /* Table des evenements pour WinEDA_SwapLayerFrame */
BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog )
EVT_BUTTON( ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute ) EVT_BUTTON( wxID_OK, WinEDA_SwapLayerFrame::OnOkClick )
EVT_BUTTON( ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel ) EVT_BUTTON( wxID_CANCEL, WinEDA_SwapLayerFrame::OnCancelClick )
EVT_BUTTON( ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer ) EVT_BUTTON( ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer )
EVT_BUTTON( ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer ) EVT_BUTTON( ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer )
EVT_RADIOBOX( ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer ) EVT_RADIOBOX( ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer )
...@@ -65,7 +64,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) : ...@@ -65,7 +64,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
wxButton* Button; wxButton* Button;
int ii; int ii;
wxPoint pos; wxPoint pos;
wxString g_Layer_Name_Pair[32]; wxString g_Layer_Name_Pair[NB_LAYERS];
wxSize winsize; wxSize winsize;
m_Parent = parent; m_Parent = parent;
...@@ -76,42 +75,38 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) : ...@@ -76,42 +75,38 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
g_Layer_Name_Pair[ii] = ReturnPcbLayerName( ii ) + wxT( " -> " ) + _( "No Change" ); g_Layer_Name_Pair[ii] = ReturnPcbLayerName( ii ) + wxT( " -> " ) + _( "No Change" );
} }
pos.x = 5; pos.y = START_Y; pos.x = 5;
pos.y = START_Y;
m_LayerList = new wxRadioBox( this, ID_SWAP_LAYER_SELECT, _( "Layers" ), m_LayerList = new wxRadioBox( this, ID_SWAP_LAYER_SELECT, _( "Layers" ),
pos, pos, wxSize( -1, -1 ),
wxSize( -1, -1 ), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS ); NB_LAYERS, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS );
winsize.y = m_LayerList->GetRect().GetBottom(); winsize.y = m_LayerList->GetRect().GetBottom();
pos.x = m_LayerList->GetRect().GetRight() + 12; pos.x = m_LayerList->GetRect().GetRight() + 12;
Button = new wxButton( this, ID_SWAP_LAYER_CANCEL,
_( "Cancel" ), pos );
Button->SetForegroundColour( *wxRED ); Button = new wxButton(this, ID_SWAP_LAYER_BUTTON_SELECT, _("Select..."), pos );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() ); Button->SetForegroundColour(wxColour(0,100,100));
pos.y += Button->GetSize().y + 5; pos.y += Button->GetSize().y + 10;
Button = new wxButton( this, ID_SWAP_LAYER_EXECUTE,
_( "OK" ), pos );
Button->SetForegroundColour( *wxBLUE ); Button = new wxButton(this, ID_SWAP_LAYER_DESELECT, _("Deselect"), pos );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() ); Button->SetForegroundColour(wxColour(0,100,0));
pos.y += Button->GetSize().y + 15; pos.y = winsize.y - 2 * Button->GetSize().y - 10;
Button = new wxButton( this, ID_SWAP_LAYER_DESELECT,
_( "Deselect" ), pos );
Button->SetForegroundColour( wxColour( 0, 100, 0 ) ); Button = new wxButton(this, wxID_OK, _("OK"), pos );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() ); Button->SetForegroundColour(*wxRED);
pos.y += Button->GetSize().y + 5; pos.y += Button->GetSize().y + 10;
Button = new wxButton( this, ID_SWAP_LAYER_BUTTON_SELECT,
_( "Select" ), pos );
Button->SetForegroundColour( wxColour( 0, 100, 100 ) ); Button = new wxButton(this, wxID_CANCEL, _("Cancel"), pos );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() ); Button->SetForegroundColour(*wxBLUE);
winsize.x += 10; winsize.y += 10; winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
winsize.y = MAX( winsize.y, Button->GetRect().GetBottom() );
winsize.x += 10;
winsize.y += 10;
SetClientSize( winsize ); SetClientSize( winsize );
} }
...@@ -127,26 +122,49 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event ) ...@@ -127,26 +122,49 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_SWAP_LAYER_DESELECT: case ID_SWAP_LAYER_DESELECT:
if( New_Layer[ii] != -1 ) if( New_Layer[ii] != NB_LAYERS )
{ {
New_Layer[ii] = -1; New_Layer[ii] = NB_LAYERS;
m_LayerList->SetString( ii, ReturnPcbLayerName( ii ) + m_LayerList->SetString( ii, ReturnPcbLayerName( ii )
+ wxT( " -> " ) + _( "No Change" ) ); + wxT( " -> " ) + _( "No Change" ) );
} }
break; break;
case ID_SWAP_LAYER_BUTTON_SELECT: case ID_SWAP_LAYER_BUTTON_SELECT:
case ID_SWAP_LAYER_SELECT: case ID_SWAP_LAYER_SELECT:
jj = m_Parent->SelectLayer( ii, -1, -1 ); jj = New_Layer[ii];
if( (jj < 0) || (jj >= 29) ) if( (jj < 0) || (jj > NB_LAYERS) )
jj = NB_LAYERS; // (Defaults to "No Change".)
jj = m_Parent->SelectLayer( jj, -1, -1, true );
if( (jj < 0) || (jj > NB_LAYERS) )
return;
// No change if the selected layer matches the layer being edited.
// (Hence the only way to restore a layer to the "No Change"
// state is by specifically deselecting it; any attempt
// to select the same layer (instead) will be ignored.)
if( jj == ii )
{
wxString msg;
msg = _( "Deselect this layer to restore its No Change state" );
DisplayInfo( this, msg );
return; return;
}
if( ii != jj ) if( jj != New_Layer[ii] )
{ {
New_Layer[ii] = jj; New_Layer[ii] = jj;
m_LayerList->SetString( ii, if( jj == NB_LAYERS )
ReturnPcbLayerName( ii ) + wxT( " -> " ) + m_LayerList->SetString( ii,
ReturnPcbLayerName( jj ) ); ReturnPcbLayerName( ii )
+ wxT( " -> " )
+ _( "No Change" ) );
else
m_LayerList->SetString( ii,
ReturnPcbLayerName( ii )
+ wxT( " -> " )
+ ReturnPcbLayerName( jj ) );
} }
break; break;
} }
...@@ -154,7 +172,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event ) ...@@ -154,7 +172,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event ) void WinEDA_SwapLayerFrame::OnCancelClick( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
...@@ -162,7 +180,7 @@ void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event ) ...@@ -162,7 +180,7 @@ void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Execute( wxCommandEvent& event ) void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
{ {
EndModal( 1 ); EndModal( 1 );
...@@ -181,15 +199,16 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) ...@@ -181,15 +199,16 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
/* Init default values */ /* Init default values */
for( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < NB_LAYERS; ii++ )
New_Layer[ii] = -1; New_Layer[ii] = NB_LAYERS;
WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this ); WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this );
ii = frame->ShowModal(); frame->Destroy(); ii = frame->ShowModal();
frame->Destroy();
if( ii != 1 ) if( ii != 1 )
return; return; // (Cancelled dialog box returns -1 instead)
/* Modifications des pistes */ /* Modifications des pistes */
pt_segm = (TRACK*) m_Pcb->m_Track; pt_segm = (TRACK*) m_Pcb->m_Track;
......
/*****************************************************************/ /*****************************************************************/
/* too_modeit.cpp: construction du menu de l'editeur de modules */ /* tool_modeit.cpp: construction du menu de l'editeur de modules */
/*****************************************************************/ /*****************************************************************/
#include "fctsys.h" #include "fctsys.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment