diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index b17beafd70..98fc265176 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -96,7 +96,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin for( wxEventType eventType : events ) { - Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), + Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::OnEvent ), NULL, m_eventDispatcher ); } @@ -401,7 +401,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType ) } -void EDA_DRAW_PANEL_GAL::onEvent( wxEvent& aEvent ) +void EDA_DRAW_PANEL_GAL::OnEvent( wxEvent& aEvent ) { if( m_lostFocus && m_stealsFocus ) SetFocus(); diff --git a/common/status_popup.cpp b/common/status_popup.cpp index 5ba303a775..0d81db3b8a 100644 --- a/common/status_popup.cpp +++ b/common/status_popup.cpp @@ -30,7 +30,9 @@ #include STATUS_POPUP::STATUS_POPUP( EDA_DRAW_FRAME* aParent ) : - wxPopupWindow( aParent ), m_expireTimer( this ) + wxPopupWindow( aParent ), + m_frame( aParent ), + m_expireTimer( this ) { m_panel = new wxPanel( this, wxID_ANY ); m_panel->SetBackgroundColour( *wxLIGHT_GREY ); @@ -40,6 +42,27 @@ STATUS_POPUP::STATUS_POPUP( EDA_DRAW_FRAME* aParent ) : m_panel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); Connect( wxEVT_TIMER, wxTimerEventHandler( STATUS_POPUP::onExpire ), NULL, this ); + +#ifdef __WXOSX_MAC__ + // Key events from popups don't get put through the wxWidgets event system on OSX, + // so we have to fall back to the CHAR_HOOK to forwared hotkeys from the popup to + // the canvas / frame. + Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( STATUS_POPUP::onCharHook ), nullptr, this ); +#endif +} + + +void STATUS_POPUP::onCharHook( wxKeyEvent& aEvent ) +{ + // Key events from popups don't get put through the wxWidgets event system on OSX, + // so we have to fall back to the CHAR_HOOK to forward hotkeys from the popup to + // the canvas / frame. + aEvent.SetEventType( wxEVT_CHAR ); + + if( m_frame->IsGalCanvasActive() ) + m_frame->GetGalCanvas()->OnEvent( aEvent ); + else + m_frame->ProcessEvent( aEvent ); } diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index a2f82a0a2a..4ef3a4ad06 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -236,11 +236,14 @@ public: return BOX2I(); } + /** + * Used to forward events to the canvas from popups, etc. + */ + void OnEvent( wxEvent& aEvent ); protected: void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ); void onSize( wxSizeEvent& aEvent ); - void onEvent( wxEvent& aEvent ); void onEnter( wxEvent& aEvent ); void onLostFocus( wxFocusEvent& aEvent ); void onRefreshTimer( wxTimerEvent& aEvent ); diff --git a/include/status_popup.h b/include/status_popup.h index 9fbdb3087f..661bed0ce2 100644 --- a/include/status_popup.h +++ b/include/status_popup.h @@ -57,9 +57,12 @@ public: protected: void updateSize(); + void onCharHook( wxKeyEvent& aEvent ); + ///> Expire timer even handler void onExpire( wxTimerEvent& aEvent ); + EDA_DRAW_FRAME* m_frame; wxPanel* m_panel; wxBoxSizer* m_topSizer; wxTimer m_expireTimer; diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp index 3eb5ad89fa..9eaaf9cfbe 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp @@ -39,15 +39,21 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* m_settings( aSettings ), m_mode( aMode ) { - m_miterStyle->Enable( true ); - m_radiusText->Enable( aMode != PNS::PNS_MODE_TUNE_DIFF_PAIR ); - //m_minAmpl.Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR_SKEW ); + if( aMode == PNS::PNS_MODE_TUNE_DIFF_PAIR ) + { + // TODO: fix diff-pair meandering so we can use non-100% radii + m_radiusText->SetValue( wxT( "100" ) ); + m_radiusText->Enable( false ); + } + else + { + m_radiusText->SetValue( wxString::Format( wxT( "%i" ), m_settings.m_cornerRadiusPercentage ) ); + } m_minAmpl.SetValue( m_settings.m_minAmplitude ); m_maxAmpl.SetValue( m_settings.m_maxAmplitude ); m_spacing.SetValue( m_settings.m_spacing ); - m_radiusText->SetValue( wxString::Format( wxT( "%i" ), m_settings.m_cornerRadiusPercentage ) ); m_miterStyle->SetSelection( m_settings.m_cornerStyle == PNS::MEANDER_STYLE_ROUND ? 1 : 0 ); diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.cpp index 9418d992ba..57590e8039 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.cpp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -19,7 +19,7 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( bMainSizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Length/skew:") ), wxVERTICAL ); + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Length / Skew") ), wxVERTICAL ); wxFlexGridSizer* fgSizerLenSkew; fgSizerLenSkew = new wxFlexGridSizer( 0, 3, 0, 0 ); @@ -29,31 +29,31 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( m_staticText4 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Tune from:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText4->Wrap( -1 ); - fgSizerLenSkew->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizerLenSkew->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); wxArrayString m_choicePathFromChoices; m_choicePathFrom = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePathFromChoices, 0 ); m_choicePathFrom->SetSelection( 0 ); - fgSizerLenSkew->Add( m_choicePathFrom, 0, wxALL|wxEXPAND, 5 ); + fgSizerLenSkew->Add( m_choicePathFrom, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); fgSizerLenSkew->Add( 0, 0, 0, 0, 5 ); m_staticText15 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Tune to:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText15->Wrap( -1 ); - fgSizerLenSkew->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizerLenSkew->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); wxArrayString m_choice4Choices; m_choice4 = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice4Choices, 0 ); m_choice4->SetSelection( 0 ); - fgSizerLenSkew->Add( m_choice4, 0, wxALL|wxEXPAND, 5 ); + fgSizerLenSkew->Add( m_choice4, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); fgSizerLenSkew->Add( 0, 0, 0, 0, 5 ); m_staticText3 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Constraint:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText3->Wrap( -1 ); - fgSizerLenSkew->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizerLenSkew->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); wxString m_constraintSourceChoices[] = { _("From Design Rules"), _("Manual") }; int m_constraintSourceNChoices = sizeof( m_constraintSourceChoices ) / sizeof( wxString ); @@ -61,30 +61,30 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( m_constraintSource->SetSelection( 1 ); m_constraintSource->Enable( false ); - fgSizerLenSkew->Add( m_constraintSource, 1, wxALL|wxEXPAND, 5 ); + fgSizerLenSkew->Add( m_constraintSource, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); fgSizerLenSkew->Add( 0, 0, 0, 0, 5 ); m_targetLengthLabel = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Target length:"), wxDefaultPosition, wxDefaultSize, 0 ); m_targetLengthLabel->Wrap( -1 ); - fgSizerLenSkew->Add( m_targetLengthLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + fgSizerLenSkew->Add( m_targetLengthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_targetLengthText = new TEXT_CTRL_EVAL( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerLenSkew->Add( m_targetLengthText, 0, wxALL|wxEXPAND, 5 ); m_targetLengthUnit = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_targetLengthUnit->Wrap( -1 ); - fgSizerLenSkew->Add( m_targetLengthUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + fgSizerLenSkew->Add( m_targetLengthUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); sbSizer1->Add( fgSizerLenSkew, 1, wxEXPAND, 5 ); - bMainSizer->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 ); + bMainSizer->Add( sbSizer1, 0, wxEXPAND|wxALL, 10 ); wxStaticBoxSizer* sbSizer2; - sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Meandering:") ), wxVERTICAL ); + sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Meandering") ), wxVERTICAL ); m_legend = new wxStaticBitmap( sbSizer2->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); sbSizer2->Add( m_legend, 0, wxALL|wxEXPAND, 5 ); @@ -97,67 +97,66 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( m_staticText9 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Min amplitude (Amin):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText9->Wrap( -1 ); - fgSizer3->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizer3->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); m_minAmplText = new TEXT_CTRL_EVAL( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_minAmplText, 0, wxALL|wxEXPAND, 5 ); + fgSizer3->Add( m_minAmplText, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); m_minAmplUnit = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_minAmplUnit->Wrap( -1 ); - fgSizer3->Add( m_minAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + fgSizer3->Add( m_minAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); m_staticText91 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Max amplitude (Amax):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText91->Wrap( -1 ); - fgSizer3->Add( m_staticText91, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizer3->Add( m_staticText91, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); m_maxAmplText = new TEXT_CTRL_EVAL( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_maxAmplText, 0, wxALL|wxEXPAND, 5 ); + fgSizer3->Add( m_maxAmplText, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_maxAmplUnit = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_maxAmplUnit->Wrap( -1 ); - fgSizer3->Add( m_maxAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + fgSizer3->Add( m_maxAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); m_staticText11 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Spacing (s):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText11->Wrap( -1 ); - fgSizer3->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizer3->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); m_spacingText = new TEXT_CTRL_EVAL( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_spacingText, 0, wxALL|wxEXPAND, 5 ); + fgSizer3->Add( m_spacingText, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_spacingUnit = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_spacingUnit->Wrap( -1 ); - fgSizer3->Add( m_spacingUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + fgSizer3->Add( m_spacingUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); + + m_staticText14 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Miter style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText14->Wrap( -1 ); + fgSizer3->Add( m_staticText14, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxString m_miterStyleChoices[] = { _("45 degree"), _("arc") }; + int m_miterStyleNChoices = sizeof( m_miterStyleChoices ) / sizeof( wxString ); + m_miterStyle = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_miterStyleNChoices, m_miterStyleChoices, 0 ); + m_miterStyle->SetSelection( 0 ); + fgSizer3->Add( m_miterStyle, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + + fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticText13 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Miter radius (r):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText13->Wrap( -1 ); - fgSizer3->Add( m_staticText13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizer3->Add( m_staticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_radiusText = new TEXT_CTRL_EVAL( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer3->Add( m_radiusText, 0, wxALL|wxEXPAND, 5 ); m_radiusUnit = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); m_radiusUnit->Wrap( -1 ); - fgSizer3->Add( m_radiusUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_staticText14 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Miter style:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText14->Wrap( -1 ); - m_staticText14->Enable( false ); - - fgSizer3->Add( m_staticText14, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - wxString m_miterStyleChoices[] = { _("45 degree"), _("arc") }; - int m_miterStyleNChoices = sizeof( m_miterStyleChoices ) / sizeof( wxString ); - m_miterStyle = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_miterStyleNChoices, m_miterStyleChoices, 0 ); - m_miterStyle->SetSelection( 0 ); - m_miterStyle->Enable( false ); - - fgSizer3->Add( m_miterStyle, 0, wxALL|wxEXPAND, 5 ); + fgSizer3->Add( m_radiusUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); sbSizer2->Add( fgSizer3, 1, wxEXPAND, 5 ); - bMainSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 ); + bMainSizer->Add( sbSizer2, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_stdButtons = new wxStdDialogButtonSizer(); m_stdButtonsOK = new wxButton( this, wxID_OK ); diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.fbp b/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.fbp index 6e8335b330..9abc1adf4f 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.fbp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.fbp @@ -14,7 +14,6 @@ dialog_pns_length_tuning_settings_base 1000 none - 1 DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE @@ -95,12 +94,12 @@ wxVERTICAL none - 5 + 10 wxEXPAND|wxALL 0 wxID_ANY - Length/skew: + Length / Skew sbSizer1 wxVERTICAL @@ -125,7 +124,7 @@ 0 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -208,7 +207,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -306,7 +305,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -389,7 +388,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -487,7 +486,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -570,7 +569,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 1 @@ -668,7 +667,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -842,7 +841,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT 0 1 @@ -928,12 +927,12 @@ - 5 - wxALL|wxEXPAND + 10 + wxEXPAND|wxRIGHT|wxLEFT 0 wxID_ANY - Meandering: + Meandering sbSizer2 wxVERTICAL @@ -1039,7 +1038,7 @@ 0 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1122,7 +1121,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxLEFT|wxRIGHT|wxTOP 0 1 @@ -1213,7 +1212,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT 0 1 @@ -1296,7 +1295,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1379,7 +1378,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1470,7 +1469,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT 0 1 @@ -1553,7 +1552,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1636,7 +1635,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1727,7 +1726,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT 0 1 @@ -1810,7 +1809,188 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Miter style: + + 0 + + + 0 + + 1 + m_staticText14 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "45 degree" "arc" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_miterStyle + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -1984,7 +2164,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT 0 1 @@ -2065,177 +2245,6 @@ - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - Miter style: - - 0 - - - 0 - - 1 - m_staticText14 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "45 degree" "arc" - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_miterStyle - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.h b/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.h index f04829debc..ea826d5c2b 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.h +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -61,11 +61,11 @@ class DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE : public DIALOG_SHIM wxStaticText* m_staticText11; TEXT_CTRL_EVAL* m_spacingText; wxStaticText* m_spacingUnit; + wxStaticText* m_staticText14; + wxChoice* m_miterStyle; wxStaticText* m_staticText13; TEXT_CTRL_EVAL* m_radiusText; wxStaticText* m_radiusUnit; - wxStaticText* m_staticText14; - wxChoice* m_miterStyle; wxStdDialogButtonSizer* m_stdButtons; wxButton* m_stdButtonsOK; wxButton* m_stdButtonsCancel; diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 2d3ea288b8..c08b8da18e 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -105,6 +105,8 @@ static EDA_HOTKEY HkRouteTuneDiffPair( _HKI( "Tune Differential Pair Length (Mod HK_ROUTE_TUNE_DIFF_PAIR, '8' ); static EDA_HOTKEY HkRouteTuneSkew( _HKI( "Tune Differential Pair Skew (Modern Toolset only)" ), HK_ROUTE_TUNE_SKEW, '9' ); +static EDA_HOTKEY HkRouteTuneSettings( _HKI( "Length Tuning Settings (Modern Toolset only)" ), + HK_ROUTE_TUNE_SETTINGS, 'L' ); static EDA_HOTKEY HkAddThroughVia( _HKI( "Add Through Via" ), HK_ADD_THROUGH_VIA, 'V' ); static EDA_HOTKEY HkSelLayerAndAddThroughVia( _HKI( "Select Layer and Add Through Via" ), diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index e50466b075..13e422366c 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -52,6 +52,7 @@ enum hotkey_id_commnand { HK_ROUTE_TUNE_SINGLE, HK_ROUTE_TUNE_DIFF_PAIR, HK_ROUTE_TUNE_SKEW, + HK_ROUTE_TUNE_SETTINGS, HK_ADD_THROUGH_VIA, HK_SEL_LAYER_AND_ADD_THROUGH_VIA, HK_ADD_BLIND_BURIED_VIA, diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp index b107422166..cb5d04468e 100644 --- a/pcbnew/router/length_tuner_tool.cpp +++ b/pcbnew/router/length_tuner_tool.cpp @@ -151,8 +151,7 @@ void LENGTH_TUNER_TOOL::performTuning() return; } - PNS::MEANDER_PLACER_BASE* placer = static_cast( - m_router->Placer() ); + auto placer = static_cast( m_router->Placer() ); placer->UpdateSettings( m_savedMeanderSettings ); @@ -208,6 +207,13 @@ void LENGTH_TUNER_TOOL::performTuning() m_router->Move( end, NULL ); updateStatusPopup( statusPopup ); } + else if( evt->IsAction( &ACT_Settings ) ) + { + statusPopup.Hide(); + TOOL_EVENT dummy; + meanderSettingsDialog( dummy ); + statusPopup.Show(); + } } m_router->StopRouting(); @@ -241,8 +247,6 @@ void LENGTH_TUNER_TOOL::setTransitions() Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, PCB_ACTIONS::routerActivateTuneSingleTrace.MakeEvent() ); Go( &LENGTH_TUNER_TOOL::TuneDiffPair, PCB_ACTIONS::routerActivateTuneDiffPair.MakeEvent() ); Go( &LENGTH_TUNER_TOOL::TuneDiffPairSkew, PCB_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent() ); - - Go( &LENGTH_TUNER_TOOL::meanderSettingsDialog, ACT_Settings.MakeEvent() ); } @@ -278,6 +282,11 @@ int LENGTH_TUNER_TOOL::mainLoop( PNS::ROUTER_MODE aMode ) updateStartItem( *evt ); performTuning(); } + else if( evt->IsAction( &ACT_Settings ) ) + { + TOOL_EVENT dummy; + meanderSettingsDialog( dummy ); + } } frame()->SetNoToolSelected(); @@ -294,16 +303,16 @@ int LENGTH_TUNER_TOOL::meanderSettingsDialog( const TOOL_EVENT& aEvent ) { PNS::MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); - if( !placer ) - return 0; - - PNS::MEANDER_SETTINGS settings = placer->MeanderSettings(); + PNS::MEANDER_SETTINGS settings = placer ? placer->MeanderSettings() : m_savedMeanderSettings; DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( frame(), settings, m_router->Mode() ); if( settingsDlg.ShowModal() ) - placer->UpdateSettings( settings ); + { + if( placer ) + placer->UpdateSettings( settings ); - m_savedMeanderSettings = placer->MeanderSettings(); + m_savedMeanderSettings = settings; + } return 0; } diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index cf562199df..a3ee15643c 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -167,7 +167,10 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) int MEANDER_SHAPE::cornerRadius() const { - return (int64_t) spacing() * Settings().m_cornerRadiusPercentage / 200; + // TODO: fix diff-pair meandering so we can use non-100% radii + int rPercent = m_type == PNS_MODE_TUNE_DIFF_PAIR ? 100 : Settings().m_cornerRadiusPercentage; + + return (int64_t) spacing() * rPercent / 200; }