2 CLASS(XonoticScreenshotViewerDialog) EXTENDS(XonoticDialog)
3 METHOD(XonoticScreenshotViewerDialog, fill, void(entity))
4 METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float))
5 METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string))
6 METHOD(XonoticScreenshotViewerDialog, close, void(entity))
7 ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
8 ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
9 ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
10 ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
11 ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
12 ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
13 ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
14 ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
15 ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
16 ENDCLASS(XonoticScreenshotViewerDialog)
20 void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
22 if (me.currentScrPath == scrImage)
24 if (me.currentScrPath)
25 strunzone(me.currentScrPath);
26 me.currentScrPath = strzone(scrImage);
27 me.screenshotImage.configureXonoticScreenshotImage(me.screenshotImage, me.currentScrPath);
29 void prevScreenshot_Click(entity btn, entity me)
31 me.scrList.goScreenshot(me.scrList, -1);
33 void nextScreenshot_Click(entity btn, entity me)
35 me.scrList.goScreenshot(me.scrList, +1);
37 void startSlideShow_Click(entity btn, entity me)
39 me.scrList.startSlideShow(me.scrList);
41 float XonoticScreenshotViewerDialog_keyDown(entity me, float key, float ascii, float shift)
46 me.scrList.goScreenshot(me.scrList, -1);
50 me.scrList.goScreenshot(me.scrList, +1);
55 // we cannot use SPACE/ENTER directly, as in a dialog they are needed
56 // to press buttons while browsing with only the keyboard
59 me.scrList.startSlideShow(me.scrList);
62 return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
64 // mousewheel doesn't always reach the first/last screenshot
65 if (key == K_MWHEELUP)
67 else if (key == K_MWHEELDOWN)
69 if (me.scrList.keyDown(me.scrList, key, ascii, shift))
71 // keyDown has already changed the selected item
72 me.scrList.goScreenshot(me.scrList, 0);
75 return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
78 void XonoticScreenshotViewerDialog_close(entity me)
80 me.scrList.stopSlideShow(me.scrList);
81 SUPER(XonoticScreenshotViewerDialog).close(me);
83 void XonoticScreenshotViewerDialog_fill(entity me)
87 me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
88 me.screenshotImage = e;
89 me.gotoRC(me, me.rows - 1, 0);
91 me.TD(me, 1, 1, e = makeXonoticButton("Previous", '0 0 0'));
92 e.onClick = prevScreenshot_Click;
95 me.TD(me, 1, 1, e = makeXonoticButton("Start slide show", '0 0 0'));
96 e.onClick = startSlideShow_Click;
99 me.TD(me, 1, 1, e = makeXonoticButton("Next", '0 0 0'));
100 e.onClick = nextScreenshot_Click;
101 e.onClickEntity = me;