MACOS Setfocus and CancelButtonIssue moved into dialog_shim.

Setfocus now works on macos dialogs by setting DLGSHIM_USE_SETFOCUS.
This option is only enabled __WXMAC__ is defined.

FixOSXCancelButtonIssue() is now called inside DIALOG_SHIM::SHOW.
All other calls from within the dialogs were removed.
This commit is contained in:
Diogo Condeco 2017-01-27 20:31:35 +00:00 committed by Maciej Suminski
parent 019b949646
commit 75ffcbcef5
42 changed files with 10 additions and 73 deletions

View File

@ -170,6 +170,9 @@ bool DIALOG_SHIM::Show( bool show )
ret = wxDialog::Show( show );
}
FixOSXCancelButtonIssue();
return ret;
}

View File

@ -237,8 +237,6 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
m_checkBoxShowConsole->Show( true );
#endif
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -49,9 +49,6 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRA
initDlg();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -220,8 +220,6 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
wxToolTip::Enable( true );
stdDialogButtonSizerOK->SetDefault();
FixOSXCancelButtonIssue();
Fit();
}

View File

@ -110,8 +110,6 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_CurrentText = aTextItem;
InitDialog();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -205,8 +205,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
stdDialogButtonSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -142,8 +142,6 @@ void DIALOG_EDIT_ONE_FIELD::init()
m_sdbSizerButtonsOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -74,8 +74,6 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
Layout();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -77,8 +77,6 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_lastMarkerFound = NULL;
Init();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -38,8 +38,6 @@ DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( wxWindow* parent,
SetFocus();
m_sdbSizer1OK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -66,8 +66,6 @@ void DIALOG_LIB_EDIT_PIN::OnInitDialog( wxInitDialogEvent& event )
{
m_textPinName->SetFocus();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -48,8 +48,6 @@ DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* a
m_graphicText = aText;
initDlg();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -38,8 +38,6 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ) :
// What happens when user presses "Enter"? OK button! OK?
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -43,8 +43,6 @@ DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) :
SetItemRepeatStep( Parent()->GetRepeatStep() );
SetPinRepeatStep( Parent()->GetRepeatPinStep() );
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -347,8 +347,6 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
SetDefaultItem( m_buttonNetlist );
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -75,9 +75,6 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) :
initDlg();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -48,9 +48,6 @@ DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) :
m_textName->SetFocus();
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();

View File

@ -34,8 +34,6 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
m_textFileName->SetFocus();
m_sdbSizer1OK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -31,7 +31,6 @@ DIALOG_SIGNAL_LIST::DIALOG_SIGNAL_LIST( SIM_PLOT_FRAME* aParent, NETLIST_EXPORTE
: DIALOG_SIGNAL_LIST_BASE( aParent ), m_plotFrame( aParent ), m_exporter( aExporter )
{
FixOSXCancelButtonIssue();
}

View File

@ -66,7 +66,6 @@ DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS( wxWindow* aParent )
m_sdbSizerOK->SetDefault();
updateNetlistOpts();
FixOSXCancelButtonIssue();
}

View File

@ -95,7 +95,6 @@ DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aCompo
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
}

View File

@ -29,7 +29,14 @@
#include <hashtables.h>
#include <kiway_player.h>
#ifdef __WXMAC__
/**
* MACOS requires this option to be set to 1 in order to set dialogs focus.
**/
#define DLGSHIM_USE_SETFOCUS 1
#else
#define DLGSHIM_USE_SETFOCUS 0
#endif
class WDO_ENABLE_DISABLE;
class EVENT_LOOP;

View File

@ -211,8 +211,6 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent ) :
Layout();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -58,8 +58,6 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
init();
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -53,8 +53,6 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
InitValues();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -103,7 +103,6 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent
Layout();
FixOSXCancelButtonIssue();
}

View File

@ -91,7 +91,6 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME*
Layout();
FixOSXCancelButtonIssue();
}

View File

@ -85,7 +85,6 @@ DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent,
m_sdbSizerOK->SetDefault();
SetFocus();
FixOSXCancelButtonIssue();
}

View File

@ -28,8 +28,6 @@ DIALOG_ENUM_PADS::DIALOG_ENUM_PADS( wxWindow* aParent ) :
DIALOG_ENUM_PADS_BASE( aParent )
{
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -94,8 +94,6 @@ public:
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -102,8 +102,6 @@ public:
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -87,8 +87,6 @@ public:
m_VRML_Yref->SetValue( tmpStr );
m_sdbSizer1OK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();

View File

@ -103,7 +103,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME*
m_StandardButtonsSizerOK->SetDefault();
FixOSXCancelButtonIssue();
}

View File

@ -63,7 +63,6 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
}
DIALOG_GRAPHIC_ITEMS_OPTIONS::~DIALOG_GRAPHIC_ITEMS_OPTIONS()

View File

@ -152,8 +152,6 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
m_sdbSizerOK->SetDefault();
m_canUpdate = true;
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -101,7 +101,6 @@ DIALOG_PCB_TEXT_PROPERTIES::DIALOG_PCB_TEXT_PROPERTIES( PCB_EDIT_FRAME* parent,
m_StandardSizerOK->SetDefault();
FixOSXCancelButtonIssue();
}

View File

@ -44,8 +44,6 @@ DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB( wxWindow* parent,
m_sdbSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -99,7 +99,6 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent, const wxArrayString&
m_TextPosXUnits->SetLabel( GetUnitsLabel( m_parent->m_UserGridUnit ) );
m_TextPosYUnits->SetLabel( GetUnitsLabel( m_parent->m_UserGridUnit ) );
FixOSXCancelButtonIssue();
}

View File

@ -200,8 +200,6 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
m_StdButtonsOK->SetDefault();
FixOSXCancelButtonIssue();
// Pressing ENTER when any of the text input fields is active applies changes
Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onOkClick ), NULL, this );
}

View File

@ -45,8 +45,6 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SE
m_trackWidthText->SetSelection( -1, -1 );
m_stdButtonsOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();

View File

@ -153,8 +153,6 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
m_sdbSizerBtsOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -112,8 +112,6 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
// OK button on return key.
SetDefaultItem( m_sdbSizerButtsOK );
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}