KiCad PCB EDA Suite
confirm.cpp File Reference

utilities to display some error, warning and info short messges More...

#include <wx/stockitem.h>
#include <wx/richmsgdlg.h>
#include <confirm.h>
#include <bitmaps.h>
#include <html_messagebox.h>
#include <dialog_exit_base.h>
#include <functional>
#include <unordered_map>

Go to the source code of this file.

Classes

class  DIALOG_EXIT
 

Functions

int UnsavedChangesDialog (wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
 Function UnsavedChangesDialog a specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox. More...
 
bool ConfirmRevertDialog (wxWindow *parent, const wxString &aMessage)
 Function ConfirmRevertDialog displays a confirmation for a revert action. More...
 
bool HandleUnsavedChanges (wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
 Function HandleUnsavedChanges displays a dialog with Save, Cancel and Discard Changes buttons. More...
 
int YesOrCancelDialog (wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aOKLabel, const wxString &aCancelLabel, bool *aApplyToAll)
 Function YesOrCancelDialog displays a warning dialog with aMessage and returns the user response. More...
 
void DisplayError (wxWindow *parent, const wxString &text, int displaytime)
 Function DisplayError displays an error or warning message box with aMessage. More...
 
void DisplayErrorMessage (wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
 Function DisplayErrorMessage displays an error message with aMessage. More...
 
void DisplayInfoMessage (wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
 Function DisplayInfoMessage displays an informational message box with aMessage. More...
 
bool IsOK (wxWindow *aParent, const wxString &aMessage)
 Function IsOK displays 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)
 Displays a dialog with radioboxes asking the user to select an option. More...
 

Variables

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

Detailed Description

utilities to display some error, warning and info short messges

Definition in file confirm.cpp.

Function Documentation

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

Function ConfirmRevertDialog displays a confirmation for a revert action.

Definition at line 200 of file confirm.cpp.

References DIALOG_EXIT_BASE::m_ApplyToAllOpt, and DIALOG_EXIT_BASE::m_DiscardButton.

Referenced by LIB_EDIT_FRAME::OnRevert(), and FOOTPRINT_EDIT_FRAME::RevertFootprint().

201 {
202  DIALOG_EXIT dlg( parent, aMessage,
203  _( "Your current changes will be permanently lost." ),
204  _( "Revert" ), _( "Cancel" ) );
205 
206  dlg.m_ApplyToAllOpt->Show( false );
207  dlg.m_DiscardButton->Show( false );
208 
209  return dlg.ShowModal() == wxID_YES;
210 }
void DisplayError ( wxWindow *  parent,
const wxString &  aMessage,
int  displaytime = 0 
)

Function DisplayError displays an error or warning message box with aMessage.

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

Definition at line 245 of file confirm.cpp.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), add_search_paths(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_EDIT_FRAME::addLibraryFile(), NETLIST_EXPORTER::addPinToComponentPinList(), SIM_PLOT_FRAME::AddTuner(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), LIB_EDIT_FRAME::backupFile(), PCB_EDIT_FRAME::Begin_Self(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), SCH_EDIT_FRAME::ConvertPart(), create_backup_file(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), DIALOG_GEN_FOOTPRINT_POSITION::CreateFiles(), LIB_EDIT_FRAME::CreateGraphicItem(), MICROWAVE_TOOL::createInductorBetween(), SPICE_SIMULATOR::CreateInstance(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), SCH_EDIT_FRAME::CreateNewText(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), PANEL_SETUP_LAYERS::DenyChangeCheckBox(), SCH_EDIT_FRAME::doUpdatePcb(), PCB_EDIT_FRAME::Edit_Gap(), SCH_EDIT_FRAME::EditSheet(), ExecuteFile(), FOOTPRINT_EDIT_FRAME::Export_Module(), GBR_TO_PCB_EXPORTER::ExportPcb(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::Files_io_from_id(), FootprintWriteShape(), NETLIST_EXPORTER_PSPICE::Format(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), DIALOG_SPICE_MODEL::generatePowerSource(), PCB_EDIT_FRAME::GenFootprintsReport(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), GetAssociatedDocument(), SCH_BASE_FRAME::HandleBlockBegin(), EDA_DRAW_FRAME::HandleBlockBegin(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), FOOTPRINT_EDIT_FRAME::Import_Module(), SCH_EDIT_FRAME::importFile(), ALIGN_DISTRIBUTE_TOOL::Init(), POINT_EDITOR::Init(), EDIT_TOOL::Init(), PCB_EDIT_FRAME::ListAndSelectModuleName(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadOneSymbol(), LIB_EDIT_FRAME::loadPart(), SIM_PLOT_FRAME::menuOpenWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), PCB_EDIT_FRAME::MuWaveCommand(), DIALOG_FIELDS_EDITOR_GLOBAL::OnAddField(), DIALOG_CONFIG_EQUFILES::OnAddFiles(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), LIB_EDIT_FRAME::OnCreateNewPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteField(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnDeleteField(), DIALOG_FOOTPRINT_FP_EDITOR::OnDeleteField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnDeleteField(), LIB_EDIT_FRAME::OnExportPart(), LIB_EDIT_FRAME::OnImportPart(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_DRC_CONTROL::OnListUnconnectedClick(), SCH_EDIT_FRAME::OnNewProject(), SCH_EDIT_FRAME::OnOpenCvpcb(), EDA_DRAW_PANEL_GAL::onPaint(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick(), DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick(), DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview(), DIALOG_PRINT_USING_PRINTER::OnPrintPreview(), FOOTPRINT_EDIT_FRAME::OnRightClick(), SIM_PLOT_FRAME::onSettings(), PCB_DRAW_PANEL_GAL::OnShow(), DIALOG_DRC_CONTROL::OnStartdrcClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), PCB_EDIT_FRAME::OnUpdatePCBFromSch(), DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateUI(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnUpdateUI(), FOOTPRINT_EDIT_FRAME::OnVerticalToolbar(), ROUTER_TOOL::onViaCommand(), WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnWizardFinished(), OpenPDF(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_PARSER::parseZONE_CONTAINER(), SYMBOL_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), SCH_EDIT_FRAME::PasteListOfItems(), DIALOG_PLOT::Plot(), DIALOG_BOM::pluginInit(), ROUTER_TOOL::prepareInteractive(), DIALOG_PRINT_USING_PRINTER::PreparePrintPrms(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::ProcessMuWaveFunctions(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), KIGFX::VERTEX_MANAGER::Reserve(), Retrace(), MODULE::RunOnChildren(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_EDIT_FRAME::saveLibrary(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), LIB_EDIT_FRAME::savePartAs(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), SCH_BASE_FRAME::SelectLibraryFromList(), KIGFX::GPU_MANAGER::SetShader(), PCB_EDIT_FRAME::SpreadFootprints(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), SIM_PLOT_FRAME::StartSimulation(), EDA_DRAW_PANEL_GAL::SwitchBackend(), FOOTPRINT_EDIT_FRAME::ToPrinter(), PCB_EDIT_FRAME::ToPrinter(), GERBVIEW_FRAME::ToPrinter(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_TRACK_VIA_SIZE::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_IMPORT_SETTINGS::TransferDataFromWindow(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow(), DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), UNIT_BINDER::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().

246 {
247  wxMessageDialog* dialog;
248 
249  int icon = displaytime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
250 
251  dialog = new wxMessageDialog( parent, text, _( "Warning" ),
252  wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
253 
254  dialog->ShowModal();
255  dialog->Destroy();
256 }
void DisplayErrorMessage ( wxWindow *  aParent,
const wxString &  aMessage,
const wxString &  aExtraInfo = wxEmptyString 
)

Function DisplayErrorMessage displays 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 259 of file confirm.cpp.

Referenced by PROJECT::AbsolutePath(), PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), checkGlError(), copy_pro_file_template(), SCH_EDIT_FRAME::CreateArchiveLibrary(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::duplicateZone(), LIB_EDIT_FRAME::EditField(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::ExportSpecctraFile(), LIB_MANAGER::FlushLibrary(), LIB_MANAGER::GetAlias(), LIB_MANAGER::GetAliases(), LIB_MANAGER::GetAliasNames(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::GetLibrary(), LIB_MANAGER::getOriginalParts(), PCB_EDIT_FRAME::ImportSpecctraSession(), LIB_EDIT_FRAME::InstallPreferences(), FOOTPRINT_EDIT_FRAME::KiwayMailIn(), LIB_EDIT_FRAME::KiwayMailIn(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::LoadOneSymbol(), DIALOG_EXPORT_STEP::onExportButton(), LIB_EDIT_FRAME::OnExportPart(), PCB_EDIT_FRAME::OnExportSTEP(), LIB_EDIT_FRAME::OnImportPart(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), PCB_EDIT_FRAME::OnLeftDClick(), KICAD_MANAGER_FRAME::OnNewProject(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), DIALOG_CONFIGURE_PATHS::OnUpdateUI(), PAGED_DIALOG::OnUpdateUI(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PROJECT::PcbFootprintLibs(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Remove_Zone_Corner(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), SchGetLibAlias(), FOOTPRINT_VIEWER_FRAME::ShowModal(), DIALOG_PNS_DIFF_PAIR_DIMENSIONS::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), and SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

260 {
261  wxRichMessageDialog* dlg;
262 
263  dlg = new wxRichMessageDialog( aParent, aText, _( "Error" ),
264  wxOK | wxCENTRE | wxRESIZE_BORDER |
265  wxICON_ERROR | wxSTAY_ON_TOP );
266 
267  if( !aExtraInfo.IsEmpty() )
268  {
269  dlg->ShowDetailedText( aExtraInfo );
270  }
271 
272  dlg->ShowModal();
273  dlg->Destroy();
274 }
void DisplayInfoMessage ( wxWindow *  parent,
const wxString &  aMessage,
const wxString &  aExtraInfo = wxEmptyString 
)

Function DisplayInfoMessage displays 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 277 of file confirm.cpp.

Referenced by PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_FRAME::CreateNewModule(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), PCB_EDIT_FRAME::duplicateZone(), FOOTPRINT_EDIT_FRAME::Export_Module(), GERBVIEW_FRAME::ExportDataInPcbnewFormat(), PCB_EDIT_FRAME::Files_io_from_id(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), PGM_BASE::GetEditorName(), SCH_EDIT_FRAME::ImportSheetPin(), SIM_PLOT_FRAME::onAddSignal(), LIB_EDIT_FRAME::OnCheckComponent(), DIALOG_PRINT_USING_PRINTER::OnCloseWindow(), CV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), PCB_EDIT_FRAME::OnSelectTool(), DIALOG_NETLIST::OnTestFootprintsClick(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_PLOT::Plot(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_BASE_FRAME::SelectCopperLayerPair(), DIALOG_PRINT_USING_PRINTER::SetPrintParameters(), SIM_PLOT_FRAME::StartSimulation(), PCBNEW_CONTROL::ToBeDone(), and FOOTPRINT_EDIT_FRAME::Transform().

278 {
279  wxRichMessageDialog* dlg;
280 
281  dlg = new wxRichMessageDialog( aParent, aMessage, _( "Info" ),
282  wxOK | wxCENTRE | wxRESIZE_BORDER |
283  wxICON_INFORMATION | wxSTAY_ON_TOP );
284 
285  if( !aExtraInfo.IsEmpty() )
286  {
287  dlg->ShowDetailedText( aExtraInfo );
288  }
289 
290  dlg->ShowModal();
291  dlg->Destroy();
292 }
bool HandleUnsavedChanges ( wxWindow *  aParent,
const wxString &  aMessage,
const std::function< bool()> &  aSaveFunction 
)

Function HandleUnsavedChanges displays 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 213 of file confirm.cpp.

References UnsavedChangesDialog().

Referenced by SCH_EDIT_FRAME::AskToSaveChanges(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PL_EDITOR_FRAME::Files_io(), LIB_EDIT_FRAME::LoadComponentAndSelectLib(), DIALOG_FIELDS_EDITOR_GLOBAL::OnClose(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OpenProjectFiles(), and FOOTPRINT_EDIT_FRAME::Process_Special_Functions().

215 {
216  switch( UnsavedChangesDialog( aParent, aMessage, nullptr ) )
217  {
218  case wxID_YES: return aSaveFunction();
219  case wxID_NO: return true;
220  default:
221  case wxID_CANCEL: return false;
222  }
223 }
int UnsavedChangesDialog(wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
Function UnsavedChangesDialog a specialized version of HandleUnsavedChanges which handles an apply-to...
Definition: confirm.cpp:182
bool IsOK ( wxWindow *  aParent,
const wxString &  aMessage 
)

Function IsOK displays 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 295 of file confirm.cpp.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), SCH_EDIT_FRAME::AppendSchematic(), SELECTION_TOOL::CheckLock(), DIALOG_IMAGE_EDITOR::CheckValues(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_EDIT_FRAME::Clear_Pcb(), CVPCB_MAINFRAME::DelAssociations(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), PCB_EDIT_FRAME::Delete_net(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), PCB_BASE_FRAME::DeletePad(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), SCH_EDIT_FRAME::EditSheet(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), PCB_EDIT_FRAME::Files_io_from_id(), PGM_BASE::InitPgm(), SCH_EDIT_FRAME::OnAppendProject(), KICAD_MANAGER_FRAME::OnNewProject(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), LIB_EDIT_FRAME::OnRemovePart(), DIALOG_NETLIST::OnUpdatePCB(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Process_Special_Functions(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate().

296 {
297  wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
298  wxYES_NO | wxCENTRE | wxICON_QUESTION | wxSTAY_ON_TOP );
299 
300  return dlg.ShowModal() == wxID_YES;
301 }
int SelectSingleOption ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const wxArrayString &  aOptions 
)

Displays 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 cancelled.

Definition at line 304 of file confirm.cpp.

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary().

305 {
306  wxSingleChoiceDialog dlg( aParent, aMessage, aTitle, aOptions );
307 
308  if( dlg.ShowModal() != wxID_OK )
309  return -1;
310 
311  return dlg.GetSelection();
312 }
int UnsavedChangesDialog ( wxWindow *  aParent,
const wxString &  aMessage,
bool *  aApplyToAll 
)

Function UnsavedChangesDialog 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 182 of file confirm.cpp.

References DIALOG_EXIT_BASE::m_ApplyToAllOpt.

Referenced by HandleUnsavedChanges(), and LIB_EDIT_FRAME::saveAllLibraries().

183 {
184  DIALOG_EXIT dlg( parent, aMessage,
185  _( "If you don't save, all your changes will be permanently lost." ),
186  _( "Save" ), _( "Cancel" ) );
187 
188  dlg.m_ApplyToAllOpt->Show( aApplyToAll != nullptr );
189 
190  int ret = dlg.ShowModal();
191 
192  if( aApplyToAll )
193  *aApplyToAll = dlg.m_ApplyToAllOpt->GetValue();
194 
195  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
196  return ret;
197 }
int YesOrCancelDialog ( wxWindow *  aParent,
const wxString &  aWarning,
const wxString &  aMessage,
const wxString &  aOKLabel,
const wxString &  aCancelLabel,
bool *  aApplyToAll = nullptr 
)

Function YesOrCancelDialog displays 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.
aOKLabelis the text to display in the OK button.
aCancelLabelis the text to display in the cancel button.
Returns
wxID_YES or wxID_CANCEL depending on the button the user selected.

Definition at line 226 of file confirm.cpp.

References DIALOG_EXIT_BASE::m_ApplyToAllOpt, and DIALOG_EXIT_BASE::m_DiscardButton.

Referenced by PANEL_SYM_LIB_TABLE::browseLibrariesHandler(), and PANEL_FP_LIB_TABLE::browseLibrariesHandler().

228 {
229  DIALOG_EXIT dlg( aParent, aWarning, aMessage, aOKLabel, aCancelLabel );
230 
231  dlg.m_ApplyToAllOpt->Show( aApplyToAll != nullptr );
232  dlg.m_DiscardButton->Show( false );
233 
234  int ret = dlg.ShowModal();
235 
236  if( aApplyToAll )
237  *aApplyToAll = dlg.m_ApplyToAllOpt->GetValue();
238 
239  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
240  return ret;
241 }

Variable Documentation

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