mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 10:20:11 +00:00
Make sure standard OK/Cancel buttons respond to current language.
Fixes https://gitlab.com/kicad/code/kicad/issues/9635
This commit is contained in:
parent
84a9732497
commit
c3552a940a
common
dialog_shim.cpp
dialogs
dialog_color_picker.cppdialog_configure_paths.cppdialog_edit_library_tables.cppdialog_global_lib_table_config.cppdialog_grid_settings.cppdialog_image_editor.cppdialog_locked_items_query.cppdialog_migrate_settings.cppdialog_page_settings.cppdialog_print_generic.cppdialog_text_entry.cppdialog_unit_entry.cppeda_list_dialog.cpphtml_message_box.cpp
widgets
cvpcb/dialogs
eeschema/dialogs
dialog_annotate.cppdialog_bom.cppdialog_bus_manager.cppdialog_change_symbols.cppdialog_choose_symbol.cppdialog_erc.cppdialog_field_properties.cppdialog_global_edit_text_and_graphics.cppdialog_junction_props.cppdialog_label_properties.cppdialog_lib_edit_pin_table.cppdialog_lib_new_symbol.cppdialog_lib_shape_properties.cppdialog_lib_symbol_properties.cppdialog_lib_text_properties.cppdialog_line_wire_bus_properties.cppdialog_netlist.cppdialog_pin_properties.cppdialog_plot_schematic.cppdialog_print_using_printer.cppdialog_rescue_each.cppdialog_sch_import_settings.cppdialog_shape_properties.cppdialog_sheet_pin_properties.cppdialog_sheet_properties.cppdialog_sim_settings.cppdialog_spice_model.cppdialog_symbol_fields_table.cppdialog_symbol_properties.cppdialog_text_properties.cppdialog_update_from_pcb.cppdialog_update_symbol_fields.cpp
include
kicad/pcm/dialogs
pcb_calculator/dialogs
pcbnew
board_stackup_manager
dialogs
dialog_choose_footprint.cppdialog_cleanup_graphics.cppdialog_cleanup_tracks_and_vias.cppdialog_constraints_reporter.cppdialog_copper_zones.cppdialog_create_array.cppdialog_dimension_properties.cppdialog_drc.cppdialog_exchange_footprints.cppdialog_export_idf.cppdialog_export_svg.cppdialog_export_vrml.cppdialog_filter_selection.cppdialog_footprint_checker.cppdialog_footprint_properties.cppdialog_footprint_properties_fp_editor.cppdialog_footprint_wizard_list.cppdialog_fp_plugin_options.cppdialog_gendrill.cppdialog_get_footprint_by_name.hdialog_global_deletion.cppdialog_global_edit_text_and_graphics.cppdialog_global_edit_tracks_and_vias.cppdialog_graphic_item_properties.cppdialog_group_properties.cppdialog_import_settings.cppdialog_imported_layers.cppdialog_move_exact.cppdialog_net_inspector.cppdialog_netlist.cppdialog_non_copper_zones_properties.cppdialog_pad_basicshapes_properties.cppdialog_pad_properties.cppdialog_plot.cppdialog_pns_diff_pair_dimensions.cppdialog_pns_length_tuning_settings.cppdialog_position_relative.cppdialog_push_pad_properties.cppdialog_rule_area_properties.cppdialog_swap_layers.cppdialog_target_properties.cppdialog_text_properties.cppdialog_track_via_properties.cppdialog_track_via_size.cppdialog_unused_pad_layers.cppdialog_update_pcb.cpp
exporters
import_gfx
@ -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 );
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,
|
||||
|
@ -55,7 +55,7 @@ void DIALOG_EDIT_LIBRARY_TABLES::InstallPanel( wxPanel* aPanel )
|
||||
|
||||
mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
sdbSizerOK->SetDefault();
|
||||
SetupStandardButtons();
|
||||
|
||||
finishDialogSettings();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -42,7 +42,7 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle,
|
||||
|
||||
Center();
|
||||
|
||||
m_sdbSizer1OK->SetDefault();
|
||||
SetupStandardButtons();
|
||||
|
||||
reload();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 ),
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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() );
|
||||
|
@ -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 );
|
||||
|
@ -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();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user