Commit 283cfa67 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Set default button on all dialogs. Fixes lp:665703

* Set default button on all dialogs that do not already have a defined
  default button.  The only exception is the EESchema net list dialog
  which needs converted over to wxFormBuilder and due to it's design makes
  setting the default button in any tab other than the default tab
  problematic.
* Fix escape key dialog handling bug in EESchema print post script
  dialog.
parent 81509a11
......@@ -66,7 +66,8 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* pa
m_hotkeyGrid->SetReadOnly( i, 1, true );
}
SetFocus();
m_OKButton->SetDefault();
m_hotkeyGrid->SetFocus();
GetSizer()->SetSizeHints( this );
Center();
}
......
......@@ -24,47 +24,45 @@
#include "dialog_page_settings.h"
#define NB_ITEMS 11
Ki_PageDescr * SheetList[NB_ITEMS + 1] =
Ki_PageDescr* SheetList[NB_ITEMS + 1] =
{
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
&g_Sheet_user, NULL
};
/******************************************************************/
void EDA_DRAW_FRAME::Process_PageSettings(wxCommandEvent& event)
/******************************************************************/
/* Creation de la fenetre de configuration
*/
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
{
DIALOG_PAGES_SETTINGS frame(this);
DIALOG_PAGES_SETTINGS frame( this );
int diag = frame.ShowModal();
if ( DrawPanel && diag )
if( DrawPanel && diag )
DrawPanel->Refresh();
}
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ):
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
DIALOG_PAGES_SETTINGS_BASE( parent )
{
m_Parent = parent;
m_Screen = m_Parent->GetScreen();
m_Parent = parent;
m_Screen = m_Parent->GetScreen();
m_Modified = 0;
m_SelectedSheet = NULL;
m_SelectedSheet = NULL;
m_CurrentSelection = 0;
initDialog( );
initDialog();
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
Centre();
}
DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
{
}
void DIALOG_PAGES_SETTINGS::initDialog()
{
wxString msg;
......@@ -74,17 +72,17 @@ void DIALOG_PAGES_SETTINGS::initDialog()
// Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel();
msg.Printf(format, m_Screen->m_NumberOfScreen);
m_TextSheetCount->SetLabel(msg);
msg.Printf( format, m_Screen->m_NumberOfScreen );
m_TextSheetCount->SetLabel( msg );
format = m_TextSheetNumber->GetLabel();
msg.Printf(format, m_Screen->m_ScreenNumber);
m_TextSheetNumber->SetLabel(msg);
msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg );
switch( g_UserUnit )
{
case MILLIMETRES:
UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000;
UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000;
UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000;
UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000;
msg.Printf( wxT( "%.2f" ), UserSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.2f" ), UserSizeY );
......@@ -92,8 +90,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
break;
case INCHES:
UserSizeX = (double) g_Sheet_user.m_Size.x / 1000;
UserSizeY = (double) g_Sheet_user.m_Size.y / 1000;
UserSizeX = (double) g_Sheet_user.m_Size.x / 1000;
UserSizeY = (double) g_Sheet_user.m_Size.y / 1000;
msg.Printf( wxT( "%.3f" ), UserSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.3f" ), UserSizeY );
......@@ -101,8 +99,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
break;
case UNSCALED_UNITS:
UserSizeX = g_Sheet_user.m_Size.x;
UserSizeY = g_Sheet_user.m_Size.y;
UserSizeX = g_Sheet_user.m_Size.x;
UserSizeY = g_Sheet_user.m_Size.y;
msg.Printf( wxT( "%f" ), UserSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%f" ), UserSizeY );
......@@ -111,24 +109,27 @@ void DIALOG_PAGES_SETTINGS::initDialog()
}
// Set validators
m_PageSizeBox->SetValidator( wxGenericValidator(& m_CurrentSelection) );
m_TextRevision->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Revision) );
m_TextTitle->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Title) );
m_TextCompany->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Company) );
m_TextComment1->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire1) );
m_TextComment2->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire2) );
m_TextComment3->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire3) );
m_TextComment4->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire4) );
m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
m_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) );
m_TextComment1->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire1 ) );
m_TextComment2->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire2 ) );
m_TextComment3->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire3 ) );
m_TextComment4->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire4 ) );
#ifndef EESCHEMA
m_RevisionExport->Show(false);
m_TitleExport->Show(false);
m_CompanyExport->Show(false);
m_Comment1Export->Show(false);
m_Comment2Export->Show(false);
m_Comment3Export->Show(false);
m_Comment4Export->Show(false);
m_RevisionExport->Show( false );
m_TitleExport->Show( false );
m_CompanyExport->Show( false );
m_Comment1Export->Show( false );
m_Comment2Export->Show( false );
m_Comment3Export->Show( false );
m_Comment4Export->Show( false );
#endif
// Make the OK button the default.
m_sdbSizer1OK->SetDefault();
}
......@@ -150,7 +151,7 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{
SavePageSettings( event );
m_Modified = 1;
Close( TRUE );
Close( true );
}
......@@ -160,32 +161,28 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
{
Close( TRUE );
Close( true );
}
/*****************************************************************/
void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
/*****************************************************************/
/* Mise a jour effective des textes et dimensions
*/
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{
double dtmp;
wxString msg;
double dtmp;
wxString msg;
m_Screen->m_Revision = m_TextRevision->GetValue();
m_Screen->m_Company = m_TextCompany->GetValue();
m_Screen->m_Title = m_TextTitle->GetValue();
m_Screen->m_Commentaire1 = m_TextComment1->GetValue();
m_Screen->m_Commentaire2 = m_TextComment2->GetValue();
m_Screen->m_Commentaire3 = m_TextComment3->GetValue();
m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
m_Screen->m_Revision = m_TextRevision->GetValue();
m_Screen->m_Company = m_TextCompany->GetValue();
m_Screen->m_Title = m_TextTitle->GetValue();
m_Screen->m_Commentaire1 = m_TextComment1->GetValue();
m_Screen->m_Commentaire2 = m_TextComment2->GetValue();
m_Screen->m_Commentaire3 = m_TextComment3->GetValue();
m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
msg = m_TextUserSizeX->GetValue();
msg.ToDouble(&dtmp);
msg.ToDouble( &dtmp );
UserSizeX = dtmp;
msg = m_TextUserSizeY->GetValue();
msg.ToDouble(&dtmp);
msg.ToDouble( &dtmp );
UserSizeY = dtmp;
int ii = m_PageSizeBox->GetSelection();
......@@ -199,18 +196,18 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
switch( g_UserUnit )
{
case MILLIMETRES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 );
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 );
break;
case INCHES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 );
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 );
break;
case UNSCALED_UNITS:
g_Sheet_user.m_Size.x = (int) ( UserSizeX );
g_Sheet_user.m_Size.y = (int) ( UserSizeY );
g_Sheet_user.m_Size.x = (int) ( UserSizeX );
g_Sheet_user.m_Size.y = (int) ( UserSizeY );
break;
}
......@@ -228,9 +225,11 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
#ifdef EESCHEMA
/* Exports settings to other sheets if requested: */
SCH_SCREEN * screen;
SCH_SCREEN* screen;
/* Build the screen list */
SCH_SCREENS ScreenList;
/* Update the datas */
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
......@@ -241,7 +240,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
screen->m_Revision = m_Screen->m_Revision;
if( m_TitleExport->IsChecked() )
screen->m_Title =m_Screen->m_Title;
screen->m_Title = m_Screen->m_Title;
if( m_CompanyExport->IsChecked() )
screen->m_Company = m_Screen->m_Company;
......@@ -258,6 +257,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
if( m_Comment4Export->IsChecked() )
screen->m_Commentaire4 = m_Screen->m_Commentaire4;
}
#endif
m_Screen->SetModify();
......@@ -265,15 +265,13 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
}
/*******************************************************/
void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
/*******************************************************/
/* Search the correct index to activate the radiobox list size selection
* according to the current page size
*/
void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
{
Ki_PageDescr * sheet;
int ii;
Ki_PageDescr* sheet;
int ii;
m_CurrentSelection = NB_ITEMS - 1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -32,10 +32,13 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) :
Init( );
title = _( "Project file: " ) + fn.GetFullPath();
SetTitle( title );
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
m_sdbSizer2OK->SetDefault();
}
......
......@@ -16,6 +16,7 @@ END_EVENT_TABLE()
DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
......@@ -25,6 +26,8 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
wxBoxSizer* p1mainSizer;
p1mainSizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -148,8 +151,9 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel1->SetSizer( p1mainSizer );
m_panel1->Layout();
p1mainSizer->Fit( m_panel1 );
m_notebook1->AddPage( m_panel1, _("General Options"), true );
m_notebook1->AddPage( m_panel1, _("General Options"), false );
m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel2->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_panel2->SetToolTip( _("User defined field names for schematic components. ") );
wxBoxSizer* bSizer6;
......@@ -236,7 +240,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel2->SetSizer( bSizer6 );
m_panel2->Layout();
bSizer6->Fit( m_panel2 );
m_notebook1->AddPage( m_panel2, _("Template Field Names"), false );
m_notebook1->AddPage( m_panel2, _("Template Field Names"), true );
bOptionsSizer->Add( m_notebook1, 1, wxEXPAND, 0 );
......
......@@ -22,7 +22,7 @@
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="bg">wxSYS_COLOUR_BTNFACE</property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -151,9 +151,9 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">General Options</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="bg">wxSYS_COLOUR_BTNFACE</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
......@@ -1649,9 +1649,9 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Template Field Names</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="bg">wxSYS_COLOUR_BTNFACE</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
......
......@@ -8,46 +8,43 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent ) :
{
/* Required to make escape key work correctly in wxGTK. */
m_textName->SetFocus();
m_sdbSizer1OK->SetDefault();
}
void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list,
const char *** aBitmaps )
const char*** aBitmaps )
{
for ( unsigned ii = 0; ii < list.GetCount( ); ii++ )
for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
{
if( aBitmaps == NULL )
m_choiceOrientation->Append(list[ii]);
m_choiceOrientation->Append( list[ii] );
else
m_choiceOrientation->Insert(list[ii],
wxBitmap(aBitmaps[ii]), ii);
}
m_choiceOrientation->Insert( list[ii], wxBitmap( aBitmaps[ii] ), ii );
}
}
void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list,
const char *** aBitmaps )
const char*** aBitmaps )
{
for ( unsigned ii = 0; ii < list.GetCount( ); ii++ )
for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
{
if( aBitmaps == NULL )
m_choiceElectricalType->Append(list[ii]);
m_choiceElectricalType->Append( list[ii] );
else
m_choiceElectricalType->Insert(list[ii],
wxBitmap(aBitmaps[ii]), ii);
m_choiceElectricalType->Insert( list[ii], wxBitmap( aBitmaps[ii] ), ii );
}
}
void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list,
const char *** aBitmaps )
void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list, const char*** aBitmaps )
{
for ( unsigned ii = 0; ii < list.GetCount( ); ii++ )
for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
{
if( aBitmaps == NULL )
m_choiceStyle->Append(list[ii]);
m_choiceStyle->Append( list[ii] );
else
m_choiceStyle->Insert(list[ii],
wxBitmap(aBitmaps[ii]), ii);
m_choiceStyle->Insert( list[ii], wxBitmap( aBitmaps[ii] ), ii );
}
}
......@@ -90,6 +90,7 @@ DIALOG_PLOT_SCHEMATIC_DXF::DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent )
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
void DIALOG_PLOT_SCHEMATIC_DXF::initDlg()
......
......@@ -125,6 +125,7 @@ DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent )
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
......
......@@ -97,6 +97,7 @@ DIALOG_PLOT_SCHEMATIC_PS::DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent ) :
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
......
......@@ -55,7 +55,7 @@ DIALOG_PLOT_SCHEMATIC_PS_BASE::DIALOG_PLOT_SCHEMATIC_PS_BASE( wxWindow* parent,
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
......
......@@ -435,7 +435,7 @@
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Close</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
......
......@@ -86,11 +86,11 @@ END_EVENT_TABLE()
* Used in Netlist format Dialog box creation
*/
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
const wxString& title,
int id_NetType,
int idCheckBox,
int idCreateFile,
bool selected ) :
const wxString& title,
int id_NetType,
int idCheckBox,
int idCreateFile,
bool selected ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN )
{
m_IdNetType = id_NetType;
......@@ -113,18 +113,14 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
UpperBoxSizer->Add( m_RightOptionsBoxSizer,
0,
wxALIGN_CENTER_VERTICAL | wxALL,
5 );
UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
if( idCheckBox )
{
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
m_IsCurrentFormat =
new wxCheckBox( this, idCheckBox, _( "Default format" ) );
m_IsCurrentFormat = new wxCheckBox( this, idCheckBox, _( "Default format" ) );
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
m_IsCurrentFormat->SetValue( selected );
}
......@@ -134,15 +130,16 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
if( idCreateFile )
{
wxButton* Button;
if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel */
Button = new wxButton( this, idCreateFile, _( "&Browse Plugin" ) );
else
Button = new wxButton( this, idCreateFile, _( "&Netlist" ) );
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
m_ButtonCancel =
Button = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button->SetDefault();
m_ButtonCancel = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
m_RightBoxSizer->Add( m_ButtonCancel, 0, wxGROW | wxALL, 5 );
/* Add special buttons to plugin panels:
* for panel plugins: added the "delete" button
......@@ -162,14 +159,9 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
}
/*************************************************************************************/
NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
/*************************************************************************************/
/* Constructor for the netlist generation dialog box
*/
{
int ii;
......@@ -184,8 +176,8 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
SetSizer( GeneralBoxSizer );
m_NoteBook = new wxNotebook( this, ID_NETLIST_NOTEBOOK,
wxDefaultPosition, wxDefaultSize,
wxNB_TOP ); // @todo: tabs on top are being hidden on linux
wxDefaultPosition, wxDefaultSize,
wxNB_TOP ); // @todo: tabs on top are being hidden on linux
GeneralBoxSizer->Add( m_NoteBook, 0, wxGROW | wxALL, 5 );
......@@ -194,29 +186,29 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
// Add Panel FORMAT PCBNEW
m_PanelNetType[PANELPCBNEW] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "Pcbnew" ),
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_PCBNEW );
wxT( "Pcbnew" ),
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_PCBNEW );
// Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_ORCADPCB2 );
wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_ORCADPCB2 );
// Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "CadStar" ),
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_CADSTAR );
wxT( "CadStar" ),
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_CADSTAR );
// Add Panel spice
InstallPageSpice();
......@@ -231,26 +223,20 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
}
/*************************************************/
void NETLIST_DIALOG::InstallPageSpice()
/*************************************************/
/* Create the spice page
*/
{
wxButton* Button;
wxButton* Button;
NETLIST_PAGE_DIALOG* page;
page = m_PanelNetType[PANELSPICE] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "Spice" ),
NET_TYPE_SPICE,
0, 0,
m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
page->m_IsCurrentFormat =
new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "Spice" ),
NET_TYPE_SPICE,
0, 0,
m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
page->m_IsCurrentFormat = new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
page->m_IsCurrentFormat->SetValue( m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
......@@ -261,6 +247,7 @@ void NETLIST_DIALOG::InstallPageSpice()
wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames )
m_UseNetNamesInNetlist->SetSelection( 1 );
page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
page->m_CommandStringCtrl = new WinEDA_EnterText( page,
......@@ -272,6 +259,7 @@ void NETLIST_DIALOG::InstallPageSpice()
// Add buttons
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button->SetDefault();
Button = new wxButton( page, ID_RUN_SIMULATOR, _( "&Run Simulator" ) );
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
......@@ -281,12 +269,9 @@ void NETLIST_DIALOG::InstallPageSpice()
}
/*************************************************/
void NETLIST_DIALOG::InstallCustomPages()
/*************************************************/
/* create the pages for custom netlist format selection:
*/
void NETLIST_DIALOG::InstallCustomPages()
{
bool selected;
int ii, CustomCount;
......@@ -295,6 +280,7 @@ void NETLIST_DIALOG::InstallCustomPages()
CustomCount = CUSTOMPANEL_COUNTMAX;
previoustitle = wxT( "dummy_title" );
for( ii = 0; ii < CustomCount; ii++ )
{
title = ReturnUserNetlistTypeName( ii == 0 ? true : false );
......@@ -311,20 +297,20 @@ void NETLIST_DIALOG::InstallCustomPages()
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
_( "Add Plugin" ),
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_SETUP_PLUGIN,
selected );
_( "Add Plugin" ),
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_SETUP_PLUGIN,
selected );
else /* Install a plugin panel */
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
new NETLIST_PAGE_DIALOG( m_NoteBook,
title,
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
selected );
title,
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
selected );
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
......@@ -361,13 +347,14 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
Mask,
this,
wxFD_OPEN,
TRUE
true
);
if( FullFileName.IsEmpty() )
return;
NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL )
return;
......@@ -376,6 +363,7 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
wxString cmdLine;
wxFileName fn( FullFileName );
wxString ext = fn.GetExt();
if( ext == wxT("xsl" ) )
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
else if( ext == wxT("exe" ) || ext.IsEmpty() )
......@@ -389,68 +377,61 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() )
DisplayInfoMessage( this,
_( "Do not forget to choose a title for this \
netlist control page" ) );
_( "Do not forget to choose a title for this netlist control page" ) );
}
/*****************************************************************/
void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
/*****************************************************************/
/* Called when the check box "default format" is clicked
*/
void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
{
int ii;
NETLIST_PAGE_DIALOG* CurrPage;
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
if( m_PanelNetType[ii] )
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( FALSE );
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( false );
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL )
return;
m_Parent->m_NetlistFormat = CurrPage->m_IdNetType;
CurrPage->m_IsCurrentFormat->SetValue( TRUE );
CurrPage->m_IsCurrentFormat->SetValue( true );
}
/***********************************************/
void NETLIST_DIALOG::NetlistUpdateOpt()
/***********************************************/
{
int ii;
g_SimulatorCommandLine =
m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
g_SimulatorCommandLine = m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
m_Parent->m_NetlistFormat = NET_TYPE_PCBNEW;
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
{
if( m_PanelNetType[ii] == NULL )
break;
if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == TRUE )
if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == true )
m_Parent->m_NetlistFormat = m_PanelNetType[ii]->m_IdNetType;
}
g_OptNetListUseNames = TRUE; // Used for pspice, gnucap
g_OptNetListUseNames = true; // Used for pspice, gnucap
if( m_UseNetNamesInNetlist->GetSelection() == 1 )
g_OptNetListUseNames = FALSE;
g_OptNetListUseNames = false;
}
/**********************************************************/
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
/**********************************************************/
/**
* Function GenNetlist
* Create the netlist file:
* calculate the filename with the suitable extensions
* and run the netlist creator
*/
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
{
wxFileName fn;
wxString fileWildcard;
......@@ -538,9 +519,11 @@ bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
if( !IsOK( NULL, _( "Some items are not annotated\n\
Do you want to annotate schematic?" ) ) )
return false;
// Schematic must be annotated: call Annotate dialog:
wxCommandEvent event;
OnAnnotate( event );
if( CheckAnnotate( NULL, 0 ) )
return false;
}
......@@ -575,8 +558,8 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
wxString ExecFile, CommandLine;
g_SimulatorCommandLine = m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
g_SimulatorCommandLine.Trim( FALSE );
g_SimulatorCommandLine.Trim( TRUE );
g_SimulatorCommandLine.Trim( false );
g_SimulatorCommandLine.Trim( true );
ExecFile = g_SimulatorCommandLine.BeforeFirst( ' ' );
CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
......@@ -597,14 +580,11 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
}
/*********************************************************/
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
/*********************************************************/
/**
* Function WriteCurrentNetlistSetup
* Write the current netlist options setup in the configuration
*/
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
{
wxString msg, Command;
wxConfig* config = wxGetApp().m_EDA_Config;
......@@ -615,13 +595,17 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
{
NETLIST_PAGE_DIALOG* CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE];
if( CurrPage == NULL )
break;
msg = wxT( "Custom" );
msg << ii + 1;
if( CurrPage->m_TitleStringCtrl )
{
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( msg != title ) // Title has changed, Update config
{
msg = CUSTOM_NETLIST_TITLE;
......@@ -641,47 +625,42 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
}
/******************************************************************/
void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event )
/******************************************************************/
/**
* Function DeletePluginPanel
* Remove a panel relative to a netlist plugin
*/
void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event )
{
NETLIST_PAGE_DIALOG* CurrPage =
(NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
NETLIST_PAGE_DIALOG* CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString );
CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString );
if( CurrPage->m_IsCurrentFormat->IsChecked() )
{
CurrPage->m_IsCurrentFormat->SetValue( FALSE );
m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( TRUE );
CurrPage->m_IsCurrentFormat->SetValue( false );
m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
}
WriteCurrentNetlistSetup();
EndModal( NET_PLUGIN_CHANGE );
}
/******************************************************************/
void NETLIST_DIALOG::ValidatePluginPanel( wxCommandEvent& event )
/******************************************************************/
/**
* Function ValidatePluginPanel
* Validate the panel info relative to a new netlist plugin
*/
void NETLIST_DIALOG::ValidatePluginPanel( wxCommandEvent& event )
{
NETLIST_PAGE_DIALOG* CurrPage =
(NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
NETLIST_PAGE_DIALOG* CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString )
{
DisplayError( this, _( "Error. You must provide a command String" ) );
return;
}
if( CurrPage->m_TitleStringCtrl->GetValue() == wxEmptyString )
{
DisplayError( this, _( "Error. You must provide a Title" ) );
......
......@@ -18,7 +18,8 @@ enum id_netlist {
ID_SETUP_PLUGIN,
ID_VALIDATE_PLUGIN,
ID_DELETE_PLUGIN,
ID_NETLIST_NOTEBOOK
ID_NETLIST_NOTEBOOK,
ID_CHANGE_NOTEBOOK_PAGE
};
/* panel (notebook page) identifiers */
......
......@@ -118,6 +118,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent )
{
GetSizer()->SetSizeHints( this );
}
m_buttonPrint->SetDefault();
}
......
......@@ -51,6 +51,7 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Center();
m_sdbSizer1OK->SetDefault();
}
......
......@@ -159,13 +159,16 @@ public:
wxString* m_Pt_param; ///< Pointer to the parameter value
wxString m_default; ///< The default value of the parameter
public: PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
public:
PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING( bool Insetup,
const wxChar* ident,
wxString* ptparam,
const wxString& default_val = wxEmptyString,
const wxChar* group = NULL );
virtual ~PARAM_CFG_WXSTRING() {}
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
};
......
......@@ -55,11 +55,11 @@ END_EVENT_TABLE()
PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
int idtype,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style) :
int idtype,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style) :
EDA_DRAW_FRAME( father, idtype, title, pos, size, style )
{
m_InternalUnits = PCB_INTERNAL_UNIT; // Internal unit = 1/10000 inch
......
......@@ -47,6 +47,7 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) :
initDialog( );
GetSizer()->SetSizeHints( this );
Centre();
m_buttonBoard->SetDefault();
}
......
......@@ -16,6 +16,7 @@ DIALOG_CLEANING_OPTIONS::DIALOG_CLEANING_OPTIONS( wxWindow* parent ):
m_deleteUnconnectedOpt->SetValue( deleteUnconnectedSegm );
m_reconnectToPadsOpt->SetValue( connectToPads );
m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints(this);
Centre();
}
......
......@@ -25,15 +25,14 @@ void PCB_EDIT_FRAME::InstallDisplayOptionsDialog( wxCommandEvent& aEvent )
}
/*******************************************************************************/
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
DIALOG_DISPLAY_OPTIONS_BASE(parent)
/*******************************************************************************/
DIALOG_DISPLAY_OPTIONS_BASE( parent )
{
m_Parent = parent;
init();
m_buttonOK->SetDefault();
GetSizer()->SetSizeHints( this );
}
......
......@@ -30,6 +30,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent
InitModeditProperties();
InitBoardProperties();
m_sdbSizerStdButtonsOK->SetDefault();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Centre();
......
......@@ -16,16 +16,16 @@
#include "module_editor_frame.h"
#include "dialog_edit_module_for_Modedit.h"
/**************************************************************************************/
DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( WinEDA_ModuleEditFrame* aParent,
MODULE* aModule ) :
DIALOG_MODULE_MODULE_EDITOR_BASE( aParent )
/**************************************************************************************/
{
m_Parent = aParent;
m_CurrentModule = aModule;
SetIcon( wxICON( icon_modedit ) ); // Give an icon
InitModeditProperties();
m_sdbSizerStdButtonsOK->SetDefault();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Centre();
......
......@@ -58,10 +58,13 @@ DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* parent,
m_DC = DC;
m_Module = NULL;
m_CurrentTextMod = TextMod;
if( m_CurrentTextMod )
m_Module = (MODULE*) m_CurrentTextMod->GetParent();
Init( );
m_buttonOK->SetDefault();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
......
......@@ -37,6 +37,7 @@ DIALOG_FREEROUTE::DIALOG_FREEROUTE( PCB_EDIT_FRAME* parent ):
m_Parent = parent;
MyInit();
m_sdbSizer1OK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
}
......
......@@ -25,6 +25,7 @@ Dialog_GeneralOptions::Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ) :
m_Parent = parent;
init();
m_buttonOK->SetDefault();
GetSizer()->SetSizeHints( this );
Center();
}
......
......@@ -43,6 +43,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
initValues( );
m_sdbSizer1OK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
......
......@@ -29,6 +29,7 @@ DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent )
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
MyInit();
m_sdbButtonsSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
}
......
......@@ -157,6 +157,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* parent, D_PAD* Pad
initValues();
m_sdbSizer1OK->SetDefault();
GetSizer()->SetSizeHints( this );
Center();
m_canUpdate = true;
......
......@@ -53,6 +53,7 @@ DIALOG_PCB_TEXT_PROPERTIES::DIALOG_PCB_TEXT_PROPERTIES( PCB_EDIT_FRAME* parent,
m_SelectedPCBText = passedTextPCB;
MyInit();
m_StandardSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
}
......
......@@ -40,9 +40,10 @@ DIALOG_PCBNEW_CONFIG_LIBS::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ):
wxString title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
SetTitle( title );
m_sdbSizer1OK->SetDefault();
if( GetSizer() )
GetSizer()->SetSizeHints( this );
}
/*************************************/
......
......@@ -89,6 +89,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( EDA_DRAW_FRAME* parent ) :
m_Config = wxGetApp().m_EDA_Config;
InitValues();
m_buttonPrint->SetDefault();
GetSizer()->SetSizeHints( this );
Center();
}
......
......@@ -258,20 +258,23 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( PCB_BASE_FRAME* parent ) :
m_Parent = parent;
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
int Masque_Layer =
g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
int Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
{
m_LayerId[ii] = 0;
if( (g_TabOneLayerMask[ii] & Masque_Layer) )
{
LayerList[LayerCount] = board->GetLayerName( ii );
if( ii == screen->m_Route_Layer_TOP )
LayerTopSelect = LayerCount;
if( ii == screen->m_Route_Layer_BOTTOM )
LayerBottomSelect = LayerCount;
m_LayerId[LayerCount] = ii;
LayerCount++;
}
......@@ -306,6 +309,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( PCB_BASE_FRAME* parent ) :
RadioBoxSizer->Add( m_LayerListBOTTOM, 0, wxALIGN_TOP | wxALL, 5 );
Button = new wxButton( this, wxID_OK, _( "OK" ) );
Button->SetDefault();
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
......@@ -323,16 +327,14 @@ void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event )
// select the same layer for top and bottom is allowed (normal in some
// boards)
// but could be a mistake. So display an info message
if( m_LayerId[m_LayerListTOP->GetSelection()]
== m_LayerId[m_LayerListBOTTOM->GetSelection()] )
if( m_LayerId[m_LayerListTOP->GetSelection()] == m_LayerId[m_LayerListBOTTOM->GetSelection()] )
DisplayInfoMessage( this,
_( "Warning: The Top Layer and Bottom Layer are same." ) );
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
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 );
}
......
......@@ -70,6 +70,7 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( wxWindow* parent, const wxPoint& pos ) :
m_TextPosXUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_TextPosYUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_sdbSizer1OK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
}
......
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