ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 0.9)
ATTRIB(XonoticScreenshotBrowserTab, rows, float, 22)
ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
- ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+
+ METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string))
+ ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
+ ATTRIB(XonoticScreenshotBrowserTab, currentScrName, string, string_null)
+ ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
ENDCLASS(XonoticScreenshotBrowserTab)
entity makeXonoticScreenshotBrowserTab();
#endif
me.configureDialog(me);
return me;
}
+void XonoticScreenshotBrowserTab_loadPreviewScreenshot(entity me, string scrImage)
+{
+ if (me.currentScrPath)
+ strunzone(me.currentScrPath);
+ me.currentScrPath = strzone(scrImage);
+ me.screenshotImage.configureImage(me.screenshotImage, me.currentScrPath);
+ me.screenshotImage.updateAspect(me.screenshotImage);
+
+ if (me.currentScrName)
+ strunzone(me.currentScrName);
+ me.currentScrName = strzone(substring(scrImage, 13, strlen(scrImage) - 13));
+}
void XonoticScreenshotBrowserTab_fill(entity me)
{
entity e, btn, slist;
slist.screenshotViewerDialog = main.screenshotViewerDialog;
main.screenshotViewerDialog.scrList = slist;
me.TR(me);
- me.TD(me, me.rows - 4, me.columns, slist);
- me.gotoRC(me, me.rows - 1, 0);
+ me.TD(me, me.rows - 4 - 11, me.columns, slist);
+ me.gotoRC(me, me.rows - 2 - 11, 0);
me.TD(me, 1, me.columns, e = makeXonoticButton("View", '0 0 0'));
e.onClick = StartScreenshot_Click;
e.onClickEntity = slist;
+ me.gotoRC(me, me.rows - 1 - 11, 0);
+ me.TD(me, 12, me.columns, e = makeXonoticImage(string_null, -1));
+ me.screenshotImage = e;
+ slist.screenshotPreview = e;
+ slist.screenshotBrowserDialog = me;
}
#endif
METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticScreenshotList, getScreenshots, void(entity))
+ METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
METHOD(XonoticScreenshotList, startScreenshot, void(entity))
METHOD(XonoticScreenshotList, screenshotName, string(entity, float))
METHOD(XonoticScreenshotList, clickListBoxItem, void(entity, float, vector))
ATTRIB(XonoticScreenshotList, lastClickedScreenshot, float, -1)
ATTRIB(XonoticScreenshotList, lastClickedTime, float, 0)
ATTRIB(XonoticScreenshotList, filterString, string, string_null)
+
+ ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
+ ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
METHOD(XonoticScreenshotList, goScreenshot, void(entity, float))
ENDCLASS(XonoticScreenshotList)
{
string s;
if(isSelected)
+ {
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ me.previewScreenshot(me);
+ }
s = me.screenshotName(me,i);
s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
}
void ScreenshotList_Filter_Change(entity box, entity me)
-{
+{
if(me.filterString)
strunzone(me.filterString);
me.filterString = string_null;
me.getScreenshots(me);
+ me.setSelected(me, 0); //alway select the first element after a new search
}
void XonoticScreenshotList_goScreenshot(entity me, float d)
if(!me.screenshotViewerDialog)
return;
me.setSelected(me, me.selectedItem + d);
- main.screenshotViewerDialog.loadScreenshot(main.screenshotViewerDialog, strcat("/screenshots/", me.screenshotName(me,me.selectedItem)));
+ me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", me.screenshotName(me,me.selectedItem)));
}
void XonoticScreenshotList_startScreenshot(entity me)
{
- main.screenshotViewerDialog.loadScreenshot(main.screenshotViewerDialog, strcat("/screenshots/", me.screenshotName(me,me.selectedItem)));
+ me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", me.screenshotName(me,me.selectedItem)));
// pop up screenshot
- DialogOpenButton_Click_withCoords(NULL, main.screenshotViewerDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
+ DialogOpenButton_Click_withCoords(NULL, me.screenshotViewerDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
+}
+
+void XonoticScreenshotList_previewScreenshot(entity me)
+{
+ if(!me.screenshotBrowserDialog)
+ return;
+ me.screenshotBrowserDialog.loadPreviewScreenshot(me.screenshotBrowserDialog, strcat("/screenshots/", me.screenshotName(me,me.selectedItem)));
}
void StartScreenshot_Click(entity btn, entity me)