And made indeterminate progressbars work. Now to theme them.
This commit is contained in:
parent
c7555dcfd3
commit
301376706f
|
@ -76,6 +76,7 @@ void uiTableModelRowDeleted(uiTableModel *m, int oldIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO explain all this
|
||||||
static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIDSubclass, DWORD_PTR dwRefData)
|
static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIDSubclass, DWORD_PTR dwRefData)
|
||||||
{
|
{
|
||||||
uiTable *t = (uiTable *) dwRefData;
|
uiTable *t = (uiTable *) dwRefData;
|
||||||
|
@ -84,10 +85,11 @@ static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
if (wParam != (WPARAM) t)
|
if (wParam != (WPARAM) t)
|
||||||
break;
|
break;
|
||||||
for (auto &i : t->indeterminatePositions) {
|
// TODO only increment and update if visible?
|
||||||
i->second++;
|
for (auto &i : *(t->indeterminatePositions)) {
|
||||||
|
i.second++;
|
||||||
// TODO check errors
|
// TODO check errors
|
||||||
SendMessageW(hwnd, LVM_UPDATE, (WPARAM) (i->first.first), 0);
|
SendMessageW(hwnd, LVM_UPDATE, (WPARAM) (i.first.first), 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
|
@ -108,7 +110,7 @@ int uiprivTableProgress(uiTable *t, int item, int subitem, int modelColumn, LONG
|
||||||
bool stopTimer = false;
|
bool stopTimer = false;
|
||||||
|
|
||||||
data = (*(t->model->mh->CellValue))(t->model->mh, t->model, item, modelColumn);
|
data = (*(t->model->mh->CellValue))(t->model->mh, t->model, item, modelColumn);
|
||||||
progress = uiTableModelInt(data);
|
progress = uiTableDataInt(data);
|
||||||
uiFreeTableData(data);
|
uiFreeTableData(data);
|
||||||
|
|
||||||
p.first = item;
|
p.first = item;
|
||||||
|
@ -131,11 +133,13 @@ int uiprivTableProgress(uiTable *t, int item, int subitem, int modelColumn, LONG
|
||||||
if (startTimer)
|
if (startTimer)
|
||||||
// the interval shown here is PBM_SETMARQUEE's default
|
// the interval shown here is PBM_SETMARQUEE's default
|
||||||
// TODO should we pass a function here instead? it seems to be called by DispatchMessage(), not DefWindowProc(), but I'm still unsure
|
// TODO should we pass a function here instead? it seems to be called by DispatchMessage(), not DefWindowProc(), but I'm still unsure
|
||||||
if (SetTimer(t->hwnd, (UINT_PTR) (&t), 30, NULL) == 0)
|
if (SetTimer(t->hwnd, (UINT_PTR) t, 30, NULL) == 0)
|
||||||
logLastError(L"SetTimer()");
|
logLastError(L"SetTimer()");
|
||||||
if (stopTimer)
|
if (stopTimer)
|
||||||
if (KillTimer(t->hwnd, (UINT_PTR) (&t)) == 0)
|
if (KillTimer(t->hwnd, (UINT_PTR) (&t)) == 0)
|
||||||
logLastError(L"KillTimer()");
|
logLastError(L"KillTimer()");
|
||||||
|
|
||||||
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL onWM_NOTIFY(uiControl *c, HWND hwnd, NMHDR *nmhdr, LRESULT *lResult)
|
static BOOL onWM_NOTIFY(uiControl *c, HWND hwnd, NMHDR *nmhdr, LRESULT *lResult)
|
||||||
|
@ -315,7 +319,6 @@ uiTable *uiNewTable(uiTableModel *model)
|
||||||
{
|
{
|
||||||
uiTable *t;
|
uiTable *t;
|
||||||
int n;
|
int n;
|
||||||
int i;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
uiWindowsNewControl(uiTable, t);
|
uiWindowsNewControl(uiTable, t);
|
||||||
|
|
|
@ -32,7 +32,7 @@ static HRESULT handleLVIF_TEXT(uiTable *t, NMLVDISPINFOW *nm, uiprivTableColumnP
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->progressBarModelColumn != -1) {
|
if (p->progressBarModelColumn != -1) {
|
||||||
progress = uiprivTableProgress(t, nm->item.iItem, p->progressBarModelColumn, NULL);
|
progress = uiprivTableProgress(t, nm->item.iItem, nm->item.iSubItem, p->progressBarModelColumn, NULL);
|
||||||
|
|
||||||
if (progress == -1) {
|
if (progress == -1) {
|
||||||
// TODO either localize this or replace it with something that's language-neutral
|
// TODO either localize this or replace it with something that's language-neutral
|
||||||
|
|
|
@ -327,7 +327,7 @@ static HRESULT drawProgressBarPart(struct drawState *s)
|
||||||
|
|
||||||
if (s->p->progressBarModelColumn == -1)
|
if (s->p->progressBarModelColumn == -1)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
progress = uiprivTableProgress(s->t, s->iItem, s->p->progressBarModelColumn, &indeterminatePos);
|
progress = uiprivTableProgress(s->t, s->iItem, s->iSubItem, s->p->progressBarModelColumn, &indeterminatePos);
|
||||||
|
|
||||||
theme = OpenThemeData(s->t->hwnd, L"TODO");
|
theme = OpenThemeData(s->t->hwnd, L"TODO");
|
||||||
|
|
||||||
|
@ -376,6 +376,7 @@ static HRESULT drawProgressBarPart(struct drawState *s)
|
||||||
LONG pieceWidth;
|
LONG pieceWidth;
|
||||||
|
|
||||||
// TODO explain all this
|
// TODO explain all this
|
||||||
|
// TODO this should really start the progressbar scrolling into view instead of already on screen when first set
|
||||||
rFill[1] = rFill[0]; // save in case we need it
|
rFill[1] = rFill[0]; // save in case we need it
|
||||||
barWidth = rFill[0].right - rFill[0].left;
|
barWidth = rFill[0].right - rFill[0].left;
|
||||||
pieceWidth = barWidth / indeterminateSegments;
|
pieceWidth = barWidth / indeterminateSegments;
|
||||||
|
|
Loading…
Reference in New Issue