KiCad PCB EDA Suite
confirm.h File Reference

This file is part of the common library. More...

#include <wx/dialog.h>
#include <vector>

Go to the source code of this file.

Classes

class  KI_DIALOG
 Helper class to create more flexible dialogs, e.g: More...
 

Functions

int DisplayExitDialog (wxWindow *aParent, const wxString &aMessage)
 Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save. More...
 
void DisplayError (wxWindow *parent, const wxString &aMessage, int displaytime=0)
 Function DisplayError displays an error or warning message box with aMessage. More...
 
void DisplayErrorMessage (wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo=wxEmptyString)
 Function DisplayErrorMessage displays an error message with aMessage. More...
 
void DisplayInfoMessage (wxWindow *parent, const wxString &aMessage, const wxString &aExtraInfo=wxEmptyString)
 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 YesNoCancelDialog (wxWindow *aParent, const wxString &aPrimaryMessage, const wxString &aSecondaryMessage, const wxString &aYesButtonText=wxEmptyString, const wxString &aNoButtonText=wxEmptyString, const wxString &aCancelButtonText=wxEmptyString)
 Function YesNoCancelDialog displays a yes/no/cancel 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...
 
std::pair< bool, std::vector< int > > SelectMultipleOptions (wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions, bool aDefaultState=false)
 Displays a dialog with checkboxes asking the user to select one or more options. More...
 
std::pair< bool, std::vector< int > > SelectMultipleOptions (wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const std::vector< std::string > &aOptions, bool aDefaultState=false)
 

Detailed Description

This file is part of the common library.

See also
common.h

Definition in file confirm.h.

Function Documentation

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 241 of file confirm.cpp.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut(), add_search_paths(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter(), LIB_EDIT_FRAME::addLibraryFile(), NETLIST_EXPORTER::addPinToComponentPinList(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), LIB_EDIT_FRAME::backupFile(), PCB_EDIT_FRAME::Begin_Self(), DIALOG_TRACK_VIA_SIZE::check(), DIALOG_TRACK_VIA_PROPERTIES::check(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), create_backup_file(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), SCH_EDIT_FRAME::CreateArchiveLibrary(), 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(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings(), PCB_EDIT_FRAME::DlgGlobalChange_PadSettings(), SCH_EDIT_FRAME::doUpdatePcb(), PCB_EDIT_FRAME::Edit_Gap(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditAliasOfPart(), SCH_EDIT_FRAME::EditSheet(), ExecuteFile(), FOOTPRINT_EDIT_FRAME::Export_Module(), GBR_TO_PCB_EXPORTER::ExportPcb(), DIALOG_SVG_PRINT::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(), genPlacementRoutingMatrix(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), GetAssociatedDocument(), DIALOG_PRINT_USING_PRINTER::GetPrintOptions(), PCB_BASE_FRAME::GlobalChange_PadSettings(), 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(), POSITION_RELATIVE_TOOL::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_ENV_VAR_CONFIG::OnAddButton(), DIALOG_CONFIG_EQUFILES::OnAddFiles(), DIALOG_DESIGN_RULES::OnAddNetclassClick(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), LIB_EDIT_FRAME::OnCreateNewPart(), LIB_EDIT_FRAME::OnExportPart(), LIB_EDIT_FRAME::OnImportPart(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_DRC_CONTROL::OnListUnconnectedClick(), SCH_EDIT_FRAME::OnNewProject(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), EDA_DRAW_PANEL_GAL::onPaint(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), LIB_EDIT_FRAME::OnPreferencesOptions(), DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick(), DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick(), DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview(), DIALOG_PRINT_USING_PRINTER::OnPrintPreview(), FOOTPRINT_EDIT_FRAME::OnRightClick(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), SCH_EDIT_FRAME::OnSaveProject(), DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar(), KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser(), SIM_PLOT_FRAME::onSettings(), PCB_DRAW_PANEL_GAL::OnShow(), DIALOG_DRC_CONTROL::OnStartdrcClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), PCB_EDIT_FRAME::OnUpdatePCBFromSch(), FOOTPRINT_EDIT_FRAME::OnVerticalToolbar(), ROUTER_TOOL::onViaCommand(), WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnWizardFinished(), WIZARD_FPLIB_TABLE::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(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_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(), FOOTPRINT_EDIT_FRAME::SaveCurrentModule(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), PCB_BASE_FRAME::SelectFootprint(), 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(), DIALOG_LAYERS_SETUP::testLayerNames(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), FOOTPRINT_EDIT_FRAME::ToPrinter(), PCB_EDIT_FRAME::ToPrinter(), GERBVIEW_FRAME::ToPrinter(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), DIALOG_ENV_VAR_SINGLE::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_LAYERS_SETUP::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), SPICE_VALIDATOR::Validate(), KIGFX::VERTEX_MANAGER::Vertex(), KIGFX::VERTEX_MANAGER::Vertices(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), NETLIST_EXPORTER_KICAD::WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), LEGACY_RESCUER::WriteRescueLibrary(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

242 {
243  wxMessageDialog* dialog;
244 
245  int icon = displaytime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
246 
247  dialog = new wxMessageDialog( parent, text, _( "Warning" ),
248  wxOK | wxCENTRE | wxRESIZE_BORDER | icon );
249 
250  dialog->ShowModal();
251  dialog->Destroy();
252 }
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 255 of file confirm.cpp.

Referenced by PROJECT::AbsolutePath(), PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), checkGlError(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), copy_pro_file_template(), SCH_EDIT_FRAME::CreateArchiveLibrary(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::duplicateZone(), LIB_EDIT_FRAME::EditField(), DIALOG_ENV_VAR_CONFIG::EditSelectedEntry(), 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::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::LoadOneSymbol(), 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(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PROJECT::PcbFootprintLibs(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Remove_Zone_Corner(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), SchGetLibAlias(), FOOTPRINT_EDIT_FRAME::ToolOnRightClick(), and SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

256 {
257  wxRichMessageDialog* dlg;
258 
259  dlg = new wxRichMessageDialog( aParent, aText, _( "Error" ),
260  wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR );
261 
262  if( !aExtraInfo.IsEmpty() )
263  {
264  dlg->ShowDetailedText( aExtraInfo );
265  }
266 
267  dlg->ShowModal();
268  dlg->Destroy();
269 }
int DisplayExitDialog ( wxWindow *  aParent,
const wxString &  aMessage 
)

Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save.

Parameters
aParent= the parent window
aMessage= the main message to put in dialog If empty, the standard message will be shown: Save the changes before closing?
Returns
wxID_YES, wxID_CANCEL, wxID_NO.

Definition at line 229 of file confirm.cpp.

Referenced by DIALOG_FIELDS_EDITOR_GLOBAL::CanCloseDialog(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), and PCB_EDIT_FRAME::OnCloseWindow().

230 {
231  DIALOG_EXIT dlg( parent, aMessage );
232 
233  int ret = dlg.ShowModal();
234 
235  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
236  return ret;
237 }
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 272 of file confirm.cpp.

Referenced by PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), PCB_BASE_FRAME::CreateNewModule(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), 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(), DIALOG_PRINT_USING_PRINTER::InitValues(), SIM_PLOT_FRAME::onAddSignal(), LIB_EDIT_FRAME::OnCheckComponent(), CV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), PCB_EDIT_FRAME::OnSelectTool(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), 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::SaveCurrentModule(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), 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().

273 {
274  wxRichMessageDialog* dlg;
275 
276  dlg = new wxRichMessageDialog( aParent, aMessage, _( "Info" ),
277  wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_INFORMATION );
278 
279  if( !aExtraInfo.IsEmpty() )
280  {
281  dlg->ShowDetailedText( aExtraInfo );
282  }
283 
284  dlg->ShowModal();
285  dlg->Destroy();
286 }
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 289 of file confirm.cpp.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::AutoPlaceModule(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage(), SELECTION_TOOL::CheckLock(), GERBVIEW_FRAME::Clear_DrawLayers(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), CVPCB_MAINFRAME::DelAssociations(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), PCB_EDIT_FRAME::Delete_net(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter(), deleteItem(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), PCB_BASE_FRAME::DeletePad(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), SCH_EDIT_FRAME::EditSheet(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), PL_EDITOR_FRAME::Files_io(), PCB_EDIT_FRAME::Files_io_from_id(), getOptimalModulePlacement(), PGM_BASE::InitPgm(), ROUTER_TOOL::InlineDrag(), PCB_EDIT_FRAME::InstallNetlistFrame(), LIB_EDIT_FRAME::LoadComponentAndSelectLib(), FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard(), SCH_EDIT_FRAME::OnAppendProject(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnExportPart(), PL_EDITOR_FRAME::OnFileHistory(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), KICAD_MANAGER_FRAME::OnNewProject(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), DIALOG_NETLIST::OnReadNetlistFileClick(), LIB_EDIT_FRAME::OnRemovePart(), DIALOG_FIELDS_EDITOR_GLOBAL::OnRevertFieldChanges(), LIB_EDIT_FRAME::OnRevertLibrary(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), ROUTER_TOOL::performDragging(), LIB_EDIT_FRAME::PlacePin(), SCH_EDIT_FRAME::prepareForNetlist(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), PCB_EDIT_FRAME::Solve(), DIALOG_GENCAD_EXPORT_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow(), and DIALOG_LAYERS_SETUP::TransferDataFromWindow().

290 {
291  wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
292  wxYES_NO | wxCENTRE | wxICON_QUESTION );
293 
294  return dlg.ShowModal() == wxID_YES;
295 }
std::pair<bool, std::vector<int> > SelectMultipleOptions ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const wxArrayString &  aOptions,
bool  aDefaultState = false 
)

Displays a dialog with checkboxes asking the user to select one or more options.

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.
aDefaultStateis the default state for the checkboxes.
Returns
Vector containing indices of the selected option.

Definition at line 475 of file confirm.cpp.

References DIALOG_MULTI_OPTIONS::GetSelection(), and DIALOG_MULTI_OPTIONS::SetCheckboxes().

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

477 {
478  std::vector<int> ret;
479  bool clickedOk;
480  DIALOG_MULTI_OPTIONS dlg( aParent, aTitle, aMessage, aOptions );
481  dlg.SetCheckboxes( aDefaultState );
482 
483  if( dlg.ShowModal() == wxID_OK )
484  {
485  ret = dlg.GetSelection();
486  clickedOk = true;
487  }
488  else
489  {
490  clickedOk = false;
491  }
492 
493  return std::make_pair( clickedOk, ret );
494 }
std::pair<bool, std::vector<int> > SelectMultipleOptions ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const std::vector< std::string > &  aOptions,
bool  aDefaultState = false 
)

Definition at line 497 of file confirm.cpp.

References SelectMultipleOptions().

499 {
500  wxArrayString array;
501 
502  for( const auto& option : aOptions )
503  array.Add( option );
504 
505  return SelectMultipleOptions( aParent, aTitle, aMessage, array, aDefaultState );
506 }
std::pair< bool, std::vector< int > > SelectMultipleOptions(wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions, bool aDefaultState)
Displays a dialog with checkboxes asking the user to select one or more options.
Definition: confirm.cpp:475
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 340 of file confirm.cpp.

Referenced by LIB_EDIT_FRAME::selectSymLibTable().

341 {
342  int ret = -1;
343  wxDialog* dlg = new wxDialog( aParent, wxID_ANY, aTitle );
344 
345  wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
346 
347  if( !aMessage.IsEmpty() )
348  boxSizer->Add( new wxStaticText( dlg, wxID_ANY, aMessage ), 0, wxEXPAND | wxALL, 5 );
349 
350  std::vector<wxRadioButton*> radioButtons;
351  radioButtons.reserve( aOptions.Count() );
352 
353  for( const wxString& option : aOptions )
354  {
355  radioButtons.emplace_back( new wxRadioButton( dlg, wxID_ANY, _( option ) ) );
356  boxSizer->Add( radioButtons.back(), 0, wxEXPAND | wxALL, 5 );
357  }
358 
359  wxStdDialogButtonSizer* m_sdboxSizer = new wxStdDialogButtonSizer();
360  wxButton* btnOk = new wxButton( dlg, wxID_OK );
361  m_sdboxSizer->AddButton( btnOk );
362  m_sdboxSizer->AddButton( new wxButton( dlg, wxID_CANCEL ) );
363  m_sdboxSizer->Realize();
364  btnOk->SetDefault();
365  boxSizer->Add( m_sdboxSizer, 1, wxEXPAND | wxALL, 5 );
366 
367  dlg->SetSizer( boxSizer );
368  dlg->Layout();
369  boxSizer->Fit( dlg );
370  boxSizer->SetSizeHints( dlg );
371  dlg->Centre( wxBOTH );
372 
373  if( dlg->ShowModal() == wxID_OK )
374  {
375  for( unsigned int i = 0; i < radioButtons.size(); ++i )
376  {
377  if( radioButtons[i]->GetValue() )
378  {
379  ret = i;
380  break;
381  }
382  }
383  }
384  else
385  {
386  ret = -1;
387  }
388 
389  dlg->Destroy();
390 
391  return ret;
392 }
int YesNoCancelDialog ( wxWindow *  aParent,
const wxString &  aPrimaryMessage,
const wxString &  aSecondaryMessage,
const wxString &  aYesButtonText = wxEmptyString,
const wxString &  aNoButtonText = wxEmptyString,
const wxString &  aCancelButtonText = wxEmptyString 
)

Function YesNoCancelDialog displays a yes/no/cancel 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.
aPrimaryMessageis the message to display in the top part of the dialog box using a bold font.
aSecondaryMessageis the message to display in the lower part of the dialog box using the default system UI font.
aYesButtonTextis the text to display in the yes button when defined.
aNoButtonTextis the text to display in the no button when defiend.
aCancelButtonTextis the text to display in the cancel button when defined.
Returns
wxID_YES, wxID_NO, or wxID_CANCEL depending on the button the user selected.

Definition at line 326 of file confirm.cpp.

Referenced by SCH_EDIT_FRAME::AskToSaveChanges(), and PCB_EDIT_FRAME::OpenProjectFiles().

332 {
333  DIALOG_YES_NO_CANCEL dlg( aParent, aPrimaryMessage, aSecondaryMessage,
334  aYesButtonText, aNoButtonText, aCancelButtonText );
335 
336  return dlg.ShowModal();
337 }