A few more tweaks to progress dialog.

Originally committed to SVN as r2429.
This commit is contained in:
Rodrigo Braz Monteiro 2008-10-29 00:18:13 +00:00
parent acfb815484
commit f46200a3b6
3 changed files with 9 additions and 4 deletions

View file

@ -44,6 +44,8 @@
#include "standard_paths.h"
#include "options.h"
#include "utils.h"
#include "frame_main.h"
#include "main.h"
///////////////
@ -72,7 +74,7 @@ HDAudioProvider::HDAudioProvider(AudioProvider *source) {
// Start progress
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();
// Write to disk

View file

@ -39,6 +39,8 @@
#include "dialog_progress.h"
#include "audio_provider_ram.h"
#include "utils.h"
#include "frame_main.h"
#include "main.h"
///////////
@ -82,7 +84,7 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *source) {
// Start progress
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->SetProgress(0,1);

View file

@ -39,6 +39,7 @@
#include <wx/button.h>
#include <wx/sizer.h>
#include "dialog_progress.h"
#include "utils.h"
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
if (wxIsMainThread()) {
gauge->SetValue(value);
gauge->SetValue(MID(0,value,100));
wxYield();
return;
}
@ -105,7 +106,7 @@ void DialogProgress::SetProgress(int cur,int max) {
void DialogProgress::OnUpdateProgress(wxCommandEvent &event)
{
int value = event.GetInt();
if (gauge->GetValue() != value) gauge->SetValue(value);
if (gauge->GetValue() != value) gauge->SetValue(MID(0,value,100));
wxMutexLocker locker(mutex);
count--;
}