summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-09-12 08:28:59 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-09-12 08:28:59 +0300
commit0323d36f28b3954d4111dbb0c22cd7983edec855 (patch)
tree179e68cb2c0995d907333c74dc22f1b2e7150e5c /src
parentbc869008f0cfba661e92b3975db3ca6a65be4bf7 (diff)
Cleanup
Diffstat (limited to 'src')
-rw-r--r--src/ui/listwidget.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c
index dd11b008..a0cd4bb4 100644
--- a/src/ui/listwidget.c
+++ b/src/ui/listwidget.c
@@ -69,10 +69,6 @@ struct Impl_ListWidget {
69 size_t hoverItem; 69 size_t hoverItem;
70 iClick click; 70 iClick click;
71 iIntSet invalidItems; 71 iIntSet invalidItems;
72// SDL_Texture *visBuffer[numVisBuffers_ListWidget_];
73// int visBufferIndex;
74// int visBufferScrollY[3];
75// enum iBufferValidity visBufferValid;
76 iInt2 visBufSize; 72 iInt2 visBufSize;
77 iListVisBuffer visBuffers[numVisBuffers_ListWidget_]; 73 iListVisBuffer visBuffers[numVisBuffers_ListWidget_];
78}; 74};
@@ -103,7 +99,6 @@ void deinit_ListWidget(iListWidget *d) {
103} 99}
104 100
105void invalidate_ListWidget(iListWidget *d) { 101void invalidate_ListWidget(iListWidget *d) {
106 //d->visBufferValid = none_BufferValidity;
107 iForIndices(i, d->visBuffers) { 102 iForIndices(i, d->visBuffers) {
108 iZap(d->visBuffers[i].validRange); 103 iZap(d->visBuffers[i].validRange);
109 } 104 }
@@ -173,7 +168,6 @@ int scrollPos_ListWidget(const iListWidget *d) {
173void setScrollPos_ListWidget(iListWidget *d, int pos) { 168void setScrollPos_ListWidget(iListWidget *d, int pos) {
174 d->scrollY = pos; 169 d->scrollY = pos;
175 d->hoverItem = iInvalidPos; 170 d->hoverItem = iInvalidPos;
176// d->visBufferValid = partial_BufferValidity;
177 refresh_Widget(as_Widget(d)); 171 refresh_Widget(as_Widget(d));
178} 172}
179 173
@@ -191,7 +185,6 @@ void scrollOffset_ListWidget(iListWidget *d, int offset) {
191 d->hoverItem = iInvalidPos; 185 d->hoverItem = iInvalidPos;
192 } 186 }
193 updateVisible_ListWidget(d); 187 updateVisible_ListWidget(d);
194// d->visBufferValid = partial_BufferValidity;
195 refresh_Widget(as_Widget(d)); 188 refresh_Widget(as_Widget(d));
196 } 189 }
197} 190}
@@ -350,46 +343,21 @@ static void allocVisBuffer_ListWidget_(iListWidget *d) {
350 d->visBuffers[i].origin = i * size.y; 343 d->visBuffers[i].origin = i * size.y;
351 iZap(d->visBuffers[i].validRange); 344 iZap(d->visBuffers[i].validRange);
352 } 345 }
353 //d->visBufferValid = none_BufferValidity;
354 } 346 }
355} 347}
356 348
357static void drawItem_ListWidget_(const iListWidget *d, iPaint *p, size_t index, iInt2 pos) { 349static void drawItem_ListWidget_(const iListWidget *d, iPaint *p, size_t index, iInt2 pos) {
358 const iWidget * w = constAs_Widget(d); 350 const iWidget * w = constAs_Widget(d);
359 const iRect bounds = innerBounds_Widget(w); 351 const iRect bounds = innerBounds_Widget(w);
360 const iRect bufBounds = { zero_I2(), bounds.size };
361 const iListItem *item = constAt_PtrArray(&d->items, index); 352 const iListItem *item = constAt_PtrArray(&d->items, index);
362 const iRect itemRect = { pos, init_I2(width_Rect(bounds), d->itemHeight) }; 353 const iRect itemRect = { pos, init_I2(width_Rect(bounds), d->itemHeight) };
363// setClip_Paint(p, intersect_Rect(itemRect, bufBounds));
364// if (d->visBufferValid) {
365// fillRect_Paint(p, itemRect, w->bgColor);
366// }
367 class_ListItem(item)->draw(item, p, itemRect, d); 354 class_ListItem(item)->draw(item, p, itemRect, d);
368// unsetClip_Paint(p);
369} 355}
370 356
371static const iListItem *item_ListWidget_(const iListWidget *d, size_t pos) { 357static const iListItem *item_ListWidget_(const iListWidget *d, size_t pos) {
372 return constAt_PtrArray(&d->items, pos); 358 return constAt_PtrArray(&d->items, pos);
373} 359}
374 360
375#if 0
376static size_t findBuffer_ListWidget_(const iListWidget *d, int top, const iRangei vis) {
377 size_t avail = iInvalidPos;
378 iForIndices(i, d->visBuffers) {
379 const iListVisBuffer *buf = d->visBuffers + i;
380 const iRangei bufRange = { buf->scrollY, buf->scrollY + d->visBufSize.y };
381 if (top >= bufRange.start && top < bufRange.end) {
382 return i;
383 }
384 if (buf->scrollY >= vis.end || buf->scrollY + d->visBufSize.y <= vis.start) {
385 avail = i; /* Outside currently visible region. */
386 }
387 }
388 iAssert(avail != iInvalidPos);
389 return avail;
390}
391#endif
392
393static void draw_ListWidget_(const iListWidget *d) { 361static void draw_ListWidget_(const iListWidget *d) {
394 const iWidget *w = constAs_Widget(d); 362 const iWidget *w = constAs_Widget(d);
395 const iRect bounds = innerBounds_Widget(w); 363 const iRect bounds = innerBounds_Widget(w);