KiCad PCB EDA Suite
confirm.cpp File Reference
#include <wx/stockitem.h>
#include <wx/richmsgdlg.h>
#include <wx/choicdlg.h>
#include <confirm.h>
#include <bitmaps.h>
#include <dialogs/html_messagebox.h>
#include <functional>
#include <unordered_map>

Go to the source code of this file.

Functions

int UnsavedChangesDialog (wxWindow *parent, wxString aMessage, bool *aApplyToAll)
 A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox. More...
 
int UnsavedChangesDialog (wxWindow *parent, const wxString &aMessage)
 
bool ConfirmRevertDialog (wxWindow *parent, const wxString &aMessage)
 Display a confirmation dialog for a revert action. More...
 
bool HandleUnsavedChanges (wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
 Display a dialog with Save, Cancel and Discard Changes buttons. More...
 
int OKOrCancelDialog (wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, wxString aDetailedMessage, wxString aOKLabel, wxString aCancelLabel, bool *aApplyToAll)
 Display a warning dialog with aMessage and returns the user response. More...
 
void DisplayError (wxWindow *aParent, const wxString &aText, int aDisplayTime)
 Display an error or warning message box with aMessage. More...
 
void DisplayErrorMessage (wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
 Display an error message with aMessage. More...
 
void DisplayInfoMessage (wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
 Display an informational message box with aMessage. More...
 
bool IsOK (wxWindow *aParent, const wxString &aMessage)
 Display a yes/no dialog with aMessage and returns the user response. More...
 
int SelectSingleOption (wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions)
 Display a dialog with radioboxes asking the user to select an option. More...
 

Variables

static std::unordered_map< unsigned long, int > doNotShowAgainDlgs
 

Function Documentation

◆ ConfirmRevertDialog()

bool ConfirmRevertDialog ( wxWindow *  parent,
const wxString &  aMessage 
)

Display a confirmation dialog for a revert action.

Definition at line 197 of file confirm.cpp.

198 {
199  wxMessageDialog dlg( parent, aMessage, wxEmptyString,
200  wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
201  dlg.SetExtendedMessage( _( "Your current changes will be permanently lost." ) );
202  dlg.SetOKCancelLabels( _( "Revert" ), _( "Cancel" ) );
203 
204  return dlg.ShowModal() == wxID_OK;
205 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by SYMBOL_EDIT_FRAME::Revert(), and FOOTPRINT_EDIT_FRAME::RevertFootprint().

◆ DisplayError()

void DisplayError ( wxWindow *  aParent,
const wxString &  aText,
int  aDisplayTime = 0 
)

Display an error or warning message box with aMessage.

Warning
Setting displaytime does not work. Do not use it.

Definition at line 253 of file confirm.cpp.

254 {
255  wxMessageDialog* dlg;
256  int icon = aDisplayTime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
257 
258  dlg = new wxMessageDialog( aParent, aText, _( "Warning" ),
259  wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
260 
261  dlg->ShowModal();
262  dlg->Destroy();
263 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SIM_PLOT_FRAME::AddTuner(), PCB_CONTROL::AppendBoard(), SYMBOL_EDIT_FRAME::backupFile(), SCH_EDIT_FRAME::CheckSheetForRecursion(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), MICROWAVE_TOOL::createFootprint(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), SPICE_SIMULATOR::CreateInstance(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), SYMBOL_EDIT_FRAME::CreateNewPart(), UNIT_BINDER::delayedFocusHandler(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), PANEL_SETUP_LAYERS::DenyChangeCheckBox(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), doPrintFile(), DIALOG_SIM_SETTINGS::evaluateDCControls(), ExecuteFile(), FOOTPRINT_EDIT_FRAME::ExportFootprint(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), SYMBOL_EDIT_FRAME::ExportPart(), GBR_TO_PCB_EXPORTER::ExportPcb(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::FetchNetlistFromSchematic(), NETLIST_EXPORTER_PSPICE::Format(), DIALOG_GENDRILL::GenDrillAndMapFiles(), DIALOG_SPICE_MODEL::generatePowerSource(), PCB_EDIT_FRAME::GenFootprintsReport(), GetAssociatedDocument(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::ImportFootprint(), SCH_EDITOR_CONTROL::ImportFPAssignments(), SYMBOL_EDIT_FRAME::ImportPart(), DIALOG_PRINT_GENERIC::initPrintData(), SYMBOL_EDIT_FRAME::LoadPart(), SIM_PLOT_FRAME::menuOpenWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), SCH_EDIT_FRAME::NewProject(), DIALOG_FIELDS_EDITOR_GLOBAL::OnAddField(), DIALOG_CONFIG_EQUFILES::OnAddFiles(), DIALOG_BOM::OnAddGenerator(), DIALOG_NET_INSPECTOR::onAddNet(), DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled(), DIALOG_SHEET_PROPERTIES::OnDeleteField(), DIALOG_SYMBOL_PROPERTIES::OnDeleteField(), DIALOG_LIB_SYMBOL_PROPERTIES::OnDeleteField(), DIALOG_FOOTPRINT_FP_EDITOR::OnDeleteField(), DIALOG_FOOTPRINT_PROPERTIES::OnDeleteField(), DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging(), DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging(), SCH_EDIT_FRAME::OnOpenCvpcb(), DIALOG_PRINT_GENERIC::onPrintButtonClick(), DIALOG_PRINT_GENERIC::onPrintPreview(), DIALOG_NET_INSPECTOR::onRenameNet(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), SIM_PLOT_FRAME::onSettings(), PCB_DRAW_PANEL_GAL::OnShow(), SCH_EDIT_FRAME::OnUpdatePCB(), DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI(), DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI(), DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI(), OpenPDF(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), DIALOG_PLOT::Plot(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), KIGFX::VERTEX_MANAGER::Reserve(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), SYMBOL_EDIT_FRAME::savePartAs(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), KIGFX::GPU_MANAGER::SetShader(), SIM_PLOT_FRAME::StartSimulation(), EDA_DRAW_PANEL_GAL::SwitchBackend(), PCB_EDIT_FRAME::TestStandalone(), DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TRACK_VIA_SIZE::TransferDataFromWindow(), DIALOG_SCH_IMPORT_SETTINGS::TransferDataFromWindow(), DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow(), DIALOG_RULE_AREA_PROPERTIES::TransferDataFromWindow(), DIALOG_IMPORT_SETTINGS::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), REGEX_VALIDATOR::Validate(), SPICE_VALIDATOR::Validate(), KIGFX::VERTEX_MANAGER::Vertex(), KIGFX::VERTEX_MANAGER::Vertices(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), NETLIST_EXPORTER_KICAD::WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), and LEGACY_RESCUER::WriteRescueLibrary().

◆ DisplayErrorMessage()

void DisplayErrorMessage ( wxWindow *  aParent,
const wxString &  aMessage,
const wxString &  aExtraInfo = wxEmptyString 
)

Display an error message with aMessage.

Parameters
aParentis the parent window
aMessageis the message text to display
aExtraInfois extra data that can be optionally displayed in a collapsible pane

Definition at line 266 of file confirm.cpp.

267 {
268  wxMessageDialog* dlg;
269 
270  dlg = new wxMessageDialog( aParent, aText, _( "Error" ),
271  wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR | wxSTAY_ON_TOP );
272 
273  if( !aExtraInfo.IsEmpty() )
274  dlg->SetExtendedMessage( aExtraInfo );
275 
276  dlg->ShowModal();
277  dlg->Destroy();
278 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), CVPCB_ASSOCIATION_TOOL::Associate(), CVPCB_MAINFRAME::AssociateFootprint(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), checkGlError(), SCH_EDIT_FRAME::CreateArchiveLibrary(), PROJECT_TREE_ITEM::Delete(), SYMBOL_EDIT_FRAME::ExportPart(), PCB_EDIT_FRAME::ExportSpecctraFile(), BACK_ANNOTATE::FetchNetlistFromPCB(), PL_EDITOR_FRAME::Files_io(), SYMBOL_EDIT_FRAME::ImportPart(), PCB_EDIT_FRAME::ImportSpecctraSession(), PGM_BASE::InitPgm(), FOOTPRINT_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), SETTINGS_MANAGER::MigrateIfNeeded(), KICAD_MANAGER_CONTROL::NewFromTemplate(), KICAD_MANAGER_CONTROL::NewProject(), DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries(), DIALOG_EXPORT_STEP::onExportButton(), PCB_EDIT_FRAME::OnExportSTEP(), PCB_EDIT_FRAME::OnExportVRML(), CV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), PANEL_TEXT_VARIABLES::OnUpdateUI(), DIALOG_CONFIGURE_PATHS::OnUpdateUI(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PROJECT::PcbFootprintLibs(), KIWAY::Player(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_EDIT_FRAME::saveLibrary(), KICAD_MANAGER_CONTROL::SaveProjectAs(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SchGetLibPart(), KIWAY::SetLanguage(), SYMBOL_VIEWER_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), DIALOG_PNS_DIFF_PAIR_DIMENSIONS::TransferDataFromWindow(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PIN_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), DIALOG_SHEET_PROPERTIES::Validate(), DIALOG_SYMBOL_PROPERTIES::Validate(), IPC356D_WRITER::Write(), and SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

◆ DisplayInfoMessage()

void DisplayInfoMessage ( wxWindow *  parent,
const wxString &  aMessage,
const wxString &  aExtraInfo = wxEmptyString 
)

Display an informational message box with aMessage.

Parameters
aParentis the parent window
aMessageis the message text to display
aExtraInfois the extra data that can be optionally displayed in a collapsible pane

Definition at line 281 of file confirm.cpp.

282 {
283  wxRichMessageDialog* dlg;
284  int icon = wxICON_INFORMATION;
285 
286  dlg = new wxRichMessageDialog( aParent, aMessage, _( "Info" ),
287  wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
288 
289  if( !aExtraInfo.IsEmpty() )
290  dlg->ShowDetailedText( aExtraInfo );
291 
292  dlg->ShowModal();
293  dlg->Destroy();
294 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds(), EE_INSPECTION_TOOL::CheckSymbol(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_BASE_FRAME::CreateNewFootprint(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), EDA_DRAW_PANEL_GAL::DoRePaint(), FOOTPRINT_EDIT_FRAME::ExportFootprint(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), GERBVIEW_CONTROL::ExportToPcbnew(), PCB_EDIT_FRAME::Files_io_from_id(), PGM_BASE::GetEditorName(), DIALOG_PRINT_GENERIC::getScaleValue(), SIM_PLOT_FRAME::onAddSignal(), CV::IFACE::OnKifaceStart(), SCH_DRAW_PANEL::OnShow(), SCH_EDIT_FRAME::OpenProjectFiles(), DIALOG_PLOT::Plot(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), PCB_EDIT_FRAME::SavePcbCopy(), ROUTER_TOOL::SelectCopperLayerPair(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME::StartSimulation(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ HandleUnsavedChanges()

bool HandleUnsavedChanges ( wxWindow *  aParent,
const wxString &  aMessage,
const std::function< bool()> &  aSaveFunction 
)

Display a dialog with Save, Cancel and Discard Changes buttons.

Parameters
aParent= the parent window
aMessage= the main message to put in dialog
aSaveFunction= a function to save changes, if requested. Must return true if the save was successful and false otherwise (which will result in HandleUnsavedChanges() returning wxID_CANCEL).
Returns
wxID_YES, wxID_CANCEL, wxID_NO.

Definition at line 208 of file confirm.cpp.

210 {
211  switch( UnsavedChangesDialog( aParent, aMessage ) )
212  {
213  case wxID_YES: return aSaveFunction();
214  case wxID_NO: return true;
215  default:
216  case wxID_CANCEL: return false;
217  }
218 }
int UnsavedChangesDialog(wxWindow *parent, wxString aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition: confirm.cpp:155

References UnsavedChangesDialog().

Referenced by SCH_EDIT_FRAME::AskToSaveChanges(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), PL_EDITOR_FRAME::canCloseWindow(), CVPCB_MAINFRAME::canCloseWindow(), PCB_EDIT_FRAME::canCloseWindow(), SCH_EDIT_FRAME::canCloseWindow(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), PL_EDITOR_FRAME::Files_io(), PCB_EDIT_FRAME::Files_io_from_id(), SYMBOL_EDIT_FRAME::LoadSymbolAndSelectLib(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_FIELDS_EDITOR_GLOBAL::OnClose(), PL_EDITOR_FRAME::OnFileHistory(), and PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsOK()

bool IsOK ( wxWindow *  aParent,
const wxString &  aMessage 
)

Display a yes/no dialog with aMessage and returns the user response.

Parameters
aParentis the parent window. NULL can be used if the parent is the top level window.
aMessageis the message to display in the dialog box.
Returns
True if user selected the yes button, otherwise false.

Definition at line 297 of file confirm.cpp.

298 {
299  wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
300  wxYES_NO | wxCENTRE | wxICON_QUESTION | wxSTAY_ON_TOP );
301  dlg.SetEscapeId( wxID_NO );
302 
303  return dlg.ShowModal() == wxID_YES;
304 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by DIALOG_GLOBAL_DELETION::acceptPcbDelete(), DIALOG_IMAGE_EDITOR::CheckValues(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_EDIT_FRAME::Clear_Pcb(), CVPCB_ASSOCIATION_TOOL::DeleteAll(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), SYMBOL_EDIT_FRAME::DeletePartFromLibrary(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), PCB_EDIT_FRAME::Files_io_from_id(), PGM_BASE::InitPgm(), KICAD_MANAGER_CONTROL::NewProject(), SCH_EDIT_FRAME::OnAppendProject(), DIALOG_BOARD_REANNOTATE::OnApplyClick(), PANEL_SETUP_RULES::onCharHook(), PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries(), DIALOG_NET_INSPECTOR::onDeleteNet(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), SCH_EDIT_FRAME::ReadyToNetlist(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), DIALOG_PIN_PROPERTIES::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), and DIALOG_LIB_SYMBOL_PROPERTIES::Validate().

◆ OKOrCancelDialog()

int OKOrCancelDialog ( wxWindow *  aParent,
const wxString &  aWarning,
const wxString &  aMessage,
wxString  aDetailedMessage = wxEmptyString,
wxString  aOKLabel = wxEmptyString,
wxString  aCancelLabel = wxEmptyString,
bool *  aApplyToAll = nullptr 
)

Display a warning dialog with aMessage and returns the user response.

Parameters
aParentis the parent window. NULL can be used if the parent is the top level window.
aWarningis the warning to display in the top part of the dialog box using a bold font.
aMessageis the message to display in the lower part of the dialog box using the default system UI font.
aDetailedMessageis the message to display in the "Show detailed information" section. Passing wxEmptyString will hide this portion of the dialog.
aOKLabelis the text to display in the OK button.
aCancelLabelis the text to display in the cancel button.
Returns
wxID_OK or wxID_CANCEL depending on the button the user selected.

Definition at line 221 of file confirm.cpp.

224 {
225  wxRichMessageDialog dlg( aParent, aMessage, aWarning,
226  wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
227 
228  if( aOKLabel.IsEmpty() )
229  aOKLabel = _( "OK" );
230 
231  if( aCancelLabel.IsEmpty() )
232  aCancelLabel = _( "Cancel" );
233 
234  dlg.SetOKCancelLabels( aOKLabel, aCancelLabel );
235 
236  if( !aDetailedMessage.IsEmpty() )
237  dlg.SetExtendedMessage( aDetailedMessage );
238 
239  if( aApplyToAll )
240  dlg.ShowCheckBox( _( "Apply to all" ), true );
241 
242  int ret = dlg.ShowModal();
243 
244  if( aApplyToAll )
245  *aApplyToAll = dlg.IsCheckBoxChecked();
246 
247  // Returns wxID_OK or wxID_CANCEL
248  return ret;
249 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by PANEL_SYM_LIB_TABLE::browseLibrariesHandler(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_EDIT_FRAME::saveAllLibraries(), and ROUTER_TOOL::saveRouterDebugLog().

◆ SelectSingleOption()

int SelectSingleOption ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const wxArrayString &  aOptions 
)

Display a dialog with radioboxes asking the user to select an option.

Parameters
aParentis the parent window.
aTitleis the dialog title.
aMessageis a text label displayed in the first row of the dialog.
aOptionsis a vector of possible options.
Returns
Index of the selected option or -1 when the dialog has been canceled.

Definition at line 307 of file confirm.cpp.

309 {
310  wxSingleChoiceDialog dlg( aParent, aMessage, aTitle, aOptions );
311 
312  if( dlg.ShowModal() != wxID_OK )
313  return -1;
314 
315  return dlg.GetSelection();
316 }

◆ UnsavedChangesDialog() [1/2]

int UnsavedChangesDialog ( wxWindow *  aParent,
wxString  aMessage,
bool *  aApplyToAll 
)

A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.

Parameters
aParent= the parent window
aMessage= the main message to put in dialog
aApplyToAll= if non-null an "Apply to all" checkbox will be shown and it's value written back to the bool.
Returns
wxID_YES, wxID_CANCEL, wxID_NO.

Definition at line 155 of file confirm.cpp.

156 {
157  static bool s_apply_to_all = false;
158 
159  wxRichMessageDialog dlg( parent, aMessage, wxEmptyString,
160  wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
161  dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) );
162  dlg.SetYesNoLabels( _( "Save" ), _( "Discard Changes" ) );
163 
164  if( aApplyToAll )
165  dlg.ShowCheckBox( _( "Apply to all" ), s_apply_to_all );
166 
167  int ret = dlg.ShowModal();
168 
169  if( aApplyToAll )
170  {
171  *aApplyToAll = dlg.IsCheckBoxChecked();
172  s_apply_to_all = dlg.IsCheckBoxChecked();
173  }
174 
175  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
176  return ret;
177 }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

Referenced by SYMBOL_EDIT_FRAME::canCloseWindow(), HandleUnsavedChanges(), InvokeSchEditSymbolLibTable(), SYMBOL_EDIT_FRAME::saveAllLibraries(), and UnsavedChangesDialog().

◆ UnsavedChangesDialog() [2/2]

int UnsavedChangesDialog ( wxWindow *  parent,
const wxString &  aMessage 
)

Definition at line 180 of file confirm.cpp.

181 {
182 #ifdef __APPLE__
183  // wxWidgets gets the button order wrong on Mac so use the other dialog.
184  return UnsavedChangesDialog( parent, aMessage, nullptr );
185 #else
186  wxMessageDialog dlg( parent, aMessage, wxEmptyString,
187  wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
188  dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) );
189  dlg.SetYesNoLabels( _( "Save" ), _( "Discard Changes" ) );
190 
191  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
192  return dlg.ShowModal();
193 #endif
194 }
int UnsavedChangesDialog(wxWindow *parent, wxString aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition: confirm.cpp:155
#define _(s)
Definition: 3d_actions.cpp:33

References _, and UnsavedChangesDialog().

Variable Documentation

◆ doNotShowAgainDlgs

std::unordered_map<unsigned long, int> doNotShowAgainDlgs
static