Subversion Repositories spk

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#include "SpkFile.h"
2
 
3
class MyProgress : public CProgressInfo
4
{
5
public:
6
	MyProgress ( int t = 0 ) { current = 0; type = t; }
7
 
8
	int GetCurrent() { return current; }
9
	void ProgressUpdated ( const long cur, const long max )
10
	{
11
		int percent = (int)(((float)cur / (float)max) * 100);
12
		// split the half way point
13
		if ( m_bDoHalf )
14
		{
15
			percent /= 2;
16
			if ( m_bSecondHalf )
17
				percent += 50;
18
			else if ( percent > 50 )
19
				percent = 50;
20
		}
21
 
22
		while ( (percent - current) >= 5 )
23
		{
24
			current += 5;
25
			PrintType();
26
		}
27
	}
28
 
29
	void DoingFile ( C_File *file ) {}
30
 
31
	void PrintDone ()
32
	{
33
		while ( current < 100 )
34
		{
35
			current += 5;
36
			PrintType();
37
		}
38
		Reset ();
39
	}
40
 
41
	void Reset ()
42
	{
43
		current = 0;
44
	}
45
 
46
private:
47
	void PrintType ()
48
	{
49
		if ( type == 0 )
50
			printf ( "#" );
51
		else
52
		{
53
			if ( (current % 10) )
54
				printf ( "#" );
55
			else if ( current >= 100 )
56
				printf ( "0" );
57
			else
58
				printf ( "%1d", current / 10 );
59
		}
60
	}
61
 
62
	int type;
63
	int current;
64
};