]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/screenshotlist.qc
Merge branch 'master' into TimePath/vehicles_cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / screenshotlist.qc
index d6fcaf86e3d0d97b0494e823ac311df0fb2183af..e7693a2e351080f0eaa6e7fba4807c040f2fbc6a 100644 (file)
@@ -2,20 +2,20 @@
 #define SCREENSHOTLIST_H
 #include "listbox.qc"
 CLASS(XonoticScreenshotList, XonoticListBox)
-       METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity))
+       METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity));
        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, int, vector, bool, bool))
-       METHOD(XonoticScreenshotList, getScreenshots, void(entity))
-       METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
-       METHOD(XonoticScreenshotList, startScreenshot, void(entity))
-       METHOD(XonoticScreenshotList, screenshotName, string(entity, float))
-       METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticScreenshotList, destroy, void(entity))
-       METHOD(XonoticScreenshotList, showNotify, void(entity))
+       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, int, vector, bool, bool));
+       METHOD(XonoticScreenshotList, getScreenshots, void(entity));
+       METHOD(XonoticScreenshotList, previewScreenshot, void(entity));
+       METHOD(XonoticScreenshotList, startScreenshot, void(entity));
+       METHOD(XonoticScreenshotList, screenshotName, string(entity, float));
+       METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticScreenshotList, destroy, void(entity));
+       METHOD(XonoticScreenshotList, showNotify, void(entity));
        ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
        ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
        ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
@@ -29,14 +29,13 @@ CLASS(XonoticScreenshotList, XonoticListBox)
 
        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))
+       METHOD(XonoticScreenshotList, goScreenshot, void(entity, float));
+       METHOD(XonoticScreenshotList, startSlideShow, void(entity));
+       METHOD(XonoticScreenshotList, stopSlideShow, void(entity));
 ENDCLASS(XonoticScreenshotList)
 
 entity makeXonoticScreenshotList();
@@ -152,13 +151,12 @@ void XonoticScreenshotList_setSelected(entity me, float i)
 {
        if (me.newSlideShowScreenshotTime)
                me.startSlideShow(me);
-       me.prevSelectedItem = me.selectedItem;
+       float selectedItem_save = me.selectedItem;
        SUPER(XonoticScreenshotList).setSelected(me, i);
-       if (me.pressed && me.selectedItem != me.prevSelectedItem)
+       if (me.pressed && me.selectedItem != selectedItem_save)
        {
-               // 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;)
+               // avoid immediate image loading on quick repeated selection changes
+               me.newScreenshotTime = time + 0.22;
        }
        else if (time > me.newScreenshotTime)
        {
@@ -296,8 +294,6 @@ float XonoticScreenshotList_keyDown(entity me, float scan, float ascii, float sh
                me.startScreenshot(me);
                return 1;
        }
-       if(scan == K_MWHEELUP || scan == K_MWHEELDOWN)
-               me.newScreenshotTime = time + 0.2;
        return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
 }
 #endif