Xonotic
dialog_multiplayer_media_screenshot_viewer.qc File Reference
+ Include dependency graph for dialog_multiplayer_media_screenshot_viewer.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void decreaseZoom_Click (entity btn, entity me)
 
void increaseZoom_Click (entity btn, entity me)
 
void nextScreenshot_Click (entity btn, entity me)
 
void prevScreenshot_Click (entity btn, entity me)
 
void resetZoom_Click (entity btn, entity me)
 
void toggleSlideShow_Click (entity btn, entity me)
 
void XonoticScreenshotViewerDialog_close (entity me)
 
void XonoticScreenshotViewerDialog_fill (entity me)
 
float XonoticScreenshotViewerDialog_keyDown (entity me, float key, float ascii, float shift)
 
void XonoticScreenshotViewerDialog_loadScreenshot (entity me, string scrImage)
 

Variables

float music_playlist_index_backup
 

Function Documentation

◆ decreaseZoom_Click()

void decreaseZoom_Click ( entity  btn,
entity  me 
)

Definition at line 43 of file dialog_multiplayer_media_screenshot_viewer.qc.

Referenced by XonoticScreenshotViewerDialog_fill().

44 {
45  me.screenshotImage.setZoom(me.screenshotImage, -1/2, false);
46 }
+ Here is the caller graph for this function:

◆ increaseZoom_Click()

void increaseZoom_Click ( entity  btn,
entity  me 
)

Definition at line 39 of file dialog_multiplayer_media_screenshot_viewer.qc.

Referenced by XonoticScreenshotViewerDialog_fill().

40 {
41  me.screenshotImage.setZoom(me.screenshotImage, -2, false);
42 }
+ Here is the caller graph for this function:

◆ nextScreenshot_Click()

void nextScreenshot_Click ( entity  btn,
entity  me 
)

Definition at line 35 of file dialog_multiplayer_media_screenshot_viewer.qc.

36 {
37  me.scrList.goScreenshot(me.scrList, +1);
38 }

◆ prevScreenshot_Click()

void prevScreenshot_Click ( entity  btn,
entity  me 
)

Definition at line 31 of file dialog_multiplayer_media_screenshot_viewer.qc.

32 {
33  me.scrList.goScreenshot(me.scrList, -1);
34 }

◆ resetZoom_Click()

void resetZoom_Click ( entity  btn,
entity  me 
)

Definition at line 47 of file dialog_multiplayer_media_screenshot_viewer.qc.

48 {
49  me.screenshotImage.setZoom(me.screenshotImage, 0, false);
50 }

◆ toggleSlideShow_Click()

void toggleSlideShow_Click ( entity  btn,
entity  me 
)

Definition at line 51 of file dialog_multiplayer_media_screenshot_viewer.qc.

Referenced by XonoticScreenshotViewerDialog_keyDown().

52 {
53  if (me.slideShowButton.forcePressed)
54  {
55  me.scrList.stopSlideShow(me.scrList);
56  me.slideShowButton.forcePressed = 0;
57  }
58  else
59  {
60  me.scrList.startSlideShow(me.scrList);
61  me.slideShowButton.forcePressed = 1;
62  }
63 }
+ Here is the caller graph for this function:

◆ XonoticScreenshotViewerDialog_close()

void XonoticScreenshotViewerDialog_close ( entity  me)

Definition at line 107 of file dialog_multiplayer_media_screenshot_viewer.qc.

References cvar(), cvar_set(), ftos(), localcmd, music_playlist_index_backup, and SUPER.

108 {
109  // resume music
110  if(!cvar("menu_screenshotviewer_enablemusic"))
111  if(cvar("music_playlist_index") == 999)
112  {
113  cvar_set("music_playlist_index", ftos(music_playlist_index_backup));
114  }
115  else
116  localcmd("\ncd resume\n");
117 
118  me.scrList.stopSlideShow(me.scrList);
119  me.slideShowButton.forcePressed = 0;
121 }
#define SUPER(cname)
Definition: oo.qh:219
+ Here is the call graph for this function:

◆ XonoticScreenshotViewerDialog_fill()

void XonoticScreenshotViewerDialog_fill ( entity  me)

Definition at line 122 of file dialog_multiplayer_media_screenshot_viewer.qc.

References decreaseZoom_Click(), entity(), increaseZoom_Click(), makeXonoticButton(), and makeXonoticScreenshotImage().

123 {
124  entity e;
125  me.TR(me);
126  me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
127  e.showTitle = 0; // dialog title is enough
128  me.screenshotImage = e;
129  me.gotoRC(me, me.rows - 1, 0);
130  me.TDempty(me, 1/20 * me.columns);
131  me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("-", '0 0 0'));
132  e.onClick = decreaseZoom_Click;
133  e.onClickEntity = me;
134  me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("+", '0 0 0'));
135  e.onClick = increaseZoom_Click;
136  e.onClickEntity = me;
137  me.TD(me, 1, 2/20 * me.columns, e = makeXonoticButton(_("Reset"), '0 0 0'));
138  e.onClick = resetZoom_Click;
139  e.onClickEntity = me;
140 
141  me.TDempty(me, 2/20 * me.columns);
142  me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Previous"), '0 0 0'));
143  e.onClick = prevScreenshot_Click;
144  e.onClickEntity = me;
145  me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Next"), '0 0 0'));
146  e.onClick = nextScreenshot_Click;
147  e.onClickEntity = me;
148 
149  me.TDempty(me, 2/20 * me.columns);
150  me.TD(me, 1, 4/20 * me.columns, e = makeXonoticButton(_("Slide show"), '0 0 0'));
151  e.onClick = toggleSlideShow_Click;
152  e.onClickEntity = me;
153  me.slideShowButton = e;
154 }
void resetZoom_Click(entity btn, entity me)
entity() spawn
void increaseZoom_Click(entity btn, entity me)
entity makeXonoticScreenshotImage()
void prevScreenshot_Click(entity btn, entity me)
void nextScreenshot_Click(entity btn, entity me)
void decreaseZoom_Click(entity btn, entity me)
void toggleSlideShow_Click(entity btn, entity me)
+ Here is the call graph for this function:

◆ XonoticScreenshotViewerDialog_keyDown()

float XonoticScreenshotViewerDialog_keyDown ( entity  me,
float  key,
float  ascii,
float  shift 
)

Definition at line 64 of file dialog_multiplayer_media_screenshot_viewer.qc.

References K_ENTER, K_KP_ENTER, K_KP_LEFTARROW, K_KP_RIGHTARROW, K_LEFTARROW, K_MWHEELDOWN, K_MWHEELUP, K_RIGHTARROW, K_SPACE, NULL, S_CTRL, SUPER, and toggleSlideShow_Click().

65 {
66  switch(key)
67  {
68  case K_KP_LEFTARROW:
69  case K_LEFTARROW:
70  me.scrList.goScreenshot(me.scrList, -1);
71  return 1;
72  case K_KP_RIGHTARROW:
73  case K_RIGHTARROW:
74  me.scrList.goScreenshot(me.scrList, +1);
75  return 1;
76  case K_KP_ENTER:
77  case K_ENTER:
78  case K_SPACE:
79  // we cannot use SPACE/ENTER directly, as in a dialog they are needed
80  // to press buttons while browsing with only the keyboard
81  if (shift & S_CTRL)
82  {
84  return 1;
85  }
86  return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
87  default:
88  if (key == K_MWHEELUP || ascii == '+')
89  {
90  me.screenshotImage.setZoom(me.screenshotImage, -2, (key == K_MWHEELUP));
91  return 1;
92  }
93  else if (key == K_MWHEELDOWN || ascii == '-')
94  {
95  me.screenshotImage.setZoom(me.screenshotImage, -1/2, (key == K_MWHEELDOWN));
96  return 1;
97  }
98  if (me.scrList.keyDown(me.scrList, key, ascii, shift))
99  {
100  // keyDown has already changed the selected item
101  me.scrList.goScreenshot(me.scrList, 0);
102  return 1;
103  }
104  return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
105  }
106 }
float K_KP_RIGHTARROW
Definition: keycodes.qc:60
float K_SPACE
Definition: keycodes.qc:10
float K_RIGHTARROW
Definition: keycodes.qc:18
float K_KP_ENTER
Definition: keycodes.qc:74
#define SUPER(cname)
Definition: oo.qh:219
#define NULL
Definition: post.qh:17
float K_MWHEELDOWN
Definition: keycodes.qc:133
float K_LEFTARROW
Definition: keycodes.qc:17
float K_ENTER
Definition: keycodes.qc:8
const int S_CTRL
Definition: hud.qh:128
float K_KP_LEFTARROW
Definition: keycodes.qc:57
float K_MWHEELUP
Definition: keycodes.qc:132
void toggleSlideShow_Click(entity btn, entity me)
+ Here is the call graph for this function:

◆ XonoticScreenshotViewerDialog_loadScreenshot()

void XonoticScreenshotViewerDialog_loadScreenshot ( entity  me,
string  scrImage 
)

Definition at line 8 of file dialog_multiplayer_media_screenshot_viewer.qc.

References cvar(), cvar_set(), localcmd, music_playlist_index_backup, and strcpy.

9 {
10  // disable music as it can lag depending on image loading time
11  if(!cvar("menu_screenshotviewer_enablemusic"))
12  if(cvar("music_playlist_index") != 999) // if the playlist isn't paused
13  {
14  // pause music
15  if(cvar("music_playlist_index") != -1)
16  {
17  music_playlist_index_backup = cvar("music_playlist_index");
18  cvar_set("music_playlist_sampleposition0", "0");
19  cvar_set("music_playlist_index", "999");
20  }
21  else
22  localcmd("\ncd pause\n");
23  }
24 
25  if (me.currentScrPath == scrImage)
26  return;
27  strcpy(me.currentScrPath, scrImage);
28  me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
29  me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
30 }
#define strcpy(this, s)
Definition: string.qh:49
+ Here is the call graph for this function:

Variable Documentation

◆ music_playlist_index_backup