Skip to content

Commit 5165612

Browse files
committed
Update patches
1 parent c6a786e commit 5165612

File tree

8 files changed

+723
-60
lines changed

8 files changed

+723
-60
lines changed

patches/CirSim.patch

Lines changed: 486 additions & 49 deletions
Large diffs are not rendered by default.

patches/EditDialog.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--- /dev/null
2+
+++ src/main/java/com/lushprojects/circuitjs1/client/EditDialog.java
3+
@@ -162,6 +162,10 @@
4+
if (ei.text == null) {
5+
ei.textf.setText(unitString(ei));
6+
}
7+
+ if (ei.isColor){
8+
+ ei.textf.getElement().setAttribute("type", "color");
9+
+ ei.textf.getElement().setAttribute("style", "width:178px;padding:0");
10+
+ }
11+
}
12+
if (vp.getWidgetCount() > 15) {
13+
// start a new column
14+
@@ -272,6 +276,8 @@
15+
adj.setSliderValue(ei.value);
16+
}
17+
}
18+
+ cframe.unsavedChanges = true;
19+
+ cframe.changeWindowTitle(true);
20+
cframe.needAnalyze();
21+
}
22+

patches/EditInfo.patch

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- /dev/null
2+
+++ src/main/java/com/lushprojects/circuitjs1/client/EditInfo.java
3+
@@ -77,6 +77,7 @@
4+
boolean dimensionless;
5+
boolean noSliders;
6+
double minVal, maxVal;
7+
+ boolean isColor = false;
8+
9+
// for slider dialog
10+
TextBox minBox, maxBox, labelBox;

patches/EditOptions.patch

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
--- /dev/null
2+
+++ src/main/java/com/lushprojects/circuitjs1/client/EditOptions.java
3+
@@ -55,16 +55,36 @@
4+
return ei;
5+
}
6+
7+
- if (n == 3)
8+
- return new EditInfo("Positive Color", CircuitElm.positiveColor.getHexValue());
9+
- if (n == 4)
10+
- return new EditInfo("Negative Color", CircuitElm.negativeColor.getHexValue());
11+
- if (n == 5)
12+
- return new EditInfo("Neutral Color", CircuitElm.neutralColor.getHexValue());
13+
- if (n == 6)
14+
- return new EditInfo("Selection Color", CircuitElm.selectColor.getHexValue());
15+
- if (n == 7)
16+
- return new EditInfo("Current Color", CircuitElm.currentColor.getHexValue());
17+
+ if (n == 3){
18+
+ EditInfo ei = new EditInfo("Positive Color", CircuitElm.positiveColor.getHexValue());
19+
+ ei.isColor = true;
20+
+ return ei;
21+
+ }
22+
+
23+
+ if (n == 4){
24+
+ EditInfo ei = new EditInfo("Negative Color", CircuitElm.negativeColor.getHexValue());
25+
+ ei.isColor = true;
26+
+ return ei;
27+
+ }
28+
+
29+
+ if (n == 5){
30+
+ EditInfo ei = new EditInfo("Neutral Color", CircuitElm.neutralColor.getHexValue());
31+
+ ei.isColor = true;
32+
+ return ei;
33+
+ }
34+
+
35+
+ if (n == 6){
36+
+ EditInfo ei = new EditInfo("Selection Color", CircuitElm.selectColor.getHexValue());
37+
+ ei.isColor = true;
38+
+ return ei;
39+
+ }
40+
+
41+
+ if (n == 7){
42+
+ EditInfo ei = new EditInfo("Current Color", CircuitElm.currentColor.getHexValue());
43+
+ ei.isColor = true;
44+
+ return ei;
45+
+ }
46+
+
47+
if (n == 8)
48+
return new EditInfo("# of Decimal Digits (short format)", CircuitElm.shortDecimalDigits);
49+
if (n == 9)

patches/HelpDialog.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- /dev/null
22
+++ src/main/java/com/lushprojects/circuitjs1/client/HelpDialog.java
3-
@@ -0,0 +1,90 @@
3+
@@ -0,0 +1,104 @@
44
+/*
55
+ Copyright (C) Paul Falstad, Iain Sharp and Usevalad Khatkevich
66
+

patches/LoadFile.patch

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--- /dev/null
2+
+++ src/main/java/com/lushprojects/circuitjs1/client/LoadFile.java
3+
@@ -37,7 +37,7 @@
4+
sim.readCircuit(s);
5+
sim.createNewLoadFile();
6+
sim.setCircuitTitle(t);
7+
- ExportAsLocalFileDialog.setLastFileName(t);
8+
+ sim.setLastFileName(t);
9+
sim.unsavedChanges = false;
10+
}
11+
12+
@@ -57,6 +57,16 @@
13+
}
14+
15+
16+
+ public native String getPath()
17+
+ /*-{
18+
+ return $doc.getElementById("LoadFileElement").value;
19+
+ }-*/;
20+
+
21+
+ public native String getFileName()
22+
+ /*-{
23+
+ return $doc.getElementById("LoadFileElement").files[0].name;
24+
+ }-*/;
25+
+
26+
public final native void click()
27+
/*-{
28+
$doc.getElementById("LoadFileElement").click();

patches/ModDialog.patch

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- /dev/null
22
+++ src/main/java/com/lushprojects/circuitjs1/client/ModDialog.java
3-
@@ -0,0 +1,372 @@
3+
@@ -0,0 +1,487 @@
44
+/*
55
+ Copyright (C) Paul Falstad and Usevalad Khatkevich
66
+
@@ -24,6 +24,10 @@
2424
+
2525
+import com.google.gwt.event.dom.client.ClickEvent;
2626
+import com.google.gwt.event.dom.client.ClickHandler;
27+
+import com.google.gwt.event.dom.client.KeyPressEvent;
28+
+import com.google.gwt.event.dom.client.KeyPressHandler;
29+
+import com.google.gwt.event.dom.client.ChangeEvent;
30+
+import com.google.gwt.event.dom.client.ChangeHandler;
2731
+import com.google.gwt.user.client.ui.DialogBox;
2832
+import com.google.gwt.user.client.ui.VerticalPanel;
2933
+import com.google.gwt.user.client.ui.HTML;
@@ -34,6 +38,10 @@
3438
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
3539
+import com.google.gwt.user.client.ui.CheckBox;
3640
+import com.google.gwt.storage.client.Storage;
41+
+import com.google.gwt.user.client.ui.Label;
42+
+import com.google.gwt.user.client.ui.TextBox;
43+
+import com.google.gwt.user.client.ui.ListBox;
44+
+import com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment;
3745
+
3846
+public class ModDialog extends DialogBox {
3947
+
@@ -78,10 +86,23 @@
7886
+ native boolean CirSimIsRunning()/*-{
7987
+ return $wnd.CircuitJS1.isRunning();
8088
+ }-*/;
81-
+
82-
+ //for "Other:"
8389
+ CheckBox setShowSidebaronStartup;
90+
+ CheckBox setOverlayingSidebar;
91+
+
92+
+ HorizontalPanel SBAnimationSettings;
93+
+ TextBox DurationSB;
94+
+ CheckBox setAnimSidebar;
95+
+ ListBox SpeedCurveSB;
96+
+
97+
+ int getSpeedCurveSBIndex(String val){
98+
+ for (int i=0;i<=SpeedCurveSB.getItemCount();i++){
99+
+ if (SpeedCurveSB.getValue(i)==val)
100+
+ return i;
101+
+ }
102+
+ return 1;
103+
+ }
84104
+
105+
+ CheckBox setPauseWhenWinUnfocused;
85106
+
86107
+ Button closeButton;
87108
+
@@ -233,7 +254,7 @@
233254
+ vp2.add(setStopIcon = new CheckBox("Stop"));
234255
+ vp2.add(setPauseIcon = new CheckBox("Pause"));
235256
+
236-
+ vp3.add(hideSRBtns = new CheckBox("HIDE BUTTONS!"));
257+
+ vp3.add(hideSRBtns = new CheckBox("HIDE BUTTONS"));
237258
+
238259
+ if (CirSim.absResetBtn.getElement().hasClassName("modDefaultResetBtn"))
239260
+ setDefaultSRBtns.setValue(true);
@@ -246,7 +267,7 @@
246267
+ if (lstor.getItem("MOD_absBtnIcon")=="stop") setStopIcon.setValue(true);
247268
+ else setPauseIcon.setValue(true);
248269
+
249-
+ if (!CirSim.absRunStopBtn.isVisible()) hideSRBtns.setValue(true);
270+
+ if (lstor.getItem("MOD_hideAbsBtns")=="true") hideSRBtns.setValue(true);
250271
+
251272
+ setDefaultSRBtns.addClickHandler(new ClickHandler() {
252273
+ public void onClick(ClickEvent event) {
@@ -342,9 +363,91 @@
342363
+ }
343364
+ });
344365
+
345-
+ vp.add(new HTML("<hr><big><b>Other:</b></big>"));
366+
+ vp.add(new HTML("<hr><big><b>Sidebar:</b></big>"));
367+
+ vp.add(setOverlayingSidebar = new CheckBox("Sidebar is overlaying"));
368+
+ vp.setCellVerticalAlignment(setOverlayingSidebar, HasVerticalAlignment.ALIGN_TOP);
369+
+ //vp.setCellHorizontalAlignment(setOverlayingSidebar, HasHorizontalAlignment.ALIGN_CENTER);
370+
+
371+
+ vp.add(SBAnimationSettings = new HorizontalPanel());
372+
+ SBAnimationSettings.setWidth("100%");
373+
+ SBAnimationSettings.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
374+
+ SBAnimationSettings.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
375+
+ SBAnimationSettings.add(setAnimSidebar = new CheckBox("Animation:"));
376+
+ SBAnimationSettings.setCellHorizontalAlignment(setAnimSidebar, HasHorizontalAlignment.ALIGN_LEFT);
377+
+ SBAnimationSettings.add(new Label("duration is"));
378+
+ SBAnimationSettings.add(DurationSB = new TextBox());
379+
+ DurationSB.setMaxLength(3);DurationSB.setVisibleLength(1);
380+
+ DurationSB.setHeight("0.6em");
381+
+ DurationSB.setAlignment(TextAlignment.CENTER);
382+
+ SBAnimationSettings.add(new Label("ms,"));
383+
+ SBAnimationSettings.add(new Label("speed curve is"));
384+
+ SBAnimationSettings.add(SpeedCurveSB = new ListBox());
385+
+ SpeedCurveSB.getElement().setAttribute("style","appearance:none;padding:1px;");
386+
+ SpeedCurveSB.addItem("ease");
387+
+ SpeedCurveSB.addItem("linear");
388+
+ SpeedCurveSB.addItem("ease-in");
389+
+ SpeedCurveSB.addItem("ease-out");
390+
+ SpeedCurveSB.addItem("ease-in-out");
391+
+
346392
+ vp.add(setShowSidebaronStartup = new CheckBox("Show sidebar on startup"));
347-
+ vp.setCellHorizontalAlignment(setShowSidebaronStartup, HasHorizontalAlignment.ALIGN_CENTER);
393+
+ //vp.setCellHorizontalAlignment(setShowSidebaronStartup, HasHorizontalAlignment.ALIGN_CENTER);
394+
+
395+
+ if (lstor.getItem("MOD_overlayingSidebar")=="true") setOverlayingSidebar.setValue(true);
396+
+ else setAnimSidebar.setEnabled(false);
397+
+ if (lstor.getItem("MOD_overlayingSBAnimation")=="true") setAnimSidebar.setValue(true);
398+
+
399+
+ DurationSB.setValue(lstor.getItem("MOD_SBAnim_duration"));
400+
+ SpeedCurveSB.setItemSelected(getSpeedCurveSBIndex(lstor.getItem("MOD_SBAnim_SpeedCurve")),true);
401+
+
402+
+ DurationSB.addKeyPressHandler(new KeyPressHandler() {
403+
+ public void onKeyPress(KeyPressEvent event) {
404+
+ if (!Character.isDigit(event.getCharCode()) || DurationSB.getValue()=="0") {
405+
+ ((TextBox) event.getSource()).cancelKey();
406+
+ }
407+
+ }
408+
+ });
409+
+
410+
+ DurationSB.addChangeHandler(new ChangeHandler() {
411+
+ public void onChange(ChangeEvent event) {
412+
+ lstor.setItem("MOD_SBAnim_duration", DurationSB.getValue());
413+
+ if (setOverlayingSidebar.getValue()) CirSim.setSidebarAnimation(DurationSB.getValue(),SpeedCurveSB.getSelectedItemText());
414+
+ }
415+
+ });
416+
+
417+
+ SpeedCurveSB.addChangeHandler(new ChangeHandler() {
418+
+ public void onChange(ChangeEvent event) {
419+
+ lstor.setItem("MOD_SBAnim_SpeedCurve", SpeedCurveSB.getSelectedItemText());
420+
+ if (setOverlayingSidebar.getValue())
421+
+ CirSim.setSidebarAnimation(DurationSB.getValue(),SpeedCurveSB.getSelectedItemText());
422+
+ }
423+
+ });
424+
+
425+
+ setOverlayingSidebar.addClickHandler(new ClickHandler() {
426+
+ public void onClick(ClickEvent event) {
427+
+ if (setOverlayingSidebar.getValue()){
428+
+ lstor.setItem("MOD_overlayingSidebar", "true");
429+
+ setAnimSidebar.setEnabled(true);
430+
+ if (setAnimSidebar.getValue()) CirSim.setSidebarAnimation(DurationSB.getValue(),SpeedCurveSB.getSelectedItemText());
431+
+ } else {
432+
+ lstor.setItem("MOD_overlayingSidebar", "false");
433+
+ setAnimSidebar.setEnabled(false);
434+
+ CirSim.setSidebarAnimation("none","");
435+
+ }
436+
+ }
437+
+ });
438+
+ setAnimSidebar.addClickHandler(new ClickHandler() {
439+
+ public void onClick(ClickEvent event) {
440+
+ if (setAnimSidebar.getValue()){
441+
+ lstor.setItem("MOD_overlayingSBAnimation", "true");
442+
+ if (setOverlayingSidebar.getValue())
443+
+ CirSim.setSidebarAnimation(DurationSB.getValue(),SpeedCurveSB.getSelectedItemText());
444+
+ } else {
445+
+ lstor.setItem("MOD_overlayingSBAnimation", "false");
446+
+ CirSim.setSidebarAnimation("none","");
447+
+ }
448+
+ }
449+
+ });
450+
+
348451
+ if (lstor.getItem("MOD_showSidebaronStartup")=="true") setShowSidebaronStartup.setValue(true);
349452
+ setShowSidebaronStartup.addClickHandler(new ClickHandler() {
350453
+ public void onClick(ClickEvent event) {
@@ -353,6 +456,18 @@
353456
+ } else {lstor.setItem("MOD_showSidebaronStartup", "false");}
354457
+ }
355458
+ });
459+
+
460+
+ vp.add(new HTML("<hr><big><b>Other:</b></big>"));
461+
+ vp.add(setPauseWhenWinUnfocused = new CheckBox("Pause simulation when window loses focus<br>(recommended for optimal performance)",true));
462+
+ vp.setCellHorizontalAlignment(setPauseWhenWinUnfocused, HasHorizontalAlignment.ALIGN_CENTER);
463+
+ if (lstor.getItem("MOD_setPauseWhenWinUnfocused")=="true") setPauseWhenWinUnfocused.setValue(true);
464+
+ setPauseWhenWinUnfocused.addClickHandler(new ClickHandler() {
465+
+ public void onClick(ClickEvent event) {
466+
+ if (setPauseWhenWinUnfocused.getValue()){
467+
+ lstor.setItem("MOD_setPauseWhenWinUnfocused", "true");
468+
+ } else {lstor.setItem("MOD_setPauseWhenWinUnfocused", "false");}
469+
+ }
470+
+ });
356471
+ vp.add(new HTML("<br>"));
357472
+
358473
+ vp.add(closeButton = new Button("<b>Close</b>",

patches/style.css.patch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- /dev/null
22
+++ src/main/java/com/lushprojects/circuitjs1/public/style.css
3-
@@ -1,123 +1,92 @@
3+
@@ -1,123 +1,94 @@
44
@charset "UTF-8";
55

66
-/*Hide all mobile elements when in desktop usage*/
@@ -45,6 +45,7 @@
4545
- }
4646
+.triggerLabel {
4747
+ display: initial;
48+
+ border: 1px solid #bbb;
4849
+ border-radius: 10px 0px 0px 10px;
4950
+ background: #e3e8f3 url(images/hborder.png) repeat-x 0px -2003px;
5051
+ width: 25px;
@@ -53,7 +54,7 @@
5354
+ top: 50px;
5455
+ right: 0;
5556
+ z-index: 1;
56-
+ transition: right 1s;
57+
+ /*transition: right 1s;*/
5758
+ cursor: pointer;
5859
+}
5960
+.triggerLabel:before {
@@ -122,7 +123,8 @@
122123
+ width: 0 !important;
123124
+ background: white;
124125
+ z-index: 1;
125-
+ transition: width 1s;
126+
+ /*transition: width 1s;*/
127+
+ border-left: 1px solid #bbb;
126128
+}
127129
+.trigger:checked+.triggerLabel+div {
128130
+ width: 166px !important;

0 commit comments

Comments
 (0)