Progress bar optimisation.
This commit is contained in:
parent
3abbf8e1b2
commit
e2f3a68c3b
2 changed files with 28 additions and 32 deletions
|
@ -79,7 +79,6 @@ GHandle gwinGProgressbarCreate(GDisplay *g, GProgressbarObject *gs, const GWidge
|
||||||
gs->pos = 0;
|
gs->pos = 0;
|
||||||
|
|
||||||
#if GWIN_PROGRESSBAR_AUTO
|
#if GWIN_PROGRESSBAR_AUTO
|
||||||
gs->delay = 0;
|
|
||||||
gtimerInit(&gs->gt);
|
gtimerInit(&gs->gt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -189,8 +188,8 @@ void gwinProgressbarDecrement(GHandle gh) {
|
||||||
|
|
||||||
gwinProgressbarIncrement(gh);
|
gwinProgressbarIncrement(gh);
|
||||||
|
|
||||||
if (gsw->pos < gsw->max)
|
if (gsw->pos >= gsw->max)
|
||||||
gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay);
|
gtimerStop(&gsw->gt);
|
||||||
|
|
||||||
#undef gsw
|
#undef gsw
|
||||||
}
|
}
|
||||||
|
@ -201,9 +200,7 @@ void gwinProgressbarDecrement(GHandle gh) {
|
||||||
if (gh->vmt != (gwinVMT *)&progressbarVMT)
|
if (gh->vmt != (gwinVMT *)&progressbarVMT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gsw->delay = delay;
|
gtimerStart(&gsw->gt, _progressbarCallback, gh, TRUE, delay);
|
||||||
|
|
||||||
gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay);
|
|
||||||
|
|
||||||
#undef gsw
|
#undef gsw
|
||||||
}
|
}
|
||||||
|
@ -214,7 +211,7 @@ void gwinProgressbarDecrement(GHandle gh) {
|
||||||
if (gh->vmt != (gwinVMT *)&progressbarVMT)
|
if (gh->vmt != (gwinVMT *)&progressbarVMT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtimerStop(&(gsw->gt));
|
gtimerStop(&gsw->gt);
|
||||||
|
|
||||||
#undef gsw
|
#undef gsw
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ typedef struct GProgressbarObject {
|
||||||
int pos;
|
int pos;
|
||||||
#if GWIN_PROGRESSBAR_AUTO
|
#if GWIN_PROGRESSBAR_AUTO
|
||||||
GTimer gt;
|
GTimer gt;
|
||||||
delaytime_t delay;
|
|
||||||
#endif
|
#endif
|
||||||
} GProgressbarObject;
|
} GProgressbarObject;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue