2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
ProgressDialog.h
|
|
|
|
|
|
|
|
Copyright
|
|
|
|
Leland Lucius
|
|
|
|
Vaughan Johnson
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_WIDGETS_PROGRESSDIALOG__
|
|
|
|
#define __AUDACITY_WIDGETS_PROGRESSDIALOG__
|
|
|
|
|
|
|
|
#include "../Audacity.h"
|
|
|
|
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/dialog.h>
|
2015-07-19 20:47:50 +00:00
|
|
|
#include <wx/evtloop.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/gauge.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/utils.h>
|
2016-03-30 22:46:15 +00:00
|
|
|
#include <wx/msgdlg.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
eProgressCancelled = 0, //<! User says that whatever is happening is undesirable and shouldn't have happened at all
|
|
|
|
eProgressSuccess, //<! User says nothing, everything works fine, continue doing whatever we're doing
|
|
|
|
eProgressFailed, //<! Something has gone wrong, we should stop and cancel everything we did
|
|
|
|
eProgressStopped //<! Nothing is wrong, but user says we should stop now and leave things as they are now
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ProgressDialogFlags
|
|
|
|
{
|
|
|
|
pdlgEmptyFlags = 0x00000000,
|
|
|
|
pdlgHideStopButton = 0x00000001,
|
2015-07-19 20:47:50 +00:00
|
|
|
pdlgHideCancelButton = 0x00000002,
|
2016-03-30 22:46:15 +00:00
|
|
|
pdlgHideElapsedTime = 0x00000004,
|
|
|
|
pdlgConfirmStopCancel = 0x00000008,
|
2015-07-19 20:47:50 +00:00
|
|
|
|
2015-08-18 02:48:10 +00:00
|
|
|
pdlgDefaultFlags = pdlgEmptyFlags
|
2015-07-19 20:47:50 +00:00
|
|
|
};
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// ProgressDialog Class
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class AUDACITY_DLL_API ProgressDialog /* not final */ : public wxDialog
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-07-19 20:47:50 +00:00
|
|
|
public:
|
|
|
|
ProgressDialog();
|
2016-03-30 22:46:15 +00:00
|
|
|
ProgressDialog(const wxString & title,
|
|
|
|
const wxString & message = wxEmptyString,
|
|
|
|
int flags = pdlgDefaultFlags,
|
|
|
|
const wxString & sRemainingLabelText = wxEmptyString);
|
2015-08-14 21:15:28 +00:00
|
|
|
virtual ~ProgressDialog();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-26 17:32:35 +00:00
|
|
|
// NEW virtual? It doesn't override wxDialog
|
2016-03-30 22:46:15 +00:00
|
|
|
virtual bool Create(const wxString & title,
|
|
|
|
const wxString & message = wxEmptyString,
|
|
|
|
int flags = pdlgDefaultFlags,
|
|
|
|
const wxString & sRemainingLabelText = wxEmptyString);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
int Update(int value, const wxString & message = wxEmptyString);
|
|
|
|
int Update(double current, const wxString & message = wxEmptyString);
|
|
|
|
int Update(double current, double total, const wxString & message = wxEmptyString);
|
|
|
|
int Update(wxULongLong_t current, wxULongLong_t total, const wxString & message = wxEmptyString);
|
|
|
|
int Update(wxLongLong current, wxLongLong total, const wxString & message = wxEmptyString);
|
|
|
|
int Update(wxLongLong_t current, wxLongLong_t total, const wxString & message = wxEmptyString);
|
|
|
|
int Update(int current, int total, const wxString & message = wxEmptyString);
|
|
|
|
void SetMessage(const wxString & message);
|
|
|
|
|
2015-07-19 20:47:50 +00:00
|
|
|
protected:
|
2015-09-03 07:33:41 +00:00
|
|
|
wxWindow *mHadFocus;
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
wxStaticText *mElapsed;
|
|
|
|
wxStaticText *mRemaining;
|
|
|
|
wxGauge *mGauge;
|
|
|
|
|
|
|
|
wxLongLong_t mStartTime;
|
|
|
|
wxLongLong_t mLastUpdate;
|
|
|
|
int mLastValue; // gauge value, range = [0,1000]
|
|
|
|
|
|
|
|
bool mCancel;
|
|
|
|
bool mStop;
|
|
|
|
|
2015-08-14 21:15:28 +00:00
|
|
|
bool mIsTransparent;
|
|
|
|
|
2016-03-30 22:46:15 +00:00
|
|
|
// MY: Booleans to hold the flag values
|
|
|
|
bool m_bShowElapsedTime = true;
|
|
|
|
bool m_bConfirmAction = false;
|
|
|
|
|
|
|
|
// MY: Declare the buttons so we can se the focus on them later
|
|
|
|
wxWindow *m_btnStop;
|
|
|
|
wxWindow *m_btnCancel;
|
|
|
|
|
2015-07-19 20:47:50 +00:00
|
|
|
private:
|
|
|
|
void Init();
|
2015-09-03 07:33:41 +00:00
|
|
|
bool SearchForWindow(const wxWindowList & list, const wxWindow *searchfor) const;
|
2015-07-19 20:47:50 +00:00
|
|
|
void OnCancel(wxCommandEvent & e);
|
|
|
|
void OnStop(wxCommandEvent & e);
|
|
|
|
void OnCloseWindow(wxCloseEvent & e);
|
2015-08-14 21:15:28 +00:00
|
|
|
void Beep() const;
|
2015-07-19 20:47:50 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// This guarantees we have an active event loop...possible during OnInit()
|
|
|
|
wxEventLoopGuarantor mLoop;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
wxWindowDisabler *mDisable;
|
2015-08-14 21:15:28 +00:00
|
|
|
|
|
|
|
wxStaticText *mMessage;
|
2015-05-22 05:47:52 +00:00
|
|
|
int mLastW;
|
|
|
|
int mLastH;
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class AUDACITY_DLL_API TimerProgressDialog final : public ProgressDialog
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-08-14 21:15:28 +00:00
|
|
|
public:
|
2014-06-03 20:30:19 +00:00
|
|
|
TimerProgressDialog(const wxLongLong_t duration,
|
2015-08-14 21:15:28 +00:00
|
|
|
const wxString & title,
|
|
|
|
const wxString & message = wxEmptyString,
|
2016-03-30 22:46:15 +00:00
|
|
|
int flags = pdlgDefaultFlags,
|
|
|
|
const wxString & sRemainingLabelText = wxEmptyString);
|
2010-01-23 19:44:49 +00:00
|
|
|
int Update(const wxString & message = wxEmptyString);
|
|
|
|
|
2015-08-14 21:15:28 +00:00
|
|
|
protected:
|
2010-01-23 19:44:49 +00:00
|
|
|
wxLongLong_t mDuration;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|