Make sure standard OK/Cancel buttons respond to current language.

Fixes https://gitlab.com/kicad/code/kicad/issues/9635
This commit is contained in:
Jeff Young 2021-11-16 19:39:58 +00:00
parent 84a9732497
commit c3552a940a
102 changed files with 257 additions and 283 deletions

View File

@ -637,3 +637,69 @@ void DIALOG_SHIM::OnGridEditorHidden( wxGridEvent& event )
SetEscapeId( wxID_ANY );
event.Skip();
}
static void recursiveDescent( wxSizer* aSizer, std::map<int, wxString>& aLabels )
{
wxStdDialogButtonSizer* sdbSizer = dynamic_cast<wxStdDialogButtonSizer*>( aSizer );
auto setupButton =
[&]( wxButton* aButton )
{
if( aLabels.count( aButton->GetId() ) > 0 )
{
aButton->SetLabel( aLabels[ aButton->GetId() ] );
}
else
{
// wxWidgets has an uneven track record when the language is changed on
// the fly so we set them even when they don't appear in the label map
switch( aButton->GetId() )
{
case wxID_OK: aButton->SetLabel( _( "&OK" ) ); break;
case wxID_CANCEL: aButton->SetLabel( _( "&Cancel" ) ); break;
case wxID_YES: aButton->SetLabel( _( "&Yes" ) ); break;
case wxID_NO: aButton->SetLabel( _( "&No" ) ); break;
case wxID_APPLY: aButton->SetLabel( _( "&Apply" ) ); break;
case wxID_SAVE: aButton->SetLabel( _( "&Save" ) ); break;
case wxID_HELP: aButton->SetLabel( _( "&Help" ) ); break;
case wxID_CONTEXT_HELP: aButton->SetLabel( _( "&Help" ) ); break;
}
}
};
if( sdbSizer )
{
if( sdbSizer->GetAffirmativeButton() )
setupButton( sdbSizer->GetAffirmativeButton() );
if( sdbSizer->GetApplyButton() )
setupButton( sdbSizer->GetApplyButton() );
if( sdbSizer->GetNegativeButton() )
setupButton( sdbSizer->GetNegativeButton() );
if( sdbSizer->GetCancelButton() )
setupButton( sdbSizer->GetCancelButton() );
if( sdbSizer->GetHelpButton() )
setupButton( sdbSizer->GetHelpButton() );
sdbSizer->Layout();
if( sdbSizer->GetAffirmativeButton() )
sdbSizer->GetAffirmativeButton()->SetDefault();
}
for( wxSizerItem* item : aSizer->GetChildren() )
{
if( item->GetSizer() )
recursiveDescent( item->GetSizer(), aLabels );
}
}
void DIALOG_SHIM::SetupStandardButtons( std::map<int, wxString> aLabels )
{
recursiveDescent( GetSizer(), aLabels );
}

View File

@ -93,7 +93,7 @@ DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER( wxWindow* aParent, const COLOR4D& aCur
if( aDefaultColor == COLOR4D::UNSPECIFIED )
m_resetToDefault->SetLabel( _( "Clear Color" ) );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
}

View File

@ -107,7 +107,7 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
m_sb3DSearchPaths->Show( false );
SetInitialFocus( m_EnvVars );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// wxFormBuilder doesn't include this event...
m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING,

View File

@ -55,7 +55,7 @@ void DIALOG_EDIT_LIBRARY_TABLES::InstallPanel( wxPanel* aPanel )
mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
sdbSizerOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();

View File

@ -71,10 +71,7 @@ DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParen
wxUpdateUIEventHandler( DIALOG_GLOBAL_LIB_TABLE_CONFIG::onUpdateFilePicker ),
nullptr, this );
wxButton* okButton = (wxButton *) FindWindowById( wxID_OK );
if( okButton )
okButton->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -59,7 +59,7 @@ DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ):
m_book->SetSelection( 0 );
}
m_sdbSizerOK->SetDefault(); // set OK button as default response to 'Enter' key
SetupStandardButtons();
SetInitialFocus( m_GridOriginXCtrl );
Layout();

View File

@ -39,8 +39,9 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem
msg.Printf( wxT( "%f" ), m_workingImage->GetScale() );
m_textCtrlScale->SetValue( msg );
SetupStandardButtons();
finishDialogSettings();
m_sdbSizerOK->SetDefault();
}

View File

@ -32,11 +32,11 @@ DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, int aLo
m_messageLine1->SetLabel( wxString::Format( m_messageLine1->GetLabel(), aLockedItemCount ) );
m_sdbSizerOK->SetLabel( _( "Skip Locked Items" ) );
SetupStandardButtons( { { wxID_OK, _( "Skip Locked Items" ) } } );
m_sdbSizerOK->SetToolTip( _( "Remove locked items from the selection and only apply the "
"operation to the unlocked items (if any)." ) );
m_sdbSizerOK->SetDefault();
m_sdbSizerOK->SetFocus();
SetInitialFocus( m_sdbSizerOK );
Layout();

View File

@ -35,7 +35,8 @@ DIALOG_MIGRATE_SETTINGS::DIALOG_MIGRATE_SETTINGS( SETTINGS_MANAGER* aManager ) :
// Disabled for now. See https://gitlab.com/kicad/code/kicad/-/issues/9826
m_cbCopyLibraryTables->Hide();
m_standardButtonsOK->SetDefault();
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
Centre();
}

View File

@ -111,6 +111,8 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
m_staticTextTitleBlock->SetLabel( _( "Title Block" ) );
}
SetupStandardButtons();
Centre();
}
@ -197,8 +199,6 @@ bool DIALOG_PAGES_SETTINGS::TransferDataToWindow()
GetSizer()->SetSizeHints( this );
// Make the OK button the default.
m_sdbSizerOK->SetDefault();
m_initialized = true;
return true;

View File

@ -42,14 +42,9 @@ DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SE
m_scaleValidator.SetRange( 0.0, MAX_SCALE );
m_scaleCustomText->SetValidator( m_scaleValidator );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Print" ) );
m_sdbSizer1Apply->SetLabel( _( "Print Preview" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Print" ) },
{ wxID_APPLY, _( "Print Preview" ) },
{ wxID_CANCEL, _( "Close" ) } } );
#if defined(__WXMAC__) or defined(__WXGTK__)
// Preview does not work well on GTK or Mac,

View File

@ -33,8 +33,9 @@ WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG( wxWindow* aParent,
m_label->SetLabel( aFieldLabel );
m_textCtrl->SetValue( aDefaultValue );
SetupStandardButtons();
SetInitialFocus( m_textCtrl );
m_sdbSizer1OK->SetDefault();
}

View File

@ -34,7 +34,8 @@ WX_UNIT_ENTRY_DIALOG::WX_UNIT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxStr
{
m_label->SetLabel( aLabel );
m_unit_binder.SetValue( aDefaultValue );
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
}

View File

@ -54,7 +54,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle,
// columns, different column names, and column widths.
m_hash_key = TO_UTF8( aTitle );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// this line fixes an issue on Linux Ubuntu using Unity (dialog not shown),
// and works fine on all systems

View File

@ -42,7 +42,7 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle,
Center();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
reload();

View File

@ -91,7 +91,7 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aSho
m_buttonsSizer->Add( sdbSizer, 1, 0, 5 );
mainSizer->Add( m_buttonsSizer, 0, wxALL|wxEXPAND, 5 );
sdbSizerOK->SetDefault();
SetupStandardButtons();
// We normally save the dialog size and position based on its class-name. This class
// substitutes the title so that each distinctly-titled dialog can have its own saved

View File

@ -25,8 +25,8 @@
#include <wx/dcclient.h>
#include <wx/settings.h>
WX_PANEL::WX_PANEL( wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style, const wxString& name ) :
WX_PANEL::WX_PANEL( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) :
wxPanel( parent, id, pos, size, style, name ),
m_leftBorder( false ),
m_rightBorder( false ),

View File

@ -52,6 +52,8 @@ DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
Init( );
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
Center();
}
@ -59,7 +61,6 @@ DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
void DIALOG_CONFIG_EQUFILES::Init()
{
m_sdbSizerOK->SetDefault();
m_ListChanged = false;
PROJECT_FILE& project = Prj().GetProjectFile();
@ -90,7 +91,6 @@ void DIALOG_CONFIG_EQUFILES::Init()
}
m_gridEnvVars->AutoSizeColumns();
}

View File

@ -87,13 +87,8 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& messag
m_MessageWindow->SetLabel( _( "Annotation Messages:" ) );
m_MessageWindow->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Annotate" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Annotate" ) },
{ wxID_CANCEL, _( "Close" ) } } );
InitValues();
Layout();
@ -215,6 +210,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
m_Parent->GetCanvas()->Refresh();
m_btnClear->Enable();
m_sdbSizer1Cancel->SetDefault();
// Don't close dialog if there are things the user needs to address

View File

@ -130,12 +130,10 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
m_checkBoxShowConsole->Show( false );
#endif
m_sdbSizerOK->SetLabel( _( "Generate" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sdbSizer->Layout();
SetupStandardButtons( { { wxID_OK, _( "Generate" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetInitialFocus( m_lbGenerators );
m_sdbSizerOK->SetDefault();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -180,8 +180,9 @@ DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER( SCH_EDIT_FRAME* aParent )
m_bus_edit->SetHint( _( "Bus Alias Name" ) );
m_signal_edit->SetHint( _( "Net or Bus Name" ) );
SetupStandardButtons();
finishDialogSettings();
okButton->SetDefault();
}

View File

@ -151,16 +151,10 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
// because the update and change versions of this dialog have different controls.
m_hash_key = TO_UTF8( GetTitle() );
// Ensure m_closeButton (with id = wxID_CANCEL) has the right label
// (to fix automatic renaming of button label )
m_sdbSizerCancel->SetLabel( _( "Close" ) );
wxString okLabel = m_mode == MODE::CHANGE ? _( "Change" ) : _( "Update" );
if( m_mode == MODE::CHANGE )
m_sdbSizerOK->SetLabel( _( "Change" ) );
else
m_sdbSizerOK->SetLabel( _( "Update" ) );
m_sdbSizerOK->SetDefault();
SetupStandardButtons( { { wxID_OK, okLabel },
{ wxID_CANCEL, _( "Close" ) } } );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -197,7 +197,7 @@ DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxStr
}
SetInitialFocus( m_tree->GetFocusTarget() );
okButton->SetDefault();
SetupStandardButtons();
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
Bind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this, m_dbl_click_timer->GetId() );

View File

@ -73,13 +73,8 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
syncCheckboxes();
updateDisplayedCounts();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Run ERC" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Run ERC" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_errorsBadge->SetMaximumNumber( 999 );
m_warningsBadge->SetMaximumNumber( 999 );

View File

@ -183,8 +183,6 @@ void DIALOG_FIELD_PROPERTIES::init()
m_TextCtrl->Enable( true );
}
m_sdbSizerButtonsOK->SetDefault();
GetSizer()->SetSizeHints( this );
// Adjust the height of the scintilla text editor after the first layout
@ -200,6 +198,8 @@ void DIALOG_FIELD_PROPERTIES::init()
m_StyledTextCtrl->SetUseHorizontalScrollBar( false );
}
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}

View File

@ -123,7 +123,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_
m_dotColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_dotColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_sdbSizerButtonsOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -33,8 +33,6 @@ DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent,
m_diameter( aParent, m_staticTextDiameter, m_textCtrlDiameter,
m_staticTextDiameterUnits, true )
{
m_sdbSizerApply->SetLabel( _( "Default" ) );
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() );
@ -42,7 +40,7 @@ DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent,
SetInitialFocus( m_textCtrlDiameter );
m_sdbSizerOK->SetDefault();
SetupStandardButtons( { { wxID_APPLY, _( "Default" ) } } );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -179,7 +179,7 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_top ) );
}
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
// various versions have different controls so we want to store sizes for each version.

View File

@ -509,18 +509,15 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
GetSizer()->SetSizeHints(this);
Centre();
SetupStandardButtons();
if( !parent->IsSymbolEditable() || parent->IsSymbolAlias() )
{
m_ButtonsCancel->SetDefault();
m_ButtonsOK->SetLabel( _( "Read Only" ) );
m_ButtonsOK->Enable( false );
}
else
{
m_ButtonsOK->SetDefault();
}
m_ButtonsOK->SetDefault();
m_initialized = true;
m_modified = false;
m_width = 0;

View File

@ -52,8 +52,7 @@ DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL( EDA_DRAW_FRAME* aParent,
// initial focus should be on first editable field.
m_textName->SetFocus();
// What happens when user presses "Enter"? OK button! OK?
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -42,16 +42,14 @@ DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aPa
// Required under wxGTK if we want to dismiss the dialog with the ESC key
SetFocus();
SetupStandardButtons();
if( !aParent->IsSymbolEditable() || aParent->IsSymbolAlias() )
{
m_sdbSizerCancel->SetDefault();
m_sdbSizerOK->SetLabel( _( "Read Only" ) );
m_sdbSizerOK->Enable( false );
}
else
{
m_sdbSizerOK->SetDefault();
}
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -86,16 +86,14 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
m_deleteFilterButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_editFilterButton->SetBitmap( KiBitmap( BITMAPS::small_edit ) );
SetupStandardButtons();
if( aParent->IsSymbolFromLegacyLibrary() && !aParent->IsSymbolFromSchematic() )
{
m_stdSizerButtonCancel->SetDefault();
m_stdSizerButtonOK->SetLabel( _( "Read Only" ) );
m_stdSizerButtonOK->Enable( false );
}
else
{
m_stdSizerButtonOK->SetDefault();
}
#ifndef KICAD_SPICE
m_spiceFieldsButton->Hide();

View File

@ -58,17 +58,6 @@ DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aPare
SetInitialFocus( m_TextCtrl );
m_StyledTextCtrl->Show( false );
if( !aParent->IsSymbolEditable() || aParent->IsSymbolAlias() )
{
m_sdbSizerButtonsCancel->SetDefault();
m_sdbSizerButtonsOK->SetLabel( _( "Read Only" ) );
m_sdbSizerButtonsOK->Enable( false );
}
else
{
m_sdbSizerButtonsOK->SetDefault();
}
m_separator1->SetIsSeparator();
m_horizontal->SetIsCheckButton();
@ -114,6 +103,15 @@ DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aPare
m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXT_PROPERTIES::onVAlignButton, this );
m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXT_PROPERTIES::onVAlignButton, this );
SetupStandardButtons();
if( !aParent->IsSymbolEditable() || aParent->IsSymbolAlias() )
{
m_sdbSizerButtonsCancel->SetDefault();
m_sdbSizerButtonsOK->SetLabel( _( "Read Only" ) );
m_sdbSizerButtonsOK->Enable( false );
}
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}

View File

@ -38,8 +38,6 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME
m_strokeItems( aItems ),
m_width( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits, true )
{
m_sdbSizerApply->SetLabel( _( "Default" ) );
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() );
@ -52,7 +50,7 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME
m_typeCombo->Append( DEFAULT_STYLE );
m_sdbSizerOK->SetDefault();
SetupStandardButtons( { { wxID_APPLY, _( "Default" ) } } );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -264,12 +264,8 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
InstallPageSpice();
InstallCustomPages();
// We use a sdbSizer here to get the order right, which is platform-dependent
m_sdbSizer2OK->SetLabel( _( "Export Netlist" ) );
m_sdbSizer2Cancel->SetLabel( _( "Close" ) );
m_buttonSizer->Layout();
m_sdbSizer2OK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Export Netlist" ) },
{ wxID_CANCEL, _( "Close" ) } } );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
@ -647,7 +643,7 @@ NETLIST_DIALOG_ADD_GENERATOR::NETLIST_DIALOG_ADD_GENERATOR( NETLIST_DIALOG* pare
NETLIST_DIALOG_ADD_GENERATOR_BASE( parent )
{
m_Parent = parent;
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
}

View File

@ -202,8 +202,8 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN
{
m_alternatesTurndown->Collapse();
m_alternatesTurndown->Disable();
m_alternatesTurndown->SetToolTip(
_( "Alternate pin assignments are not available for De Morgan symbols." ) );
m_alternatesTurndown->SetToolTip( _( "Alternate pin assignments are not available for "
"De Morgan symbols." ) );
}
// Set special attributes
@ -223,7 +223,7 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN
m_deleteAlternate->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_addAlternate->GetParent()->Layout();
m_sdbSizerButtonsOK->SetDefault();
SetupStandardButtons();
SetInitialFocus( m_textPinName );
// Now all widgets have the size fixed, call FinishDialogSettings

View File

@ -106,14 +106,10 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent )
m_MessagesBox->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Plot All Pages" ) );
m_sdbSizer1Apply->SetLabel( _( "Plot Current Page" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
SetupStandardButtons( { { wxID_OK, _( "Plot All Pages" ) },
{ wxID_APPLY, _( "Plot Current Page" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_sdbSizer1OK->SetDefault();
initDlg();
// Now all widgets have the size fixed, call FinishDialogSettings

View File

@ -141,20 +141,15 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
{
wxASSERT( aParent );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Print" ) );
m_sdbSizer1Apply->SetLabel( _( "Preview" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
SetupStandardButtons( { { wxID_OK, _( "Print" ) },
{ wxID_APPLY, _( "Print Preview" ) },
{ wxID_CANCEL, _( "Close" ) } } );
#ifdef __WXMAC__
// Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_sdbSizer1Apply->Hide();
#endif
m_sdbSizer1OK->SetDefault(); // on linux, this is inadequate to determine
// what ENTER does. Must also SetFocus().
m_sdbSizer1OK->SetFocus();
finishDialogSettings();

View File

@ -96,8 +96,6 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( wxWindow* aParent,
m_previewNewWidget = new SYMBOL_PREVIEW_WIDGET( m_previewNewPanel, Kiway(), aGalBackEndType );
m_SizerNewPanel->Add( m_previewNewWidget, 1, wxEXPAND | wxALL, 5 );
m_stdButtonsOK->SetDefault();
// Set the info message, customized to include the proper suffix.
wxString info =
_( "This schematic was made using older symbol libraries which may break the "
@ -145,11 +143,14 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( wxWindow* aParent,
// Make sure the HTML window is large enough. Some fun size juggling and
// fudge factors here but it does seem to work pretty reliably.
auto info_size = m_htmlPrompt->GetTextExtent( info );
auto prompt_size = m_htmlPrompt->GetSize();
auto font_size = m_htmlPrompt->GetTextExtent( "X" );
auto approx_info_height = ( 2 * info_size.x / prompt_size.x ) * font_size.y;
wxSize info_size = m_htmlPrompt->GetTextExtent( info );
wxSize prompt_size = m_htmlPrompt->GetSize();
wxSize font_size = m_htmlPrompt->GetTextExtent( "X" );
int approx_info_height = ( 2 * info_size.x / prompt_size.x ) * font_size.y;
m_htmlPrompt->SetSizeHints( 2 * prompt_size.x / 3, approx_info_height );
SetupStandardButtons();
Layout();
GetSizer()->SetSizeHints( this );
setSizeInDU( 480, 360 );

View File

@ -40,10 +40,7 @@ DIALOG_SCH_IMPORT_SETTINGS::DIALOG_SCH_IMPORT_SETTINGS( wxWindow* aParent, SCH_E
{
m_browseButton->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_sdbSizer1OK->SetLabel( _( "Import Settings" ) );
m_buttonsSizer->Layout();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Import Settings" ) } } );
}

View File

@ -51,7 +51,8 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
// Required under wxGTK if we want to dismiss the dialog with the ESC key
SetFocus();
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -54,7 +54,7 @@ DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES( SCH_EDIT_FRAME* parent
m_choiceConnectionType->SetSelection( 0 );
SetInitialFocus( m_comboName );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Set invalid label characters list:
SCH_NETNAME_VALIDATOR validator( true );

View File

@ -73,7 +73,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
}
wxToolTip::Enable( true );
m_stdDialogButtonSizerOK->SetDefault();
SetupStandardButtons();
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );

View File

@ -98,7 +98,7 @@ DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS( wxWindow* aParent,
if( !dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( aSettings.get() ) )
m_compatibilityMode->Show( false );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
updateNetlistOpts();
}

View File

@ -194,7 +194,7 @@ void DIALOG_SPICE_MODEL::Init()
m_pwlTimeCol = m_pwlValList->AppendColumn( "Time [s]", wxLIST_FORMAT_LEFT, 100 );
m_pwlValueCol = m_pwlValList->AppendColumn( "Value [V/A]", wxLIST_FORMAT_LEFT, 100 );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
m_staticTextF1->SetLabel( wxS( "f" ) );
m_staticTextP1->SetLabel( wxS( "p" ) );

View File

@ -810,7 +810,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
m_grid->SetGridCursor( 0, 1 );
SetInitialFocus( m_grid );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
SetSize( defaultDlgSize );

View File

@ -353,7 +353,7 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
m_pinGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
wxToolTip::Enable( true );
m_stdDialogButtonSizerOK->SetDefault();
SetupStandardButtons();
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );

View File

@ -81,7 +81,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_TEX
m_separator3->SetIsSeparator();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
Layout();
m_textCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_TEXT_PROPERTIES::onScintillaCharAdded, this );

View File

@ -61,13 +61,9 @@ DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent )
m_cbUpdateValues->SetValue( s_savedDialogState.UpdateValues );
m_cbUpdateNetNames->SetValue( s_savedDialogState.UpdateNetNames );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizerOK->SetLabel( _( "Update Schematic" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sdbSizer->Layout();
SetupStandardButtons( { { wxID_OK, _( "Update Schematic" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_sdbSizerOK->SetDefault();
finishDialogSettings();
}

View File

@ -60,7 +60,7 @@ DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aPa
m_resetFieldEffects->SetValue( g_resetLibFieldEffects );
m_resetFieldPositions->SetValue( g_resetLibFieldPositions );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -123,6 +123,8 @@ public:
return m_units;
}
void SetupStandardButtons( std::map<int, wxString> aLabels = {} );
static bool IsCtrl( int aChar, const wxKeyEvent& e )
{
return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&

View File

@ -126,14 +126,9 @@ DIALOG_PCM::DIALOG_PCM( wxWindow* parent ) : DIALOG_PCM_BASE( parent )
m_dialogNotebook->SetSelection( 0 );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Close" ) );
m_sdbSizer1Cancel->SetLabel( _( "Discard Pending Changes" ) );
m_sdbSizer1Apply->SetLabel( _( "Apply Pending Changes" ) );
m_sdbSizer1->Layout();
SetDefaultItem( m_sdbSizer1OK );
SetupStandardButtons( { { wxID_OK, _( "Close" ) },
{ wxID_APPLY, _( "Apply Pending Changes" ) },
{ wxID_CANCEL, _( "Discard Pending Changes" ) } } );
Bind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );

View File

@ -35,7 +35,7 @@ DIALOG_REGULATOR_FORM::DIALOG_REGULATOR_FORM( PANEL_REGULATOR* parent, const wxS
m_textCtrlName->Enable( aRegName.IsEmpty() );
UpdateDialog();
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -27,7 +27,7 @@ DIALOG_DIELECTRIC_MATERIAL::DIALOG_DIELECTRIC_MATERIAL( wxWindow* aParent,
m_materialList( aMaterialList )
{
initMaterialList();
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
}
DIALOG_DIELECTRIC_MATERIAL::~DIALOG_DIELECTRIC_MATERIAL()

View File

@ -109,6 +109,8 @@ DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT( PCB_BASE_FRAME* aParent,
aAdapter->FinishTreeInitialization();
SetupStandardButtons();
Bind( wxEVT_TIMER, &DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer, this, m_dbl_click_timer->GetId() );
Bind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_FOOTPRINT::OnComponentPreselected, this );
Bind( SYMBOL_SELECTED, &DIALOG_CHOOSE_FOOTPRINT::OnComponentSelected, this );
@ -139,7 +141,6 @@ DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT( PCB_BASE_FRAME* aParent,
SetSize( wxSize( w, h ) );
SetInitialFocus( m_tree->GetFocusTarget() );
okButton->SetDefault();
}

View File

@ -41,11 +41,11 @@ DIALOG_CLEANUP_GRAPHICS::DIALOG_CLEANUP_GRAPHICS( PCB_BASE_FRAME* aParent,
m_changesTreeModel->SetSeverities( RPT_SEVERITY_ACTION );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizerOK->SetLabel( aIsFootprintEditor ? _( "Update Footprint" ) : _( "Update PCB" ) );
if( aIsFootprintEditor )
SetupStandardButtons( { { wxID_OK, _( "Update Footprint" ) } } );
else
SetupStandardButtons( { { wxID_OK, _( "Update PCB" ) } } );
m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints(this);
Centre();
}

View File

@ -50,11 +50,8 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
m_changesTreeModel->SetSeverities( RPT_SEVERITY_ACTION );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizerOK->SetLabel( _( "Update PCB" ) );
SetupStandardButtons( { { wxID_OK, _( "Update PCB" ) } } );
m_sdbSizerOK->SetDefault();
m_sdbSizer->SetSizeHints( this );
finishDialogSettings();

View File

@ -37,7 +37,7 @@ DIALOG_CONSTRAINTS_REPORTER::DIALOG_CONSTRAINTS_REPORTER( PCB_EDIT_FRAME* aParen
void DIALOG_CONSTRAINTS_REPORTER::FinishInitialization()
{
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -191,7 +191,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
m_netSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
m_sdbSizerOK->SetDefault();
m_ShowNetNameFilter->SetHint( _( "Filter" ) );
m_cbRemoveIslands->Bind( wxEVT_CHOICE,
@ -205,6 +204,8 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
m_islandThresholdUnits->Enable( val );
} );
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -237,7 +237,7 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent,
setControlEnablement();
calculateCircularArrayProperties();
m_stdButtonsOK->SetDefault();
SetupStandardButtons();
Fit();
SetMinSize( GetSize() );
}

View File

@ -117,8 +117,6 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_cbTextOrientation->SetString( i, item );
}
m_sdbSizerOK->SetDefault();
m_cbOverrideValue->Bind( wxEVT_CHECKBOX,
[&]( wxCommandEvent& evt )
{
@ -163,6 +161,8 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_cbTextOrientation->Enable( !m_cbKeepAligned->GetValue() );
} );
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -92,12 +92,8 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
if( Kiface().IsSingle() )
m_cbTestFootprints->Hide();
// We use a sdbSizer here to get the order right, which is platform-dependent
m_sdbSizerOK->SetLabel( _( "Run DRC" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sizerButtons->Layout();
m_sdbSizerOK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Run DRC" ) },
{ wxID_CANCEL, _( "Close" ) } } );
initValues();
syncCheckboxes();

View File

@ -155,16 +155,10 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
// because the update and change versions of this dialog have different controls.
m_hash_key = TO_UTF8( GetTitle() );
// Ensure m_closeButton (with id = wxID_CANCEL) has the right label
// (to fix automatic renaming of button label )
m_sdbSizerCancel->SetLabel( _( "Close" ) );
wxString okLabel = m_updateMode ? _( "Update" ) : _( "Change" );
if( m_updateMode )
m_sdbSizerOK->SetLabel( _( "Update" ) );
else
m_sdbSizerOK->SetLabel( _( "Change" ) );
m_sdbSizerOK->SetDefault();
SetupStandardButtons( { { wxID_OK, okLabel },
{ wxID_CANCEL, _( "Close" ) } } );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -81,7 +81,7 @@ public:
m_IDF_Yref->Enable( true );
}
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -91,11 +91,8 @@ DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG( PCB_EDIT_FRAME* aParent, BOARD* aBoard ) :
initDialog();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Export" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
SetupStandardButtons( { { wxID_OK, _( "Export" ) },
{ wxID_CANCEL, _( "Close" ) } } );
finishDialogSettings();
}

View File

@ -83,7 +83,8 @@ public:
tmpStr = wxT( "" );
tmpStr << m_YRef;
m_VRML_Yref->SetValue( tmpStr );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -34,7 +34,8 @@ DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION( PCB_BASE_FRAME* aParent, OPTIO
// Update "All Items" checkbox based on how many items are currently checked
m_All_Items->Set3StateValue( GetSuggestedAllItemsState() );
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
SetFocus();
GetSizer()->SetSizeHints( this );
Centre();

View File

@ -45,13 +45,8 @@ DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER( FOOTPRINT_EDIT_FRAME* aParen
m_markersTreeModel->SetSeverities( -1 );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizerOK->SetLabel( _( "Run Checks" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sdbSizerOK->SetDefault();
m_sdbSizer->Layout();
SetupStandardButtons( { { wxID_OK, _( "Run Checks" ) },
{ wxID_CANCEL, _( "Close" ) } } );
syncCheckboxes();

View File

@ -140,14 +140,14 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_solderPasteRatio.SetUnits( EDA_UNITS::PERCENT );
m_solderPasteRatio.SetNegativeZero();
m_sdbSizerStdButtonsOK->SetDefault();
m_orientValue = 0;
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
SetupStandardButtons();
finishDialogSettings();
m_initialized = true;
}

View File

@ -131,12 +131,12 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
m_solderPasteRatio.SetUnits( EDA_UNITS::PERCENT );
m_solderPasteRatio.SetNegativeZero();
m_sdbSizerStdButtonsOK->SetDefault();
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
SetupStandardButtons();
// wxFormBuilder doesn't include this event...
m_itemsGrid->Connect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnGridCellChanging ),

View File

@ -59,7 +59,7 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
size.y = cfg->m_FootprintWizardList.height;
SetSize( size );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
Center();

View File

@ -96,7 +96,7 @@ public:
// initial focus on the grid please.
SetInitialFocus( m_grid );
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
}
~DIALOG_FP_PLUGIN_OPTIONS() override

View File

@ -72,14 +72,12 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, wxWindow* aPar
m_board = m_pcbEditFrame->GetBoard();
m_plotOpts = m_pcbEditFrame->GetPlotSettings();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizerOK->SetLabel( _( "Generate Drill File" ) );
m_sdbSizerApply->SetLabel( _( "Generate Map File" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
SetupStandardButtons( { { wxID_OK, _( "Generate Drill File" ) },
{ wxID_APPLY, _( "Generate Map File" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_buttonsSizer->Layout();
m_sdbSizerOK->SetDefault();
SetReturnCode( 1 );
initDialog();
GetSizer()->SetSizeHints( this );

View File

@ -43,7 +43,6 @@ public:
DIALOG_GET_FOOTPRINT_BY_NAME( PCB_BASE_FRAME* aParent, wxArrayString& aFpList ) :
DIALOG_GET_FOOTPRINT_BY_NAME_BASE( aParent )
{
m_sdbSizerOK->SetDefault();
m_choiceFpList->Append( aFpList );
m_multipleHint->SetFont( KIUI::GetInfoFont( this ).Italic() );
@ -51,6 +50,8 @@ public:
// Hide help string until someone implements successive placement (#2227)
m_multipleHint->Show( false );
SetupStandardButtons();
// Dialog should not shrink beyond it's minimal size.
GetSizer()->SetSizeHints( this );
}

View File

@ -49,7 +49,9 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) :
m_footprintFilterUnlocked->Enable( m_delFootprints->GetValue() );
m_drawingFilterLocked->Enable( m_delDrawings->GetValue() );
m_drawingFilterUnlocked->Enable( m_delDrawings->GetValue() );
m_sdbSizer1OK->SetDefault();
SetupStandardButtons();
SetFocus();
GetSizer()->SetSizeHints( this );
Centre();

View File

@ -141,7 +141,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
m_grid->SetCellHighlightPenWidth( 0 );
m_grid->SetDefaultCellFont( KIUI::GetInfoFont( this ) );
m_sdbSizerButtonsOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -135,7 +135,8 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
buildNetclassesGrid();
m_netclassGrid->SetCellHighlightPenWidth( 0 );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
m_netFilter->Connect( NET_SELECTED,
wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ),

View File

@ -146,7 +146,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
SetInitialFocus( m_startXCtrl );
m_StandardButtonsSizerOK->SetDefault();
SetupStandardButtons();
}

View File

@ -50,7 +50,7 @@ DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
for( BOARD_ITEM* item : m_group->GetItems() )
m_membersList->Append( item->GetSelectMenuText( m_brdEditor->GetUserUnits() ), item );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
SetInitialFocus( m_nameCtrl );

View File

@ -42,12 +42,6 @@ DIALOG_IMPORT_SETTINGS::DIALOG_IMPORT_SETTINGS( wxWindow* aParent, PCB_EDIT_FRAM
m_browseButton->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
// Button created in wxFormBuilder is an "OK" button. Change label here
m_sdbSizer1OK->SetLabel( _( "Import Settings" ) );
// Disable "Import Settings" button until user selects at least one import option
m_sdbSizer1OK->Enable( false );
// Make sure "Select All" button is big enough to hold "Deselect All"
m_selectAllButton->SetLabel( _( "Deselect All" ) ); // Change the text temporarily
sizeNeeded = m_selectAllButton->GetBestSize(); // Get control to tell us the width required
@ -55,9 +49,12 @@ DIALOG_IMPORT_SETTINGS::DIALOG_IMPORT_SETTINGS( wxWindow* aParent, PCB_EDIT_FRAM
sizeNeeded.y = m_selectAllButton->GetSize().y; // Keep the height unchanged
m_selectAllButton->SetMinSize( sizeNeeded ); // Set control to the required size
m_buttonsSizer->Layout();
SetupStandardButtons( { { wxID_OK, _( "Import Settings" ) } } );
m_sdbSizer1OK->SetDefault();
// Disable "Import Settings" button until user selects at least one import option
m_sdbSizer1OK->Enable( false );
m_buttonsSizer->Layout();
m_showSelectAllOnBtn = true; // Store state to toggle message/usage of "Select All" button
}

View File

@ -299,7 +299,7 @@ DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS( wxWindow* aParent,
// Auto select the first item to improve ease-of-use
m_kicad_layers_list->SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
Fit();
finishDialogSettings();

View File

@ -82,7 +82,7 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, wxPoint& aTransla
m_rotate.SetValue( m_options.entryRotation );
m_anchorOptions->SetSelection( std::min( m_options.entryAnchorSelection, m_menuIDs.size() ) );
m_stdButtonsOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -881,7 +881,8 @@ DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR( PCB_EDIT_FRAME* aParent,
m_renameNet->SetBitmap( KiBitmap( BITMAPS::small_edit ) );
m_deleteNet->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
m_renameNet->Disable();
m_deleteNet->Disable();

View File

@ -78,13 +78,9 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullF
m_MessageWindow->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter );
m_MessageWindow->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Update PCB" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_buttonsSizer->Layout();
SetupStandardButtons( { { wxID_OK, _( "Update PCB" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_sdbSizer1OK->SetDefault();
finishDialogSettings();
m_initialized = true;

View File

@ -83,7 +83,7 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*
m_settings = *aSettings;
m_settings.SetupLayersList( m_layers, m_parent, false );
m_sdbSizerButtonsOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -62,7 +62,7 @@ DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES( wxWindow* aP
TransferDataToWindow();
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}
@ -248,7 +248,8 @@ DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS( wxWindow* aPar
TransferDataToWindow();
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
m_gridCornersList->Connect( wxEVT_GRID_CELL_CHANGING,
@ -570,7 +571,8 @@ DIALOG_PAD_PRIMITIVES_TRANSFORM::DIALOG_PAD_PRIMITIVES_TRANSFORM( wxWindow* aPar
m_spinCtrlDuplicateCount->Show( false );
}
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
}

View File

@ -225,7 +225,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
prepareCanvas();
SetInitialFocus( m_padNumCtrl );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
m_canUpdate = true;
m_padNetSelector->Connect( NET_SELECTED,

View File

@ -63,14 +63,9 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
init_Dialog();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Plot" ) );
m_sdbSizer1Apply->SetLabel( _( "Generate Drill Files..." ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sizerButtons->Layout();
m_sdbSizer1OK->SetDefault();
SetupStandardButtons( { { wxID_OK, _( "Plot" ) },
{ wxID_APPLY, _( "Generate Drill Files..." ) },
{ wxID_CANCEL, _( "Close" ) } } );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );

View File

@ -37,11 +37,11 @@ DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( EDA_DRAW_FRAME
m_viaGap( aParent, m_viaGapLabel, m_viaGapText, m_viaGapUnit ),
m_sizes( aSizes )
{
SetupStandardButtons();
Layout();
GetSizer()->SetSizeHints( this );
Centre();
m_stdButtonsOK->SetDefault();
}

View File

@ -41,11 +41,12 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( EDA_DRAW_F
m_settings( aSettings ),
m_mode( aMode )
{
m_stdButtonsOK->SetDefault();
m_targetLengthText->SetSelection( -1, -1 );
m_targetLengthText->SetFocus();
m_radius.SetUnits( EDA_UNITS::PERCENT );
SetupStandardButtons();
GetSizer()->SetSizeHints(this);
Centre();
}

View File

@ -68,7 +68,7 @@ DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxP
m_xOffset.SetDoubleValue( m_options.entry1 );
m_yOffset.SetDoubleValue( m_options.entry2 );
m_stdButtonsOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -46,18 +46,11 @@ DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES( PCB_BASE_FRAME* aParent
m_Pad_Orient_Filter_CB->SetValue( m_Pad_Orient_Filter );
m_Pad_Type_Filter_CB->SetValue( m_Pad_Type_Filter );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Change Pads on Current Footprint" ) );
SetupStandardButtons( { { wxID_OK, _( "Change Pads on Current Footprint" ) },
{ wxID_APPLY, _( "Change Pads on Identical Footprints" ) } } );
if( aParent->IsType( FRAME_FOOTPRINT_EDITOR ) )
m_sdbSizer1Apply->Show( false );
else
m_sdbSizer1Apply->SetLabel( _( "Change Pads on Identical Footprints" ) );
m_sdbSizer1->Layout();
m_sdbSizer1OK->SetDefault();
finishDialogSettings();
}

View File

@ -78,7 +78,7 @@ DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES( PCB_BASE_FRAME* aParen
bool fpEditorMode = m_parent->IsType( FRAME_FOOTPRINT_EDITOR );
m_zonesettings.SetupLayersList( m_layers, m_parent, true, fpEditorMode );
m_sdbSizerButtonsOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -76,7 +76,7 @@ DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_BASE_EDIT_FRAME* aParent, PCB_LAYER_
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
m_grid->SetCellHighlightROPenWidth( 0 );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
finishDialogSettings();
}

View File

@ -65,7 +65,7 @@ DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES( PCB_EDIT_FRAME* aParent, PCB
m_Size( aParent, m_sizeLabel, m_sizeCtrl, m_sizeUnits ),
m_Thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
{
m_sdbSizerButtsOK->SetDefault();
SetupStandardButtons();
SetInitialFocus( m_sizeCtrl );

View File

@ -163,7 +163,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
// Set font sizes
m_statusLine->SetFont( KIUI::GetInfoFont( this ) );
m_sdbSizerOK->SetDefault();
SetupStandardButtons();
// wxTextCtrls fail to generate wxEVT_CHAR events when the wxTE_MULTILINE flag is set,
// so we have to listen to wxEVT_CHAR_HOOK events instead.

View File

@ -377,7 +377,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
else
SetInitialFocus( m_ViaDiameterCtrl );
m_StdButtonsOK->SetDefault();
SetupStandardButtons();
m_frame->Bind( UNITS_CHANGED, &DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged, this );

View File

@ -41,7 +41,7 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( EDA_DRAW_FRAME* aParent,
m_viaDrill( aParent, m_viaDrillLabel, m_viaDrillText, m_viaDrillUnits, minSize ),
m_settings( aSettings )
{
m_stdButtonsOK->SetDefault();
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();

View File

@ -54,7 +54,6 @@ DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS( PCB_BASE_FRAME* aParent,
m_items( aItems ),
m_commit( aCommit )
{
m_StdButtonsOK->SetDefault();
m_image->SetBitmap( KiBitmap( BITMAPS::pads_remove_unused ) );
// Set keep Through Hole pads on external layers ON by default.
@ -62,6 +61,8 @@ DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS( PCB_BASE_FRAME* aParent,
// is probably not frequent
m_cbPreservePads->SetValue( true );
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}

View File

@ -56,13 +56,9 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
m_messagePanel->GetSizer()->SetSizeHints( this );
m_messagePanel->Layout();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Update PCB" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
SetupStandardButtons( { { wxID_OK, _( "Update PCB" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_sdbSizer1OK->SetDefault();
finishDialogSettings();
m_initialized = true;

Some files were not shown because too many files have changed in this diff Show More