1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 17:09:26 +02:00

AUP3: Add help button and change wording

This commit is contained in:
Leland Lucius 2020-08-05 09:55:07 -05:00
parent 7772f46345
commit f92ca33a20

View File

@ -16,6 +16,7 @@
#include "../ProjectManager.h" #include "../ProjectManager.h"
#include "../ProjectWindow.h" #include "../ProjectWindow.h"
#include "../SelectUtilities.h" #include "../SelectUtilities.h"
#include "../ShuttleGUI.h"
#include "../TrackPanel.h" #include "../TrackPanel.h"
#include "../UndoManager.h" #include "../UndoManager.h"
#include "../ViewInfo.h" #include "../ViewInfo.h"
@ -28,6 +29,8 @@
#include "../import/ImportRaw.h" #include "../import/ImportRaw.h"
#include "../widgets/AudacityMessageBox.h" #include "../widgets/AudacityMessageBox.h"
#include "../widgets/FileHistory.h" #include "../widgets/FileHistory.h"
#include "../widgets/HelpSystem.h"
#include "../widgets/wxPanelWrapper.h"
#ifdef USE_MIDI #ifdef USE_MIDI
#include "../import/ImportMIDI.h" #include "../import/ImportMIDI.h"
@ -107,6 +110,48 @@ void DoExport( AudacityProject &project, const FileExtension & Format )
} }
} }
// Compact dialog
class CompactDialog : public wxDialogWrapper
{
public:
CompactDialog(TranslatableString text)
: wxDialogWrapper(nullptr, wxID_ANY, XO("Compact Project"))
{
ShuttleGui S(this, eIsCreating);
S.StartVerticalLay(true);
{
S.AddFixedText(text, false, 500);
S.AddStandardButtons(eYesButton | eNoButton | eHelpButton);
}
S.EndVerticalLay();
FindWindowById(wxID_YES, this)->Bind(wxEVT_BUTTON, &CompactDialog::OnYes, this);
FindWindowById(wxID_NO, this)->Bind(wxEVT_BUTTON, &CompactDialog::OnNo, this);
FindWindowById(wxID_HELP, this)->Bind(wxEVT_BUTTON, &CompactDialog::OnGetURL, this);
Layout();
Fit();
Center();
}
void OnYes(wxCommandEvent &WXUNUSED(evt))
{
EndModal(wxYES);
}
void OnNo(wxCommandEvent &WXUNUSED(evt))
{
EndModal(wxNO);
}
void OnGetURL(wxCommandEvent &WXUNUSED(evt))
{
HelpSystem::ShowHelp(this, wxT("File_Menu:_Compact_Project"), true);
}
};
// Menu handler functions // Menu handler functions
namespace FileActions { namespace FileActions {
@ -165,21 +210,19 @@ void OnCompact(const CommandContext &context)
auto before = wxFileName::GetSize(projectFileIO.GetFileName()); auto before = wxFileName::GetSize(projectFileIO.GetFileName());
int id = AudacityMessageBox( CompactDialog dlg(
XO("Compacting this project will free up disk space by removing unused bytes within the file.\n\n" XO("Compacting this project will free up disk space by removing unused bytes within the file.\n\n"
"There is %s of free disk space and this project is currently using %s.\n" "There is %s of free disk space and this project is currently using %s.\n"
"\n" "\n"
"If you proceed, the current Undo History and clipboard contents will be discarded " "If you proceed, the current Undo/Redo History and clipboard contents will be discarded "
"and you will recover approximately %s of disk space.\n" "and you will recover approximately %s of disk space.\n"
"\n" "\n"
"Do you want to continue?") "Do you want to continue?")
.Format(Internat::FormatSize(projectFileIO.GetFreeDiskSpace()), .Format(Internat::FormatSize(projectFileIO.GetFreeDiskSpace()),
Internat::FormatSize(before.GetValue()), Internat::FormatSize(before.GetValue()),
Internat::FormatSize(total - used)), Internat::FormatSize(total - used)));
XO("Compact Project"),
wxYES_NO);
if (id == wxYES) if (dlg.ShowModal() == wxYES)
{ {
// Want to do this before removing the states so that it becomes the // Want to do this before removing the states so that it becomes the
// current state. // current state.