From e1b3a2d410e47660d5f8e421a7fcb6efa7c20e35 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 22 Jun 2015 11:53:27 -0400 Subject: [PATCH] Eeschema: improve annotation dialog checkbox labeling * Change 'Silent mode' -> 'Always ask for confirmation'. Default on (Same behavior as before, though arguably, it is very annoying and should probably be default off) * 'Automatically close dialog' -> 'Keep this dialog open'. Also changed the default to _not_ keep the dialog open (what is keeping it open even useful for ?) --- eeschema/dialogs/dialog_annotate.cpp | 47 ++++++++++++----------- eeschema/dialogs/dialog_annotate_base.cpp | 9 +++-- eeschema/dialogs/dialog_annotate_base.fbp | 10 ++--- eeschema/dialogs/dialog_annotate_base.h | 6 +-- 4 files changed, 38 insertions(+), 34 deletions(-) diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 55ab3a4034..b439cc99e6 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -36,10 +36,10 @@ #include #include -#define KEY_ANNOTATE_SORT_OPTION wxT( "AnnotateSortOption" ) -#define KEY_ANNOTATE_ALGO_OPTION wxT( "AnnotateAlgoOption" ) -#define KEY_ANNOTATE_AUTOCLOSE_OPTION wxT( "AnnotateAutoCloseOption" ) -#define KEY_ANNOTATE_USE_SILENTMODE wxT( "AnnotateSilentMode" ) +#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_ASK_FOR_CONFIRMATION wxT( "AnnotateRequestConfirmation" ) class wxConfigBase; @@ -85,14 +85,14 @@ private: */ int GetAnnotateAlgo(); - bool GetAnnotateAutoCloseOpt() + bool GetAnnotateKeepOpen() { - return m_cbAutoCloseDlg->GetValue(); + return m_cbKeepDlgOpen->GetValue(); } - bool GetAnnotateSilentMode() + bool GetAnnotateAskForConfirmation() { - return m_cbUseSilentMode->GetValue(); + return m_cbAskForConfirmation->GetValue(); } }; @@ -118,7 +118,7 @@ void DIALOG_ANNOTATE::InitValues() { long option; - m_Config->Read( KEY_ANNOTATE_SORT_OPTION, &option, 0l ); + m_Config->Read( KEY_ANNOTATE_SORT_OPTION, &option, 0L ); switch( option ) { default: @@ -135,7 +135,7 @@ void DIALOG_ANNOTATE::InitValues() break; } - m_Config->Read( KEY_ANNOTATE_ALGO_OPTION, &option, 0l ); + m_Config->Read( KEY_ANNOTATE_ALGO_OPTION, &option, 0L ); switch( option ) { default: @@ -152,13 +152,13 @@ void DIALOG_ANNOTATE::InitValues() break; } - m_Config->Read( KEY_ANNOTATE_AUTOCLOSE_OPTION, &option, 0l ); - if( option ) - m_cbAutoCloseDlg->SetValue( 1 ); - m_Config->Read( KEY_ANNOTATE_USE_SILENTMODE, &option, 0l ); - if( option ) - m_cbUseSilentMode->SetValue( 1 ); + m_Config->Read( KEY_ANNOTATE_KEEP_OPEN_OPTION, &option, 0L ); + m_cbKeepDlgOpen->SetValue( option ); + + + m_Config->Read( KEY_ANNOTATE_ASK_FOR_CONFIRMATION, &option, 1L ); + m_cbAskForConfirmation->SetValue( option ); } annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) ); @@ -177,13 +177,13 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) { m_Config->Write( KEY_ANNOTATE_SORT_OPTION, GetSortOrder() ); m_Config->Write( KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo() ); - m_Config->Write( KEY_ANNOTATE_AUTOCLOSE_OPTION, GetAnnotateAutoCloseOpt() ); - m_Config->Write( KEY_ANNOTATE_USE_SILENTMODE, GetAnnotateSilentMode() ); + m_Config->Write( KEY_ANNOTATE_KEEP_OPEN_OPTION, GetAnnotateKeepOpen() ); + m_Config->Write( KEY_ANNOTATE_ASK_FOR_CONFIRMATION, GetAnnotateAskForConfirmation() ); } - // Display a message info in verbose mode, + // Display a message info if we always ask for confirmation // or if a reset of the previous annotation is asked. - bool promptUser = ! GetAnnotateSilentMode(); + bool promptUser = GetAnnotateAskForConfirmation(); if( GetResetItems() ) { @@ -205,6 +205,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) if( promptUser ) { + // TODO(hzeller): ideally, this would be a wxMessageDialog that contains + // a checkbox asking the 'ask for confirmation' flag for better + // discoverability (and it should only show in the 'benign' case, so if + // !GetResetItems()) response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); if( response == wxCANCEL ) @@ -218,7 +222,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) m_btnClear->Enable(); - if( GetAnnotateAutoCloseOpt() ) + if( !GetAnnotateKeepOpen() ) { if( IsModal() ) EndModal( wxID_OK ); @@ -312,4 +316,3 @@ int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller ) return dlg.ShowModal(); } - diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index b9e9d7a972..2e65004cd1 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -169,8 +169,8 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con wxBoxSizer* bSizerChoiceClose; bSizerChoiceClose = new wxBoxSizer( wxHORIZONTAL ); - m_cbAutoCloseDlg = new wxCheckBox( this, wxID_ANY, _("Automatically close this dialog"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerChoiceClose->Add( m_cbAutoCloseDlg, 0, wxALL, 5 ); + 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 ); @@ -181,8 +181,9 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con wxBoxSizer* bSizerChoiceSilentMode; bSizerChoiceSilentMode = new wxBoxSizer( wxHORIZONTAL ); - m_cbUseSilentMode = new wxCheckBox( this, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerChoiceSilentMode->Add( m_cbUseSilentMode, 0, wxALL, 5 ); + m_cbAskForConfirmation = new wxCheckBox( this, wxID_ANY, _("Always ask for confirmation"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbAskForConfirmation->SetValue(true); + bSizerChoiceSilentMode->Add( m_cbAskForConfirmation, 0, wxALL, 5 ); bSizerChoiceSilentMode->Add( 0, 0, 1, wxEXPAND, 5 ); diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index 560edd85de..5742fbfdc6 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -2009,7 +2009,7 @@ 0 0 wxID_ANY - Automatically close this dialog + Keep this dialog open 0 @@ -2017,7 +2017,7 @@ 0 1 - m_cbAutoCloseDlg + m_cbKeepDlgOpen 1 @@ -2103,7 +2103,7 @@ 1 0 - 0 + 1 1 1 @@ -2118,7 +2118,7 @@ 0 0 wxID_ANY - Silent mode + Always ask for confirmation 0 @@ -2126,7 +2126,7 @@ 0 1 - m_cbUseSilentMode + m_cbAskForConfirmation 1 diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index 7865bf2b2c..856903308e 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 Mar 9 2015) +// C++ code generated with wxFormBuilder (version Jun 20 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -70,8 +70,8 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM wxRadioButton* m_rbStartSheetNumLarge; wxStaticLine* m_staticline4; wxStaticText* m_staticTextDlgOpts; - wxCheckBox* m_cbAutoCloseDlg; - wxCheckBox* m_cbUseSilentMode; + wxCheckBox* m_cbKeepDlgOpen; + wxCheckBox* m_cbAskForConfirmation; wxStaticLine* m_staticline41; wxButton* m_btnClose; wxButton* m_btnClear;