CvPcb: fix save changes dialog layout issue.

DIALOG_EXIT was not being laid out correctly after setting the dialog
message.  Rather than fix our custom DIALOG_EXIT, wxMessageDialog and
wxRichMessageDialog were substituted as direct replacements for all
of the variants of DIALOG_EXIT.  This make message dialogs appear more
consistent because wxMessageDialog uses the default platform message
dialog and wxRichMessageDialog uses the default platform rich message
dialog on windows.

Remove DIALOG_EXIT_BASE as it is no longer required.

Fixes lp:1832899

https://bugs.launchpad.net/kicad/+bug/1832899
This commit is contained in:
Wayne Stambaugh 2019-06-15 12:05:33 -04:00
parent e4fbd003e0
commit 77bf575742
9 changed files with 99 additions and 757 deletions

View File

@ -165,7 +165,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

View File

@ -33,7 +33,6 @@
#include <confirm.h>
#include <bitmaps.h>
#include <html_messagebox.h>
#include <dialog_exit_base.h>
#include <functional>
#include <unordered_map>
@ -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<bool()>& 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 );

View File

@ -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 );
}

View File

@ -1,511 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_exit_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_exit_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_EXIT_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerUpper</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap">Load From File; </property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_bitmap</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMessages</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font">,90,92,-1,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Save changes?</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_TextInfo</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">If you don&apos;t save, all your changes will be permanently lost.</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextWarningMessage</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">300</property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">-1,-1</property>
<property name="name">m_buttonSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxTOP</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply to all</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ApplyToAllOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">public</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Discard Changes</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_DiscardButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">public</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDiscard</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnOKButtonClick">OnSave</event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -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 <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// 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();
};

View File

@ -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 <stambaughw@verizon.net>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -89,9 +89,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()
@ -214,17 +216,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();
}
@ -261,7 +273,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();
@ -454,7 +467,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 );
}
@ -464,7 +478,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 );
}
@ -538,6 +553,7 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
DisplayStatus();
}
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
{
int option = 0;
@ -769,7 +785,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;
}
@ -837,7 +854,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();
}

View File

@ -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 );
}

View File

@ -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 );

View File

@ -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 );
}