METHOD(XonoticScreenshotViewerDialog, fill, void(entity))
METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float))
METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string))
+ METHOD(XonoticScreenshotViewerDialog, close, void(entity))
ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
- ATTRIB(XonoticScreenshotViewerDialog, columns, float, 6.5)
+ ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
{
me.scrList.goScreenshot(me.scrList, +1);
}
+void startSlideShow_Click(entity btn, entity me)
+{
+ me.scrList.startSlideShow(me.scrList);
+}
float XonoticScreenshotViewerDialog_keyDown(entity me, float key, float ascii, float shift)
{
switch(key)
{
- case K_KP_LEFTARROW:
case K_LEFTARROW:
me.scrList.goScreenshot(me.scrList, -1);
return 1;
case K_RIGHTARROW:
me.scrList.goScreenshot(me.scrList, +1);
return 1;
+ case K_KP_ENTER:
+ case K_ENTER:
+ case K_SPACE:
+ // we cannot use SPACE/ENTER directly, as in a dialog they are needed
+ // to press buttons while browsing with only the keyboard
+ if (shift & S_CTRL)
+ {
+ me.scrList.startSlideShow(me.scrList);
+ return 1;
+ }
+ return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
default:
if (me.scrList.keyDown(me.scrList, key, ascii, shift))
{
return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
}
}
+void XonoticScreenshotViewerDialog_close(entity me)
+{
+ me.scrList.stopSlideShow(me.scrList);
+ SUPER(XonoticScreenshotViewerDialog).close(me);
+}
void XonoticScreenshotViewerDialog_fill(entity me)
{
entity e;
me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
me.screenshotImage = e;
me.gotoRC(me, me.rows - 1, 0);
- me.TD(me, 1, me.columns/2, e = makeXonoticButton("Previous", '0 0 0'));
+ me.TDempty(me, 1/4);
+ me.TD(me, 1, 1, e = makeXonoticButton("Previous", '0 0 0'));
e.onClick = prevScreenshot_Click;
e.onClickEntity = me;
- me.TD(me, 1, me.columns/2, e = makeXonoticButton("Next", '0 0 0'));
+ me.TDempty(me, 1/4);
+ me.TD(me, 1, 1, e = makeXonoticButton("Start slide show", '0 0 0'));
+ e.onClick = startSlideShow_Click;
+ e.onClickEntity = me;
+ me.TDempty(me, 1/4);
+ me.TD(me, 1, 1, e = makeXonoticButton("Next", '0 0 0'));
e.onClick = nextScreenshot_Click;
e.onClickEntity = me;
}
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 XonoticScreenshotList_setSelected(entity me, float i)
{
+ me.stopSlideShow(me);
me.prevSelectedItem = me.selectedItem;
SUPER(XonoticScreenshotList).setSelected(me, i);
if (me.pressed && me.selectedItem != me.prevSelectedItem)
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)