// Update m_DateTime_End and ctrls based on m_DateTime_Start and m_TimeSpan_Duration. void TimerRecordDialog::UpdateEnd() { //v Use remaining disk -> record time calcs from AudacityProject::OnTimer to set range? m_DateTime_End = m_DateTime_Start + m_TimeSpan_Duration; m_pDatePickerCtrl_End->SetValue(m_DateTime_End); m_pDatePickerCtrl_End->SetRange(m_DateTime_Start, wxInvalidDateTime); // No backdating. m_pDatePickerCtrl_End->Refresh(); m_pTimeTextCtrl_End->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_End)); }
void TimerRecordDialog::OnTimer(wxTimerEvent& WXUNUSED(event)) { wxDateTime dateTime_UNow = wxDateTime::UNow(); if (m_DateTime_Start < dateTime_UNow) { m_DateTime_Start = dateTime_UNow; m_pDatePickerCtrl_Start->SetValue(m_DateTime_Start); m_pTimeTextCtrl_Start->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_Start)); this->UpdateEnd(); // Keep Duration constant and update End for changed Start. } }
void TimerRecordDialog::OnDatePicker_End(wxDateEvent& event) { m_DateTime_End = m_pDatePickerCtrl_End->GetValue(); double dTime = m_pTimeTextCtrl_End->GetTimeValue(); long hr = (long)(dTime / 3600.0); long min = (long)((dTime - (hr * 3600.0)) / 60.0); long sec = (long)(dTime - (hr * 3600.0) - (min * 60.0)); m_DateTime_End.SetHour(hr); m_DateTime_End.SetMinute(min); m_DateTime_End.SetSecond(sec); // DatePickerCtrls use SetRange to make sure End is never less than Start, but // need to implement it for the TimeTextCtrls. if (m_DateTime_End < m_DateTime_Start) { m_DateTime_End = m_DateTime_Start; m_pTimeTextCtrl_End->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_End)); } this->UpdateDuration(); // Keep Start constant and update Duration for changed End. }
void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) { S.SetBorder(5); S.StartVerticalLay(true); { /* i18n-hint: This string is used to configure the controls for times when the recording is * started and stopped. As such it is important that only the alphabetic parts of the string * are translated, with the numbers left exactly as they are. * The 'h' indicates the first number displayed is hours, the 'm' indicates the second number * displayed is minutes, and the 's' indicates that the third number displayed is seconds. */ wxString strFormat = _("099 h 060 m 060 s"); S.StartStatic(_("Start Date and Time"), true); { m_pDatePickerCtrl_Start = new wxDatePickerCtrl(this, // wxWindow *parent, ID_DATEPICKER_START, // wxWindowID id, m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_Start->SetName(_("Start Date")); m_pDatePickerCtrl_Start->SetRange(wxDateTime::Today(), wxInvalidDateTime); // No backdating. S.AddWindow(m_pDatePickerCtrl_Start); m_pTimeTextCtrl_Start = new TimeTextCtrl(this, ID_TIMETEXT_START); m_pTimeTextCtrl_Start->SetName(_("Start Time")); m_pTimeTextCtrl_Start->SetFormatString(strFormat); m_pTimeTextCtrl_Start->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_Start)); S.AddWindow(m_pTimeTextCtrl_Start); m_pTimeTextCtrl_Start->EnableMenu(false); } S.EndStatic(); S.StartStatic(_("End Date and Time"), true); { m_pDatePickerCtrl_End = new wxDatePickerCtrl(this, // wxWindow *parent, ID_DATEPICKER_END, // wxWindowID id, m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_End->SetRange(m_DateTime_Start, wxInvalidDateTime); // No backdating. m_pDatePickerCtrl_End->SetName(_("End Date")); S.AddWindow(m_pDatePickerCtrl_End); m_pTimeTextCtrl_End = new TimeTextCtrl(this, ID_TIMETEXT_END); m_pTimeTextCtrl_End->SetName(_("End Time")); m_pTimeTextCtrl_End->SetFormatString(strFormat); m_pTimeTextCtrl_End->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_End)); S.AddWindow(m_pTimeTextCtrl_End); m_pTimeTextCtrl_End->EnableMenu(false); } S.EndStatic(); S.StartStatic(_("Duration"), true); { /* i18n-hint: This string is used to configure the controls which shows the recording * duration. As such it is important that only the alphabetic parts of the string * are translated, with the numbers left exactly as they are. * The string 'days' indicates that the first number in the control will be the number of days, * then the 'h' indicates the second number displayed is hours, the 'm' indicates the third * number displayed is minutes, and the 's' indicates that the fourth number displayed is * seconds. */ wxString strFormat1 = _("099 days 024 h 060 m 060 s"); m_pTimeTextCtrl_Duration = new TimeTextCtrl(this, ID_TIMETEXT_DURATION); m_pTimeTextCtrl_Duration->SetName(_("Duration")); m_pTimeTextCtrl_Duration->SetFormatString(strFormat1); m_pTimeTextCtrl_Duration->SetTimeValue(m_TimeSpan_Duration.GetSeconds().ToDouble()); S.AddWindow(m_pTimeTextCtrl_Duration); m_pTimeTextCtrl_Duration->EnableMenu(false); } S.EndStatic(); } S.EndVerticalLay(); S.AddStandardButtons(); Layout(); Fit(); SetMinSize(GetSize()); Center(); }
void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) { S.SetBorder(5); S.StartVerticalLay(true); { wxString strFormat = wxT("099 h 060 m 060 s"); S.StartStatic(_("Start Date and Time"), true); { m_pDatePickerCtrl_Start = new wxDatePickerCtrl(this, // wxWindow *parent, ID_DATEPICKER_START, // wxWindowID id, m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_Start->SetName(_("Start Date")); m_pDatePickerCtrl_Start->SetRange(wxDateTime::Today(), wxInvalidDateTime); // No backdating. S.AddWindow(m_pDatePickerCtrl_Start); m_pTimeTextCtrl_Start = new TimeTextCtrl(this, ID_TIMETEXT_START, strFormat); m_pTimeTextCtrl_Start->SetName(_("Start Time")); m_pTimeTextCtrl_Start->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_Start)); S.AddWindow(m_pTimeTextCtrl_Start); m_pTimeTextCtrl_Start->EnableMenu(false); } S.EndStatic(); S.StartStatic(_("End Date and Time"), true); { m_pDatePickerCtrl_End = new wxDatePickerCtrl(this, // wxWindow *parent, ID_DATEPICKER_END, // wxWindowID id, m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_End->SetRange(m_DateTime_Start, wxInvalidDateTime); // No backdating. m_pDatePickerCtrl_End->SetName(_("End Date")); S.AddWindow(m_pDatePickerCtrl_End); m_pTimeTextCtrl_End = new TimeTextCtrl(this, ID_TIMETEXT_END, strFormat); m_pTimeTextCtrl_End->SetName(_("End Time")); m_pTimeTextCtrl_End->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_End)); S.AddWindow(m_pTimeTextCtrl_End); m_pTimeTextCtrl_End->EnableMenu(false); } S.EndStatic(); S.StartStatic(_("Duration"), true); { wxString strFormat1 = wxT("099 days 024 h 060 m 060 s"); m_pTimeTextCtrl_Duration = new TimeTextCtrl(this, ID_TIMETEXT_DURATION, strFormat1); m_pTimeTextCtrl_Duration->SetName(_("Duration")); m_pTimeTextCtrl_Duration->SetTimeValue( Internat::CompatibleToDouble(m_TimeSpan_Duration.GetSeconds().ToString())); //v milliseconds? S.AddWindow(m_pTimeTextCtrl_Duration); m_pTimeTextCtrl_Duration->EnableMenu(false); } S.EndStatic(); } S.EndVerticalLay(); S.AddStandardButtons(); Layout(); Fit(); SetMinSize(GetSize()); Center(); }
void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) { bool bAutoSave = gPrefs->ReadBool("/TimerRecord/AutoSave", false); bool bAutoExport = gPrefs->ReadBool("/TimerRecord/AutoExport", false); int iPostTimerRecordAction = gPrefs->ReadLong("/TimerRecord/PostAction", 0); S.SetBorder(5); S.StartMultiColumn(2, wxCENTER); { S.StartVerticalLay(true); { /* i18n-hint: This string is used to configure the controls for times when the recording is * started and stopped. As such it is important that only the alphabetic parts of the string * are translated, with the numbers left exactly as they are. * The 'h' indicates the first number displayed is hours, the 'm' indicates the second number * displayed is minutes, and the 's' indicates that the third number displayed is seconds. */ wxString strFormat = _("099 h 060 m 060 s"); using Options = NumericTextCtrl::Options; S.StartStatic(_("Start Date and Time"), true); { m_pDatePickerCtrl_Start = safenew wxDatePickerCtrl(this, // wxWindow *parent, ID_DATEPICKER_START, // wxWindowID id, m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_Start->SetName(_("Start Date")); m_pDatePickerCtrl_Start->SetRange(wxDateTime::Today(), wxInvalidDateTime); // No backdating. #if wxUSE_ACCESSIBILITY m_pDatePickerCtrl_Start->SetAccessible( safenew DatePickerCtrlAx(m_pDatePickerCtrl_Start)); #endif S.AddWindow(m_pDatePickerCtrl_Start); m_pTimeTextCtrl_Start = safenew NumericTextCtrl( this, ID_TIMETEXT_START, NumericConverter::TIME, wxEmptyString, 0, 44100, Options{} .MenuEnabled(false) .Format(strFormat) .Value(true, wxDateTime_to_AudacityTime(m_DateTime_Start))); m_pTimeTextCtrl_Start->SetName(_("Start Time")); S.AddWindow(m_pTimeTextCtrl_Start); } S.EndStatic(); S.StartStatic(_("End Date and Time"), true); { m_pDatePickerCtrl_End = safenew wxDatePickerCtrl(this, // wxWindow *parent, ID_DATEPICKER_END, // wxWindowID id, m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, // long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, // const wxValidator& validator = wxDefaultValidator, // const wxString& name = "datectrl") m_pDatePickerCtrl_End->SetRange(m_DateTime_Start, wxInvalidDateTime); // No backdating. m_pDatePickerCtrl_End->SetName(_("End Date")); #if wxUSE_ACCESSIBILITY m_pDatePickerCtrl_End->SetAccessible( safenew DatePickerCtrlAx(m_pDatePickerCtrl_End)); #endif S.AddWindow(m_pDatePickerCtrl_End); m_pTimeTextCtrl_End = safenew NumericTextCtrl( this, ID_TIMETEXT_END, NumericConverter::TIME, wxEmptyString, 0, 44100, Options{} .MenuEnabled(false) .Format(strFormat) .Value(true, wxDateTime_to_AudacityTime(m_DateTime_End))); m_pTimeTextCtrl_End->SetName(_("End Time")); S.AddWindow(m_pTimeTextCtrl_End); } S.EndStatic(); S.StartStatic(_("Duration"), true); { /* i18n-hint: This string is used to configure the controls which shows the recording * duration. As such it is important that only the alphabetic parts of the string * are translated, with the numbers left exactly as they are. * The string 'days' indicates that the first number in the control will be the number of days, * then the 'h' indicates the second number displayed is hours, the 'm' indicates the third * number displayed is minutes, and the 's' indicates that the fourth number displayed is * seconds. */ wxString strFormat1 = _("099 days 024 h 060 m 060 s"); m_pTimeTextCtrl_Duration = safenew NumericTextCtrl( this, ID_TIMETEXT_DURATION, NumericConverter::TIME, wxEmptyString, 0, 44100, Options{} .MenuEnabled(false) .Format(strFormat1) .Value(true, m_TimeSpan_Duration.GetSeconds().ToDouble())); m_pTimeTextCtrl_Duration->SetName(_("Duration")); S.AddWindow(m_pTimeTextCtrl_Duration); } S.EndStatic(); } S.EndVerticalLay(); S.StartVerticalLay(true); { S.StartStatic(_("Automatic Save"), true); { // If checked, the project will be saved when the recording is completed m_pTimerAutoSaveCheckBoxCtrl = S.Id(ID_AUTOSAVE_CHECKBOX).AddCheckBox(_("Enable &Automatic Save?"), (bAutoSave ? "true" : "false")); S.StartMultiColumn(3, wxEXPAND); { wxString sInitialValue = wxT(""); AudacityProject* pProject = GetActiveProject(); wxString sSaveValue = pProject->GetFileName(); if (sSaveValue != wxEmptyString) { m_fnAutoSaveFile.Assign(sSaveValue); sInitialValue = _("Current Project"); } S.AddPrompt(_("Save Project As:")); m_pTimerSavePathTextCtrl = NewPathControl(this, ID_AUTOSAVEPATH_TEXT, _("Save Project As:"), sInitialValue); m_pTimerSavePathTextCtrl->SetEditable(false); S.AddWindow(m_pTimerSavePathTextCtrl); m_pTimerSavePathButtonCtrl = S.Id(ID_AUTOSAVEPATH_BUTTON).AddButton(_("Select...")); } S.EndMultiColumn(); } S.EndStatic(); S.StartStatic(_("Automatic Export"), true); { m_pTimerAutoExportCheckBoxCtrl = S.Id(ID_AUTOEXPORT_CHECKBOX).AddCheckBox(_("Enable Automatic &Export?"), (bAutoExport ? "true" : "false")); S.StartMultiColumn(3, wxEXPAND); { S.AddPrompt(_("Export Project As:")); m_pTimerExportPathTextCtrl = NewPathControl(this, ID_AUTOEXPORTPATH_TEXT, _("Export Project As:"), wxT("")); m_pTimerExportPathTextCtrl->SetEditable(false); S.AddWindow(m_pTimerExportPathTextCtrl); m_pTimerExportPathButtonCtrl = S.Id(ID_AUTOEXPORTPATH_BUTTON).AddButton(_("Select...")); } S.EndMultiColumn(); } S.EndStatic(); S.StartStatic(_("Options"), true); { wxArrayString arrayOptions; arrayOptions.Add(_("Do nothing")); arrayOptions.Add(_("Exit Audacity")); arrayOptions.Add(_("Restart system")); arrayOptions.Add(_("Shutdown system")); m_sTimerAfterCompleteOptionsArray.Add(arrayOptions.Item(0)); m_sTimerAfterCompleteOptionsArray.Add(arrayOptions.Item(1)); #ifdef __WINDOWS__ m_sTimerAfterCompleteOptionsArray.Add(arrayOptions.Item(2)); m_sTimerAfterCompleteOptionsArray.Add(arrayOptions.Item(3)); #endif m_sTimerAfterCompleteOption = arrayOptions.Item(iPostTimerRecordAction); m_pTimerAfterCompleteChoiceCtrl = S.AddChoice(_("After Recording completes:"), m_sTimerAfterCompleteOption, &m_sTimerAfterCompleteOptionsArray); } S.EndStatic(); } S.EndVerticalLay(); } S.EndMultiColumn(); // MY: Added the help button here S.AddStandardButtons(eOkButton | eCancelButton | eHelpButton); Layout(); Fit(); SetMinSize(GetSize()); Center(); EnableDisableAutoControls(bAutoSave, CONTROL_GROUP_SAVE); EnableDisableAutoControls(bAutoExport, CONTROL_GROUP_EXPORT); }