-
Notifications
You must be signed in to change notification settings - Fork 4
/
MaxProgress.cpp
44 lines (31 loc) · 1.36 KB
/
MaxProgress.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ---------------------------------------------------------------------------
//
// MaxProgress.h
//
// Class that handle progress update and cancellation messages in Max
//
// ---------------------------------------------------------------------------
#include "MaxProgress.h"
#include "IProgress.h"
#include "Max.h"
// --------------------------------------------------------------------------
MaxProgress::MaxProgress(Interface* iface, const char* message) {
ip = iface;
msg = message;
}
// --------------------------------------------------------------------------
DWORD WINAPI dummyFn(LPVOID arg) { return (0); }
void MaxProgress::progressStart() {
LPVOID arg = (LPVOID)0;
ip->ProgressStart((TCHAR*)msg, TRUE, dummyFn, arg);
}
// --------------------------------------------------------------------------
void MaxProgress::progressNotify(int progress, int total) {
int pct = (int)(100.0f * (float)progress / (float)total);
ip->ProgressUpdate(pct % 100);
}
// --------------------------------------------------------------------------
void MaxProgress::progressEnd() { ip->ProgressEnd(); }
// --------------------------------------------------------------------------
bool MaxProgress::isCancelled() { return (ip->GetCancel() == TRUE); }
// --------------------------------------------------------------------------