diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 0e9e726d32..d2a9c763db 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -188,7 +188,6 @@ set( COMMON_DLG_SRCS dialogs/dialog_configure_paths_base.cpp dialogs/dialog_display_info_HTML_base.cpp dialogs/dialog_edit_library_tables.cpp - dialogs/dialog_exit_base.cpp dialogs/dialog_file_dir_picker.cpp dialogs/dialog_global_lib_table_config.cpp dialogs/dialog_global_lib_table_config_base.cpp diff --git a/common/confirm.cpp b/common/confirm.cpp index 093f2b5c0b..9c9f2d9992 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -153,66 +152,56 @@ long KIDIALOG::getStyle( KD_TYPE aType ) } -class DIALOG_EXIT: public DIALOG_EXIT_BASE -{ -public: - DIALOG_EXIT( wxWindow *aParent, const wxString& aWarning, const wxString& aMessage, - const wxString& aOKLabel, const wxString& aCancelLabel ) : - DIALOG_EXIT_BASE( aParent ) - { - m_bitmap->SetBitmap( KiBitmap( dialog_warning_xpm ) ); - m_TextInfo->SetLabel( aWarning ); - m_staticTextWarningMessage->SetLabel( aMessage ); - - m_sdbSizerOK->SetLabel( aOKLabel ); - m_sdbSizerCancel->SetLabel( aCancelLabel ); - m_sdbSizerOK->SetFocus(); - m_sdbSizerOK->SetDefault(); - - FinishDialogSettings(); - }; - -private: - void OnSave( wxCommandEvent& event ) override { EndModal( wxID_YES ); } - void OnDiscard( wxCommandEvent& event ) override { EndModal( wxID_NO ); } -}; - - int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApplyToAll ) { - DIALOG_EXIT dlg( parent, aMessage, - _( "If you don't save, all your changes will be permanently lost." ), - _( "Save" ), _( "Cancel" ) ); + wxRichMessageDialog dlg( parent, aMessage, wxEmptyString, + wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER ); + dlg.ShowDetailedText( _( "If you don't save, all your changes will be permanently lost." ) ); + dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Save" ) ), + wxMessageDialog::ButtonLabel( _( "Discard Changes" ) ) ); - dlg.m_ApplyToAllOpt->Show( aApplyToAll != nullptr ); + if( aApplyToAll ) + dlg.ShowCheckBox( _( "Apply to all" ), true ); int ret = dlg.ShowModal(); if( aApplyToAll ) - *aApplyToAll = dlg.m_ApplyToAllOpt->GetValue(); + *aApplyToAll = dlg.IsCheckBoxChecked(); // Returns wxID_YES, wxID_NO, or wxID_CANCEL return ret; } +int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage ) +{ + wxMessageDialog dlg( parent, aMessage, wxEmptyString, + wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER ); + dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) ); + dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Save" ) ), + wxMessageDialog::ButtonLabel( _( "Discard Changes" ) ) ); + + // Returns wxID_YES, wxID_NO, or wxID_CANCEL + return dlg.ShowModal(); +} + + bool ConfirmRevertDialog( wxWindow* parent, const wxString& aMessage ) { - DIALOG_EXIT dlg( parent, aMessage, - _( "Your current changes will be permanently lost." ), - _( "Revert" ), _( "Cancel" ) ); + wxMessageDialog dlg( parent, aMessage, wxEmptyString, + wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER ); + dlg.SetExtendedMessage( _( "Your current changes will be permanently lost." ) ); + dlg.SetOKCancelLabels( wxMessageDialog::ButtonLabel( _( "Revert" ) ), + wxMessageDialog::ButtonLabel( _( "Cancel" ) ) ); - dlg.m_ApplyToAllOpt->Show( false ); - dlg.m_DiscardButton->Show( false ); - - return dlg.ShowModal() == wxID_YES; + return dlg.ShowModal() == wxID_OK; } bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage, const std::function& aSaveFunction ) { - switch( UnsavedChangesDialog( aParent, aMessage, nullptr ) ) + switch( UnsavedChangesDialog( aParent, aMessage ) ) { case wxID_YES: return aSaveFunction(); case wxID_NO: return true; @@ -222,20 +211,24 @@ bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage, } -int YesOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, - const wxString& aOKLabel, const wxString& aCancelLabel, bool* aApplyToAll ) +int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, + const wxString& aOKLabel, const wxString& aCancelLabel, bool* aApplyToAll ) { - DIALOG_EXIT dlg( aParent, aWarning, aMessage, aOKLabel, aCancelLabel ); + wxRichMessageDialog dlg( aParent, aMessage, wxEmptyString, + wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER ); + dlg.ShowDetailedText( _( "If you don't save, all your changes will be permanently lost." ) ); + dlg.SetOKCancelLabels( wxMessageDialog::ButtonLabel( aOKLabel ), + wxMessageDialog::ButtonLabel( aCancelLabel ) ); - dlg.m_ApplyToAllOpt->Show( aApplyToAll != nullptr ); - dlg.m_DiscardButton->Show( false ); + if( aApplyToAll ) + dlg.ShowCheckBox( _( "Apply to all" ), true ); int ret = dlg.ShowModal(); if( aApplyToAll ) - *aApplyToAll = dlg.m_ApplyToAllOpt->GetValue(); + *aApplyToAll = dlg.IsCheckBoxChecked(); - // Returns wxID_YES, wxID_NO, or wxID_CANCEL + // Returns wxID_OK or wxID_CANCEL return ret; } @@ -301,7 +294,8 @@ bool IsOK( wxWindow* aParent, const wxString& aMessage ) } -int SelectSingleOption( wxWindow* aParent, const wxString& aTitle, const wxString& aMessage, const wxArrayString& aOptions ) +int SelectSingleOption( wxWindow* aParent, const wxString& aTitle, + const wxString& aMessage, const wxArrayString& aOptions ) { wxSingleChoiceDialog dlg( aParent, aMessage, aTitle, aOptions ); diff --git a/common/dialogs/dialog_exit_base.cpp b/common/dialogs/dialog_exit_base.cpp deleted file mode 100644 index cd9d427f1b..0000000000 --- a/common/dialogs/dialog_exit_base.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 21 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_exit_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizerUpper; - bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerUpper->Add( m_bitmap, 0, wxALL, 5 ); - - wxBoxSizer* bSizerMessages; - bSizerMessages = new wxBoxSizer( wxVERTICAL ); - - m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save changes?"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextInfo->Wrap( -1 ); - m_TextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - - bSizerMessages->Add( m_TextInfo, 0, wxALL, 5 ); - - m_staticTextWarningMessage = new wxStaticText( this, wxID_ANY, _("If you don't save, all your changes will be permanently lost."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextWarningMessage->Wrap( 300 ); - bSizerMessages->Add( m_staticTextWarningMessage, 0, wxALL, 5 ); - - - bSizerUpper->Add( bSizerMessages, 1, wxEXPAND, 5 ); - - - bSizerMain->Add( bSizerUpper, 1, wxEXPAND|wxALL, 5 ); - - m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerMain->Add( m_staticline, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 ); - - m_buttonSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_ApplyToAllOpt = new wxCheckBox( this, wxID_ANY, _("Apply to all"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonSizer->Add( m_ApplyToAllOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxTOP, 5 ); - - - m_buttonSizer->Add( 20, 0, 1, wxRIGHT|wxLEFT, 5 ); - - m_DiscardButton = new wxButton( this, wxID_ANY, _("Discard Changes"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonSizer->Add( m_DiscardButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - m_buttonSizer->Add( 20, 0, 0, wxRIGHT|wxLEFT, 5 ); - - m_sdbSizer = new wxStdDialogButtonSizer(); - m_sdbSizerOK = new wxButton( this, wxID_OK ); - m_sdbSizer->AddButton( m_sdbSizerOK ); - m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer->AddButton( m_sdbSizerCancel ); - m_sdbSizer->Realize(); - - m_buttonSizer->Add( m_sdbSizer, 0, wxBOTTOM|wxTOP, 5 ); - - - bSizerMain->Add( m_buttonSizer, 0, wxEXPAND|wxLEFT, 5 ); - - - this->SetSizer( bSizerMain ); - this->Layout(); - bSizerMain->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - m_DiscardButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnDiscard ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSave ), NULL, this ); -} - -DIALOG_EXIT_BASE::~DIALOG_EXIT_BASE() -{ - // Disconnect Events - m_DiscardButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnDiscard ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSave ), NULL, this ); - -} diff --git a/common/dialogs/dialog_exit_base.fbp b/common/dialogs/dialog_exit_base.fbp deleted file mode 100644 index 902f6fca39..0000000000 --- a/common/dialogs/dialog_exit_base.fbp +++ /dev/null @@ -1,511 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_exit_base - 1000 - none - - 1 - dialog_exit_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_EXIT_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - - - - - - - - bSizerMain - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 1 - - - bSizerUpper - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - Load From File; - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - 5 - wxEXPAND - 1 - - - bSizerMessages - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,90,92,-1,70,0 - 0 - 0 - wxID_ANY - Save changes? - 0 - - 0 - - - 0 - - 1 - m_TextInfo - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - If you don't save, all your changes will be permanently lost. - 0 - - 0 - - - 0 - - 1 - m_staticTextWarningMessage - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - 300 - - - - - - - - 10 - wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - 5 - wxEXPAND|wxLEFT - 0 - - -1,-1 - m_buttonSizer - wxHORIZONTAL - protected - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Apply to all - - 0 - - - 0 - - 1 - m_ApplyToAllOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxRIGHT|wxLEFT - 1 - - 0 - protected - 20 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Discard Changes - - 0 - - 0 - - - 0 - - 1 - m_DiscardButton - 1 - - - public - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnDiscard - - - - 5 - wxRIGHT|wxLEFT - 0 - - 0 - protected - 20 - - - - 5 - wxBOTTOM|wxTOP - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - OnSave - - - - - - - - diff --git a/common/dialogs/dialog_exit_base.h b/common/dialogs/dialog_exit_base.h deleted file mode 100644 index cf3f96f50a..0000000000 --- a/common/dialogs/dialog_exit_base.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 21 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_EXIT_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_EXIT_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxStaticBitmap* m_bitmap; - wxStaticText* m_TextInfo; - wxStaticText* m_staticTextWarningMessage; - wxStaticLine* m_staticline; - wxBoxSizer* m_buttonSizer; - wxStdDialogButtonSizer* m_sdbSizer; - wxButton* m_sdbSizerOK; - wxButton* m_sdbSizerCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnDiscard( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSave( wxCommandEvent& event ) { event.Skip(); } - - - public: - wxCheckBox* m_ApplyToAllOpt; - wxButton* m_DiscardButton; - - DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_EXIT_BASE(); - -}; - diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index f0b1277046..3ae7b3f151 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2011-2016 Wayne Stambaugh + * Copyright (C) 2011 Wayne Stambaugh * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -96,9 +96,11 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER ) EVT_SIZE( CVPCB_MAINFRAME::OnSize ) // UI event handlers - EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords) - EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyPinCount ) - EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, CVPCB_MAINFRAME::OnFilterFPbyLibrary ) + EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords ) + EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, + CVPCB_MAINFRAME::OnFilterFPbyPinCount ) + EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, + CVPCB_MAINFRAME::OnFilterFPbyLibrary ) EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, CVPCB_MAINFRAME::OnFilterFPbyKeyName ) END_EVENT_TABLE() @@ -213,17 +215,27 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : m_initialized = true; // Connect Events - m_saveAndContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this ); - m_footprintListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ), NULL, this ); - m_compListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ), NULL, this ); + m_saveAndContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, + wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), + NULL, this ); + m_footprintListBox->Connect( wxEVT_RIGHT_DOWN, + wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ), + NULL, this ); + m_compListBox->Connect( wxEVT_RIGHT_DOWN, + wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ), + NULL, this ); } CVPCB_MAINFRAME::~CVPCB_MAINFRAME() { // Disconnect Events - m_saveAndContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this ); - m_footprintListBox->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ), NULL, this ); + m_saveAndContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, + wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), + NULL, this ); + m_footprintListBox->Disconnect( wxEVT_RIGHT_DOWN, + wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ), + NULL, this ); m_auimgr.UnInit(); } @@ -260,7 +272,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) { if( m_modified ) { - if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified.\nSave before exit?" ), + if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. " + "Save before exit?" ), [&]()->bool { return SaveFootprintAssociation( false ); } ) ) { Event.Veto(); @@ -456,7 +469,8 @@ void CVPCB_MAINFRAME::OnComponentRightClick( wxMouseEvent& event ) { wxMenu menu; - menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ), _( "Show the assigned footprint in the footprint viewer" ) ); + menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ), + _( "Show the assigned footprint in the footprint viewer" ) ); PopupMenu( &menu ); } @@ -466,7 +480,8 @@ void CVPCB_MAINFRAME::OnFootprintRightClick( wxMouseEvent& event ) { wxMenu menu; - menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ), _( "Show the current footprint in the footprint viewer" ) ); + menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ), + _( "Show the current footprint in the footprint viewer" ) ); PopupMenu( &menu ); } @@ -540,6 +555,7 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component ) DisplayStatus(); } + void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event ) { int option = 0; @@ -771,7 +787,8 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist ) } catch( const IO_ERROR& ioe ) { - wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ), ioe.What().GetData() ); + wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ), + ioe.What().GetData() ); wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR ); return 1; } @@ -839,7 +856,7 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX() } m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL, - wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST ); + wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST ); DisplayStatus(); } diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 3985e6fccb..533dd82d02 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -381,8 +381,8 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) { if( !applyToAll ) { - int ret = YesOrCancelDialog( this, warning, wxString::Format( msg, nickname ), - _( "Skip" ), _( "Add Anyway" ), &applyToAll ); + int ret = OKOrCancelDialog( this, warning, wxString::Format( msg, nickname ), + _( "Skip" ), _( "Add Anyway" ), &applyToAll ); addDuplicates = (ret == wxID_CANCEL ); } diff --git a/include/confirm.h b/include/confirm.h index 94d6eec5cf..430e48a26d 100644 --- a/include/confirm.h +++ b/include/confirm.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -47,8 +47,10 @@ public: ///> Dialog type. Selects appropriate icon and default dialog title enum KD_TYPE { KD_NONE, KD_INFO, KD_QUESTION, KD_WARNING, KD_ERROR }; - KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, long aStyle = wxOK ); - KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption = "" ); + KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, + long aStyle = wxOK ); + KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, + const wxString& aCaption = "" ); ///> Shows the 'do not show again' checkbox void DoNotShowCheckbox( wxString file, int line ); @@ -71,8 +73,7 @@ protected: /** - * Function HandleUnsavedChanges - * displays a dialog with Save, Cancel and Discard Changes buttons. + * Display a dialog with Save, Cancel and Discard Changes buttons. * * @param aParent = the parent window * @param aMessage = the main message to put in dialog @@ -86,8 +87,7 @@ bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage, /** - * Function UnsavedChangesDialog - * a specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox. + * A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox. * * @param aParent = the parent window * @param aMessage = the main message to put in dialog @@ -97,46 +97,45 @@ bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage, */ int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage, bool* aApplyToAll ); +int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage ); + /** - * Function ConfirmRevertDialog - * displays a confirmation for a revert action + * Display a confirmation dialog for a revert action. */ bool ConfirmRevertDialog( wxWindow* parent, const wxString& aMessage ); /** - * Function DisplayError - * displays an error or warning message box with \a aMessage. + * Display an error or warning message box with \a aMessage. * * @warning Setting \a displaytime does not work. Do not use it. */ void DisplayError( wxWindow* parent, const wxString& aMessage, int displaytime = 0 ); /** - * Function DisplayErrorMessage - * displays an error message with \a aMessage + * Display an error message with \a aMessage * * @param aParent is the parent window * @param aMessage is the message text to display * @param aExtraInfo is extra data that can be optionally displayed in a collapsible pane */ -void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage, const wxString& aExtraInfo = wxEmptyString ); +void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage, + const wxString& aExtraInfo = wxEmptyString ); /** - * Function DisplayInfoMessage - * displays an informational message box with \a aMessage. + * Display an informational message box with \a aMessage. * * @param aParent is the parent window * @param aMessage is the message text to display * @param aExtraInfo is the extra data that can be optionally displayed in a collapsible pane */ -void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, const wxString& aExtraInfo = wxEmptyString ); +void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, + const wxString& aExtraInfo = wxEmptyString ); /** - * Function IsOK - * displays a yes/no dialog with \a aMessage and returns the user response. + * Display a yes/no dialog with \a aMessage and returns the user response. * * @param aParent is the parent window. NULL can be used if the parent is the top level window. * @param aMessage is the message to display in the dialog box. @@ -146,8 +145,7 @@ void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, const wxStr bool IsOK( wxWindow* aParent, const wxString& aMessage ); /** - * Function YesOrCancelDialog - * displays a warning dialog with \a aMessage and returns the user response. + * Displays a warning dialog with \a aMessage and returns the user response. * * @param aParent is the parent window. NULL can be used if the parent is the top level window. * @param aWarning is the warning to display in the top part of the dialog box using a bold font. @@ -156,11 +154,10 @@ bool IsOK( wxWindow* aParent, const wxString& aMessage ); * @param aOKLabel is the text to display in the OK button. * @param aCancelLabel is the text to display in the cancel button. * - * @return wxID_YES or wxID_CANCEL depending on the button the user selected. + * @return wxID_OK or wxID_CANCEL depending on the button the user selected. */ -int YesOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, - const wxString& aOKLabel, const wxString& aCancelLabel, - bool* aApplyToAll = nullptr ); +int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, + const wxString& aOKLabel, const wxString& aCancelLabel, bool* aApplyToAll ); @@ -171,7 +168,7 @@ int YesOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxStri * @param aTitle is the dialog title. * @param aMessage is a text label displayed in the first row of the dialog. * @param aOptions is a vector of possible options. - * @return Index of the selected option or -1 when the dialog has been cancelled. + * @return Index of the selected option or -1 when the dialog has been canceled. */ int SelectSingleOption( wxWindow* aParent, const wxString& aTitle, const wxString& aMessage, const wxArrayString& aOptions ); diff --git a/pcbnew/dialogs/panel_fp_lib_table.cpp b/pcbnew/dialogs/panel_fp_lib_table.cpp index a8b485ccfe..a48ab09f38 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table.cpp @@ -647,8 +647,8 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) { if( !applyToAll ) { - int ret = YesOrCancelDialog( this, warning, wxString::Format( msg, nickname ), - _( "Skip" ), _( "Add Anyway" ), &applyToAll ); + int ret = OKOrCancelDialog( this, warning, wxString::Format( msg, nickname ), + _( "Skip" ), _( "Add Anyway" ), &applyToAll ); addDuplicates = (ret == wxID_CANCEL ); }