| 166 | END_EVENT_TABLE() |
| 167 | |
| 168 | TimerRecordDialog::TimerRecordDialog( |
| 169 | wxWindow* parent, AudacityProject &project, bool bAlreadySaved) |
| 170 | : wxDialogWrapper(parent, -1, XO("Audacity Timer Record"), wxDefaultPosition, |
| 171 | wxDefaultSize, wxCAPTION) |
| 172 | , mProject{ project } |
| 173 | { |
| 174 | SetName(); |
| 175 | |
| 176 | m_DateTime_Start = wxDateTime::UNow(); |
| 177 | long seconds; // default duration is 1 hour = 3600 seconds |
| 178 | gPrefs->Read(wxT("/TimerRecord/LastDuration"), &seconds, 3600L); |
| 179 | m_TimeSpan_Duration = wxTimeSpan::Seconds(seconds); |
| 180 | m_DateTime_End = m_DateTime_Start + m_TimeSpan_Duration; |
| 181 | |
| 182 | m_pDatePickerCtrl_Start = NULL; |
| 183 | m_pTimeTextCtrl_Start = NULL; |
| 184 | |
| 185 | m_pDatePickerCtrl_End = NULL; |
| 186 | m_pTimeTextCtrl_End = NULL; |
| 187 | |
| 188 | m_pTimeTextCtrl_Duration = NULL; |
| 189 | |
| 190 | // Do we allow the user to change the Automatic Save file? |
| 191 | m_bProjectAlreadySaved = bAlreadySaved; |
| 192 | |
| 193 | wxString exportPath; |
| 194 | DefaultExportAudioPath.Read(&exportPath); |
| 195 | if(exportPath.empty()) |
| 196 | exportPath = FileNames::FindDefaultPath(FileNames::Operation::Export); |
| 197 | m_fnAutoExportFile.SetPath(exportPath); |
| 198 | |
| 199 | m_fnAutoExportFile.SetName(mProject.GetProjectName()); |
| 200 | if(m_fnAutoExportFile.GetName().IsEmpty()) |
| 201 | m_fnAutoExportFile.SetName(_("untitled")); |
| 202 | |
| 203 | DefaultExportAudioFormat.Read(&m_sAutoExportFormat); |
| 204 | if(!m_sAutoExportFormat.empty()) |
| 205 | { |
| 206 | auto [plugin, formatIndex] |
| 207 | = ExportPluginRegistry::Get().FindFormat(m_sAutoExportFormat); |
| 208 | |
| 209 | if(plugin != nullptr) |
| 210 | { |
| 211 | const auto formatInfo = plugin->GetFormatInfo(formatIndex); |
| 212 | m_fnAutoExportFile.SetExt(formatInfo.extensions[0]); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | m_iAutoExportSampleRate = ProjectRate::Get(mProject).GetRate(); |
| 217 | m_iAutoExportChannels = AudioIORecordChannels.Read(); |
| 218 | |
| 219 | ShuttleGui S(this, eIsCreating); |
| 220 | this->PopulateOrExchange(S); |
| 221 | |
| 222 | // Set initial focus to "1" of "01h" in Duration NumericTextCtrl, |
| 223 | // instead of OK button (default). |
| 224 | m_pTimeTextCtrl_Duration->SetFocus(); |
| 225 | m_pTimeTextCtrl_Duration->SetFieldFocus(3); |
nothing calls this directly
no test coverage detected