Make sure CvPcb gets its Cancel button fixed up.
It's no longer a DIALOG_SHIM so it can't depend on its fixup. Fixes https://gitlab.com/kicad/code/kicad/issues/4611
This commit is contained in:
parent
b274b9f972
commit
0ddf53397f
|
@ -297,38 +297,11 @@ static void selectAllInTextCtrls( wxWindowList& children )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
static void fixOSXCancelButtonIssue( wxWindow *aWindow )
|
|
||||||
{
|
|
||||||
// A ugly hack to fix an issue on OSX: cmd+c closes the dialog instead of
|
|
||||||
// copying the text if a button with wxID_CANCEL is used in a
|
|
||||||
// wxStdDialogButtonSizer created by wxFormBuilder: the label is &Cancel, and
|
|
||||||
// this accelerator key has priority over the standard copy accelerator.
|
|
||||||
// Note: problem also exists in other languages; for instance cmd+a closes
|
|
||||||
// dialogs in German because the button is &Abbrechen.
|
|
||||||
wxButton* button = dynamic_cast<wxButton*>( wxWindow::FindWindowById( wxID_CANCEL, aWindow ) );
|
|
||||||
|
|
||||||
if( button )
|
|
||||||
{
|
|
||||||
static const wxString placeholder = wxT( "{amp}" );
|
|
||||||
|
|
||||||
wxString buttonLabel = button->GetLabel();
|
|
||||||
buttonLabel.Replace( wxT( "&&" ), placeholder );
|
|
||||||
buttonLabel.Replace( wxT( "&" ), wxEmptyString );
|
|
||||||
buttonLabel.Replace( placeholder, wxT( "&" ) );
|
|
||||||
button->SetLabel( buttonLabel );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_SHIM::OnPaint( wxPaintEvent &event )
|
void DIALOG_SHIM::OnPaint( wxPaintEvent &event )
|
||||||
{
|
{
|
||||||
if( m_firstPaintEvent )
|
if( m_firstPaintEvent )
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC__
|
KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision( this );
|
||||||
fixOSXCancelButtonIssue( this );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
selectAllInTextCtrls( GetChildren() );
|
selectAllInTextCtrls( GetChildren() );
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include <tools/cvpcb_actions.h>
|
#include <tools/cvpcb_actions.h>
|
||||||
#include <tools/cvpcb_association_tool.h>
|
#include <tools/cvpcb_association_tool.h>
|
||||||
#include <tools/cvpcb_control.h>
|
#include <tools/cvpcb_control.h>
|
||||||
|
#include <libs/kiplatform/include/kiplatform/ui.h>
|
||||||
|
|
||||||
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
||||||
|
|
||||||
|
@ -149,6 +150,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
bottomPanel->Fit();
|
bottomPanel->Fit();
|
||||||
|
|
||||||
sdbSizerOK->SetDefault();
|
sdbSizerOK->SetDefault();
|
||||||
|
KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision( this );
|
||||||
|
|
||||||
m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
|
m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ class WX_EVENT_LOOP;
|
||||||
#define SHOWQUASIMODAL ShowQuasiModal
|
#define SHOWQUASIMODAL ShowQuasiModal
|
||||||
#define ENDQUASIMODAL EndQuasiModal
|
#define ENDQUASIMODAL EndQuasiModal
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog helper object to sit in the inheritance tree between wxDialog and any class written
|
* Dialog helper object to sit in the inheritance tree between wxDialog and any class written
|
||||||
* by wxFormBuilder.
|
* by wxFormBuilder.
|
||||||
|
@ -146,6 +145,8 @@ public:
|
||||||
e.ShiftDown() && !e.MetaDown();
|
e.ShiftDown() && !e.MetaDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FixOSXCancelButtonIssue( wxWindow *aWindow );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,3 +33,9 @@ void KIPLATFORM::UI::ReparentQuasiModal( wxNonOwnedWindow* aWindow )
|
||||||
{
|
{
|
||||||
// Not needed on this platform
|
// Not needed on this platform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIPLATFORM::UI::FixupCancelButtonCmdCopyCollision( wxWindow *aWindow )
|
||||||
|
{
|
||||||
|
// Not needed on this platform
|
||||||
|
}
|
||||||
|
|
|
@ -50,6 +50,16 @@ namespace KIPLATFORM
|
||||||
* @param aWindow is the window to reparent
|
* @param aWindow is the window to reparent
|
||||||
*/
|
*/
|
||||||
void ReparentQuasiModal( wxNonOwnedWindow* aWindow );
|
void ReparentQuasiModal( wxNonOwnedWindow* aWindow );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An ugly hack to fix an issue on OSX: cmd+c closes the dialog instead of copying the
|
||||||
|
* text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer created by
|
||||||
|
* wxFormBuilder: the label is &Cancel, and this accelerator key has priority over the
|
||||||
|
* standard copy accelerator.
|
||||||
|
* Note: problem also exists in other languages; for instance cmd+a closes dialogs in
|
||||||
|
* German because the button is &Abbrechen.
|
||||||
|
*/
|
||||||
|
void FixupCancelButtonCmdKeyCollision( wxWindow* aWindow );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,9 @@ void KIPLATFORM::UI::ReparentQuasiModal( wxNonOwnedWindow* aWindow )
|
||||||
{
|
{
|
||||||
// Not needed on this platform
|
// Not needed on this platform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIPLATFORM::UI::FixupCancelButtonCmdCopyCollision( wxWindow *aWindow )
|
||||||
|
{
|
||||||
|
// Not needed on this platform
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include <wx/nonownedwnd.h>
|
#include <wx/nonownedwnd.h>
|
||||||
#include <wx/toplevel.h>
|
#include <wx/toplevel.h>
|
||||||
#include <wx/window.h>
|
#include <wx/button.h>
|
||||||
|
|
||||||
void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow )
|
void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow )
|
||||||
{
|
{
|
||||||
|
@ -45,3 +45,21 @@ void KIPLATFORM::UI::ReparentQuasiModal( wxNonOwnedWindow* aWindow )
|
||||||
|
|
||||||
[parentWindow addChildWindow:theWindow ordered:NSWindowAbove];
|
[parentWindow addChildWindow:theWindow ordered:NSWindowAbove];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision( wxWindow *aWindow )
|
||||||
|
{
|
||||||
|
wxButton* button = dynamic_cast<wxButton*>( wxWindow::FindWindowById( wxID_CANCEL, aWindow ) );
|
||||||
|
|
||||||
|
if( button )
|
||||||
|
{
|
||||||
|
static const wxString placeholder = wxT( "{amp}" );
|
||||||
|
|
||||||
|
wxString buttonLabel = button->GetLabel();
|
||||||
|
buttonLabel.Replace( wxT( "&&" ), placeholder );
|
||||||
|
buttonLabel.Replace( wxT( "&" ), wxEmptyString );
|
||||||
|
buttonLabel.Replace( placeholder, wxT( "&" ) );
|
||||||
|
button->SetLabel( buttonLabel );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue