From bc0e67579c4759f5baf24d16e00841fe8550f62c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 26 Aug 2019 18:36:35 +0100 Subject: [PATCH] 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.) --- common/CMakeLists.txt | 1 - common/widgets/tab_traversal.cpp | 33 --------------------- eeschema/dialogs/dialog_lib_edit_pin.cpp | 6 ++-- eeschema/dialogs/dialog_sch_sheet_props.cpp | 18 ++++++----- pcbnew/dialogs/dialog_move_exact.cpp | 19 ++++++------ pcbnew/dialogs/dialog_position_relative.cpp | 16 +++++----- pcbnew/dialogs/dialog_text_properties.cpp | 9 ++++-- 7 files changed, 38 insertions(+), 64 deletions(-) delete mode 100644 common/widgets/tab_traversal.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 1c8c76802d..84a4cefd79 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -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 diff --git a/common/widgets/tab_traversal.cpp b/common/widgets/tab_traversal.cpp deleted file mode 100644 index deef3080b4..0000000000 --- a/common/widgets/tab_traversal.cpp +++ /dev/null @@ -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 - - -void KIUI::SetControlsTabOrder( const std::vector& aControlsInTabOrder ) -{ - for( unsigned i = 1; i < aControlsInTabOrder.size(); ++i ) - { - aControlsInTabOrder[i]->MoveAfterInTabOrder( aControlsInTabOrder[i - 1] ); - } -} diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp index f931c6190d..5e0cb4924a 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp @@ -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(); diff --git a/eeschema/dialogs/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp index be39acaef5..a1c4d2f0c3 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props.cpp +++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp @@ -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 ); diff --git a/pcbnew/dialogs/dialog_move_exact.cpp b/pcbnew/dialogs/dialog_move_exact.cpp index e92499dae8..36305b5866 100644 --- a/pcbnew/dialogs/dialog_move_exact.cpp +++ b/pcbnew/dialogs/dialog_move_exact.cpp @@ -23,9 +23,7 @@ */ #include - #include - #include // 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 ); diff --git a/pcbnew/dialogs/dialog_position_relative.cpp b/pcbnew/dialogs/dialog_position_relative.cpp index de49dd3d6c..f70ab1795f 100644 --- a/pcbnew/dialogs/dialog_position_relative.cpp +++ b/pcbnew/dialogs/dialog_position_relative.cpp @@ -22,11 +22,8 @@ */ #include - #include - #include - #include // 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 ); diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 63cc726ba7..efa5db7764 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -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.