diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 76b120be9c..f56a40e02f 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -40,8 +41,6 @@ #define KEY_ANNOTATE_SORT_OPTION wxT( "AnnotateSortOption" ) #define KEY_ANNOTATE_ALGO_OPTION wxT( "AnnotateAlgoOption" ) -#define KEY_ANNOTATE_KEEP_OPEN_OPTION wxT( "AnnotateKeepOpenOption" ) -#define KEY_ANNOTATE_SKIP_CONFIRMATION wxT( "AnnotateSkipConfirmation" ) #define KEY_ANNOTATE_MESSAGES_FILTER wxT( "AnnotateFilterMsg" ) @@ -87,16 +86,6 @@ private: int GetAnnotateAlgo(); int GetStartNumber(); - - bool GetAnnotateKeepOpen() - { - return m_cbKeepDlgOpen->GetValue(); - } - - bool GetAnnotateSkipConfirmation() - { - return m_cbSkipConfirmation->GetValue(); - } }; @@ -111,11 +100,18 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& messag m_userMessage->Show( true ); m_rbScope->Enable( false ); - m_cbKeepDlgOpen->Show( false ); } m_MessageWindow->SetLabel( _( "Annotation Messages:" ) ); + // We use a sdbSizer to get platform-dependent ordering of the action buttons, but + // that requires us to correct the button labels here. + m_sdbSizer1OK->SetLabel( _( "Annotate" ) ); + m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); + m_sdbSizer1->Layout(); + + m_sdbSizer1OK->SetDefault(); + InitValues(); Layout(); @@ -128,8 +124,6 @@ DIALOG_ANNOTATE::~DIALOG_ANNOTATE() { m_Config->Write( KEY_ANNOTATE_SORT_OPTION, GetSortOrder() ); m_Config->Write( KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo() ); - m_Config->Write( KEY_ANNOTATE_KEEP_OPEN_OPTION, GetAnnotateKeepOpen() ); - m_Config->Write( KEY_ANNOTATE_SKIP_CONFIRMATION, GetAnnotateSkipConfirmation() ); m_Config->Write( KEY_ANNOTATE_MESSAGES_FILTER, (long) m_MessageWindow->GetVisibleSeverities() ); @@ -176,12 +170,6 @@ void DIALOG_ANNOTATE::InitValues() } m_textNumberAfter->SetValue( wxT( "0" ) ); - m_Config->Read( KEY_ANNOTATE_KEEP_OPEN_OPTION, &option, 0L ); - m_cbKeepDlgOpen->SetValue( option ); - - m_Config->Read( KEY_ANNOTATE_SKIP_CONFIRMATION, &option, 0L ); - m_cbSkipConfirmation->SetValue( option ); - annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) ); annotate_right_down_bitmap->SetBitmap( KiBitmap( annotate_right_down_xpm ) ); @@ -189,29 +177,28 @@ void DIALOG_ANNOTATE::InitValues() m_MessageWindow->SetVisibleSeverities( severities ); m_MessageWindow->MsgPanelSetMinSize( wxSize( -1, 160 ) ); - - m_btnApply->SetDefault(); } void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) { - int response; wxString message; - // Ask for confirmation of destructive actions unless the user asked us not to. - if( GetResetItems() && !GetAnnotateSkipConfirmation() ) + // Ask for confirmation of destructive actions. + if( GetResetItems() ) { if( GetLevel() ) message += _( "Clear and annotate all of the symbols on the entire schematic?" ); else message += _( "Clear and annotate all of the symbols on the current sheet?" ); - message += _( "\n\nThis operation will change the current annotation and cannot be undone." ); + message += _( "\n\nThis operation will change the current annotation and cannot \nbe undone." ); - response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); + KIDIALOG dlg( this, message, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); + dlg.SetOKLabel( _( "Clear and Annotate" ) ); + dlg.DoNotShowCheckbox(); - if( response == wxCANCEL ) + if( dlg.ShowModal() == wxCANCEL ) return; } @@ -233,7 +220,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) if( reporter.HasMessage() ) return; - if( m_userMessage->IsShown() || !GetAnnotateKeepOpen() ) + if( m_userMessage->IsShown() ) { // Close the dialog by calling the default handler for a wxID_OK event event.SetId( wxID_OK ); @@ -244,24 +231,23 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event ) { - int response; wxString message; - if( !GetAnnotateSkipConfirmation() ) - { - if( GetLevel() ) - message = _( "Clear the existing annotation for the entire schematic?" ); - else - message = _( "Clear the existing annotation for the current sheet?" ); + if( GetLevel() ) + message = _( "Clear the existing annotation for the entire schematic?" ); + else + message = _( "Clear the existing annotation for the current sheet?" ); - message += _( "\n\nThis operation will clear the existing annotation and cannot be undone." ); - response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); + message += _( "\n\nThis operation will clear the existing annotation and cannot \nbe undone." ); - if( response == wxCANCEL ) - return; - } + KIDIALOG dlg( this, message, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); + dlg.SetOKLabel( _( "Clear" ) ); + dlg.DoNotShowCheckbox(); - m_Parent->DeleteAnnotation( GetLevel() ? false : true ); + if( dlg.ShowModal() == wxID_CANCEL ) + return; + + m_Parent->DeleteAnnotation( !GetLevel() ); m_btnClear->Enable( false ); } diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index 0755a4da68..c0eec8f450 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_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! @@ -112,58 +112,6 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bupperSizer->Add( fgSizer1, 0, wxBOTTOM|wxEXPAND, 5 ); - wxBoxSizer* bSizerDldOptions; - bSizerDldOptions = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizerDlgChoices; - bSizerDlgChoices = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizerChoiceClose; - bSizerChoiceClose = new wxBoxSizer( wxHORIZONTAL ); - - m_cbKeepDlgOpen = new wxCheckBox( this, wxID_ANY, _("Keep this dialog open"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerChoiceClose->Add( m_cbKeepDlgOpen, 0, wxALL, 5 ); - - - bSizerChoiceClose->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizerDlgChoices->Add( bSizerChoiceClose, 0, wxEXPAND|wxRIGHT, 5 ); - - wxBoxSizer* bSizerChoiceSilentMode; - bSizerChoiceSilentMode = new wxBoxSizer( wxHORIZONTAL ); - - m_cbSkipConfirmation = new wxCheckBox( this, wxID_ANY, _("Don't ask for confirmation"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerChoiceSilentMode->Add( m_cbSkipConfirmation, 0, wxALL, 5 ); - - - bSizerChoiceSilentMode->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizerDlgChoices->Add( bSizerChoiceSilentMode, 1, wxEXPAND, 5 ); - - - bSizerDldOptions->Add( bSizerDlgChoices, 1, wxLEFT, 5 ); - - wxBoxSizer* bButtonsSizer; - bButtonsSizer = new wxBoxSizer( wxVERTICAL ); - - bButtonsSizer->SetMinSize( wxSize( 160,-1 ) ); - m_btnApply = new wxButton( this, wxID_APPLY, _("Annotate"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 ); - - m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_btnClear, 0, wxALL|wxEXPAND, 5 ); - - m_btnClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 ); - - - bSizerDldOptions->Add( bButtonsSizer, 0, wxALIGN_RIGHT, 5 ); - - - bupperSizer->Add( bSizerDldOptions, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); - m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_MessageWindow->SetMinSize( wxSize( -1,120 ) ); @@ -172,20 +120,38 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 ); + wxBoxSizer* m_buttonsSizer; + m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonsSizer->Add( m_btnClear, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + m_buttonsSizer->Add( m_sdbSizer1, 1, wxALL|wxEXPAND, 5 ); + + + bmainSizer->Add( m_buttonsSizer, 0, wxEXPAND, 5 ); + this->SetSizer( bmainSizer ); this->Layout(); bmainSizer->Fit( this ); // Connect Events - m_btnApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); } DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE() { // Disconnect Events - m_btnApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index 1ce90bd0e6..f02e07241b 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -14,7 +14,6 @@ dialog_annotate_base 1000 none - 1 dialog_annotate_base @@ -1178,521 +1177,6 @@ - - 5 - wxEXPAND|wxLEFT|wxRIGHT - 0 - - - bSizerDldOptions - wxHORIZONTAL - none - - 5 - wxLEFT - 1 - - - bSizerDlgChoices - wxVERTICAL - none - - 5 - wxEXPAND|wxRIGHT - 0 - - - bSizerChoiceClose - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Keep this dialog open - - 0 - - - 0 - - 1 - m_cbKeepDlgOpen - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - - - 5 - wxEXPAND - 1 - - - bSizerChoiceSilentMode - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Don't ask for confirmation - - 0 - - - 0 - - 1 - m_cbSkipConfirmation - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - - - - - 5 - wxALIGN_RIGHT - 0 - - 160,-1 - bButtonsSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_APPLY - Annotate - - 0 - - - 0 - - 1 - m_btnApply - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnApplyClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_CLEAR_ANNOTATION_CMP - Clear Annotation - - 0 - - - 0 - - 1 - m_btnClear - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnClearAnnotationCmpClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Close - - 0 - - - 0 - - 1 - m_btnClose - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxEXPAND | wxALL @@ -1775,6 +1259,131 @@ + + 5 + wxEXPAND + 0 + + + m_buttonsSizer + wxHORIZONTAL + none + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_CLEAR_ANNOTATION_CMP + Clear Annotation + + 0 + + + 0 + + 1 + m_btnClear + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnClearAnnotationCmpClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + + + + + OnApplyClick + + + + + + diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index c5195c5ba8..c69b799852 100644 --- a/eeschema/dialogs/dialog_annotate_base.h +++ b/eeschema/dialogs/dialog_annotate_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! @@ -30,9 +30,8 @@ class WX_HTML_REPORT_PANEL; #include #include #include -#include -#include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -63,16 +62,15 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM wxTextCtrl* m_textNumberAfter; wxRadioButton* m_rbSheetX100; wxRadioButton* m_rbSheetX1000; - wxCheckBox* m_cbKeepDlgOpen; - wxCheckBox* m_cbSkipConfirmation; - wxButton* m_btnApply; - wxButton* m_btnClear; - wxButton* m_btnClose; WX_HTML_REPORT_PANEL* m_MessageWindow; + wxButton* m_btnClear; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; // Virtual event handlers, overide them in your derived class - virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } public: