void MainFrame::OnNewRaceEvent(wxCommandEvent &event){ wxString defaultDir = _appPrefs.GetLastConfigFileDirectory(); wxString defaultFile = ""; wxFileDialog fileDialog(this, "New Race Event", defaultDir, defaultFile, OPEN_RACE_EVENT_FILTER, wxFD_SAVE); int result = fileDialog.ShowModal(); if (wxID_OK == result){ try{ const wxString fileName = fileDialog.GetPath(); if (wxFile::Exists(fileName)){ wxMessageDialog dlg(this, wxString::Format("Race Event file already exists. Open this Event?"),"Open Existing Race Event", wxYES_DEFAULT | wxYES_NO); int result = dlg.ShowModal(); if (result == wxID_YES){ OpenRaceEvent(fileName); } }else{ NewRaceEvent(fileName); } RaceEventUpdated(); } catch(DatastoreException &e){ wxMessageDialog dlg(this, wxString::Format("Failed to Create Race Event:\n\n%s", e.GetMessage().ToAscii()), "Error Creating Race Event", wxOK | wxICON_HAND); } _appPrefs.SetLastConfigFileDirectory(fileDialog.GetDirectory()); } //Set default values NotifyConfigChanged(); }
void MainFrame::OnNewConfig(wxCommandEvent &event){ if (m_configModified){ if (QuerySaveModifications()) SaveCurrentConfig(); } m_currentConfig.SetDefaults(); NotifyConfigChanged(); }
void MainFrame::RaceEventUpdated(){ UpdateAnalyzerView(); m_datalogPlayer.DatalogSessionsUpdated(); m_datalogPlayer.RequeryAll(); UpdateCommControls(); NotifyConfigChanged(); SyncControls(); UpdateConfigFileStatus(); SetStatusMessage("Race Event Loaded"); }
void MainFrame::OnConfigChanged(wxCommandEvent &event){ event.StopPropagation(); wxObject *obj = event.GetEventObject(); if (obj == NULL){ wxLogMessage("null event object"); return; } event.Skip(false); ConfigModified(); NotifyConfigChanged(); }
void MainFrame::LoadInitialConfig(){ if (m_appOptions.GetAutoLoadConfig()){ ReadRaceCaptureConfig(); } else{ SetStatusMessage("Default Config Loaded"); } NotifyConfigChanged(); m_configModified = false; UpdateCommControls(); SyncControls(); UpdateConfigFileStatus(); }
void MainFrame::LoadConfigurationFile(const wxString fileName){ RaceCaptureConfigFileReader reader; reader.SetFileName(fileName); try{ reader.ReadConfiguration(m_currentConfig); if (m_currentConfigFileName) delete m_currentConfigFileName; m_currentConfigFileName = new wxString(fileName); m_configModified = false; UpdateCommControls(); NotifyConfigChanged(); SyncControls(); UpdateConfigFileStatus(); SetStatusMessage("RaceCapture Configuration Loaded"); } catch( FileAccessException &e ){ wxMessageDialog dlg(this, wxString::Format("Failed to load RaceCapture Configuration:\n\n%s", e.GetMessage().ToAscii()), "Error loading", wxOK | wxICON_HAND); dlg.ShowModal(); return; } UpdateConfigFileStatus(); }
void TextureReplacer::Init() { NotifyConfigChanged(); }