1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 16:39:30 +02:00

Define an AudacityException subclass for user cancellation of progress

This commit is contained in:
Paul Licameli 2016-12-02 12:32:29 -05:00
parent 195509a033
commit acf3c018bb
6 changed files with 76 additions and 0 deletions

View File

@ -1206,6 +1206,7 @@
28FE4A090ABF4E960056F5C4 /* sse_optimized.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28FE4A070ABF4E960056F5C4 /* sse_optimized.cpp */; };
5E02BFF21D1164DF00EB7578 /* Distortion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E02BFF01D1164DF00EB7578 /* Distortion.cpp */; };
5E07842E1DEE6B8600CA76EA /* FileException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E07842C1DEE6B8600CA76EA /* FileException.cpp */; };
5E0784311DF1E4F400CA76EA /* UserException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E07842F1DF1E4F400CA76EA /* UserException.cpp */; };
5E0A0E311D23019A00CD2567 /* MenusMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E0A0E301D23019A00CD2567 /* MenusMac.cpp */; };
5E74D2E31CC4429700D88B0B /* EditCursorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DD1CC4429700D88B0B /* EditCursorOverlay.cpp */; };
5E74D2E41CC4429700D88B0B /* PlayIndicatorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DF1CC4429700D88B0B /* PlayIndicatorOverlay.cpp */; };
@ -2982,6 +2983,8 @@
5E02BFF11D1164DF00EB7578 /* Distortion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Distortion.h; sourceTree = "<group>"; };
5E07842C1DEE6B8600CA76EA /* FileException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileException.cpp; sourceTree = "<group>"; };
5E07842D1DEE6B8600CA76EA /* FileException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileException.h; sourceTree = "<group>"; };
5E07842F1DF1E4F400CA76EA /* UserException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserException.cpp; sourceTree = "<group>"; };
5E0784301DF1E4F400CA76EA /* UserException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserException.h; sourceTree = "<group>"; };
5E0A0E301D23019A00CD2567 /* MenusMac.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = MenusMac.cpp; sourceTree = "<group>"; };
5E4685F81CCA9D84008741F2 /* CommandFunctors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommandFunctors.h; sourceTree = "<group>"; };
5E61EE0C1CBAA6BB0009FCF1 /* MemoryX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryX.h; sourceTree = "<group>"; };
@ -3919,6 +3922,7 @@
1790B0EC09883BFD008A330A /* TrackPanel.cpp */,
1790B0EE09883BFD008A330A /* TrackPanelAx.cpp */,
1790B0F209883BFD008A330A /* UndoManager.cpp */,
5E07842F1DF1E4F400CA76EA /* UserException.cpp */,
28C8211C1B5C661E00B53328 /* ViewInfo.cpp */,
1790B0F709883BFD008A330A /* VoiceKey.cpp */,
1790B0F909883BFD008A330A /* WaveClip.cpp */,
@ -4019,6 +4023,7 @@
2803C8B619F35AA000278526 /* TrackPanelListener.h */,
284416391B82D6BC0000574D /* TranslatableStringArray.h */,
1790B0F309883BFD008A330A /* UndoManager.h */,
5E0784301DF1E4F400CA76EA /* UserException.h */,
1790B0F609883BFD008A330A /* ViewInfo.h */,
1790B0F809883BFD008A330A /* VoiceKey.h */,
1790B0FA09883BFD008A330A /* WaveClip.h */,
@ -7368,6 +7373,7 @@
1790B13F09883BFD008A330A /* LadspaEffect.cpp in Sources */,
1790B14109883BFD008A330A /* Leveller.cpp in Sources */,
1790B14209883BFD008A330A /* LoadEffects.cpp in Sources */,
5E0784311DF1E4F400CA76EA /* UserException.cpp in Sources */,
1790B14309883BFD008A330A /* Noise.cpp in Sources */,
1790B14409883BFD008A330A /* NoiseRemoval.cpp in Sources */,
1790B14509883BFD008A330A /* Normalize.cpp in Sources */,

View File

@ -245,6 +245,8 @@ audacity_SOURCES = \
TranslatableStringArray.h \
UndoManager.cpp \
UndoManager.h \
UserException.cpp \
UserException.h \
ViewInfo.cpp \
ViewInfo.h \
VoiceKey.cpp \

24
src/UserException.cpp Normal file
View File

@ -0,0 +1,24 @@
//
// UserException.cpp
//
//
// Created by Paul Licameli on 11/27/16.
//
//
#include "Audacity.h"
#include "UserException.h"
UserException::~UserException()
{
}
std::unique_ptr< AudacityException > UserException::Move()
{
return std::unique_ptr< AudacityException >
{ safenew UserException{ std::move( *this ) } };
}
void UserException::DelayedHandlerAction()
{
}

36
src/UserException.h Normal file
View File

@ -0,0 +1,36 @@
//
// UserException.h
//
//
// Created by Paul Licameli on 11/27/16.
//
// An exception to throw when the user cancels an operation, as for instance
// with a progress dialog. Its delayed handler action does nothing.
//
#ifndef __AUDACITY_USER_EXCEPTION__
#define __AUDACITY_USER_EXCEPTION__
#include "AudacityException.h"
// This class does not inherit from MessageBoxException, and it does nothing
// in its delayed handler. It might be thrown after the user clicks a
// cancel button, as on a progress dialog.
class UserException final : public AudacityException
{
public:
UserException() {}
UserException(UserException &&that)
: AudacityException{ std::move( that ) }
{}
~UserException() override;
void DelayedHandlerAction() override;
private:
std::unique_ptr< AudacityException > Move() override;
};
#endif

View File

@ -225,6 +225,7 @@
<ClCompile Include="..\..\..\src\tracks\ui\PlayIndicatorOverlay.cpp" />
<ClCompile Include="..\..\..\src\tracks\ui\Scrubbing.cpp" />
<ClCompile Include="..\..\..\src\UndoManager.cpp" />
<ClCompile Include="..\..\..\src\UserException.cpp" />
<ClCompile Include="..\..\..\src\ViewInfo.cpp" />
<ClCompile Include="..\..\..\src\VoiceKey.cpp" />
<ClCompile Include="..\..\..\src\WaveClip.cpp" />
@ -464,6 +465,7 @@
<ClInclude Include="..\..\..\src\tracks\ui\PlayIndicatorOverlay.h" />
<ClInclude Include="..\..\..\src\tracks\ui\Scrubbing.h" />
<ClInclude Include="..\..\..\src\TranslatableStringArray.h" />
<ClInclude Include="..\..\..\src\UserException.h" />
<ClInclude Include="..\..\..\src\WaveTrackLocation.h" />
<ClInclude Include="..\..\..\src\widgets\BackedPanel.h" />
<ClInclude Include="..\..\..\src\widgets\HelpSystem.h" />

View File

@ -896,6 +896,9 @@
<ClCompile Include="..\..\..\src\FileException.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\UserException.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\AboutDialog.h">
@ -1819,6 +1822,9 @@
<ClInclude Include="..\..\..\src\FileException.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\UserException.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\audacity.ico">