Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#include "SpkFile.h"
class MyProgress : public CProgressInfo
{
public:
MyProgress ( int t = 0 ) { current = 0; type = t; }
int GetCurrent() { return current; }
void ProgressUpdated ( const long cur, const long max )
{
int percent = (int)(((float)cur / (float)max) * 100);
// split the half way point
if ( m_bDoHalf )
{
percent /= 2;
if ( m_bSecondHalf )
percent += 50;
else if ( percent > 50 )
percent = 50;
}
while ( (percent - current) >= 5 )
{
current += 5;
PrintType();
}
}
void DoingFile ( C_File *file ) {}
void PrintDone ()
{
while ( current < 100 )
{
current += 5;
PrintType();
}
Reset ();
}
void Reset ()
{
current = 0;
}
private:
void PrintType ()
{
if ( type == 0 )
printf ( "#" );
else
{
if ( (current % 10) )
printf ( "#" );
else if ( current >= 100 )
printf ( "0" );
else
printf ( "%1d", current / 10 );
}
}
int type;
int current;
};