KiCad PCB EDA Suite
confirm.cpp File Reference

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

#include <wx/stockitem.h>
#include <bitmaps.h>
#include <html_messagebox.h>
#include <dialog_exit_base.h>

Go to the source code of this file.

Classes

class  DIALOG_EXIT
 
class  DIALOG_YES_NO_CANCEL
 

Functions

int DisplayExitDialog (wxWindow *parent, 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 &text, int displaytime)
 Function DisplayError displays an error or warning message box with aMessage. More...
 
void DisplayInfoMessage (wxWindow *parent, const wxString &text, int displaytime)
 Function DisplayInfoMessage displays an informational message box with aMessage. More...
 
void DisplayHtmlInfoMessage (wxWindow *parent, const wxString &title, const wxString &text, const wxSize &size)
 Function DisplayHtmlInforMessage displays aMessage in HTML format. 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, const wxString &aNoButtonText, const wxString &aCancelButtonText)
 Function YesNoCancelDialog displays a yes/no/cancel dialog with aMessage and returns the user response. More...
 

Detailed Description

utilities to display some error, warning and info short messges

Definition in file confirm.cpp.

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

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter(), NETLIST_EXPORTER::addPinToComponentPinList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), HIERARCHY_NAVIG_DLG::BuildSheetsTree(), DIALOG_TRACK_VIA_SIZE::check(), DIALOG_TRACK_VIA_PROPERTIES::check(), checkGlError(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), SCH_EDIT_FRAME::ConvertPart(), copy_pro_file_template(), 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_MODULE_POSITION::CreateFiles(), LIB_EDIT_FRAME::CreateGraphicItem(), MICROWAVE_TOOL::createInductorBetween(), SPICE_SIMULATOR::CreateInstance(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), LIB_EDIT_FRAME::CreateNewLibraryPart(), SCH_EDIT_FRAME::CreateNewText(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), LIB_EDIT_FRAME::DeleteOnePart(), FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings(), PCB_EDIT_FRAME::DlgGlobalChange_PadSettings(), PCB_EDIT_FRAME::duplicateZone(), PCB_EDIT_FRAME::Edit_Gap(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), ExecuteFile(), FOOTPRINT_EDIT_FRAME::Export_Module(), GBR_TO_PCB_EXPORTER::ExportPcb(), PCB_EDIT_FRAME::ExportSpecctraFile(), 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_SPICE_MODEL::generatePowerSource(), PCB_EDIT_FRAME::GenFootprintsReport(), genPlacementRoutingMatrix(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), GetAssociatedDocument(), 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(), PCB_EDIT_FRAME::ImportSpecctraSession(), PLACEMENT_TOOL::Init(), POINT_EDITOR::Init(), EDIT_TOOL::Init(), PCB_EDIT_FRAME::ListAndSelectModuleName(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), SCH_EDIT_FRAME::LoadOneEEFile(), LIB_EDIT_FRAME::LoadOneLibraryPart(), LIB_EDIT_FRAME::LoadOneSymbol(), SIM_PLOT_FRAME::menuOpenWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), PCB_EDIT_FRAME::MuWaveCommand(), DIALOG_CONFIG_EQUFILES::OnAddFiles(), DIALOG_DESIGN_RULES::OnAddNetclassClick(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnExportPart(), LIB_EDIT_FRAME::OnImportPart(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftDClick(), DIALOG_DRC_CONTROL::OnListUnconnectedClick(), KICAD_MANAGER_FRAME::OnLoadProject(), SCH_EDIT_FRAME::OnNewProject(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick(), DIALOG_MODULE_MODULE_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), 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(), LIB_EDIT_FRAME::OnSaveCurrentPart(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), SCH_EDIT_FRAME::OnSaveProject(), DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser(), SIM_PLOT_FRAME::onSettings(), DIALOG_DRC_CONTROL::OnStartdrcClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), 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(), FP_GRID_TRICKS::paste_text(), SCH_EDIT_FRAME::PasteListOfItems(), PROJECT::PcbFootprintLibs(), 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(), PCB_EDIT_FRAME::Remove_Zone_Corner(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), KIGFX::VERTEX_MANAGER::Reserve(), Retrace(), MODULE::RunOnChildren(), save_library(), LIB_EDIT_FRAME::SaveActiveLibrary(), FOOTPRINT_EDIT_FRAME::SaveCurrentModule(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), 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::ToolOnRightClick(), FOOTPRINT_EDIT_FRAME::ToPrinter(), PCB_EDIT_FRAME::ToPrinter(), GERBVIEW_FRAME::ToPrinter(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::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(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

70 {
71  wxMessageDialog* dialog;
72 
73  if( displaytime > 0 )
74  dialog = new wxMessageDialog( parent, text, _( "Warning" ),
75  wxOK | wxCENTRE | wxICON_INFORMATION
76  | wxRESIZE_BORDER
77  );
78  else
79  dialog = new wxMessageDialog( parent, text, _( "Error" ),
80  wxOK | wxCENTRE | wxICON_ERROR
81  | wxRESIZE_BORDER
82  );
83 
84  dialog->ShowModal();
85  dialog->Destroy();
86 }
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 58 of file confirm.cpp.

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

59 {
60  DIALOG_EXIT dlg( parent, aMessage );
61 
62  int ret = dlg.ShowModal();
63 
64  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
65  return ret;
66 }
void DisplayHtmlInfoMessage ( wxWindow *  parent,
const wxString &  title,
const wxString &  text,
const wxSize &  size 
)

Function DisplayHtmlInforMessage displays aMessage in HTML format.

Definition at line 101 of file confirm.cpp.

References HTML_MESSAGE_BOX::AddHTML_Text().

Referenced by DisplayHotkeyList().

103 {
104  HTML_MESSAGE_BOX dlg( parent, title, wxDefaultPosition, size );
105 
106  dlg.AddHTML_Text( text );
107  dlg.ShowModal();
108 }
Class HTML_MESSAGE_BOX.
void DisplayInfoMessage ( wxWindow *  parent,
const wxString &  aMessage,
int  displaytime = 0 
)

Function DisplayInfoMessage displays an informational message box with aMessage.

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

Definition at line 89 of file confirm.cpp.

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), PCB_BASE_FRAME::CreateNewModule(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), 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(), SCH_EDIT_FRAME::LoadOneEEFile(), SIM_PLOT_FRAME::onAddSignal(), LIB_EDIT_FRAME::OnCheckComponent(), LIB_EDIT_FRAME::OnExportPart(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), PCB_EDIT_FRAME::OnSelectTool(), DIALOG_NETLIST::OnTestFootprintsClick(), 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().

90 {
91  wxMessageDialog* dialog;
92 
93  dialog = new wxMessageDialog( parent, text, _( "Info" ),
94  wxOK | wxCENTRE | wxICON_INFORMATION );
95 
96  dialog->ShowModal();
97  dialog->Destroy();
98 }
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 111 of file confirm.cpp.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), PCB_EDIT_FRAME::AutoPlaceModule(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), SELECTION_TOOL::CheckLock(), GERBVIEW_FRAME::Clear_DrawLayers(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), LIB_EDIT_FRAME::CreateNewLibraryPart(), 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(), LIB_EDIT_FRAME::DeleteOnePart(), 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(), LIB_EDIT_FRAME::LoadOneLibraryPart(), SCH_EDIT_FRAME::OnAppendProject(), LIB_EDIT_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnEditPin(), PL_EDITOR_FRAME::OnFileHistory(), KICAD_MANAGER_FRAME::OnLoadProject(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), DIALOG_NETLIST::OnReadNetlistFileClick(), 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::ReadNetListAndLinkFiles(), LIB_EDIT_FRAME::SaveActiveLibrary(), LIB_EDIT_FRAME::SaveOnePart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), PCB_EDIT_FRAME::Solve(), and DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow().

112 {
113  wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
114  wxYES_NO | wxCENTRE | wxICON_QUESTION );
115 
116  return dlg.ShowModal() == wxID_YES;
117 }
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 148 of file confirm.cpp.

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

154 {
155  DIALOG_YES_NO_CANCEL dlg( aParent, aPrimaryMessage, aSecondaryMessage,
156  aYesButtonText, aNoButtonText, aCancelButtonText );
157 
158  return dlg.ShowModal();
159 }