A few more tweaks to progress dialog.
Originally committed to SVN as r2429.
This commit is contained in:
parent
acfb815484
commit
f46200a3b6
3 changed files with 9 additions and 4 deletions
|
@ -44,6 +44,8 @@
|
||||||
#include "standard_paths.h"
|
#include "standard_paths.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "frame_main.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -72,7 +74,7 @@ HDAudioProvider::HDAudioProvider(AudioProvider *source) {
|
||||||
|
|
||||||
// Start progress
|
// Start progress
|
||||||
volatile bool canceled = false;
|
volatile bool canceled = false;
|
||||||
DialogProgress *progress = new DialogProgress(NULL,_T("Load audio"),&canceled,_T("Reading to Hard Disk cache"),0,num_samples);
|
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame,_T("Load audio"),&canceled,_T("Reading to Hard Disk cache"),0,num_samples);
|
||||||
progress->Show();
|
progress->Show();
|
||||||
|
|
||||||
// Write to disk
|
// Write to disk
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include "dialog_progress.h"
|
#include "dialog_progress.h"
|
||||||
#include "audio_provider_ram.h"
|
#include "audio_provider_ram.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "frame_main.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
|
@ -82,7 +84,7 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *source) {
|
||||||
|
|
||||||
// Start progress
|
// Start progress
|
||||||
volatile bool canceled = false;
|
volatile bool canceled = false;
|
||||||
DialogProgress *progress = new DialogProgress(NULL,_("Load audio"),&canceled,_("Reading into RAM"),0,source->GetNumSamples());
|
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame,_("Load audio"),&canceled,_("Reading into RAM"),0,source->GetNumSamples());
|
||||||
progress->Show();
|
progress->Show();
|
||||||
progress->SetProgress(0,1);
|
progress->SetProgress(0,1);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include "dialog_progress.h"
|
#include "dialog_progress.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_PROGRESS_UPDATE)
|
DEFINE_EVENT_TYPE(wxEVT_PROGRESS_UPDATE)
|
||||||
|
@ -82,7 +83,7 @@ void DialogProgress::SetProgress(int cur,int max) {
|
||||||
|
|
||||||
// Check if it's the main thread, if so, just process it now
|
// Check if it's the main thread, if so, just process it now
|
||||||
if (wxIsMainThread()) {
|
if (wxIsMainThread()) {
|
||||||
gauge->SetValue(value);
|
gauge->SetValue(MID(0,value,100));
|
||||||
wxYield();
|
wxYield();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ void DialogProgress::SetProgress(int cur,int max) {
|
||||||
void DialogProgress::OnUpdateProgress(wxCommandEvent &event)
|
void DialogProgress::OnUpdateProgress(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
int value = event.GetInt();
|
int value = event.GetInt();
|
||||||
if (gauge->GetValue() != value) gauge->SetValue(value);
|
if (gauge->GetValue() != value) gauge->SetValue(MID(0,value,100));
|
||||||
wxMutexLocker locker(mutex);
|
wxMutexLocker locker(mutex);
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue