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();
}
......
This diff is collapsed.
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>
......
This diff is collapsed.
......@@ -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