#include "xonotic/dialog_multiplayer_playersetup_view.c"
#include "xonotic/dialog_multiplayer_playersetup_weapons.c"
#include "xonotic/weaponslist.c"
-#include "xonotic/dialog_multiplayer_demo.c"
+#include "xonotic/dialog_multiplayer_media.c"
+#include "xonotic/dialog_multiplayer_media_demo.c"
#include "xonotic/demolist.c"
#include "xonotic/screenshotimage.c"
-#include "xonotic/dialog_multiplayer_screenshot.c"
-#include "xonotic/dialog_multiplayer_screenshot_screenshotviewer.c"
+#include "xonotic/dialog_multiplayer_media_screenshot.c"
+#include "xonotic/dialog_multiplayer_media_screenshot_viewer.c"
#include "xonotic/screenshotlist.c"
#include "xonotic/colorpicker.c"
#include "xonotic/colorpicker_string.c"
//me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab()));
//me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab()));
//me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Players"), makeXonoticDemoBrowserTab()));
- me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Media"), makeXonoticDemoBrowserTab()));
+ me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Media"), makeXonoticMediaTab()));
me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Profile"), makeXonoticPlayerSettingsTab()));
me.TR(me);
+++ /dev/null
-#ifdef INTERFACE
-CLASS(XonoticDemoBrowserTab) EXTENDS(XonoticTab)
- METHOD(XonoticDemoBrowserTab, fill, void(entity))
- ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
- ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticDemoBrowserTab, rows, float, 22)
- ATTRIB(XonoticDemoBrowserTab, columns, float, 4)
- ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
-ENDCLASS(XonoticDemoBrowserTab)
-entity makeXonoticDemoBrowserTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticDemoBrowserTab()
-{
- entity me;
- me = spawnXonoticDemoBrowserTab();
- me.configureDialog(me);
- return me;
-}
-void XonoticDemoBrowserTab_fill(entity me)
-{
- entity e, dlist;
-
- me.TR(me);
- me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "cl_autodemo", _("Automatically record demos while playing")));
- me.TR(me);
- me.TR(me);
- me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Filter:")));
- me.TD(me, 1, 3.5, e = makeXonoticInputBox(0, string_null));
- dlist = makeXonoticDemoList();
- e.onChange = DemoList_Filter_Change;
- e.onChangeEntity = dlist;
- dlist.controlledTextbox = e;
-
- me.TR(me);
- me.TD(me, me.rows - 4, me.columns, dlist);
-
- me.gotoRC(me, me.rows - 1, 0);
- me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
- e.onClick = TimeDemo_Click;
- e.onClickEntity = dlist;
- me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
- e.onClick = StartDemo_Click;
- e.onClickEntity = dlist;
-}
-#endif
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticMediaTab) EXTENDS(XonoticTab)
+ METHOD(XonoticMediaTab, fill, void(entity))
+ ATTRIB(XonoticMediaTab, title, string, _("Demo"))
+ ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticMediaTab, rows, float, 22)
+ ATTRIB(XonoticMediaTab, columns, float, 2)
+ ATTRIB(XonoticMediaTab, name, string, "Media")
+ENDCLASS(XonoticMediaTab)
+entity makeXonoticMediaTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticMediaTab()
+{
+ entity me;
+ me = spawnXonoticMediaTab();
+ me.configureDialog(me);
+ return me;
+}
+void XonoticMediaTab_fill(entity me)
+{
+ entity mc, e;
+ mc = makeXonoticTabController(me.rows - 2);
+ me.TR(me);
+ me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab()));
+ me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab()));
+
+ me.TR(me);
+ me.TR(me);
+ me.TD(me, me.rows - 2, me.columns, mc);
+}
+#endif
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticDemoBrowserTab) EXTENDS(XonoticTab)
+ METHOD(XonoticDemoBrowserTab, fill, void(entity))
+ ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
+ ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticDemoBrowserTab, rows, float, 20)
+ ATTRIB(XonoticDemoBrowserTab, columns, float, 4)
+ ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
+ENDCLASS(XonoticDemoBrowserTab)
+entity makeXonoticDemoBrowserTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticDemoBrowserTab()
+{
+ entity me;
+ me = spawnXonoticDemoBrowserTab();
+ me.configureDialog(me);
+ return me;
+}
+void XonoticDemoBrowserTab_fill(entity me)
+{
+ entity e, dlist;
+
+ me.TR(me);
+ me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "cl_autodemo", _("Automatically record demos while playing")));
+ me.TR(me);
+ me.TR(me);
+ me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Filter:")));
+ me.TD(me, 1, 3.5, e = makeXonoticInputBox(0, string_null));
+ dlist = makeXonoticDemoList();
+ e.onChange = DemoList_Filter_Change;
+ e.onChangeEntity = dlist;
+ dlist.controlledTextbox = e;
+
+ me.TR(me);
+ me.TD(me, me.rows - 4, me.columns, dlist);
+
+ me.gotoRC(me, me.rows - 1, 0);
+ me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
+ e.onClick = TimeDemo_Click;
+ e.onClickEntity = dlist;
+ me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
+ e.onClick = StartDemo_Click;
+ e.onClickEntity = dlist;
+}
+#endif
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticScreenshotBrowserTab) EXTENDS(XonoticTab)
+ METHOD(XonoticScreenshotBrowserTab, fill, void(entity))
+ ATTRIB(XonoticScreenshotBrowserTab, title, string, "Screenshot")
+ ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
+ ATTRIB(XonoticScreenshotBrowserTab, rows, float, 20)
+ ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
+ ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+
+ METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string))
+ ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
+ ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotBrowserTab)
+entity makeXonoticScreenshotBrowserTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticScreenshotBrowserTab()
+{
+ entity me;
+ me = spawnXonoticScreenshotBrowserTab();
+ me.configureDialog(me);
+ return me;
+}
+void XonoticScreenshotBrowserTab_loadPreviewScreenshot(entity me, string scrImage)
+{
+ if (me.currentScrPath == scrImage)
+ return;
+ if (me.currentScrPath)
+ strunzone(me.currentScrPath);
+ me.currentScrPath = strzone(scrImage);
+ me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
+}
+void XonoticScreenshotBrowserTab_fill(entity me)
+{
+ entity e, slist;
+ slist = makeXonoticScreenshotList();
+ float slist_height = me.rows - 2;
+ me.TR(me);
+ me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, "Filter:"));
+ me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
+ e.onChange = ScreenshotList_Filter_Would_Change;
+ e.onChangeEntity = slist;
+ slist.screenshotViewerDialog = main.screenshotViewerDialog;
+ main.screenshotViewerDialog.scrList = slist;
+ me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
+ e.onClick = ScreenshotList_Refresh_Click;
+ e.onClickEntity = slist;
+ me.TR(me);
+ me.TD(me, slist_height, me.columns, slist);
+
+ me.gotoRC(me, slist_height + 1, 0);
+ me.TD(me, 1, me.columns, e = makeXonoticButton(_("Open in the viewer"), '0 0 0'));
+ e.onClick = StartScreenshot_Click;
+ e.onClickEntity = slist;
+/*
+ me.TR(me);
+ me.TD(me, me.rows - me.currentRow, me.columns, e = makeXonoticScreenshotImage());
+ e.showTitle = 0;
+ me.screenshotImage = e;
+ slist.screenshotPreview = e;
+ slist.screenshotBrowserDialog = me;
+*/
+}
+#endif
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticScreenshotViewerDialog) EXTENDS(XonoticDialog)
+ 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, 4)
+ ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
+ ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
+ ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
+ ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
+ ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotViewerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+float music_playlist_index_backup;
+void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
+{
+ // disable music as it can lag depending on image loading time
+ if(!cvar("menu_screenshotviewer_enablemusic"))
+ if(cvar("music_playlist_index") != 999) // if the playlist isn't paused
+ {
+ // pause music
+ if(cvar("music_playlist_index") != -1)
+ {
+ music_playlist_index_backup = cvar("music_playlist_index");
+ cvar_set("music_playlist_sampleposition0", "0");
+ cvar_set("music_playlist_index", "999");
+ }
+ else
+ localcmd("\ncd pause\n");
+ }
+
+ if (me.currentScrPath == scrImage)
+ return;
+ if (me.currentScrPath)
+ strunzone(me.currentScrPath);
+ me.currentScrPath = strzone(scrImage);
+ me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
+ me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
+}
+void prevScreenshot_Click(entity btn, entity me)
+{
+ me.scrList.goScreenshot(me.scrList, -1);
+}
+void nextScreenshot_Click(entity btn, entity me)
+{
+ me.scrList.goScreenshot(me.scrList, +1);
+}
+void increaseZoom_Click(entity btn, entity me)
+{
+ me.screenshotImage.setZoom(me.screenshotImage, -2, FALSE);
+}
+void decreaseZoom_Click(entity btn, entity me)
+{
+ me.screenshotImage.setZoom(me.screenshotImage, -1/2, FALSE);
+}
+void resetZoom_Click(entity btn, entity me)
+{
+ me.screenshotImage.setZoom(me.screenshotImage, 0, FALSE);
+}
+void toggleSlideShow_Click(entity btn, entity me)
+{
+ if (me.slideShowButton.forcePressed)
+ {
+ me.scrList.stopSlideShow(me.scrList);
+ me.slideShowButton.forcePressed = 0;
+ }
+ else
+ {
+ me.scrList.startSlideShow(me.scrList);
+ me.slideShowButton.forcePressed = 1;
+ }
+}
+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_KP_RIGHTARROW:
+ 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)
+ {
+ toggleSlideShow_Click(world, me);
+ return 1;
+ }
+ return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
+ default:
+ if (key == K_MWHEELUP || ascii == '+')
+ {
+ me.screenshotImage.setZoom(me.screenshotImage, -2, (key == K_MWHEELUP));
+ return 1;
+ }
+ else if (key == K_MWHEELDOWN || ascii == '-')
+ {
+ me.screenshotImage.setZoom(me.screenshotImage, -1/2, (key == K_MWHEELDOWN));
+ return 1;
+ }
+ if (me.scrList.keyDown(me.scrList, key, ascii, shift))
+ {
+ // keyDown has already changed the selected item
+ me.scrList.goScreenshot(me.scrList, 0);
+ return 1;
+ }
+ return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
+ }
+}
+void XonoticScreenshotViewerDialog_close(entity me)
+{
+ // resume music
+ if(!cvar("menu_screenshotviewer_enablemusic"))
+ if(cvar("music_playlist_index") == 999)
+ {
+ cvar_set("music_playlist_index", ftos(music_playlist_index_backup));
+ }
+ else
+ localcmd("\ncd resume\n");
+
+ me.scrList.stopSlideShow(me.scrList);
+ me.slideShowButton.forcePressed = 0;
+ SUPER(XonoticScreenshotViewerDialog).close(me);
+}
+void XonoticScreenshotViewerDialog_fill(entity me)
+{
+ entity e;
+ me.TR(me);
+ me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
+ e.showTitle = 0; // dialog title is enough
+ me.screenshotImage = e;
+ me.gotoRC(me, me.rows - 1, 0);
+ me.TDempty(me, 1/20 * me.columns);
+ me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("-", '0 0 0'));
+ e.onClick = decreaseZoom_Click;
+ e.onClickEntity = me;
+ me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("+", '0 0 0'));
+ e.onClick = increaseZoom_Click;
+ e.onClickEntity = me;
+ me.TD(me, 1, 2/20 * me.columns, e = makeXonoticButton(_("Reset"), '0 0 0'));
+ e.onClick = resetZoom_Click;
+ e.onClickEntity = me;
+
+ me.TDempty(me, 2/20 * me.columns);
+ me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Previous"), '0 0 0'));
+ e.onClick = prevScreenshot_Click;
+ e.onClickEntity = me;
+ me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Next"), '0 0 0'));
+ e.onClick = nextScreenshot_Click;
+ e.onClickEntity = me;
+
+ me.TDempty(me, 2/20 * me.columns);
+ me.TD(me, 1, 4/20 * me.columns, e = makeXonoticButton(_("Slide show"), '0 0 0'));
+ e.onClick = toggleSlideShow_Click;
+ e.onClickEntity = me;
+ me.slideShowButton = e;
+}
+#endif
+++ /dev/null
-#ifdef INTERFACE
-CLASS(XonoticScreenshotBrowserTab) EXTENDS(XonoticTab)
- METHOD(XonoticScreenshotBrowserTab, fill, void(entity))
- ATTRIB(XonoticScreenshotBrowserTab, title, string, "Screenshot")
- ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
- ATTRIB(XonoticScreenshotBrowserTab, rows, float, 22)
- ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
- ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
-
- METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string))
- ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
- ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotBrowserTab)
-entity makeXonoticScreenshotBrowserTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticScreenshotBrowserTab()
-{
- entity me;
- me = spawnXonoticScreenshotBrowserTab();
- me.configureDialog(me);
- return me;
-}
-void XonoticScreenshotBrowserTab_loadPreviewScreenshot(entity me, string scrImage)
-{
- if (me.currentScrPath == scrImage)
- return;
- if (me.currentScrPath)
- strunzone(me.currentScrPath);
- me.currentScrPath = strzone(scrImage);
- me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
-}
-void XonoticScreenshotBrowserTab_fill(entity me)
-{
- entity e, slist;
- slist = makeXonoticScreenshotList();
- float slist_height = me.rows - 2;
- me.TR(me);
- me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, "Filter:"));
- me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
- e.onChange = ScreenshotList_Filter_Would_Change;
- e.onChangeEntity = slist;
- slist.screenshotViewerDialog = main.screenshotViewerDialog;
- main.screenshotViewerDialog.scrList = slist;
- me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
- e.onClick = ScreenshotList_Refresh_Click;
- e.onClickEntity = slist;
- me.TR(me);
- me.TD(me, slist_height, me.columns, slist);
-
- me.gotoRC(me, slist_height + 1, 0);
- me.TD(me, 1, me.columns, e = makeXonoticButton(_("Open in the viewer"), '0 0 0'));
- e.onClick = StartScreenshot_Click;
- e.onClickEntity = slist;
-/*
- me.TR(me);
- me.TD(me, me.rows - me.currentRow, me.columns, e = makeXonoticScreenshotImage());
- e.showTitle = 0;
- me.screenshotImage = e;
- slist.screenshotPreview = e;
- slist.screenshotBrowserDialog = me;
-*/
-}
-#endif
+++ /dev/null
-#ifdef INTERFACE
-CLASS(XonoticScreenshotViewerDialog) EXTENDS(XonoticDialog)
- 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, 4)
- ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
- ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
- ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
- ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
- ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotViewerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-float music_playlist_index_backup;
-void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
-{
- // disable music as it can lag depending on image loading time
- if(!cvar("menu_screenshotviewer_enablemusic"))
- if(cvar("music_playlist_index") != 999) // if the playlist isn't paused
- {
- // pause music
- if(cvar("music_playlist_index") != -1)
- {
- music_playlist_index_backup = cvar("music_playlist_index");
- cvar_set("music_playlist_sampleposition0", "0");
- cvar_set("music_playlist_index", "999");
- }
- else
- localcmd("\ncd pause\n");
- }
-
- if (me.currentScrPath == scrImage)
- return;
- if (me.currentScrPath)
- strunzone(me.currentScrPath);
- me.currentScrPath = strzone(scrImage);
- me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
- me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
-}
-void prevScreenshot_Click(entity btn, entity me)
-{
- me.scrList.goScreenshot(me.scrList, -1);
-}
-void nextScreenshot_Click(entity btn, entity me)
-{
- me.scrList.goScreenshot(me.scrList, +1);
-}
-void increaseZoom_Click(entity btn, entity me)
-{
- me.screenshotImage.setZoom(me.screenshotImage, -2, FALSE);
-}
-void decreaseZoom_Click(entity btn, entity me)
-{
- me.screenshotImage.setZoom(me.screenshotImage, -1/2, FALSE);
-}
-void resetZoom_Click(entity btn, entity me)
-{
- me.screenshotImage.setZoom(me.screenshotImage, 0, FALSE);
-}
-void toggleSlideShow_Click(entity btn, entity me)
-{
- if (me.slideShowButton.forcePressed)
- {
- me.scrList.stopSlideShow(me.scrList);
- me.slideShowButton.forcePressed = 0;
- }
- else
- {
- me.scrList.startSlideShow(me.scrList);
- me.slideShowButton.forcePressed = 1;
- }
-}
-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_KP_RIGHTARROW:
- 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)
- {
- toggleSlideShow_Click(world, me);
- return 1;
- }
- return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
- default:
- if (key == K_MWHEELUP || ascii == '+')
- {
- me.screenshotImage.setZoom(me.screenshotImage, -2, (key == K_MWHEELUP));
- return 1;
- }
- else if (key == K_MWHEELDOWN || ascii == '-')
- {
- me.screenshotImage.setZoom(me.screenshotImage, -1/2, (key == K_MWHEELDOWN));
- return 1;
- }
- if (me.scrList.keyDown(me.scrList, key, ascii, shift))
- {
- // keyDown has already changed the selected item
- me.scrList.goScreenshot(me.scrList, 0);
- return 1;
- }
- return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
- }
-}
-void XonoticScreenshotViewerDialog_close(entity me)
-{
- // resume music
- if(!cvar("menu_screenshotviewer_enablemusic"))
- if(cvar("music_playlist_index") == 999)
- {
- cvar_set("music_playlist_index", ftos(music_playlist_index_backup));
- }
- else
- localcmd("\ncd resume\n");
-
- me.scrList.stopSlideShow(me.scrList);
- me.slideShowButton.forcePressed = 0;
- SUPER(XonoticScreenshotViewerDialog).close(me);
-}
-void XonoticScreenshotViewerDialog_fill(entity me)
-{
- entity e;
- me.TR(me);
- me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
- e.showTitle = 0; // dialog title is enough
- me.screenshotImage = e;
- me.gotoRC(me, me.rows - 1, 0);
- me.TDempty(me, 1/20 * me.columns);
- me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("-", '0 0 0'));
- e.onClick = decreaseZoom_Click;
- e.onClickEntity = me;
- me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("+", '0 0 0'));
- e.onClick = increaseZoom_Click;
- e.onClickEntity = me;
- me.TD(me, 1, 2/20 * me.columns, e = makeXonoticButton(_("Reset"), '0 0 0'));
- e.onClick = resetZoom_Click;
- e.onClickEntity = me;
-
- me.TDempty(me, 2/20 * me.columns);
- me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Previous"), '0 0 0'));
- e.onClick = prevScreenshot_Click;
- e.onClickEntity = me;
- me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Next"), '0 0 0'));
- e.onClick = nextScreenshot_Click;
- e.onClickEntity = me;
-
- me.TDempty(me, 2/20 * me.columns);
- me.TD(me, 1, 4/20 * me.columns, e = makeXonoticButton(_("Slide show"), '0 0 0'));
- e.onClick = toggleSlideShow_Click;
- e.onClickEntity = me;
- me.slideShowButton = e;
-}
-#endif