ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticScreenshotList, setSelected, void(entity, float))
+ METHOD(XonoticScreenshotList, draw, void(entity))
METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticScreenshotList, getScreenshots, void(entity))
METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
ATTRIB(XonoticScreenshotList, lastClickedScreenshot, float, -1)
ATTRIB(XonoticScreenshotList, lastClickedTime, float, 0)
ATTRIB(XonoticScreenshotList, filterString, string, string_null)
+ ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
+ ATTRIB(XonoticScreenshotList, filterTime, float, 0)
+
+ ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
+ ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
+ ATTRIB(XonoticScreenshotList, prevSelectedItem, float, 0)
ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
METHOD(XonoticScreenshotList, goScreenshot, void(entity, float))
+ METHOD(XonoticScreenshotList, startSlideShow, void(entity))
+ METHOD(XonoticScreenshotList, stopSlideShow, void(entity))
ENDCLASS(XonoticScreenshotList)
entity makeXonoticScreenshotList();
void StartScreenshot_Click(entity btn, entity me);
void ScreenshotList_Refresh_Click(entity btn, entity me);
+void ScreenshotList_Filter_Would_Change(entity box, entity me);
void ScreenshotList_Filter_Change(entity box, entity me);
#endif
void XonoticScreenshotList_setSelected(entity me, float i)
{
+ me.stopSlideShow(me);
+ me.prevSelectedItem = me.selectedItem;
SUPER(XonoticScreenshotList).setSelected(me, i);
- me.previewScreenshot(me); // load the preview on selection change
+ if (me.pressed && me.selectedItem != me.prevSelectedItem)
+ {
+ // while dragging the scrollbar (or an item)
+ // for a smooth mouse movement do not load immediately the new selected images
+ me.newScreenshotTime = time + 0.22; // dragging an item we need a delay > 0.2 (from listbox: me.dragScrollTimer = time + 0.2;)
+ }
+ else if (time > me.newScreenshotTime)
+ {
+ me.newScreenshotTime = 0;
+ me.previewScreenshot(me); // load the preview on selection change
+ }
}
void XonoticScreenshotList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
ScreenshotList_Refresh_Click(world, me);
}
+void ScreenshotList_Filter_Would_Change(entity box, entity me)
+{
+ me.filterBox = box;
+ me.filterTime = time + 0.5;
+}
+
+void XonoticScreenshotList_draw(entity me)
+{
+ if (me.filterTime && time > me.filterTime)
+ {
+ ScreenshotList_Filter_Change(me.filterBox, me);
+ me.filterTime = 0;
+ }
+ if (me.newScreenshotTime && time > me.newScreenshotTime)
+ {
+ me.previewScreenshot(me);
+ me.newScreenshotTime = 0;
+ }
+ else if (me.newSlideShowScreenshotTime && time > me.newSlideShowScreenshotTime)
+ {
+ me.goScreenshot(me, +1);
+ if (me.selectedItem < me.nItems-1)
+ me.startSlideShow(me);
+ }
+ SUPER(XonoticScreenshotList).draw(me);
+}
+
+void XonoticScreenshotList_startSlideShow(entity me)
+{
+ me.newSlideShowScreenshotTime = time + 3;
+}
+
+void XonoticScreenshotList_stopSlideShow(entity me)
+{
+ me.newSlideShowScreenshotTime = 0;
+}
+
void XonoticScreenshotList_goScreenshot(entity me, float d)
{
if(!me.screenshotViewerDialog)
me.startScreenshot(me);
return 1;
}
- else
- return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
+ if(scan == K_MWHEELUP || scan == K_MWHEELDOWN)
+ me.newScreenshotTime = time + 0.2;
+ return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
}
#endif