-
Notifications
You must be signed in to change notification settings - Fork 6
/
IFLookAndFeel.pde
71 lines (57 loc) · 2.29 KB
/
IFLookAndFeel.pde
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
import processing.core.*;
class IFLookAndFeel {
int baseColor, borderColor, highlightColor, selectionColor,
activeColor, textColor, lightGrayColor, darkGrayColor;
IFPGraphicsState defaultGraphicsState;
static final char DEFAULT = 1;
IFLookAndFeel(char type) {
defaultGraphicsState = new IFPGraphicsState();
}
IFLookAndFeel(PApplet parent, char type) {
defaultGraphicsState = new IFPGraphicsState();
if (type == DEFAULT) {
// Play nicely with other people's draw methods. They
// may have changed the color mode.
IFPGraphicsState temp = new IFPGraphicsState(parent);
parent.colorMode(PApplet.RGB, 255);
baseColor = color(153, 153, 204);
highlightColor = color(102, 102, 204);
activeColor = color (255, 153, 51);
selectionColor = color (255, 255, 0);
borderColor = color (255);
textColor = color (0);
lightGrayColor = color(100);
darkGrayColor = color(50);
/*
System.out.println("===== DEFAULT GRAPHICS STATE =====\ntextAlign:\t" + parent.g.textAlign +
"\nrectMode:\t" + parent.g.rectMode +
"\nellipseMode:\t" + parent.g.ellipseMode +
"\ncolorMode:\t" + parent.g.colorMode + ", " + parent.g.colorModeX +
"\nsmooth:\t" + parent.g.smooth);
*/
PFont tempFont = parent.createFont ("Arial",12);
parent.textFont(tempFont, 13);
parent.textAlign(PApplet.LEFT);
parent.rectMode(PApplet.CORNER);
parent.ellipseMode(PApplet.CORNER);
parent.strokeWeight(1);
parent.colorMode(PApplet.RGB, 255);
try {
parent.smooth();
} catch (RuntimeException e) {
// Can't smooth in P3D, throws exception
}
/*
System.out.println("\n===== INTERFASCIA SETUP ======\ntextAlign:\t" + parent.g.textAlign +
"\nrectMode:\t" + parent.g.rectMode +
"\nellipseMode:\t" + parent.g.ellipseMode +
"\ncolorMode:\t" + parent.g.colorMode + ", " + parent.g.colorModeX +
"\nsmooth:\t" + parent.g.smooth);
*/
defaultGraphicsState.saveSettingsForApplet(parent);
// System.out.println("Class: " + parent.g.getClass() + "/n");
// Set the color mode back
temp.restoreSettingsToApplet(parent);
}
}
}