FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing/app/src/processing/mode/java/PresentMode.java at patch-8 · GoToLoop/processing · GitHub
GoToLoop
processing
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
processing
/
app
/
src
/
processing
/
mode
/
java
/
PresentMode.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
130 lines (102 loc) · 3.58 KB
Breadcrumbs
processing
/
app
/
src
/
processing
/
mode
/
java
/
PresentMode.java
Copy path
File metadata and controls
130 lines (102 loc) · 3.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2005-09 Ben Fry and Casey Reas
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
processing
.
mode
.
java
;
import
java
.
awt
.*;
import
java
.
awt
.
event
.*;
import
java
.
util
.
Vector
;
import
javax
.
swing
.*;
import
processing
.
app
.
Preferences
;
/**
* Helper class for full-screen presentation mode.
*/
public
class
PresentMode
{
static
GraphicsDevice
devices
[];
/**
* Index of the default display device, probably the one that p5 was
* started from.
*/
static
int
defaultIndex
;
/**
* Menu object for preferences window
*/
//JMenu preferencesMenu;
static
JComboBox
selector
;
/**
* Index of the currently selected display to be used for present mode.
*/
static
GraphicsDevice
device
;
static
{
GraphicsEnvironment
environment
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
devices
=
environment
.
getScreenDevices
();
GraphicsDevice
defaultDevice
=
environment
.
getDefaultScreenDevice
();
Vector
<
String
>
names
=
new
Vector
<
String
>();
for
(
int
i
=
0
;
i
<
devices
.
length
;
i
++) {
String
name
=
String
.
valueOf
(
i
+
1
);
if
(
devices
[
i
] ==
defaultDevice
) {
defaultIndex
=
i
;
name
+=
" (default)"
;
}
names
.
add
(
name
);
}
selector
=
new
JComboBox
(
names
);
selector
.
addActionListener
(
new
ActionListener
() {
public
void
actionPerformed
(
ActionEvent
e
) {
int
index
=
selector
.
getSelectedIndex
();
//device = devices[index];
Preferences
.
setInteger
(
"run.present.display"
,
index
+
1
);
}
});
}
static
public
JComboBox
getSelector
() {
int
deviceIndex
=
Preferences
.
getInteger
(
"run.present.display"
) -
1
;
selector
.
setSelectedIndex
(
deviceIndex
);
return
selector
;
}
/*
static public JFrame create() {
int deviceIndex = PrePreferences.getInteger("run.present.display") - 1;
if ((deviceIndex < 0) || (deviceIndex >= devices.length)) {
Base.showWarning("Display doesn't exist",
"Present Mode is set to use display " +
(deviceIndex+1) +
" but that doesn't seem to exist. \n" +
"This preference will be reset to " +
"use the default display.", null);
deviceIndex = defaultIndex;
}
//GraphicsDevice device = devices[
//JFrame frame = new JFrame(devices[deviceIndex]);
PresentFrame frame = new PresentFrame(devices[deviceIndex]);
}
public void show() {
setUndecorated(true);
setResizable(false);
device.setFullScreenWindow(this);
}
public Window getWindow() {
return device.getFullScreenWindow(); // isn't this just me?
}
public void dispose() {
Window window = device.getFullScreenWindow();
if (window != null) {
window.dispose();
}
device.setFullScreenWindow(null);
}
*/
}
Back
|
FazBrowse Home
|
New Git URL