Change OK/Cancel to MSW order and move some other dialogs to new system.

(There's no point in following the OSX OK/Cancel order as you can't
tab to buttons on OSX anyway.)
This commit is contained in:
Jeff Young 2019-08-26 18:36:35 +01:00
parent 6b6e9eddee
commit bc0e67579c
7 changed files with 38 additions and 64 deletions

View File

@ -201,7 +201,6 @@ set( COMMON_WIDGET_SRCS
widgets/paged_dialog.cpp
widgets/progress_reporter.cpp
widgets/stepped_slider.cpp
widgets/tab_traversal.cpp
widgets/text_ctrl_eval.cpp
widgets/two_column_tree_list.cpp
widgets/ui_common.cpp

View File

@ -1,33 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <widgets/tab_traversal.h>
void KIUI::SetControlsTabOrder( const std::vector<wxWindow*>& aControlsInTabOrder )
{
for( unsigned i = 1; i < aControlsInTabOrder.size(); ++i )
{
aControlsInTabOrder[i]->MoveAfterInTabOrder( aControlsInTabOrder[i - 1] );
}
}

View File

@ -62,7 +62,7 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
// implementation on MSW
m_tabOrder = {
m_tabOrder = {
m_textPinName,
m_textPinNumber,
m_choiceElectricalType,
@ -76,8 +76,8 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin
m_checkApplyToAllParts,
m_checkApplyToAllConversions,
m_checkShow,
m_sdbSizerButtonsCancel,
m_sdbSizerButtonsOK
m_sdbSizerButtonsOK,
m_sdbSizerButtonsCancel
};
m_sdbSizerButtonsOK->SetDefault();

View File

@ -45,13 +45,17 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* parent, SCH_SHEE
m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
// Normally, the file and sheet name are the "main" edited fields so put them first
KIUI::SetControlsTabOrder( {
m_textFileName,
m_textSheetName,
m_filenameSizeCtrl,
m_sheetnameSizeCtrl,
} );
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
// implementation on MSW
m_tabOrder = {
m_textFileName,
m_browseButton,
m_textSheetName,
m_filenameSizeCtrl,
m_sheetnameSizeCtrl,
m_sdbSizer1OK,
m_sdbSizer1Cancel
};
SetInitialFocus( m_textFileName );

View File

@ -23,9 +23,7 @@
*/
#include <dialogs/dialog_move_exact.h>
#include <widgets/tab_traversal.h>
#include <pcb_edit_frame.h>
// initialise statics
@ -44,13 +42,16 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, wxPoint& aTransla
m_moveY( aParent, m_yLabel, m_yEntry, m_yUnit ),
m_rotate( aParent, m_rotLabel, m_rotEntry, m_rotUnit )
{
// tabbing goes through the entries in sequence
KIUI::SetControlsTabOrder( {
m_xEntry,
m_yEntry,
m_rotEntry,
m_anchorOptions,
} );
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
// implementation on MSW
m_tabOrder = {
m_xEntry,
m_yEntry,
m_rotEntry,
m_anchorOptions,
m_stdButtonsOK,
m_stdButtonsCancel
};
updateDialogControls( m_options.polarCoords );

View File

@ -22,11 +22,8 @@
*/
#include <dialogs/dialog_position_relative.h>
#include <tools/pcb_actions.h>
#include <widgets/tab_traversal.h>
#include <pcb_edit_frame.h>
// initialise statics
@ -42,11 +39,14 @@ DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxP
m_xOffset( aParent, m_xLabel, m_xEntry, m_xUnit ),
m_yOffset( aParent, m_yLabel, m_yEntry, m_yUnit )
{
// tabbing goes through the entries in sequence
KIUI::SetControlsTabOrder( {
m_xEntry,
m_yEntry,
} );
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
// implementation on MSW
m_tabOrder = {
m_xEntry,
m_yEntry,
m_stdButtonsOK,
m_stdButtonsCancel
};
SetInitialFocus( m_xEntry );

View File

@ -142,8 +142,9 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
m_sdbSizerOK->SetDefault();
// Tab down the left side first
KIUI::SetControlsTabOrder( {
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
// implementation on MSW
m_tabOrder = {
m_LayerLabel,
m_LayerSelectionCtrl,
m_SizeXCtrl,
@ -157,7 +158,9 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
m_OrientCtrl,
m_Mirrored,
m_KeepUpright,
} );
m_sdbSizerOK,
m_sdbSizerCancel
};
// 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.