-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.pde
148 lines (133 loc) · 5.65 KB
/
gui.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/* =========================================================
* ==== WARNING ===
* =========================================================
* The code in this tab has been generated from the GUI form
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
* =========================================================
*/
synchronized public void win_draw1(PApplet appc, GWinData data) { //_CODE_:window1:241021:
appc.background(232);
} //_CODE_:window1:241021:
public void equationField(GTextField source, GEvent event) { //_CODE_:equation:466968:
println("equation - GTextField >> GEvent." + event + " @ " + millis());
} //_CODE_:equation:466968:
public void slider1_change1(GSlider source, GEvent event) { //_CODE_:numLines:690567:
println("slider1 - GSlider >> GEvent." + event + " @ " + millis());
} //_CODE_:numLines:690567:
public void slider1_change2(GSlider source, GEvent event) { //_CODE_:circleSize:615335:
println("circleSize - GSlider >> GEvent." + event + " @ " + millis());
} //_CODE_:circleSize:615335:
public void modInitField(GTextField source, GEvent event) { //_CODE_:modInitial:526325:
println("modInitial - GTextField >> GEvent." + event + " @ " + millis());
mod = Solver.evaluate(modInitial.getText() + "*1").answer.toFloat();
reset = mod;
} //_CODE_:modInitial:526325:
public void modIncField(GTextField source, GEvent event) { //_CODE_:modIncrement:423552:
println("modIncrement - GTextField >> GEvent." + event + " @ " + millis());
incr = Solver.evaluate(modIncrement.getText() + "*1").answer.toFloat();
} //_CODE_:modIncrement:423552:
public void modR(GButton source, GEvent event) { //_CODE_:modReset:978412:
println("modReset - GButton >> GEvent." + event + " @ " + millis());
mod = reset;
} //_CODE_:modReset:978412:
public void option1_clicked1(GOption source, GEvent event) { //_CODE_:modMult:411430:
println("modMult - GOption >> GEvent." + event + " @ " + millis());
Add = false;
} //_CODE_:modMult:411430:
public void option2_clicked1(GOption source, GEvent event) { //_CODE_:modAdd:512566:
println("modAdd - GOption >> GEvent." + event + " @ " + millis());
Add = true;
} //_CODE_:modAdd:512566:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setMouseOverEnabled(false);
surface.setTitle("Circle graph");
window1 = GWindow.getWindow(this, "Controls", 400, 400, 400, 200, JAVA2D);
window1.noLoop();
window1.setActionOnClose(G4P.EXIT_APP);
window1.addDrawHandler(this, "win_draw1");
equation = new GTextField(window1, 10, 20, 380, 30, G4P.SCROLLBARS_NONE);
equation.setPromptText("Enter an equation");
equation.setOpaque(true);
equation.addEventHandler(this, "equationField");
label1 = new GLabel(window1, 120, 0, 130, 20);
label1.setTextAlign(GAlign.CENTER, GAlign.MIDDLE);
label1.setText("Insert equation f(x)");
label1.setOpaque(false);
numLines = new GSlider(window1, 10, 50, 380, 50, 10.0);
numLines.setShowValue(true);
numLines.setShowLimits(true);
numLines.setLimits(100, 0, 500);
numLines.setEasing(2.0);
numLines.setNumberFormat(G4P.INTEGER, 0);
numLines.setOpaque(false);
numLines.addEventHandler(this, "slider1_change1");
circleSize = new GSlider(window1, 60, 90, 100, 50, 10.0);
circleSize.setRotation(PI/2, GControlMode.CORNER);
circleSize.setLimits(400, 800, 0);
circleSize.setEasing(2.0);
circleSize.setNumberFormat(G4P.INTEGER, 0);
circleSize.setOpaque(false);
circleSize.addEventHandler(this, "slider1_change2");
label2 = new GLabel(window1, 60, 100, 90, 20);
label2.setTextAlign(GAlign.CENTER, GAlign.MIDDLE);
label2.setText("Mod initial");
label2.setOpaque(false);
label3 = new GLabel(window1, 60, 120, 90, 20);
label3.setTextAlign(GAlign.CENTER, GAlign.MIDDLE);
label3.setText("Mod increment");
label3.setOpaque(false);
modInitial = new GTextField(window1, 150, 100, 80, 20, G4P.SCROLLBARS_NONE);
modInitial.setOpaque(true);
modInitial.addEventHandler(this, "modInitField");
modIncrement = new GTextField(window1, 150, 120, 80, 20, G4P.SCROLLBARS_NONE);
modIncrement.setOpaque(true);
modIncrement.addEventHandler(this, "modIncField");
modReset = new GButton(window1, 270, 110, 90, 40);
modReset.setText("Reset mod");
modReset.addEventHandler(this, "modR");
togGroup1 = new GToggleGroup();
modMult = new GOption(window1, 90, 140, 120, 20);
modMult.setIconAlign(GAlign.LEFT, GAlign.MIDDLE);
modMult.setText("Mod *= increment");
modMult.setOpaque(false);
modMult.addEventHandler(this, "option1_clicked1");
modAdd = new GOption(window1, 90, 160, 120, 20);
modAdd.setIconAlign(GAlign.LEFT, GAlign.MIDDLE);
modAdd.setText("Mod += increment");
modAdd.setOpaque(false);
modAdd.addEventHandler(this, "option2_clicked1");
togGroup1.addControl(modMult);
togGroup1.addControl(modAdd);
modAdd.setSelected(true);
modLabel = new GLabel(window1, 230, 160, 160, 20);
modLabel.setTextAlign(GAlign.CENTER, GAlign.MIDDLE);
modLabel.setText("My label");
modLabel.setOpaque(false);
window1.loop();
}
// Variable declarations
// autogenerated do not edit
GWindow window1;
GTextField equation;
GLabel label1;
GSlider numLines;
GSlider circleSize;
GLabel label2;
GLabel label3;
GTextField modInitial;
GTextField modIncrement;
GButton modReset;
GToggleGroup togGroup1;
GOption modMult;
GOption modAdd;
GLabel modLabel;