Adjust tab ordering in some dialogs
Introduce a shortcut method to set tab ordering and use it in the dialogs that override the tab traversal orders: * Eeschema sheet properties * Pcbnew Move exact * Pcbnew Move relative Also set some initial focus fields in the same dialogs. Tidy a few includes. Fixes: lp:1816009 * https://bugs.launchpad.net/kicad/+bug/1816009
This commit is contained in:
parent
498a566ca3
commit
82734e7116
|
@ -225,6 +225,7 @@ 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
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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] );
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2014-2018 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2014-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
|
||||
|
@ -22,12 +22,18 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <dialog_sch_sheet_props.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <confirm.h>
|
||||
#include <validators.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include <widgets/tab_traversal.h>
|
||||
|
||||
#include <sch_edit_frame.h>
|
||||
|
||||
|
||||
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* parent, SCH_SHEET* aSheet ) :
|
||||
DIALOG_SCH_SHEET_PROPS_BASE( parent ),
|
||||
|
@ -39,6 +45,17 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* parent, SCH_SHEE
|
|||
m_textFileName->SetFocus();
|
||||
m_sdbSizer1OK->SetDefault();
|
||||
|
||||
// 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,
|
||||
} );
|
||||
|
||||
SetInitialFocus( m_textFileName );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef WIDGETS_TAB_TRAVERSAL__H
|
||||
#define WIDGETS_TAB_TRAVERSAL__H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Functions for manipulating tab traversal in forms and dialogs.
|
||||
*/
|
||||
|
||||
#include <wx/window.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace KIUI
|
||||
{
|
||||
|
||||
/**
|
||||
* Set a list of controls to have a defined sequential tab order.
|
||||
*
|
||||
* Each control in the list will come after the previous one. The first control will
|
||||
* keep its current position. The end result will be that the given control
|
||||
* will be sequential when tabbed though.
|
||||
*
|
||||
* This can be slightly clearer than manually calling MoveAfterInTabOrder
|
||||
* on each control in turn.
|
||||
*
|
||||
* @param aControlsInTabOrder list of controls (wxWindows) in desired tab order
|
||||
*/
|
||||
void SetControlsTabOrder( const std::vector<wxWindow*>& aControlsInTabOrder );
|
||||
|
||||
} // namespace KIUI
|
||||
|
||||
#endif // WIDGETS_TAB_TRAVERSAL__H
|
|
@ -22,9 +22,11 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <dialogs/dialog_move_exact.h>
|
||||
|
||||
#include "dialog_move_exact.h"
|
||||
#include <widgets/tab_traversal.h>
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
|
||||
// initialise statics
|
||||
DIALOG_MOVE_EXACT::MOVE_EXACT_OPTIONS DIALOG_MOVE_EXACT::m_options;
|
||||
|
@ -41,8 +43,12 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, wxPoint& aTransla
|
|||
m_rotate( aParent, m_rotLabel, m_rotEntry, m_rotUnit )
|
||||
{
|
||||
// tabbing goes through the entries in sequence
|
||||
m_yEntry->MoveAfterInTabOrder( m_xEntry );
|
||||
m_rotEntry->MoveAfterInTabOrder( m_yEntry );
|
||||
KIUI::SetControlsTabOrder( {
|
||||
m_xEntry,
|
||||
m_yEntry,
|
||||
m_rotEntry,
|
||||
m_anchorOptions,
|
||||
} );
|
||||
|
||||
updateDialogControls( m_options.polarCoords );
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@
|
|||
#include <vector>
|
||||
#include <widgets/unit_binder.h>
|
||||
|
||||
#include <dialog_move_exact_base.h>
|
||||
#include <dialogs/dialog_move_exact_base.h>
|
||||
|
||||
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
|
||||
enum ROTATION_ANCHOR
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
#include "tools/pcb_actions.h"
|
||||
#include <dialogs/dialog_position_relative.h>
|
||||
|
||||
#include "dialog_position_relative.h"
|
||||
#include <tools/pcb_actions.h>
|
||||
|
||||
#include <widgets/tab_traversal.h>
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
|
||||
// initialise statics
|
||||
DIALOG_POSITION_RELATIVE::POSITION_RELATIVE_OPTIONS DIALOG_POSITION_RELATIVE::m_options;
|
||||
|
@ -40,7 +43,12 @@ DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxP
|
|||
m_yOffset( aParent, m_yLabel, m_yEntry, m_yUnit )
|
||||
{
|
||||
// tabbing goes through the entries in sequence
|
||||
m_yEntry->MoveAfterInTabOrder( m_xEntry );
|
||||
KIUI::SetControlsTabOrder( {
|
||||
m_xEntry,
|
||||
m_yEntry,
|
||||
} );
|
||||
|
||||
SetInitialFocus( m_xEntry );
|
||||
|
||||
// and set up the entries according to the saved options
|
||||
m_polarCoords->SetValue( m_options.polarCoords );
|
||||
|
|
Loading…
Reference in New Issue