Selaa lähdekoodia

- Refactored usage of live objects in the IDE

- Save collapse state of the project browser tree
Stan Hebben 6 vuotta sitten
vanhempi
commit
3f29d8bf0c
83 muutettua tiedostoa jossa 582 lisäystä ja 413 poistoa
  1. 1
    7
      DrawableGui/build.gradle
  2. 5
    4
      DrawableGui/src/main/java/org/openzen/drawablegui/DButton.java
  3. 1
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/DComponent.java
  4. 2
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/DEmptyView.java
  5. 7
    6
      DrawableGui/src/main/java/org/openzen/drawablegui/DInputField.java
  6. 7
    5
      DrawableGui/src/main/java/org/openzen/drawablegui/DLabel.java
  7. 2
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltip.java
  8. 7
    5
      DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltipComponent.java
  9. 2
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/DSizing.java
  10. 2
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/DUIWindow.java
  11. 9
    7
      DrawableGui/src/main/java/org/openzen/drawablegui/border/DCustomWindowBorder.java
  12. 3
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/form/DForm.java
  13. 7
    5
      DrawableGui/src/main/java/org/openzen/drawablegui/layout/DLinearLayout.java
  14. 8
    6
      DrawableGui/src/main/java/org/openzen/drawablegui/layout/DSideLayout.java
  15. 0
    42
      DrawableGui/src/main/java/org/openzen/drawablegui/live/SimpleLiveObject.java
  16. 10
    8
      DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollBar.java
  17. 15
    12
      DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollPane.java
  18. 7
    6
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingDialog.java
  19. 8
    6
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingInlineWindow.java
  20. 7
    5
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingWindow.java
  21. 3
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeNode.java
  22. 12
    11
      DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeView.java
  23. 24
    12
      IDE/src/main/java/org/openzen/zenscript/ide/Main.java
  24. 1
    1
      IDE/src/main/java/org/openzen/zenscript/ide/codemodel/IDECodeSpace.java
  25. 1
    1
      IDE/src/main/java/org/openzen/zenscript/ide/host/DevelopmentHost.java
  26. 1
    1
      IDE/src/main/java/org/openzen/zenscript/ide/host/IDELibrary.java
  27. 2
    0
      IDE/src/main/java/org/openzen/zenscript/ide/host/IDEModule.java
  28. 3
    3
      IDE/src/main/java/org/openzen/zenscript/ide/host/IDEModuleType.java
  29. 1
    1
      IDE/src/main/java/org/openzen/zenscript/ide/host/IDEPackage.java
  30. 4
    0
      IDE/src/main/java/org/openzen/zenscript/ide/host/IDEPropertyDirectory.java
  31. 2
    1
      IDE/src/main/java/org/openzen/zenscript/ide/host/IDESourceFile.java
  32. 37
    0
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/JSONPropertyDirectory.java
  33. 4
    3
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalLibrary.java
  34. 6
    0
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalModule.java
  35. 6
    4
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalPackage.java
  36. 5
    3
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalProjectDevelopmentHost.java
  37. 5
    3
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalSourceFile.java
  38. 23
    0
      IDE/src/main/java/org/openzen/zenscript/ide/host/local/UniversalModuleType.java
  39. 4
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEAspectBar.java
  40. 3
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEAspectToolbar.java
  41. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEDockWindow.java
  42. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEStatusBar.java
  43. 4
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEWindow.java
  44. 3
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/dialog/CreatePackageDialog.java
  45. 4
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/dialog/CreateSourceFileDialog.java
  46. 10
    7
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControl.java
  47. 4
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/StatusBarView.java
  48. 14
    13
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedView.java
  49. 3
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewComponent.java
  50. 16
    10
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewTab.java
  51. 3
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewTabClose.java
  52. 7
    5
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/WindowView.java
  53. 9
    6
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButton.java
  54. 16
    15
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarView.java
  55. 8
    5
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/WindowActionButton.java
  56. 9
    7
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditor.java
  57. 4
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/TokenModel.java
  58. 6
    5
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/output/OutputView.java
  59. 8
    5
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/LibraryTreeNode.java
  60. 5
    5
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ModuleTreeNode.java
  61. 13
    8
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/PackageTreeNode.java
  62. 10
    9
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectBrowser.java
  63. 6
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectOverviewNode.java
  64. 8
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectTreeNode.java
  65. 11
    6
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/RootTreeNode.java
  66. 5
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/SourceFileTreeNode.java
  67. 1
    0
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaClass.java
  68. 2
    0
      JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java
  69. 1
    1
      JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/BaseMemberCompiler.java
  70. 2
    1
      JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/FormattingUtils.java
  71. 0
    1
      JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/JavaMemberCompiler.java
  72. 11
    16
      JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/JavaSourceExpressionFormatter.java
  73. 17
    0
      ScriptingExample/src/main/java/org/openzen/zenscript/scriptingexample/TestInterface.java
  74. 12
    13
      Shared/src/main/java/live/LiveConcatList.java
  75. 5
    5
      Shared/src/main/java/live/LiveEmptyList.java
  76. 7
    11
      Shared/src/main/java/live/LiveMappedList.java
  77. 12
    14
      Shared/src/main/java/live/LivePredicateBool.java
  78. 8
    16
      Shared/src/main/java/live/LivePrefixedList.java
  79. 4
    4
      Shared/src/main/java/live/MutableLiveBool.java
  80. 6
    0
      Shared/src/main/java/live/MutableLiveObject.java
  81. 35
    0
      Shared/src/main/java/live/SimpleLiveObject.java
  82. 6
    5
      Shared/src/main/java/live/SortedLiveList.java
  83. 6
    2
      Shared/src/main/java/org/openzen/zencode/shared/CompileException.java

+ 1
- 7
DrawableGui/build.gradle Näytä tiedosto

@@ -14,11 +14,5 @@ if (!hasProperty('mainClass')) {
14 14
 }
15 15
 
16 16
 dependencies {
17
-    // TODO: Add dependencies here
18
-    //   but note that JUnit should have already been added in parent.gradle.
19
-    //   By default, only the Maven Central Repository is specified in
20
-    //   parent.gradle.
21
-    //
22
-    // You can read more about how to add dependency here:
23
-    //   http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
17
+    compile project(':Shared')
24 18
 }

+ 5
- 4
DrawableGui/src/main/java/org/openzen/drawablegui/DButton.java Näytä tiedosto

@@ -5,12 +5,13 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
+import live.LiveBool;
9
+import live.LiveObject;
10
+import live.LiveString;
11
+import live.MutableLiveObject;
12
+
8 13
 import org.openzen.drawablegui.draw.DDrawnShape;
9 14
 import org.openzen.drawablegui.draw.DDrawnText;
10
-import org.openzen.drawablegui.live.LiveBool;
11
-import org.openzen.drawablegui.live.LiveObject;
12
-import org.openzen.drawablegui.live.LiveString;
13
-import org.openzen.drawablegui.live.MutableLiveObject;
14 15
 import org.openzen.drawablegui.style.DShadow;
15 16
 import org.openzen.drawablegui.style.DStyleClass;
16 17
 

+ 1
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/DComponent.java Näytä tiedosto

@@ -5,7 +5,7 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
-import org.openzen.drawablegui.live.LiveObject;
8
+import live.LiveObject;
9 9
 
10 10
 /**
11 11
  *

+ 2
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/DEmptyView.java Näytä tiedosto

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
-import org.openzen.drawablegui.live.ImmutableLiveObject;
9
-import org.openzen.drawablegui.live.LiveObject;
8
+import live.ImmutableLiveObject;
9
+import live.LiveObject;
10 10
 
11 11
 /**
12 12
  *

+ 7
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/DInputField.java Näytä tiedosto

@@ -5,14 +5,15 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
+import java.util.function.BiConsumer;
9
+import listeners.ListenerHandle;
10
+import live.LiveObject;
11
+import live.MutableLiveObject;
12
+import live.MutableLiveString;
13
+
8 14
 import org.openzen.drawablegui.draw.DDrawnRectangle;
9 15
 import org.openzen.drawablegui.draw.DDrawnShape;
10 16
 import org.openzen.drawablegui.draw.DDrawnText;
11
-import org.openzen.drawablegui.listeners.ListenerHandle;
12
-import org.openzen.drawablegui.live.LiveObject;
13
-import org.openzen.drawablegui.live.LiveString;
14
-import org.openzen.drawablegui.live.MutableLiveObject;
15
-import org.openzen.drawablegui.live.MutableLiveString;
16 17
 import org.openzen.drawablegui.style.DDimension;
17 18
 import org.openzen.drawablegui.style.DStyleClass;
18 19
 
@@ -22,7 +23,7 @@ import org.openzen.drawablegui.style.DStyleClass;
22 23
  */
23 24
 public class DInputField implements DComponent {
24 25
 	public final MutableLiveString value;
25
-	private final ListenerHandle<LiveString.Listener> valueListener;
26
+	private final ListenerHandle<BiConsumer<String, String>> valueListener;
26 27
 	
27 28
 	private final DStyleClass styleClass;
28 29
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/DLabel.java Näytä tiedosto

@@ -5,11 +5,13 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
+import java.util.function.BiConsumer;
9
+import listeners.ListenerHandle;
10
+import live.LiveString;
11
+import live.LiveObject;
12
+import live.MutableLiveObject;
13
+
8 14
 import org.openzen.drawablegui.draw.DDrawnText;
9
-import org.openzen.drawablegui.listeners.ListenerHandle;
10
-import org.openzen.drawablegui.live.LiveObject;
11
-import org.openzen.drawablegui.live.LiveString;
12
-import org.openzen.drawablegui.live.MutableLiveObject;
13 15
 import org.openzen.drawablegui.style.DStyleClass;
14 16
 
15 17
 /**
@@ -20,7 +22,7 @@ public class DLabel implements DComponent {
20 22
 	private final LiveString label;
21 23
 	private final DStyleClass styleClass;
22 24
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
23
-	private final ListenerHandle<LiveString.Listener> labelListener;
25
+	private final ListenerHandle<BiConsumer<String, String>> labelListener;
24 26
 	
25 27
 	private DComponentContext context;
26 28
 	private DIRectangle bounds;

+ 2
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltip.java Näytä tiedosto

@@ -5,7 +5,8 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
-import org.openzen.drawablegui.live.LiveString;
8
+import live.LiveString;
9
+
9 10
 import org.openzen.drawablegui.style.DStyleClass;
10 11
 
11 12
 /**

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltipComponent.java Näytä tiedosto

@@ -5,12 +5,14 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
+import java.util.function.BiConsumer;
9
+import listeners.ListenerHandle;
10
+import live.LiveObject;
11
+import live.LiveString;
12
+import live.MutableLiveObject;
13
+
8 14
 import org.openzen.drawablegui.draw.DDrawnRectangle;
9 15
 import org.openzen.drawablegui.draw.DDrawnText;
10
-import org.openzen.drawablegui.listeners.ListenerHandle;
11
-import org.openzen.drawablegui.live.LiveObject;
12
-import org.openzen.drawablegui.live.LiveString;
13
-import org.openzen.drawablegui.live.MutableLiveObject;
14 16
 import org.openzen.drawablegui.style.DStyleClass;
15 17
 
16 18
 /**
@@ -21,7 +23,7 @@ public class DSimpleTooltipComponent implements DComponent {
21 23
 	private final DStyleClass styleClass;
22 24
 	private final LiveString tooltip;
23 25
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
24
-	private final ListenerHandle<LiveString.Listener> tooltipListener;
26
+	private final ListenerHandle<BiConsumer<String, String>> tooltipListener;
25 27
 	
26 28
 	private DComponentContext context;
27 29
 	private DIRectangle bounds;

+ 2
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/DSizing.java Näytä tiedosto

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
-import org.openzen.drawablegui.live.MutableLiveObject;
9
-import org.openzen.drawablegui.live.SimpleLiveObject;
8
+import live.MutableLiveObject;
9
+import live.SimpleLiveObject;
10 10
 
11 11
 /**
12 12
  *

+ 2
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/DUIWindow.java Näytä tiedosto

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.drawablegui;
7 7
 
8
-import org.openzen.drawablegui.live.LiveBool;
9
-import org.openzen.drawablegui.live.LiveObject;
8
+import live.LiveBool;
9
+import live.LiveObject;
10 10
 
11 11
 /**
12 12
  *

+ 9
- 7
DrawableGui/src/main/java/org/openzen/drawablegui/border/DCustomWindowBorder.java Näytä tiedosto

@@ -5,6 +5,7 @@
5 5
  */
6 6
 package org.openzen.drawablegui.border;
7 7
 
8
+import java.util.function.BiConsumer;
8 9
 import org.openzen.drawablegui.DComponent;
9 10
 import org.openzen.drawablegui.DComponentContext;
10 11
 import org.openzen.drawablegui.DSizing;
@@ -15,11 +16,12 @@ import org.openzen.drawablegui.DUIWindow;
15 16
 import org.openzen.drawablegui.DIRectangle;
16 17
 import org.openzen.drawablegui.draw.DDrawnRectangle;
17 18
 import org.openzen.drawablegui.draw.DDrawnShape;
18
-import org.openzen.drawablegui.listeners.ListenerHandle;
19
-import org.openzen.drawablegui.live.ImmutableLiveObject;
20
-import org.openzen.drawablegui.live.LiveBool;
21
-import org.openzen.drawablegui.live.LiveObject;
19
+import listeners.ListenerHandle;
20
+import live.ImmutableLiveObject;
21
+import live.LiveBool;
22
+import live.LiveObject;
22 23
 import org.openzen.drawablegui.style.DStyleClass;
24
+import zsynthetic.FunctionBoolBoolToVoid;
23 25
 
24 26
 /**
25 27
  *
@@ -35,10 +37,10 @@ public class DCustomWindowBorder implements DComponent {
35 37
 	private DIRectangle bounds;
36 38
 	
37 39
 	private LiveBool active;
38
-	private LiveObject<DUIWindow.State> state;
40
+	private live.LiveObject<DUIWindow.State> state;
39 41
 	
40
-	private ListenerHandle<LiveObject.Listener<DUIWindow.State>> stateListener;
41
-	private ListenerHandle<LiveBool.Listener> activeListener;
42
+	private ListenerHandle<BiConsumer<DUIWindow.State, DUIWindow.State>> stateListener;
43
+	private ListenerHandle<FunctionBoolBoolToVoid> activeListener;
42 44
 	
43 45
 	private DDrawnRectangle background;
44 46
 	private DDrawnShape shadowedBackground;

+ 3
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/form/DForm.java Näytä tiedosto

@@ -7,6 +7,9 @@ package org.openzen.drawablegui.form;
7 7
 
8 8
 import java.util.function.Consumer;
9 9
 import java.util.function.Predicate;
10
+import live.LiveObject;
11
+import live.MutableLiveObject;
12
+
10 13
 import org.openzen.drawablegui.BaseComponentGroup;
11 14
 import org.openzen.drawablegui.DComponent;
12 15
 import org.openzen.drawablegui.DComponentContext;
@@ -14,8 +17,6 @@ import org.openzen.drawablegui.DSizing;
14 17
 import org.openzen.drawablegui.DFontMetrics;
15 18
 import org.openzen.drawablegui.DIRectangle;
16 19
 import org.openzen.drawablegui.draw.DDrawnText;
17
-import org.openzen.drawablegui.live.LiveObject;
18
-import org.openzen.drawablegui.live.MutableLiveObject;
19 20
 import org.openzen.drawablegui.style.DStyleClass;
20 21
 
21 22
 /**

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/layout/DLinearLayout.java Näytä tiedosto

@@ -5,8 +5,13 @@
5 5
  */
6 6
 package org.openzen.drawablegui.layout;
7 7
 
8
+import java.util.function.BiConsumer;
8 9
 import java.util.function.Consumer;
9 10
 import java.util.function.Predicate;
11
+import listeners.ListenerHandle;
12
+import live.LiveObject;
13
+import live.MutableLiveObject;
14
+
10 15
 import org.openzen.drawablegui.BaseComponentGroup;
11 16
 import org.openzen.drawablegui.DComponent;
12 17
 import org.openzen.drawablegui.DComponentContext;
@@ -14,9 +19,6 @@ import org.openzen.drawablegui.DIRectangle;
14 19
 import org.openzen.drawablegui.DSizing;
15 20
 import org.openzen.drawablegui.DTransform2D;
16 21
 import org.openzen.drawablegui.draw.DDrawnShape;
17
-import org.openzen.drawablegui.listeners.ListenerHandle;
18
-import org.openzen.drawablegui.live.LiveObject;
19
-import org.openzen.drawablegui.live.MutableLiveObject;
20 22
 import org.openzen.drawablegui.style.DStyleClass;
21 23
 
22 24
 /**
@@ -28,7 +30,7 @@ public class DLinearLayout extends BaseComponentGroup {
28 30
 	private final Orientation orientation;
29 31
 	private final Alignment alignment;
30 32
 	private final Element[] components;
31
-	private final ListenerHandle<LiveObject.Listener<DSizing>>[] componentSizeListeners;
33
+	private final ListenerHandle<BiConsumer<DSizing, DSizing>>[] componentSizeListeners;
32 34
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
33 35
 	
34 36
 	private DComponentContext context;
@@ -118,7 +120,7 @@ public class DLinearLayout extends BaseComponentGroup {
118 120
 
119 121
 	@Override
120 122
 	public void close() {
121
-		for (ListenerHandle<LiveObject.Listener<DSizing>> listener : componentSizeListeners) {
123
+		for (ListenerHandle<BiConsumer<DSizing, DSizing>> listener : componentSizeListeners) {
122 124
 			listener.close();
123 125
 		}
124 126
 		for (Element element : components)

+ 8
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/layout/DSideLayout.java Näytä tiedosto

@@ -8,17 +8,19 @@ package org.openzen.drawablegui.layout;
8 8
 import java.io.Closeable;
9 9
 import java.util.ArrayList;
10 10
 import java.util.List;
11
+import java.util.function.BiConsumer;
11 12
 import java.util.function.Consumer;
12 13
 import java.util.function.Predicate;
14
+import listeners.ListenerHandle;
15
+import live.LiveObject;
16
+import live.MutableLiveObject;
17
+
13 18
 import org.openzen.drawablegui.BaseComponentGroup;
14 19
 import org.openzen.drawablegui.DComponent;
15 20
 import org.openzen.drawablegui.DComponentContext;
16 21
 import org.openzen.drawablegui.DIRectangle;
17 22
 import org.openzen.drawablegui.DSizing;
18 23
 import org.openzen.drawablegui.draw.DDrawnRectangle;
19
-import org.openzen.drawablegui.listeners.ListenerHandle;
20
-import org.openzen.drawablegui.live.LiveObject;
21
-import org.openzen.drawablegui.live.MutableLiveObject;
22 24
 import org.openzen.drawablegui.style.DStyleClass;
23 25
 
24 26
 /**
@@ -257,10 +259,10 @@ public class DSideLayout extends BaseComponentGroup {
257 259
 		background.close();
258 260
 	}
259 261
 	
260
-	public class SideComponent implements Closeable, LiveObject.Listener<DSizing> {
262
+	public class SideComponent implements Closeable, BiConsumer<DSizing, DSizing> {
261 263
 		public final Side side;
262 264
 		public final DComponent component;
263
-		public final ListenerHandle<LiveObject.Listener<DSizing>> listenerHandle;
265
+		public final ListenerHandle<BiConsumer<DSizing, DSizing>> listenerHandle;
264 266
 
265 267
 		public SideComponent(Side side, DComponent component) {
266 268
 			this.side = side;
@@ -274,7 +276,7 @@ public class DSideLayout extends BaseComponentGroup {
274 276
 		}
275 277
 
276 278
 		@Override
277
-		public void onUpdated(DSizing oldValue, DSizing newValue) {
279
+		public void accept(DSizing oldValue, DSizing newValue) {
278 280
 			recalculateSize();
279 281
 		}
280 282
 	}

+ 0
- 42
DrawableGui/src/main/java/org/openzen/drawablegui/live/SimpleLiveObject.java Näytä tiedosto

@@ -1,42 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.drawablegui.live;
7
-
8
-import org.openzen.drawablegui.listeners.ListenerHandle;
9
-import org.openzen.drawablegui.listeners.ListenerList;
10
-
11
-/**
12
- *
13
- * @author Hoofdgebruiker
14
- */
15
-public class SimpleLiveObject<T> implements MutableLiveObject<T> {
16
-	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
17
-	private T value;
18
-	
19
-	public SimpleLiveObject(T value) {
20
-		this.value = value;
21
-	}
22
-	
23
-	@Override
24
-	public T getValue() {
25
-		return value;
26
-	}
27
-	
28
-	@Override
29
-	public void setValue(T value) {
30
-		if (value == this.value)
31
-			return;
32
-		
33
-		T oldValue = this.value;
34
-		this.value = value;
35
-		listeners.accept(listener -> listener.onUpdated(oldValue, value));
36
-	}
37
-	
38
-	@Override
39
-	public ListenerHandle<Listener<T>> addListener(Listener<T> listener) {
40
-		return listeners.add(listener);
41
-	}
42
-}

+ 10
- 8
DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollBar.java Näytä tiedosto

@@ -5,6 +5,11 @@
5 5
  */
6 6
 package org.openzen.drawablegui.scroll;
7 7
 
8
+import listeners.ListenerHandle;
9
+import live.LiveInt;
10
+import live.LiveObject;
11
+import live.MutableLiveObject;
12
+
8 13
 import org.openzen.drawablegui.DComponent;
9 14
 import org.openzen.drawablegui.DComponentContext;
10 15
 import org.openzen.drawablegui.DSizing;
@@ -12,13 +17,10 @@ import org.openzen.drawablegui.DMouseEvent;
12 17
 import org.openzen.drawablegui.DIRectangle;
13 18
 import org.openzen.drawablegui.DPath;
14 19
 import org.openzen.drawablegui.DTransform2D;
15
-import org.openzen.drawablegui.listeners.ListenerHandle;
16
-import org.openzen.drawablegui.live.LiveInt;
17
-import org.openzen.drawablegui.live.LiveObject;
18 20
 import org.openzen.drawablegui.draw.DDrawnRectangle;
19 21
 import org.openzen.drawablegui.draw.DDrawnShape;
20
-import org.openzen.drawablegui.live.MutableLiveObject;
21 22
 import org.openzen.drawablegui.style.DStyleClass;
23
+import zsynthetic.FunctionIntIntToVoid;
22 24
 
23 25
 /**
24 26
  *
@@ -32,8 +34,8 @@ public class DScrollBar implements DComponent {
32 34
 	private final LiveInt offset;
33 35
 	private final boolean horizontal;
34 36
 	
35
-	private final ListenerHandle<LiveInt.Listener> targetHeightListener;
36
-	private final ListenerHandle<LiveInt.Listener> offsetListener;
37
+	private final ListenerHandle<FunctionIntIntToVoid> targetHeightListener;
38
+	private final ListenerHandle<FunctionIntIntToVoid> offsetListener;
37 39
 	
38 40
 	private DComponentContext context;
39 41
 	private DScrollBarStyle style;
@@ -227,9 +229,9 @@ public class DScrollBar implements DComponent {
227 229
 		updateBarColor();
228 230
 	}
229 231
 	
230
-	private class ScrollListener implements LiveInt.Listener {
232
+	private class ScrollListener implements FunctionIntIntToVoid {
231 233
 		@Override
232
-		public void onChanged(int oldValue, int newValue) {
234
+		public void invoke(int oldValue, int newValue) {
233 235
 			recalculate();
234 236
 		}
235 237
 	}

+ 15
- 12
DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollPane.java Näytä tiedosto

@@ -5,6 +5,13 @@
5 5
  */
6 6
 package org.openzen.drawablegui.scroll;
7 7
 
8
+import java.util.function.BiConsumer;
9
+import listeners.ListenerHandle;
10
+import live.LiveInt;
11
+import live.LiveObject;
12
+import live.SimpleLiveInt;
13
+import live.SimpleLiveObject;
14
+
8 15
 import org.openzen.drawablegui.DComponent;
9 16
 import org.openzen.drawablegui.DComponentContext;
10 17
 import org.openzen.drawablegui.DSizing;
@@ -12,14 +19,10 @@ import org.openzen.drawablegui.DIRectangle;
12 19
 import org.openzen.drawablegui.DMouseEvent;
13 20
 import org.openzen.drawablegui.DScalableSize;
14 21
 import org.openzen.drawablegui.DTransform2D;
15
-import org.openzen.drawablegui.listeners.ListenerHandle;
16
-import org.openzen.drawablegui.live.LiveInt;
17
-import org.openzen.drawablegui.live.LiveObject;
18
-import org.openzen.drawablegui.live.SimpleLiveInt;
19 22
 import org.openzen.drawablegui.draw.DDrawnShape;
20 23
 import org.openzen.drawablegui.draw.DSubSurface;
21
-import org.openzen.drawablegui.live.SimpleLiveObject;
22 24
 import org.openzen.drawablegui.style.DStyleClass;
25
+import zsynthetic.FunctionIntIntToVoid;
23 26
 
24 27
 /**
25 28
  *
@@ -44,11 +47,11 @@ public class DScrollPane implements DComponent, DScrollContext {
44 47
 	private final SimpleLiveObject<DSizing> sizing = new SimpleLiveObject<>(DSizing.EMPTY);
45 48
 	private final LiveObject<DScalableSize> size;
46 49
 	
47
-	private final ListenerHandle<LiveInt.Listener> contentsWidthListener;
48
-	private final ListenerHandle<LiveInt.Listener> contentsHeightListener;
49
-	private final ListenerHandle<LiveInt.Listener> offsetXListener;
50
-	private final ListenerHandle<LiveInt.Listener> offsetYListener;
51
-	private final ListenerHandle<LiveObject.Listener<DSizing>> contentsSizingListener;
50
+	private final ListenerHandle<FunctionIntIntToVoid> contentsWidthListener;
51
+	private final ListenerHandle<FunctionIntIntToVoid> contentsHeightListener;
52
+	private final ListenerHandle<FunctionIntIntToVoid> offsetXListener;
53
+	private final ListenerHandle<FunctionIntIntToVoid> offsetYListener;
54
+	private final ListenerHandle<BiConsumer<DSizing, DSizing>> contentsSizingListener;
52 55
 	
53 56
 	private DComponent hovering = null;
54 57
 	
@@ -311,10 +314,10 @@ public class DScrollPane implements DComponent, DScrollContext {
311 314
 		return bounds.height;
312 315
 	}
313 316
 	
314
-	private class ScrollListener implements LiveInt.Listener {
317
+	private class ScrollListener implements FunctionIntIntToVoid {
315 318
 
316 319
 		@Override
317
-		public void onChanged(int oldValue, int newValue) {
320
+		public void invoke(int oldValue, int newValue) {
318 321
 			int valueX = offsetX.getValue();
319 322
 			if (valueX > contentsWidth.getValue() - bounds.width)
320 323
 				valueX = contentsWidth.getValue() - bounds.width;

+ 7
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingDialog.java Näytä tiedosto

@@ -13,18 +13,19 @@ import java.awt.event.WindowEvent;
13 13
 import java.awt.event.WindowListener;
14 14
 import java.awt.event.WindowStateListener;
15 15
 import javax.swing.JDialog;
16
-import javax.swing.JFrame;
16
+
17
+import live.LiveBool;
18
+import live.LiveObject;
19
+import live.MutableLiveObject;
20
+import live.SimpleLiveBool;
21
+import live.SimpleLiveObject;
22
+
17 23
 import org.openzen.drawablegui.DComponent;
18 24
 import org.openzen.drawablegui.DSizing;
19 25
 import org.openzen.drawablegui.DIRectangle;
20 26
 import org.openzen.drawablegui.DUIContext;
21 27
 import org.openzen.drawablegui.DUIWindow;
22 28
 import org.openzen.drawablegui.border.DCustomWindowBorder;
23
-import org.openzen.drawablegui.live.LiveBool;
24
-import org.openzen.drawablegui.live.LiveObject;
25
-import org.openzen.drawablegui.live.MutableLiveObject;
26
-import org.openzen.drawablegui.live.SimpleLiveBool;
27
-import org.openzen.drawablegui.live.SimpleLiveObject;
28 29
 import org.openzen.drawablegui.style.DStyleClass;
29 30
 
30 31
 /**

+ 8
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingInlineWindow.java Näytä tiedosto

@@ -12,16 +12,18 @@ import java.awt.event.WindowEvent;
12 12
 import java.awt.event.WindowListener;
13 13
 import java.awt.event.WindowStateListener;
14 14
 import javax.swing.JWindow;
15
+
16
+import live.ImmutableLiveObject;
17
+import live.LiveBool;
18
+import live.LiveObject;
19
+import live.MutableLiveObject;
20
+import live.SimpleLiveBool;
21
+import live.SimpleLiveObject;
22
+
15 23
 import org.openzen.drawablegui.DComponent;
16 24
 import org.openzen.drawablegui.DIRectangle;
17 25
 import org.openzen.drawablegui.DUIContext;
18 26
 import org.openzen.drawablegui.DUIWindow;
19
-import org.openzen.drawablegui.live.ImmutableLiveObject;
20
-import org.openzen.drawablegui.live.LiveBool;
21
-import org.openzen.drawablegui.live.LiveObject;
22
-import org.openzen.drawablegui.live.MutableLiveObject;
23
-import org.openzen.drawablegui.live.SimpleLiveBool;
24
-import org.openzen.drawablegui.live.SimpleLiveObject;
25 27
 
26 28
 /**
27 29
  *

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingWindow.java Näytä tiedosto

@@ -13,17 +13,19 @@ import java.awt.event.WindowEvent;
13 13
 import java.awt.event.WindowListener;
14 14
 import java.awt.event.WindowStateListener;
15 15
 import javax.swing.JFrame;
16
+
17
+import live.LiveBool;
18
+import live.LiveObject;
19
+import live.MutableLiveObject;
20
+import live.SimpleLiveBool;
21
+import live.SimpleLiveObject;
22
+
16 23
 import org.openzen.drawablegui.DComponent;
17 24
 import org.openzen.drawablegui.DSizing;
18 25
 import org.openzen.drawablegui.DIRectangle;
19 26
 import org.openzen.drawablegui.DUIContext;
20 27
 import org.openzen.drawablegui.DUIWindow;
21 28
 import org.openzen.drawablegui.border.DCustomWindowBorder;
22
-import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.live.LiveObject;
24
-import org.openzen.drawablegui.live.MutableLiveObject;
25
-import org.openzen.drawablegui.live.SimpleLiveBool;
26
-import org.openzen.drawablegui.live.SimpleLiveObject;
27 29
 import org.openzen.drawablegui.style.DStyleClass;
28 30
 
29 31
 /**

+ 3
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeNode.java Näytä tiedosto

@@ -5,10 +5,11 @@
5 5
  */
6 6
 package org.openzen.drawablegui.tree;
7 7
 
8
+import live.LiveList;
9
+import live.MutableLiveBool;
10
+
8 11
 import org.openzen.drawablegui.DColorableIcon;
9 12
 import org.openzen.drawablegui.DMouseEvent;
10
-import org.openzen.drawablegui.live.LiveList;
11
-import org.openzen.drawablegui.live.MutableLiveBool;
12 13
 
13 14
 /**
14 15
  *

+ 12
- 11
DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeView.java Näytä tiedosto

@@ -7,6 +7,12 @@ package org.openzen.drawablegui.tree;
7 7
 
8 8
 import java.util.ArrayList;
9 9
 import java.util.List;
10
+
11
+import listeners.ListenerHandle;
12
+import live.LiveList;
13
+import live.LiveObject;
14
+import live.MutableLiveObject;
15
+
10 16
 import org.openzen.drawablegui.DColorableIcon;
11 17
 import org.openzen.drawablegui.DColorableIconInstance;
12 18
 import org.openzen.drawablegui.DComponent;
@@ -19,14 +25,10 @@ import org.openzen.drawablegui.DTransform2D;
19 25
 import org.openzen.drawablegui.DIRectangle;
20 26
 import org.openzen.drawablegui.DDrawableInstance;
21 27
 import org.openzen.drawablegui.Destructible;
22
-import org.openzen.drawablegui.listeners.ListenerHandle;
23
-import org.openzen.drawablegui.live.LiveBool;
24 28
 import org.openzen.drawablegui.draw.DDrawnRectangle;
25 29
 import org.openzen.drawablegui.draw.DDrawnText;
26
-import org.openzen.drawablegui.live.LiveList;
27
-import org.openzen.drawablegui.live.LiveObject;
28
-import org.openzen.drawablegui.live.MutableLiveObject;
29 30
 import org.openzen.drawablegui.style.DStyleClass;
31
+import zsynthetic.FunctionBoolBoolToVoid;
30 32
 
31 33
 /**
32 34
  *
@@ -252,12 +254,12 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
252 254
 		// nothing to clean up
253 255
 	}
254 256
 	
255
-	private class Row implements Destructible, LiveBool.Listener, LiveList.Listener<N> {
257
+	private class Row implements Destructible, LiveList.Listener<N> {
256 258
 		private final int x;
257 259
 		private final int index;
258 260
 		private final N node;
259 261
 		private final DDrawable icon;
260
-		private final ListenerHandle<LiveBool.Listener> collapseListener;
262
+		private final ListenerHandle<FunctionBoolBoolToVoid> collapseListener;
261 263
 		private final ListenerHandle<LiveList.Listener<N>> childListener;
262 264
 		
263 265
 		private DDrawnText text;
@@ -268,7 +270,7 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
268 270
 			this.x = x;
269 271
 			this.index = index;
270 272
 			this.node = node;
271
-			this.collapseListener = node.isCollapsed().addListener(this);
273
+			this.collapseListener = node.isCollapsed().addListener(this::onCollapsedChanged);
272 274
 			this.childListener = node.getChildren().addListener(this);
273 275
 			
274 276
 			if (node == selectedNode)
@@ -319,9 +321,8 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
319 321
 					baseX + style.iconTextSpacing + getIconWidth(icon) + style.iconTextSpacing + getIconWidth(node.getIcon()),
320 322
 					baseY + fontMetrics.getAscent());
321 323
 		}
322
-
323
-		@Override
324
-		public void onChanged(boolean oldValue, boolean newValue) {
324
+		
325
+		public void onCollapsedChanged(boolean oldValue, boolean newValue) {
325 326
 			updateLayout();
326 327
 		}
327 328
 

+ 24
- 12
IDE/src/main/java/org/openzen/zenscript/ide/Main.java Näytä tiedosto

@@ -1,8 +1,11 @@
1 1
 package org.openzen.zenscript.ide;
2 2
 
3
+import java.awt.event.WindowAdapter;
4
+import java.awt.event.WindowEvent;
3 5
 import java.io.File;
4 6
 import java.io.IOException;
5 7
 import javax.swing.JFrame;
8
+import live.MutableLiveBool;
6 9
 import org.openzen.drawablegui.DUIWindow;
7 10
 import org.openzen.zenscript.ide.host.DevelopmentHost;
8 11
 import org.openzen.zenscript.ide.host.local.LocalProjectDevelopmentHost;
@@ -37,15 +40,15 @@ public class Main {
37 40
 		IDEPropertyDirectory runState = properties.getRoot().getSubdirectory("runState");
38 41
 		if (target == null)
39 42
 			target = runState.getString("target", null);
40
-		if (target == null && host.getTargets().size() > 0)
41
-			target = host.getTargets().get(0).getName();
42
-		
43
-		IDEWindow window = new IDEWindow(host, target);
44
-		WindowView root = new WindowView(window, host);
43
+		if (target == null && host.getTargets().getLength() > 0)
44
+			target = host.getTargets().getAt(0).getName();
45 45
 		
46 46
 		IDEPropertyDirectory uiState = properties.getRoot().getSubdirectory("uiState");
47
+		IDEWindow window = new IDEWindow(host, target);
48
+		WindowView root = new WindowView(window, host, uiState);
47 49
 		
48 50
 		int pixelPerInch = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
51
+		MutableLiveBool maximized = uiState.getLiveBool("maximized", false);
49 52
 		SwingWindow swingWindow = new SwingWindow("ZenCode IDE - " + host.getName(), root, false);
50 53
 		swingWindow.setSize(
51 54
 				uiState.getInt("width", 800 * pixelPerInch / 96),
@@ -54,8 +57,9 @@ public class Main {
54 57
 				uiState.getInt("x", 0),
55 58
 				uiState.getInt("y", 0));
56 59
 		swingWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
57
-		swingWindow.setExtendedState(uiState.getBool("maximized", false) ? JFrame.MAXIMIZED_BOTH : JFrame.NORMAL);
60
+		swingWindow.setExtendedState(maximized.getValue() ? JFrame.MAXIMIZED_BOTH : JFrame.NORMAL);
58 61
 		swingWindow.setVisible(true);
62
+		swingWindow.addWindowListener(new MyWindowListener(properties));
59 63
 		
60 64
 		swingWindow.getWindowBounds().addListener((oldBounds, newBounds) -> {
61 65
 			if (swingWindow.getWindowState().getValue() == DUIWindow.State.NORMAL) {
@@ -63,15 +67,23 @@ public class Main {
63 67
 				uiState.setInt("y", newBounds.y);
64 68
 				uiState.setInt("width", newBounds.width);
65 69
 				uiState.setInt("height", newBounds.height);
66
-				properties.save();
67 70
 			}
68 71
 		});
69 72
 		swingWindow.getWindowState().addListener((oldState, newState) -> {
70
-			boolean isMaximized = newState == DUIWindow.State.MAXIMIZED;
71
-			if (isMaximized != uiState.getBool("maximized", false)) {
72
-				uiState.setBool("maximized", isMaximized);
73
-				properties.save();
74
-			}
73
+			maximized.setValue(newState == DUIWindow.State.MAXIMIZED);
75 74
 		});
76 75
 	}
76
+	
77
+	private static class MyWindowListener extends WindowAdapter {
78
+		private final IDEPropertyStore properties;
79
+		
80
+		public MyWindowListener(IDEPropertyStore properties) {
81
+			this.properties = properties;
82
+		}
83
+		
84
+		@Override
85
+		public void windowClosing(WindowEvent e) {
86
+			properties.save();
87
+		}
88
+	}
77 89
 }

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/codemodel/IDECodeSpace.java Näytä tiedosto

@@ -32,7 +32,7 @@ public class IDECodeSpace {
32 32
 		ZSPackage stdlib = new ZSPackage(root, "stdlib");
33 33
 		GlobalTypeRegistry registry = new GlobalTypeRegistry(stdlib);
34 34
 		ModuleLoader loader = new ModuleLoader(registry, exception -> {
35
-			
35
+			exception.printStackTrace();
36 36
 		});
37 37
 		for (IDEModule module : host.getModules()) {
38 38
 			module.prebuild(loader, this::addError);

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/host/DevelopmentHost.java Näytä tiedosto

@@ -5,7 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host;
7 7
 
8
-import org.openzen.drawablegui.live.LiveList;
8
+import live.LiveList;
9 9
 
10 10
 /**
11 11
  *

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/host/IDELibrary.java Näytä tiedosto

@@ -5,7 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host;
7 7
 
8
-import org.openzen.drawablegui.live.LiveList;
8
+import live.LiveList;
9 9
 
10 10
 /**
11 11
  *

+ 2
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/IDEModule.java Näytä tiedosto

@@ -16,6 +16,8 @@ import org.openzen.zenscript.ide.codemodel.IDECodeError;
16 16
 public interface IDEModule {
17 17
 	public String getName();
18 18
 	
19
+	public IDEModuleType getType();
20
+	
19 21
 	public IDEPackage getRootPackage();
20 22
 	
21 23
 	void prebuild(ModuleLoader loader, Consumer<IDECodeError> errors);

DrawableGui/src/main/java/org/openzen/drawablegui/live/MutableLiveObject.java → IDE/src/main/java/org/openzen/zenscript/ide/host/IDEModuleType.java Näytä tiedosto

@@ -3,12 +3,12 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.live;
6
+package org.openzen.zenscript.ide.host;
7 7
 
8 8
 /**
9 9
  *
10 10
  * @author Hoofdgebruiker
11 11
  */
12
-public interface MutableLiveObject<T> extends LiveObject<T> {
13
-	public void setValue(T value);
12
+public interface IDEModuleType {
13
+	public String getName();
14 14
 }

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/host/IDEPackage.java Näytä tiedosto

@@ -5,7 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host;
7 7
 
8
-import org.openzen.drawablegui.live.LiveList;
8
+import live.LiveList;
9 9
 
10 10
 /**
11 11
  *

+ 4
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/IDEPropertyDirectory.java Näytä tiedosto

@@ -5,6 +5,8 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host;
7 7
 
8
+import live.MutableLiveBool;
9
+
8 10
 /**
9 11
  *
10 12
  * @author Hoofdgebruiker
@@ -14,6 +16,8 @@ public interface IDEPropertyDirectory {
14 16
 	
15 17
 	public void setBool(String name, boolean value);
16 18
 	
19
+	public MutableLiveBool getLiveBool(String name, boolean defaultValue);
20
+	
17 21
 	public int getInt(String name, int defaultValue);
18 22
 	
19 23
 	public void setInt(String name, int value);

+ 2
- 1
IDE/src/main/java/org/openzen/zenscript/ide/host/IDESourceFile.java Näytä tiedosto

@@ -5,7 +5,8 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host;
7 7
 
8
-import org.openzen.drawablegui.live.LiveString;
8
+import live.LiveString;
9
+
9 10
 import org.openzen.zencode.shared.SourceFile;
10 11
 
11 12
 /**

+ 37
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/local/JSONPropertyDirectory.java Näytä tiedosto

@@ -5,8 +5,12 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host.local;
7 7
 
8
+import listeners.ListenerHandle;
9
+import listeners.ListenerList;
10
+import live.MutableLiveBool;
8 11
 import org.json.JSONObject;
9 12
 import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13
+import zsynthetic.FunctionBoolBoolToVoid;
10 14
 
11 15
 /**
12 16
  *
@@ -29,6 +33,11 @@ public class JSONPropertyDirectory implements IDEPropertyDirectory {
29 33
 		data.put(name, value);
30 34
 	}
31 35
 	
36
+	@Override
37
+	public MutableLiveBool getLiveBool(String name, boolean defaultValue) {
38
+		return new JSONLiveBool(name, defaultValue);
39
+	}
40
+	
32 41
 	@Override
33 42
 	public int getInt(String name, int defaultValue) {
34 43
 		return data.optInt(name, defaultValue);
@@ -57,4 +66,32 @@ public class JSONPropertyDirectory implements IDEPropertyDirectory {
57 66
 		
58 67
 		return new JSONPropertyDirectory(data.getJSONObject(name));
59 68
 	}
69
+	
70
+	private class JSONLiveBool implements MutableLiveBool {
71
+		private final ListenerList<FunctionBoolBoolToVoid> listeners = new ListenerList<>();
72
+		private final String key;
73
+		private final boolean defaultValue;
74
+		
75
+		public JSONLiveBool(String key, boolean defaultValue) {
76
+			this.key = key;
77
+			this.defaultValue = defaultValue;
78
+		}
79
+
80
+		@Override
81
+		public boolean getValue() {
82
+			return data.optBoolean(key, defaultValue);
83
+		}
84
+		
85
+		@Override
86
+		public void setValue(boolean value) {
87
+			boolean current = getValue();
88
+			data.put(key, value);
89
+			listeners.accept(listener -> listener.invoke(current, value));
90
+		}
91
+
92
+		@Override
93
+		public ListenerHandle<FunctionBoolBoolToVoid> addListener(FunctionBoolBoolToVoid listener) {
94
+			return listeners.add(listener);
95
+		}
96
+	}
60 97
 }

+ 4
- 3
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalLibrary.java Näytä tiedosto

@@ -5,9 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.host.local;
7 7
 
8
-import org.openzen.drawablegui.live.LiveArrayList;
9
-import org.openzen.drawablegui.live.LiveList;
10
-import org.openzen.drawablegui.live.MutableLiveList;
8
+import live.LiveArrayList;
9
+import live.LiveList;
10
+import live.MutableLiveList;
11
+
11 12
 import org.openzen.zenscript.constructor.Library;
12 13
 import org.openzen.zenscript.constructor.module.ModuleReference;
13 14
 import org.openzen.zenscript.ide.host.IDELibrary;

+ 6
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalModule.java Näytä tiedosto

@@ -11,6 +11,7 @@ import org.openzen.zenscript.constructor.ModuleLoader;
11 11
 import org.openzen.zenscript.constructor.module.ModuleReference;
12 12
 import org.openzen.zenscript.ide.codemodel.IDECodeError;
13 13
 import org.openzen.zenscript.ide.host.IDEModule;
14
+import org.openzen.zenscript.ide.host.IDEModuleType;
14 15
 import org.openzen.zenscript.ide.host.IDEPackage;
15 16
 import org.openzen.zenscript.validator.Validator;
16 17
 
@@ -31,6 +32,11 @@ public class LocalModule implements IDEModule {
31 32
 	public String getName() {
32 33
 		return module.getName();
33 34
 	}
35
+	
36
+	@Override
37
+	public IDEModuleType getType() {
38
+		return UniversalModuleType.INSTANCE;
39
+	}
34 40
 
35 41
 	@Override
36 42
 	public IDEPackage getRootPackage() {

+ 6
- 4
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalPackage.java Näytä tiedosto

@@ -8,10 +8,12 @@ package org.openzen.zenscript.ide.host.local;
8 8
 import java.io.File;
9 9
 import java.io.IOException;
10 10
 import java.util.Arrays;
11
-import org.openzen.drawablegui.live.LiveArrayList;
12
-import org.openzen.drawablegui.live.LiveList;
13
-import org.openzen.drawablegui.live.MutableLiveList;
14
-import org.openzen.drawablegui.live.SortedLiveList;
11
+
12
+import live.LiveArrayList;
13
+import live.LiveList;
14
+import live.MutableLiveList;
15
+import live.SortedLiveList;
16
+
15 17
 import org.openzen.zencode.shared.FileSourceFile;
16 18
 import org.openzen.zencode.shared.SourceFile;
17 19
 import org.openzen.zenscript.constructor.module.SourcePackage;

+ 5
- 3
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalProjectDevelopmentHost.java Näytä tiedosto

@@ -6,9 +6,11 @@
6 6
 package org.openzen.zenscript.ide.host.local;
7 7
 
8 8
 import java.io.File;
9
-import org.openzen.drawablegui.live.LiveArrayList;
10
-import org.openzen.drawablegui.live.LiveList;
11
-import org.openzen.drawablegui.live.MutableLiveList;
9
+
10
+import live.LiveArrayList;
11
+import live.LiveList;
12
+import live.MutableLiveList;
13
+
12 14
 import org.openzen.zenscript.constructor.Library;
13 15
 import org.openzen.zenscript.constructor.Project;
14 16
 import org.openzen.zenscript.constructor.module.ModuleReference;

+ 5
- 3
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalSourceFile.java Näytä tiedosto

@@ -11,9 +11,11 @@ import java.io.IOException;
11 11
 import java.io.OutputStreamWriter;
12 12
 import java.io.Writer;
13 13
 import java.nio.charset.StandardCharsets;
14
-import org.openzen.drawablegui.live.LiveString;
15
-import org.openzen.drawablegui.live.MutableLiveString;
16
-import org.openzen.drawablegui.live.SimpleLiveString;
14
+
15
+import live.LiveString;
16
+import live.MutableLiveString;
17
+import live.SimpleLiveString;
18
+
17 19
 import org.openzen.zencode.shared.FileSourceFile;
18 20
 import org.openzen.zencode.shared.SourceFile;
19 21
 import org.openzen.zenscript.ide.host.IDESourceFile;

+ 23
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/local/UniversalModuleType.java Näytä tiedosto

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+package org.openzen.zenscript.ide.host.local;
7
+
8
+import org.openzen.zenscript.ide.host.IDEModuleType;
9
+
10
+/**
11
+ *
12
+ * @author Hoofdgebruiker
13
+ */
14
+public class UniversalModuleType implements IDEModuleType {
15
+	public static final UniversalModuleType INSTANCE = new UniversalModuleType();
16
+	
17
+	private UniversalModuleType() {}
18
+
19
+	@Override
20
+	public String getName() {
21
+		return "universal";
22
+	}
23
+}

+ 4
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEAspectBar.java Näytä tiedosto

@@ -5,10 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
-import org.openzen.drawablegui.live.LiveArrayList;
9
-import org.openzen.drawablegui.live.MutableLiveList;
10
-import org.openzen.drawablegui.live.MutableLiveObject;
11
-import org.openzen.drawablegui.live.SimpleLiveObject;
8
+import live.LiveArrayList;
9
+import live.MutableLiveList;
10
+import live.MutableLiveObject;
11
+import live.SimpleLiveObject;
12 12
 
13 13
 /**
14 14
  *

+ 3
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEAspectToolbar.java Näytä tiedosto

@@ -5,9 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
+import live.LiveArrayList;
9
+import live.MutableLiveList;
10
+
8 11
 import org.openzen.drawablegui.DDrawable;
9
-import org.openzen.drawablegui.live.LiveArrayList;
10
-import org.openzen.drawablegui.live.MutableLiveList;
11 12
 
12 13
 /**
13 14
  *

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEDockWindow.java Näytä tiedosto

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
-import org.openzen.drawablegui.listeners.ListenerHandle;
9
-import org.openzen.drawablegui.listeners.ListenerList;
8
+import listeners.ListenerHandle;
9
+import listeners.ListenerList;
10 10
 import org.openzen.zenscript.ide.host.IDESourceFile;
11 11
 
12 12
 /**

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEStatusBar.java Näytä tiedosto

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
-import org.openzen.drawablegui.listeners.ListenerHandle;
9
-import org.openzen.drawablegui.listeners.ListenerList;
8
+import listeners.ListenerHandle;
9
+import listeners.ListenerList;
10 10
 
11 11
 /**
12 12
  *

+ 4
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEWindow.java Näytä tiedosto

@@ -5,9 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
-import org.openzen.drawablegui.live.ImmutableLiveString;
9
-import org.openzen.drawablegui.live.LiveArrayList;
10
-import org.openzen.drawablegui.live.MutableLiveList;
8
+import live.ImmutableLiveString;
9
+import live.LiveArrayList;
10
+import live.MutableLiveList;
11
+
11 12
 import org.openzen.drawablegui.style.DStyleClass;
12 13
 import org.openzen.zenscript.ide.host.DevelopmentHost;
13 14
 import org.openzen.zenscript.ide.host.IDESourceFile;

+ 3
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/dialog/CreatePackageDialog.java Näytä tiedosto

@@ -19,9 +19,9 @@ import org.openzen.drawablegui.layout.DLinearLayout.Alignment;
19 19
 import org.openzen.drawablegui.layout.DLinearLayout.Element;
20 20
 import org.openzen.drawablegui.layout.DLinearLayout.ElementAlignment;
21 21
 import org.openzen.drawablegui.layout.DLinearLayout.Orientation;
22
-import org.openzen.drawablegui.live.ImmutableLiveBool;
23
-import org.openzen.drawablegui.live.ImmutableLiveString;
24
-import org.openzen.drawablegui.live.SimpleLiveString;
22
+import live.ImmutableLiveBool;
23
+import live.ImmutableLiveString;
24
+import live.SimpleLiveString;
25 25
 import org.openzen.drawablegui.style.DDpDimension;
26 26
 import org.openzen.drawablegui.style.DStyleClass;
27 27
 import org.openzen.zenscript.ide.host.IDEModule;

+ 4
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/dialog/CreateSourceFileDialog.java Näytä tiedosto

@@ -5,6 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.dialog;
7 7
 
8
+import live.ImmutableLiveBool;
9
+import live.ImmutableLiveString;
10
+import live.SimpleLiveString;
11
+
8 12
 import org.openzen.drawablegui.DAnchor;
9 13
 import org.openzen.drawablegui.DButton;
10 14
 import org.openzen.drawablegui.DComponent;
@@ -19,11 +23,7 @@ import org.openzen.drawablegui.layout.DLinearLayout.Alignment;
19 23
 import org.openzen.drawablegui.layout.DLinearLayout.Element;
20 24
 import org.openzen.drawablegui.layout.DLinearLayout.ElementAlignment;
21 25
 import org.openzen.drawablegui.layout.DLinearLayout.Orientation;
22
-import org.openzen.drawablegui.live.ImmutableLiveBool;
23
-import org.openzen.drawablegui.live.ImmutableLiveString;
24
-import org.openzen.drawablegui.live.SimpleLiveString;
25 26
 import org.openzen.drawablegui.style.DDpDimension;
26
-import org.openzen.drawablegui.style.DSimpleStylesheet;
27 27
 import org.openzen.drawablegui.style.DStyleClass;
28 28
 import org.openzen.drawablegui.style.DStylesheetBuilder;
29 29
 import org.openzen.zenscript.ide.host.IDEModule;

+ 10
- 7
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControl.java Näytä tiedosto

@@ -6,6 +6,14 @@
6 6
 package org.openzen.zenscript.ide.ui.view;
7 7
 
8 8
 import java.util.function.Consumer;
9
+
10
+import listeners.ListenerHandle;
11
+import live.ImmutableLiveBool;
12
+import live.LiveBool;
13
+import live.LiveObject;
14
+import live.LiveString;
15
+import live.MutableLiveObject;
16
+
9 17
 import org.openzen.drawablegui.DComponent;
10 18
 import org.openzen.drawablegui.DComponentContext;
11 19
 import org.openzen.drawablegui.DSizing;
@@ -17,14 +25,9 @@ import org.openzen.drawablegui.DTransform2D;
17 25
 import org.openzen.drawablegui.DIRectangle;
18 26
 import org.openzen.drawablegui.DSimpleTooltip;
19 27
 import org.openzen.drawablegui.draw.DDrawnShape;
20
-import org.openzen.drawablegui.listeners.ListenerHandle;
21
-import org.openzen.drawablegui.live.ImmutableLiveBool;
22
-import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.live.LiveObject;
24
-import org.openzen.drawablegui.live.LiveString;
25
-import org.openzen.drawablegui.live.MutableLiveObject;
26 28
 import org.openzen.drawablegui.style.DShadow;
27 29
 import org.openzen.drawablegui.style.DStyleClass;
30
+import zsynthetic.FunctionBoolBoolToVoid;
28 31
 
29 32
 /**
30 33
  *
@@ -36,7 +39,7 @@ public class IconButtonControl implements DComponent {
36 39
 	private final DDrawable iconDisabled;
37 40
 	private final Consumer<DMouseEvent> onClick;
38 41
 	private final LiveBool disabled;
39
-	private final ListenerHandle<LiveBool.Listener> disabledListener;
42
+	private final ListenerHandle<FunctionBoolBoolToVoid> disabledListener;
40 43
 	private final DSimpleTooltip tooltip;
41 44
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
42 45
 	

+ 4
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/StatusBarView.java Näytä tiedosto

@@ -5,6 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view;
7 7
 
8
+import live.LiveObject;
9
+import live.LiveString;
10
+import live.SimpleLiveObject;
11
+
8 12
 import org.openzen.drawablegui.DComponent;
9 13
 import org.openzen.drawablegui.DComponentContext;
10 14
 import org.openzen.drawablegui.DSizing;
@@ -12,11 +16,8 @@ import org.openzen.drawablegui.DFontMetrics;
12 16
 import org.openzen.drawablegui.DIRectangle;
13 17
 import org.openzen.drawablegui.DPath;
14 18
 import org.openzen.drawablegui.DTransform2D;
15
-import org.openzen.drawablegui.live.LiveObject;
16
-import org.openzen.drawablegui.live.SimpleLiveObject;
17 19
 import org.openzen.drawablegui.draw.DDrawnShape;
18 20
 import org.openzen.drawablegui.draw.DDrawnText;
19
-import org.openzen.drawablegui.live.LiveString;
20 21
 import org.openzen.drawablegui.style.DStyleClass;
21 22
 
22 23
 /**

+ 14
- 13
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedView.java Näytä tiedosto

@@ -7,25 +7,26 @@ package org.openzen.zenscript.ide.ui.view;
7 7
 
8 8
 import java.util.HashMap;
9 9
 import java.util.Map;
10
+import java.util.function.BiConsumer;
10 11
 import java.util.function.Consumer;
11 12
 import java.util.function.Predicate;
13
+
14
+import listeners.ListenerHandle;
15
+import live.LiveArrayList;
16
+import live.LiveList;
17
+import live.LiveMappedList;
18
+import live.LiveObject;
19
+import live.MutableLiveList;
20
+import live.MutableLiveObject;
21
+import live.SimpleLiveObject;
22
+
12 23
 import org.openzen.drawablegui.BaseComponentGroup;
13 24
 import org.openzen.drawablegui.DComponent;
14 25
 import org.openzen.drawablegui.DComponentContext;
15 26
 import org.openzen.drawablegui.DSizing;
16 27
 import org.openzen.drawablegui.DFontMetrics;
17 28
 import org.openzen.drawablegui.DIRectangle;
18
-import org.openzen.drawablegui.draw.DDrawSurface;
19
-import org.openzen.drawablegui.listeners.ListenerHandle;
20
-import org.openzen.drawablegui.live.LiveArrayList;
21
-import org.openzen.drawablegui.live.LiveList;
22
-import org.openzen.drawablegui.live.LiveMappedList;
23
-import org.openzen.drawablegui.live.LiveObject;
24
-import org.openzen.drawablegui.live.MutableLiveList;
25
-import org.openzen.drawablegui.live.MutableLiveObject;
26
-import org.openzen.drawablegui.live.SimpleLiveObject;
27 29
 import org.openzen.drawablegui.style.DStyleClass;
28
-import org.openzen.drawablegui.style.DStylePath;
29 30
 
30 31
 /**
31 32
  *
@@ -37,7 +38,7 @@ public class TabbedView extends BaseComponentGroup {
37 38
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
38 39
 	public final MutableLiveObject<TabbedViewComponent> currentTab = new SimpleLiveObject<>(null);
39 40
 	
40
-	private final Map<TabbedViewTab, ListenerHandle<LiveObject.Listener<DSizing>>> tabSizeListeners = new HashMap<>();
41
+	private final Map<TabbedViewTab, ListenerHandle<BiConsumer<DSizing, DSizing>>> tabSizeListeners = new HashMap<>();
41 42
 	
42 43
 	private DComponentContext context;
43 44
 	private TabbedViewStyle style;
@@ -127,7 +128,7 @@ public class TabbedView extends BaseComponentGroup {
127 128
 
128 129
 	@Override
129 130
 	public void close() {
130
-		for (Map.Entry<TabbedViewTab, ListenerHandle<LiveObject.Listener<DSizing>>> entry : tabSizeListeners.entrySet()) {
131
+		for (Map.Entry<TabbedViewTab, ListenerHandle<BiConsumer<DSizing, DSizing>>> entry : tabSizeListeners.entrySet()) {
131 132
 			entry.getValue().close();
132 133
 		}
133 134
 		
@@ -199,7 +200,7 @@ public class TabbedView extends BaseComponentGroup {
199 200
 		@Override
200 201
 		public void onRemoved(int index, TabbedViewComponent oldValue) {
201 202
 			if (oldValue == currentTab.getValue())
202
-				currentTab.setValue(tabs.size() == 0 ? null : tabs.get(Math.max(index - 1, 0)));
203
+				currentTab.setValue(tabs.getLength() == 0 ? null : tabs.getAt(Math.max(index - 1, 0)));
203 204
 			
204 205
 			layoutTabs();
205 206
 		}

+ 3
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewComponent.java Näytä tiedosto

@@ -5,10 +5,11 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view;
7 7
 
8
+import live.LiveBool;
9
+import live.LiveString;
10
+
8 11
 import org.openzen.drawablegui.DComponent;
9 12
 import org.openzen.drawablegui.DDrawable;
10
-import org.openzen.drawablegui.live.LiveBool;
11
-import org.openzen.drawablegui.live.LiveString;
12 13
 
13 14
 /**
14 15
  *

+ 16
- 10
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewTab.java Näytä tiedosto

@@ -5,6 +5,11 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view;
7 7
 
8
+import java.util.function.BiConsumer;
9
+import listeners.ListenerHandle;
10
+import live.LiveObject;
11
+import live.MutableLiveObject;
12
+
8 13
 import org.openzen.drawablegui.DComponent;
9 14
 import org.openzen.drawablegui.DComponentContext;
10 15
 import org.openzen.drawablegui.DSizing;
@@ -15,12 +20,8 @@ import org.openzen.drawablegui.DPath;
15 20
 import org.openzen.drawablegui.DTransform2D;
16 21
 import org.openzen.drawablegui.draw.DDrawnShape;
17 22
 import org.openzen.drawablegui.draw.DDrawnText;
18
-import org.openzen.drawablegui.listeners.ListenerHandle;
19
-import org.openzen.drawablegui.live.LiveBool;
20
-import org.openzen.drawablegui.live.LiveObject;
21
-import org.openzen.drawablegui.live.LiveString;
22
-import org.openzen.drawablegui.live.MutableLiveObject;
23 23
 import org.openzen.drawablegui.style.DStyleClass;
24
+import zsynthetic.FunctionBoolBoolToVoid;
24 25
 
25 26
 /**
26 27
  *
@@ -41,9 +42,9 @@ public class TabbedViewTab implements DComponent {
41 42
 	private int textWidth;
42 43
 	private DIRectangle bounds;
43 44
 	
44
-	private final ListenerHandle<LiveString.Listener> titleListener;
45
-	private final ListenerHandle<LiveBool.Listener> updatedListener;
46
-	private final ListenerHandle<LiveObject.Listener<TabbedViewComponent>> currentTabListener;
45
+	private final ListenerHandle<BiConsumer<String, String>> titleListener;
46
+	private final ListenerHandle<FunctionBoolBoolToVoid> updatedListener;
47
+	private final ListenerHandle<BiConsumer<TabbedViewComponent, TabbedViewComponent>> currentTabListener;
47 48
 	
48 49
 	private boolean hover;
49 50
 	private boolean press;
@@ -61,7 +62,7 @@ public class TabbedViewTab implements DComponent {
61 62
 		
62 63
 		titleListener = tab.title.addListener((oldValue, newValue) -> calculateSizing());
63 64
 		updatedListener = tab.updated.addListener((oldValue, newValue) -> calculateSizing());
64
-		currentTabListener = currentTab.addListener((oldTab, newTab) -> update());
65
+		currentTabListener = currentTab.addListener((oldTab, newTab) -> update(newTab));
65 66
 	}
66 67
 	
67 68
 	public void closeTab() {
@@ -199,11 +200,16 @@ public class TabbedViewTab implements DComponent {
199 200
 	}
200 201
 	
201 202
 	private void update() {
203
+		update(currentTab.getValue());
204
+	}
205
+	
206
+	private void update(TabbedViewComponent currentTab) {
202 207
 		if (style == null || shape == null)
203 208
 			return;
204 209
 		
210
+		System.out.println("Updating tab " + tab.title.getValue() + (currentTab == tab ? " (current)" : ""));
205 211
 		int color = style.tabColorNormal;
206
-		if (currentTab.getValue() == tab)
212
+		if (currentTab == tab)
207 213
 			color = style.tabColorActive;
208 214
 		else if (press)
209 215
 			color = style.tabColorPress;

+ 3
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewTabClose.java Näytä tiedosto

@@ -5,6 +5,9 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view;
7 7
 
8
+import live.LiveObject;
9
+import live.MutableLiveObject;
10
+
8 11
 import org.openzen.drawablegui.DColorableIcon;
9 12
 import org.openzen.drawablegui.DColorableIconInstance;
10 13
 import org.openzen.drawablegui.DComponent;
@@ -14,8 +17,6 @@ import org.openzen.drawablegui.DIRectangle;
14 17
 import org.openzen.drawablegui.DMouseEvent;
15 18
 import org.openzen.drawablegui.DTransform2D;
16 19
 import org.openzen.drawablegui.draw.DDrawnRectangle;
17
-import org.openzen.drawablegui.live.LiveObject;
18
-import org.openzen.drawablegui.live.MutableLiveObject;
19 20
 import org.openzen.drawablegui.style.DStyleClass;
20 21
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
21 22
 

+ 7
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/WindowView.java Näytä tiedosto

@@ -5,19 +5,21 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view;
7 7
 
8
+import live.LiveString;
9
+import live.SimpleLiveObject;
10
+import live.SimpleLiveString;
11
+
8 12
 import org.openzen.drawablegui.DEmptyView;
9 13
 import org.openzen.drawablegui.DScalableSize;
10 14
 import org.openzen.drawablegui.border.DLineBorder;
11 15
 import org.openzen.drawablegui.scroll.DScrollPane;
12 16
 import org.openzen.drawablegui.layout.DSideLayout;
13
-import org.openzen.drawablegui.live.LiveString;
14
-import org.openzen.drawablegui.live.SimpleLiveObject;
15
-import org.openzen.drawablegui.live.SimpleLiveString;
16 17
 import org.openzen.drawablegui.style.DDpDimension;
17 18
 import org.openzen.drawablegui.style.DShadow;
18 19
 import org.openzen.drawablegui.style.DStyleClass;
19 20
 import org.openzen.drawablegui.style.DStylesheetBuilder;
20 21
 import org.openzen.zenscript.ide.host.DevelopmentHost;
22
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
21 23
 import org.openzen.zenscript.ide.host.IDESourceFile;
22 24
 import org.openzen.zenscript.ide.ui.IDEDockWindow;
23 25
 import org.openzen.zenscript.ide.ui.IDEWindow;
@@ -36,13 +38,13 @@ public final class WindowView extends DSideLayout {
36 38
 	public final LiveString status = new SimpleLiveString("IDE initialized");
37 39
 	private final ProjectBrowser projectBrowser;
38 40
 	
39
-	public WindowView(IDEWindow window, DevelopmentHost host) {
41
+	public WindowView(IDEWindow window, DevelopmentHost host, IDEPropertyDirectory settings) {
40 42
 		super(DStyleClass.inline(
41 43
 				new DStylesheetBuilder().color("backgroundColor", 0xFFEEEEEE).build()),
42 44
 				DEmptyView.INSTANCE);
43 45
 		this.window = window;
44 46
 		
45
-		projectBrowser = new ProjectBrowser(window, host);
47
+		projectBrowser = new ProjectBrowser(window, host, settings.getSubdirectory("projectBrowserExpansionState"));
46 48
 		
47 49
 		OutputView output = new OutputView(DStyleClass.EMPTY, window.output);
48 50
 		

+ 9
- 6
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButton.java Näytä tiedosto

@@ -6,6 +6,13 @@
6 6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7 7
 
8 8
 import java.util.function.Consumer;
9
+
10
+import listeners.ListenerHandle;
11
+import live.ImmutableLiveString;
12
+import live.LiveBool;
13
+import live.LiveObject;
14
+import live.MutableLiveObject;
15
+
9 16
 import org.openzen.drawablegui.DComponent;
10 17
 import org.openzen.drawablegui.DComponentContext;
11 18
 import org.openzen.drawablegui.DSizing;
@@ -17,13 +24,9 @@ import org.openzen.drawablegui.DTransform2D;
17 24
 import org.openzen.drawablegui.DIRectangle;
18 25
 import org.openzen.drawablegui.DSimpleTooltip;
19 26
 import org.openzen.drawablegui.draw.DDrawnShape;
20
-import org.openzen.drawablegui.listeners.ListenerHandle;
21
-import org.openzen.drawablegui.live.ImmutableLiveString;
22
-import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.live.LiveObject;
24
-import org.openzen.drawablegui.live.MutableLiveObject;
25 27
 import org.openzen.drawablegui.style.DShadow;
26 28
 import org.openzen.drawablegui.style.DStyleClass;
29
+import zsynthetic.FunctionBoolBoolToVoid;
27 30
 
28 31
 /**
29 32
  *
@@ -48,7 +51,7 @@ public class AspectBarSelectorButton implements DComponent {
48 51
 	private boolean pressing;
49 52
 	private final DSimpleTooltip tooltip;
50 53
 	
51
-	private final ListenerHandle<LiveBool.Listener> activeListener;
54
+	private final ListenerHandle<FunctionBoolBoolToVoid> activeListener;
52 55
 	
53 56
 	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon, LiveBool active, String tooltip, Consumer<DMouseEvent> onClick) {
54 57
 		this.active = active;

+ 16
- 15
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarView.java Näytä tiedosto

@@ -5,8 +5,18 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7 7
 
8
+import java.util.function.BiConsumer;
8 9
 import java.util.function.Consumer;
9 10
 import java.util.function.Predicate;
11
+
12
+import listeners.ListenerHandle;
13
+import live.LiveBool;
14
+import live.LiveList;
15
+import live.LiveMappedList;
16
+import live.LiveObject;
17
+import live.LivePredicateBool;
18
+import live.MutableLiveObject;
19
+
10 20
 import org.openzen.drawablegui.BaseComponentGroup;
11 21
 import org.openzen.drawablegui.DComponent;
12 22
 import org.openzen.drawablegui.DComponentContext;
@@ -15,22 +25,13 @@ import org.openzen.drawablegui.DFontMetrics;
15 25
 import org.openzen.drawablegui.DPath;
16 26
 import org.openzen.drawablegui.DTransform2D;
17 27
 import org.openzen.drawablegui.DIRectangle;
18
-import org.openzen.drawablegui.live.LiveObject;
19 28
 import org.openzen.zenscript.ide.ui.IDEAspectBar;
20 29
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
21 30
 import org.openzen.drawablegui.DUIWindow;
22
-import org.openzen.drawablegui.draw.DDrawSurface;
23 31
 import org.openzen.drawablegui.draw.DDrawnRectangle;
24 32
 import org.openzen.drawablegui.draw.DDrawnShape;
25 33
 import org.openzen.drawablegui.draw.DDrawnText;
26
-import org.openzen.drawablegui.listeners.ListenerHandle;
27
-import org.openzen.drawablegui.live.LiveBool;
28
-import org.openzen.drawablegui.live.LiveList;
29
-import org.openzen.drawablegui.live.LiveMappedList;
30
-import org.openzen.drawablegui.live.LivePredicateBool;
31
-import org.openzen.drawablegui.live.MutableLiveObject;
32 34
 import org.openzen.drawablegui.style.DStyleClass;
33
-import org.openzen.drawablegui.style.DStylePath;
34 35
 import org.openzen.zenscript.ide.ui.IDEAspectBarControl;
35 36
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
36 37
 import org.openzen.zenscript.ide.ui.icons.ScalableMaximizeIcon;
@@ -62,9 +63,9 @@ public class AspectBarView extends BaseComponentGroup {
62 63
 	private WindowActionButton maximizeRestore;
63 64
 	private WindowActionButton close;
64 65
 	
65
-	private final ListenerHandle<LiveObject.Listener<DSizing>> minimizeRelayout;
66
-	private final ListenerHandle<LiveObject.Listener<DSizing>> maximizeRestoreRelayout;
67
-	private final ListenerHandle<LiveObject.Listener<DSizing>> closeRelayout;
66
+	private final ListenerHandle<BiConsumer<DSizing, DSizing>> minimizeRelayout;
67
+	private final ListenerHandle<BiConsumer<DSizing, DSizing>> maximizeRestoreRelayout;
68
+	private final ListenerHandle<BiConsumer<DSizing, DSizing>> closeRelayout;
68 69
 	
69 70
 	private DDrawnRectangle topBackground;
70 71
 	private DDrawnRectangle bottomBackground;
@@ -105,8 +106,8 @@ public class AspectBarView extends BaseComponentGroup {
105 106
 				});
106 107
 		selectorButtons.addListener(new SelectorButtonListListener());
107 108
 		
108
-		if (aspectBar.toolbars.size() > 0)
109
-			aspectBar.active.setValue(aspectBar.toolbars.get(0));
109
+		if (aspectBar.toolbars.getLength() > 0)
110
+			aspectBar.active.setValue(aspectBar.toolbars.getAt(0));
110 111
 	}
111 112
 	
112 113
 	@Override
@@ -451,7 +452,7 @@ public class AspectBarView extends BaseComponentGroup {
451 452
 		@Override
452 453
 		public void onRemoved(int index, IDEAspectToolbar oldValue) {
453 454
 			if (oldValue == aspectBar.active.getValue())
454
-				aspectBar.active.setValue(aspectBar.toolbars.size() == 0 ? null : aspectBar.toolbars.get(0));
455
+				aspectBar.active.setValue(aspectBar.toolbars.getLength() == 0 ? null : aspectBar.toolbars.getAt(0));
455 456
 		}
456 457
 	}
457 458
 	

+ 8
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/WindowActionButton.java Näytä tiedosto

@@ -7,6 +7,12 @@ package org.openzen.zenscript.ide.ui.view.aspectbar;
7 7
 
8 8
 import java.util.function.Consumer;
9 9
 import java.util.function.Function;
10
+
11
+import listeners.ListenerHandle;
12
+import live.LiveBool;
13
+import live.LiveObject;
14
+import live.MutableLiveObject;
15
+
10 16
 import org.openzen.drawablegui.DColorableIcon;
11 17
 import org.openzen.drawablegui.DColorableIconInstance;
12 18
 import org.openzen.drawablegui.DComponent;
@@ -16,12 +22,9 @@ import org.openzen.drawablegui.DMouseEvent;
16 22
 import org.openzen.drawablegui.DTransform2D;
17 23
 import org.openzen.drawablegui.DIRectangle;
18 24
 import org.openzen.drawablegui.draw.DDrawnRectangle;
19
-import org.openzen.drawablegui.listeners.ListenerHandle;
20
-import org.openzen.drawablegui.live.LiveBool;
21
-import org.openzen.drawablegui.live.LiveObject;
22
-import org.openzen.drawablegui.live.MutableLiveObject;
23 25
 import org.openzen.drawablegui.style.DStyleClass;
24 26
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
27
+import zsynthetic.FunctionBoolBoolToVoid;
25 28
 
26 29
 /**
27 30
  *
@@ -34,7 +37,7 @@ public class WindowActionButton implements DComponent {
34 37
 	private final Consumer<DMouseEvent> action;
35 38
 	
36 39
 	private LiveBool windowFocused;
37
-	private ListenerHandle<LiveBool.Listener> windowFocusedListener;
40
+	private ListenerHandle<FunctionBoolBoolToVoid> windowFocusedListener;
38 41
 	
39 42
 	private DComponentContext context;
40 43
 	private DColorableIcon icon;

+ 9
- 7
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditor.java Näytä tiedosto

@@ -9,6 +9,15 @@ import java.io.IOException;
9 9
 import java.io.Reader;
10 10
 import java.util.ArrayList;
11 11
 import java.util.List;
12
+
13
+import listeners.ListenerHandle;
14
+import live.ImmutableLiveString;
15
+import live.InverseLiveBool;
16
+import live.LiveObject;
17
+import live.LiveBool;
18
+import live.MutableLiveObject;
19
+import live.SimpleLiveBool;
20
+
12 21
 import org.openzen.drawablegui.DComponent;
13 22
 import org.openzen.drawablegui.DComponentContext;
14 23
 import org.openzen.drawablegui.DSizing;
@@ -20,8 +29,6 @@ import org.openzen.drawablegui.DKeyEvent;
20 29
 import org.openzen.drawablegui.DMouseEvent;
21 30
 import org.openzen.drawablegui.DTimerHandle;
22 31
 import org.openzen.drawablegui.DTransform2D;
23
-import org.openzen.drawablegui.listeners.ListenerHandle;
24
-import org.openzen.drawablegui.live.LiveObject;
25 32
 import org.openzen.zenscript.ide.host.IDESourceFile;
26 33
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
27 34
 import org.openzen.zenscript.ide.ui.IDEWindow;
@@ -35,11 +42,6 @@ import org.openzen.drawablegui.Destructible;
35 42
 import org.openzen.drawablegui.draw.DDrawnRectangle;
36 43
 import org.openzen.drawablegui.draw.DDrawnShape;
37 44
 import org.openzen.drawablegui.draw.DDrawnText;
38
-import org.openzen.drawablegui.live.ImmutableLiveString;
39
-import org.openzen.drawablegui.live.InverseLiveBool;
40
-import org.openzen.drawablegui.live.LiveBool;
41
-import org.openzen.drawablegui.live.MutableLiveObject;
42
-import org.openzen.drawablegui.live.SimpleLiveBool;
43 45
 import org.openzen.drawablegui.style.DStyleClass;
44 46
 import org.openzen.zenscript.ide.ui.icons.SaveIcon;
45 47
 import org.openzen.zenscript.ide.ui.icons.ShadedCodeIcon;

+ 4
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/TokenModel.java Näytä tiedosto

@@ -11,8 +11,10 @@ import java.util.HashSet;
11 11
 import java.util.Iterator;
12 12
 import java.util.List;
13 13
 import java.util.Set;
14
-import org.openzen.drawablegui.listeners.ListenerHandle;
15
-import org.openzen.drawablegui.listeners.ListenerList;
14
+
15
+import listeners.ListenerHandle;
16
+import listeners.ListenerList;
17
+
16 18
 import org.openzen.zencode.shared.SourceFile;
17 19
 import org.openzen.zenscript.lexer.ParseException;
18 20
 import org.openzen.zenscript.lexer.TokenStream;

+ 6
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/output/OutputView.java Näytä tiedosto

@@ -7,6 +7,11 @@ package org.openzen.zenscript.ide.ui.view.output;
7 7
 
8 8
 import java.util.ArrayList;
9 9
 import java.util.List;
10
+import listeners.ListenerHandle;
11
+import live.LiveList;
12
+import live.LiveObject;
13
+import live.MutableLiveObject;
14
+
10 15
 import org.openzen.drawablegui.DComponent;
11 16
 import org.openzen.drawablegui.DComponentContext;
12 17
 import org.openzen.drawablegui.DFontMetrics;
@@ -16,10 +21,6 @@ import org.openzen.drawablegui.DTransform2D;
16 21
 import org.openzen.drawablegui.Destructible;
17 22
 import org.openzen.drawablegui.draw.DDrawnShape;
18 23
 import org.openzen.drawablegui.draw.DDrawnText;
19
-import org.openzen.drawablegui.listeners.ListenerHandle;
20
-import org.openzen.drawablegui.live.LiveList;
21
-import org.openzen.drawablegui.live.LiveObject;
22
-import org.openzen.drawablegui.live.MutableLiveObject;
23 24
 import org.openzen.drawablegui.style.DStyleClass;
24 25
 
25 26
 /**
@@ -108,7 +109,7 @@ public class OutputView implements DComponent {
108 109
 	}
109 110
 	
110 111
 	private void updateSizing() {
111
-		sizing.setValue(new DSizing(100, lines.size() * fontMetrics.getLineHeight() + style.margin.getVertical() + style.border.getPaddingVertical()));
112
+		sizing.setValue(new DSizing(100, lines.getLength() * fontMetrics.getLineHeight() + style.margin.getVertical() + style.border.getPaddingVertical()));
112 113
 	}
113 114
 	
114 115
 	private List<DDrawnText> draw(OutputLine line) {

+ 8
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/LibraryTreeNode.java Näytä tiedosto

@@ -5,11 +5,12 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8
+import live.LiveList;
9
+import live.LiveMappedList;
10
+
8 11
 import org.openzen.drawablegui.DColorableIcon;
9
-import org.openzen.drawablegui.live.LiveList;
10
-import org.openzen.drawablegui.live.LiveMappedList;
11 12
 import org.openzen.zenscript.ide.host.IDELibrary;
12
-import org.openzen.zenscript.ide.ui.IDEWindow;
13
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13 14
 import org.openzen.zenscript.ide.ui.icons.LibraryIcon;
14 15
 
15 16
 /**
@@ -20,10 +21,12 @@ public class LibraryTreeNode extends ProjectOverviewNode {
20 21
 	private final IDELibrary library;
21 22
 	private final LiveList<ProjectOverviewNode> modules;
22 23
 	
23
-	public LibraryTreeNode(ProjectBrowser browser, IDELibrary library) {
24
+	public LibraryTreeNode(ProjectBrowser browser, IDELibrary library, IDEPropertyDirectory treeState) {
25
+		super(treeState.getLiveBool("collapsed", false));
26
+		
24 27
 		this.library = library;
25 28
 		
26
-		modules = new LiveMappedList<>(library.getModules(), module -> new ModuleTreeNode(browser, module));
29
+		modules = new LiveMappedList<>(library.getModules(), module -> new ModuleTreeNode(browser, module, treeState.getSubdirectory(module.getName())));
27 30
 	}
28 31
 	
29 32
 	@Override

+ 5
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ModuleTreeNode.java Näytä tiedosto

@@ -8,7 +8,7 @@ package org.openzen.zenscript.ide.ui.view.project;
8 8
 import org.openzen.drawablegui.DColorableIcon;
9 9
 import org.openzen.drawablegui.DMouseEvent;
10 10
 import org.openzen.zenscript.ide.host.IDEModule;
11
-import org.openzen.zenscript.ide.ui.IDEWindow;
11
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
12 12
 import org.openzen.zenscript.ide.ui.icons.ModuleIcon;
13 13
 
14 14
 /**
@@ -16,10 +16,10 @@ import org.openzen.zenscript.ide.ui.icons.ModuleIcon;
16 16
  * @author Hoofdgebruiker
17 17
  */
18 18
 public class ModuleTreeNode extends PackageTreeNode {
19
-	public ModuleTreeNode(ProjectBrowser projectBrowser, IDEModule module) {
20
-		super(projectBrowser, module.getRootPackage());
19
+	public ModuleTreeNode(ProjectBrowser projectBrowser, IDEModule module, IDEPropertyDirectory treeState) {
20
+		super(projectBrowser, module.getRootPackage(), treeState);
21 21
 		
22
-		init(module);
22
+		init(module, treeState);
23 23
 	}
24 24
 
25 25
 	@Override
@@ -34,7 +34,7 @@ public class ModuleTreeNode extends PackageTreeNode {
34 34
 
35 35
 	@Override
36 36
 	public String getTitle() {
37
-		return module.getName();
37
+		return module.getName() + " [" + module.getType().getName() + "]";
38 38
 	}
39 39
 	
40 40
 	@Override

+ 13
- 8
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/PackageTreeNode.java Näytä tiedosto

@@ -7,11 +7,12 @@ package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8 8
 import org.openzen.drawablegui.DColorableIcon;
9 9
 import org.openzen.drawablegui.DMouseEvent;
10
-import org.openzen.drawablegui.live.LiveConcatList;
11
-import org.openzen.drawablegui.live.LiveList;
12
-import org.openzen.drawablegui.live.LiveMappedList;
10
+import live.LiveConcatList;
11
+import live.LiveList;
12
+import live.LiveMappedList;
13 13
 import org.openzen.zenscript.ide.host.IDEModule;
14 14
 import org.openzen.zenscript.ide.host.IDEPackage;
15
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
15 16
 import org.openzen.zenscript.ide.ui.icons.FolderIcon;
16 17
 
17 18
 /**
@@ -24,23 +25,27 @@ public class PackageTreeNode extends ProjectOverviewNode {
24 25
 	private final IDEPackage pkg;
25 26
 	private LiveList<ProjectOverviewNode> contents;
26 27
 	
27
-	public PackageTreeNode(ProjectBrowser browser, IDEPackage pkg) {
28
+	public PackageTreeNode(ProjectBrowser browser, IDEPackage pkg, IDEPropertyDirectory treeState) {
29
+		super(treeState.getLiveBool("collapsed", true));
30
+		
28 31
 		this.browser = browser;
29 32
 		this.pkg = pkg;
30 33
 	}
31 34
 	
32
-	public PackageTreeNode(ProjectBrowser browser, IDEModule module, IDEPackage pkg) {
35
+	public PackageTreeNode(ProjectBrowser browser, IDEModule module, IDEPackage pkg, IDEPropertyDirectory treeState) {
36
+		super(treeState.getLiveBool("collapsed", true));
37
+		
33 38
 		this.browser = browser;
34 39
 		this.module = module;
35 40
 		this.pkg = pkg;
36 41
 		
37
-		init(module);
42
+		init(module, treeState);
38 43
 	}
39 44
 	
40
-	protected final void init(IDEModule module) {
45
+	protected final void init(IDEModule module, IDEPropertyDirectory treeState) {
41 46
 		this.module = module;
42 47
 		contents = new LiveConcatList<>(
43
-				new LiveMappedList<>(pkg.getSubPackages(), sub -> new PackageTreeNode(browser, module, sub)),
48
+				new LiveMappedList<>(pkg.getSubPackages(), sub -> new PackageTreeNode(browser, module, sub, treeState.getSubdirectory(sub.getName()))),
44 49
 				new LiveMappedList<>(pkg.getSourceFiles(), source -> new SourceFileTreeNode(browser, source))
45 50
 		);
46 51
 	}

+ 10
- 9
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectBrowser.java Näytä tiedosto

@@ -5,12 +5,18 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8
+import live.ImmutableLiveString;
9
+import live.LiveBool;
10
+import live.LivePredicateBool;
11
+import live.MutableLiveObject;
12
+import live.SimpleLiveObject;
13
+import live.SimpleLiveString;
14
+
8 15
 import org.openzen.drawablegui.DComponent;
9 16
 import org.openzen.drawablegui.DFont;
10 17
 import org.openzen.drawablegui.DFontFamily;
11 18
 import org.openzen.drawablegui.DLabel;
12 19
 import org.openzen.drawablegui.DScalableSize;
13
-import org.openzen.drawablegui.DSizing;
14 20
 import org.openzen.drawablegui.border.DEmptyBorder;
15 21
 import org.openzen.drawablegui.border.DPaddedBorder;
16 22
 import org.openzen.drawablegui.layout.DLinearLayout;
@@ -18,12 +24,6 @@ import org.openzen.drawablegui.layout.DLinearLayout.Alignment;
18 24
 import org.openzen.drawablegui.layout.DLinearLayout.Element;
19 25
 import org.openzen.drawablegui.layout.DLinearLayout.ElementAlignment;
20 26
 import org.openzen.drawablegui.layout.DLinearLayout.Orientation;
21
-import org.openzen.drawablegui.live.ImmutableLiveString;
22
-import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.live.LivePredicateBool;
24
-import org.openzen.drawablegui.live.MutableLiveObject;
25
-import org.openzen.drawablegui.live.SimpleLiveObject;
26
-import org.openzen.drawablegui.live.SimpleLiveString;
27 27
 import org.openzen.drawablegui.scroll.DScrollPane;
28 28
 import org.openzen.drawablegui.style.DDpDimension;
29 29
 import org.openzen.drawablegui.style.DRoundedRectangleShape;
@@ -36,6 +36,7 @@ import org.openzen.drawablegui.tree.ExpandedArrow;
36 36
 import org.openzen.zenscript.ide.host.DevelopmentHost;
37 37
 import org.openzen.zenscript.ide.host.IDEModule;
38 38
 import org.openzen.zenscript.ide.host.IDEPackage;
39
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
39 40
 import org.openzen.zenscript.ide.host.IDESourceFile;
40 41
 import org.openzen.zenscript.ide.ui.IDEWindow;
41 42
 import org.openzen.zenscript.ide.ui.dialog.CreatePackageDialog;
@@ -56,7 +57,7 @@ public class ProjectBrowser {
56 57
 	public final MutableLiveObject<IDESourceFile> contextFile = new SimpleLiveObject<>(null);
57 58
 	public final LiveBool addContentDisabled = new LivePredicateBool(contextPackage, pkg -> pkg == null);
58 59
 	
59
-	public ProjectBrowser(IDEWindow window, DevelopmentHost host) {
60
+	public ProjectBrowser(IDEWindow window, DevelopmentHost host, IDEPropertyDirectory expanded) {
60 61
 		this.window = window;
61 62
 		
62 63
 		DStyleClass minimalButtonPadding = DStyleClass.inline(new DStylesheetBuilder()
@@ -108,7 +109,7 @@ public class ProjectBrowser {
108 109
 				DStyleClass.EMPTY,
109 110
 				ExpandedArrow.INSTANCE,
110 111
 				CollapsedArrow.INSTANCE,
111
-				new RootTreeNode(this, host), false);
112
+				new RootTreeNode(this, host, expanded), false);
112 113
 		
113 114
 		DScalableSize treeSize = new DScalableSize(new DDpDimension(280), new DDpDimension(280));
114 115
 		DScrollPane treeScrollPane = new DScrollPane(

+ 6
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectOverviewNode.java Näytä tiedosto

@@ -5,8 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8
-import org.openzen.drawablegui.live.MutableLiveBool;
9
-import org.openzen.drawablegui.live.SimpleLiveBool;
8
+import live.MutableLiveBool;
10 9
 import org.openzen.drawablegui.tree.DTreeNode;
11 10
 
12 11
 /**
@@ -14,7 +13,11 @@ import org.openzen.drawablegui.tree.DTreeNode;
14 13
  * @author Hoofdgebruiker
15 14
  */
16 15
 public abstract class ProjectOverviewNode implements DTreeNode<ProjectOverviewNode> {
17
-	private final MutableLiveBool collapsed = new SimpleLiveBool();
16
+	private final MutableLiveBool collapsed;
17
+	
18
+	public ProjectOverviewNode(MutableLiveBool collapsed) {
19
+		this.collapsed = collapsed;
20
+	}
18 21
 	
19 22
 	public abstract Kind getKind();
20 23
 	

+ 8
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectTreeNode.java Näytä tiedosto

@@ -5,11 +5,13 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8
+import live.LiveList;
9
+import live.LiveMappedList;
10
+
8 11
 import org.openzen.drawablegui.DColorableIcon;
9 12
 import org.openzen.drawablegui.DMouseEvent;
10
-import org.openzen.drawablegui.live.LiveList;
11
-import org.openzen.drawablegui.live.LiveMappedList;
12 13
 import org.openzen.zenscript.ide.host.DevelopmentHost;
14
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13 15
 import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
14 16
 
15 17
 /**
@@ -21,11 +23,13 @@ public class ProjectTreeNode extends ProjectOverviewNode {
21 23
 	private final DevelopmentHost host;
22 24
 	private final LiveList<ProjectOverviewNode> modules;
23 25
 	
24
-	public ProjectTreeNode(ProjectBrowser browser, DevelopmentHost host) {
26
+	public ProjectTreeNode(ProjectBrowser browser, DevelopmentHost host, IDEPropertyDirectory treeState) {
27
+		super(treeState.getLiveBool("collapsed", false));
28
+		
25 29
 		this.browser = browser;
26 30
 		this.host = host;
27 31
 		
28
-		modules = new LiveMappedList<>(host.getModules(), module -> new ModuleTreeNode(browser, module));
32
+		modules = new LiveMappedList<>(host.getModules(), module -> new ModuleTreeNode(browser, module, treeState.getSubdirectory(module.getName())));
29 33
 	}
30 34
 	
31 35
 	@Override

+ 11
- 6
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/RootTreeNode.java Näytä tiedosto

@@ -5,11 +5,14 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8
+import live.SimpleLiveBool;
9
+import live.LiveList;
10
+import live.LiveMappedList;
11
+import live.LivePrefixedList;
12
+
8 13
 import org.openzen.drawablegui.DColorableIcon;
9
-import org.openzen.drawablegui.live.LiveList;
10
-import org.openzen.drawablegui.live.LiveMappedList;
11
-import org.openzen.drawablegui.live.LivePrefixedList;
12 14
 import org.openzen.zenscript.ide.host.DevelopmentHost;
15
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13 16
 import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
14 17
 
15 18
 /**
@@ -20,12 +23,14 @@ public class RootTreeNode extends ProjectOverviewNode {
20 23
 	private final DevelopmentHost host;
21 24
 	private final LiveList<ProjectOverviewNode> children;
22 25
 	
23
-	public RootTreeNode(ProjectBrowser browser, DevelopmentHost host) {
26
+	public RootTreeNode(ProjectBrowser browser, DevelopmentHost host, IDEPropertyDirectory treeState) {
27
+		super(new SimpleLiveBool(false));
28
+		
24 29
 		this.host = host;
25 30
 		
26 31
 		children = new LivePrefixedList<>(
27
-				new ProjectTreeNode(browser, host),
28
-				new LiveMappedList<>(host.getLibraries(), library -> new LibraryTreeNode(browser, library)));
32
+				new ProjectTreeNode(browser, host, treeState.getSubdirectory("project")),
33
+				new LiveMappedList<>(host.getLibraries(), library -> new LibraryTreeNode(browser, library, treeState.getSubdirectory(library.getName()))));
29 34
 	}
30 35
 	
31 36
 	@Override

+ 5
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/SourceFileTreeNode.java Näytä tiedosto

@@ -5,10 +5,11 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.project;
7 7
 
8
+import live.SimpleLiveBool;
8 9
 import org.openzen.drawablegui.DColorableIcon;
9 10
 import org.openzen.drawablegui.DMouseEvent;
10
-import org.openzen.drawablegui.live.LiveEmptyList;
11
-import org.openzen.drawablegui.live.LiveList;
11
+import live.LiveEmptyList;
12
+import live.LiveList;
12 13
 import org.openzen.zenscript.ide.host.IDESourceFile;
13 14
 import org.openzen.zenscript.ide.ui.icons.CodeIcon;
14 15
 
@@ -21,6 +22,8 @@ public class SourceFileTreeNode extends ProjectOverviewNode {
21 22
 	private final IDESourceFile sourceFile;
22 23
 	
23 24
 	public SourceFileTreeNode(ProjectBrowser browser, IDESourceFile sourceFile) {
25
+		super(new SimpleLiveBool(false));
26
+		
24 27
 		this.browser = browser;
25 28
 		this.sourceFile = sourceFile;
26 29
 	}

+ 1
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaClass.java Näytä tiedosto

@@ -32,6 +32,7 @@ public class JavaClass implements Comparable<JavaClass> {
32 32
 	public static final JavaClass DOUBLE = new JavaClass("java.lang", "Double", Kind.CLASS);
33 33
 	public static final JavaClass CHARACTER = new JavaClass("java.lang", "Character", Kind.CLASS);
34 34
 	public static final JavaClass COLLECTION = new JavaClass("java.util", "Collection", Kind.INTERFACE);
35
+	public static final JavaClass COLLECTIONS = new JavaClass("java.util", "Collections", Kind.CLASS);
35 36
 	
36 37
 	public static final JavaClass SHARED = new JavaClass("zsynthetic", "Shared", Kind.CLASS);
37 38
 	

+ 2
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java Näytä tiedosto

@@ -32,6 +32,7 @@ import org.openzen.zenscript.javashared.JavaClass;
32 32
 import org.openzen.zenscript.javashared.JavaCompiledModule;
33 33
 import org.openzen.zenscript.javashared.JavaContext;
34 34
 import org.openzen.zenscript.javashared.JavaMethod;
35
+import org.openzen.zenscript.javashared.JavaModifiers;
35 36
 import org.openzen.zenscript.javashared.JavaVariantOption;
36 37
 
37 38
 /**
@@ -94,6 +95,7 @@ public class JavaPrepareDefinitionVisitor implements DefinitionVisitor<JavaClass
94 95
 		
95 96
 		{
96 97
 			JavaNativeClass iterator = new JavaNativeClass(JavaClass.ITERATOR);
98
+			iterator.addMethod("empty", new JavaMethod(JavaClass.COLLECTIONS, JavaMethod.Kind.STATIC, "emptyIterator", false, "()Ljava/lang/Iterator;", JavaModifiers.STATIC | JavaModifiers.PUBLIC, false));
97 99
 			iterator.addInstanceMethod("hasNext", "hasNext", "()Z");
98 100
 			iterator.addInstanceMethod("next", "next", "()Ljava/lang/Object;");
99 101
 			nativeClasses.put("stdlib::Iterator", iterator);

+ 1
- 1
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/BaseMemberCompiler.java Näytä tiedosto

@@ -84,7 +84,7 @@ public abstract class BaseMemberCompiler implements MemberVisitor<Void> {
84 84
 			output.append("abstract ");
85 85
 		if (Modifiers.isStatic(modifiers))
86 86
 			output.append("static ");
87
-		if (Modifiers.isFinal(modifiers))
87
+		if (Modifiers.isFinal(modifiers) && !definition.isInterface())
88 88
 			output.append("final ");
89 89
 	}
90 90
 	

+ 2
- 1
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/FormattingUtils.java Näytä tiedosto

@@ -45,7 +45,7 @@ public class FormattingUtils {
45 45
 		}
46 46
 	}
47 47
 	
48
-	public static void formatCall(StringBuilder result, StatementFormattingTarget target, JavaSourceStatementScope scope, CallArguments arguments) {
48
+	public static void formatCall(StringBuilder result, StatementFormattingTarget target, JavaSourceStatementScope scope, String name, CallArguments arguments) {
49 49
 		if (arguments == null || arguments.typeArguments == null)
50 50
 			throw new IllegalArgumentException("Arguments cannot be null!");
51 51
 		
@@ -61,6 +61,7 @@ public class FormattingUtils {
61 61
 			}
62 62
 			result.append(">");
63 63
 		}
64
+		result.append(name);
64 65
 		result.append("(");
65 66
 		int index = 0;
66 67
 		for (Expression argument : arguments.arguments) {

+ 0
- 1
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/JavaMemberCompiler.java Näytä tiedosto

@@ -35,7 +35,6 @@ import org.openzen.zenscript.codemodel.statement.BlockStatement;
35 35
 import org.openzen.zenscript.codemodel.statement.EmptyStatement;
36 36
 import org.openzen.zenscript.codemodel.statement.Statement;
37 37
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
38
-import org.openzen.zenscript.codemodel.type.member.BuiltinID;
39 38
 import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
40 39
 import org.openzen.zenscript.javasource.scope.JavaSourceFileScope;
41 40
 import org.openzen.zenscript.javashared.JavaClass;

+ 11
- 16
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/JavaSourceExpressionFormatter.java Näytä tiedosto

@@ -203,8 +203,7 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
203 203
 				StringBuilder output = new StringBuilder();
204 204
 				output.append(getValue(target).value);
205 205
 				output.append('.');
206
-				output.append(method.name);
207
-				FormattingUtils.formatCall(output, this.target, scope, arguments);
206
+				FormattingUtils.formatCall(output, this.target, scope, method.name, arguments);
208 207
 				return new ExpressionString(output.toString(), JavaOperator.CALL);
209 208
 			}
210 209
 			default:
@@ -227,8 +226,7 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
227 226
 		StringBuilder result = new StringBuilder();
228 227
 		result.append(scope.type(method.cls));
229 228
 		result.append('.');
230
-		result.append(method.name);
231
-		FormattingUtils.formatCall(result, target, scope, expression.arguments);
229
+		FormattingUtils.formatCall(result, target, scope, method.name, expression.arguments);
232 230
 		return new ExpressionString(result.toString(), JavaOperator.CALL);
233 231
 	}
234 232
 
@@ -394,16 +392,14 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
394 392
 	@Override
395 393
 	public ExpressionString visitConstructorThisCall(ConstructorThisCallExpression expression) {
396 394
 		StringBuilder result = new StringBuilder();
397
-		result.append("this");
398
-		FormattingUtils.formatCall(result, target, scope, expression.arguments);
395
+		FormattingUtils.formatCall(result, target, scope, "this", expression.arguments);
399 396
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
400 397
 	}
401 398
 
402 399
 	@Override
403 400
 	public ExpressionString visitConstructorSuperCall(ConstructorSuperCallExpression expression) {
404 401
 		StringBuilder result = new StringBuilder();
405
-		result.append("super");
406
-		FormattingUtils.formatCall(result, target, scope, expression.arguments);
402
+		FormattingUtils.formatCall(result, target, scope, "super", expression.arguments);
407 403
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
408 404
 	}
409 405
 
@@ -500,8 +496,7 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
500 496
 	@Override
501 497
 	public ExpressionString visitGlobalCall(GlobalCallExpression expression) {
502 498
 		StringBuilder result = new StringBuilder();
503
-		result.append(expression.name);
504
-		FormattingUtils.formatCall(result, target, scope, expression.arguments);
499
+		FormattingUtils.formatCall(result, target, scope, expression.name, expression.arguments);
505 500
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
506 501
 	}
507 502
 
@@ -566,15 +561,14 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
566 561
 				StringBuilder output = new StringBuilder();
567 562
 				output.append(scope.type(method.cls));
568 563
 				output.append('.');
569
-				output.append(method.name);
570
-				FormattingUtils.formatCall(output, this.target, scope, expression.arguments);
564
+				FormattingUtils.formatCall(output, this.target, scope, method.name, expression.arguments);
571 565
 				return new ExpressionString(output.toString(), JavaOperator.CALL);
572 566
 			}
573 567
 			case CONSTRUCTOR: {
574 568
 				StringBuilder output = new StringBuilder();
575 569
 				output.append("new ");
576 570
 				output.append(scope.type(expression.type, method.cls));
577
-				FormattingUtils.formatCall(output, this.target, scope, expression.arguments);
571
+				FormattingUtils.formatCall(output, this.target, scope, "", expression.arguments);
578 572
 				return new ExpressionString(output.toString(), JavaOperator.PRIMARY);
579 573
 			}
580 574
 			default:
@@ -663,9 +657,10 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
663 657
 
664 658
 	@Override
665 659
 	public ExpressionString visitSetter(SetterExpression expression) {
660
+		JavaMethod setter = context.getJavaMethod(expression.setter);
666 661
 		return new ExpressionString(
667
-				getValue(expression.target) + "." + expression.setter.member.name + " = " + expression.value.accept(this),
668
-				JavaOperator.ASSIGN);
662
+				getValue(expression.target) + "." + setter.name + "(" + expression.value.accept(this) + ")",
663
+				JavaOperator.CALL);
669 664
 	}
670 665
 
671 666
 	@Override
@@ -771,7 +766,7 @@ public class JavaSourceExpressionFormatter implements ExpressionVisitor<Expressi
771 766
 		
772 767
 		StringBuilder result = new StringBuilder();
773 768
 		result.append("new ").append(scope.type(option.variantOptionClass));
774
-		FormattingUtils.formatCall(result, this.target, scope, new CallArguments(expression.arguments));
769
+		FormattingUtils.formatCall(result, this.target, scope, "", new CallArguments(expression.arguments));
775 770
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
776 771
 	}
777 772
 

+ 17
- 0
ScriptingExample/src/main/java/org/openzen/zenscript/scriptingexample/TestInterface.java Näytä tiedosto

@@ -0,0 +1,17 @@
1
+/*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+package org.openzen.zenscript.scriptingexample;
7
+
8
+import org.openzen.zencode.java.ZenCodeType;
9
+
10
+/**
11
+ *
12
+ * @author Hoofdgebruiker
13
+ */
14
+public interface TestInterface extends ZenCodeType {
15
+	@Method
16
+	String interfaceMethod();
17
+}

DrawableGui/src/main/java/org/openzen/drawablegui/live/LiveConcatList.java → Shared/src/main/java/live/LiveConcatList.java Näytä tiedosto

@@ -3,18 +3,17 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.live;
6
+package live;
7 7
 
8 8
 import java.util.Iterator;
9
-import org.openzen.drawablegui.Destructible;
10
-import org.openzen.drawablegui.listeners.ListenerHandle;
11
-import org.openzen.drawablegui.listeners.ListenerList;
9
+import listeners.ListenerHandle;
10
+import listeners.ListenerList;
12 11
 
13 12
 /**
14 13
  *
15 14
  * @author Hoofdgebruiker
16 15
  */
17
-public class LiveConcatList<T> implements Destructible, LiveList<T> {
16
+public class LiveConcatList<T> implements AutoCloseable, LiveList<T> {
18 17
 	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
19 18
 	private final LiveList<T> a;
20 19
 	private final LiveList<T> b;
@@ -43,17 +42,17 @@ public class LiveConcatList<T> implements Destructible, LiveList<T> {
43 42
 			return result;
44 43
 		
45 44
 		result = b.indexOf(value);
46
-		return result < 0 ? -1 : result + a.size();
45
+		return result < 0 ? -1 : result + a.getLength();
47 46
 	}
48 47
 
49 48
 	@Override
50
-	public int size() {
51
-		return a.size() + b.size();
49
+	public int getLength() {
50
+		return a.getLength() + b.getLength();
52 51
 	}
53 52
 
54 53
 	@Override
55
-	public T get(int index) {
56
-		return index < a.size() ? a.get(index) : b.get(index - a.size());
54
+	public T getAt(int index) {
55
+		return index < a.getLength() ? a.getAt(index) : b.getAt(index - a.getLength());
57 56
 	}
58 57
 
59 58
 	@Override
@@ -114,17 +113,17 @@ public class LiveConcatList<T> implements Destructible, LiveList<T> {
114 113
 	private class SecondListListener implements Listener<T> {
115 114
 		@Override
116 115
 		public void onInserted(int index, T value) {
117
-			listeners.accept(listener -> listener.onInserted(a.size() + index, value));
116
+			listeners.accept(listener -> listener.onInserted(a.getLength() + index, value));
118 117
 		}
119 118
 
120 119
 		@Override
121 120
 		public void onChanged(int index, T oldValue, T newValue) {
122
-			listeners.accept(listener -> listener.onChanged(a.size() + index, oldValue, newValue));
121
+			listeners.accept(listener -> listener.onChanged(a.getLength() + index, oldValue, newValue));
123 122
 		}
124 123
 
125 124
 		@Override
126 125
 		public void onRemoved(int index, T oldValue) {
127
-			listeners.accept(listener -> listener.onRemoved(a.size() + index, oldValue));
126
+			listeners.accept(listener -> listener.onRemoved(a.getLength() + index, oldValue));
128 127
 		}
129 128
 	}
130 129
 }

DrawableGui/src/main/java/org/openzen/drawablegui/live/LiveEmptyList.java → Shared/src/main/java/live/LiveEmptyList.java Näytä tiedosto

@@ -3,12 +3,12 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.live;
6
+package live;
7 7
 
8 8
 import java.util.Collections;
9 9
 import java.util.Iterator;
10
-import org.openzen.drawablegui.listeners.DummyListenerHandle;
11
-import org.openzen.drawablegui.listeners.ListenerHandle;
10
+import listeners.DummyListenerHandle;
11
+import listeners.ListenerHandle;
12 12
 
13 13
 /**
14 14
  *
@@ -32,12 +32,12 @@ public class LiveEmptyList<T> implements LiveList<T> {
32 32
 	}
33 33
 	
34 34
 	@Override
35
-	public int size() {
35
+	public int getLength() {
36 36
 		return 0;
37 37
 	}
38 38
 	
39 39
 	@Override
40
-	public T get(int index) {
40
+	public T getAt(int index) {
41 41
 		throw new ArrayIndexOutOfBoundsException(index);
42 42
 	}
43 43
 

DrawableGui/src/main/java/org/openzen/drawablegui/live/LiveMappedList.java → Shared/src/main/java/live/LiveMappedList.java Näytä tiedosto

@@ -3,21 +3,17 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.live;
6
+package live;
7 7
 
8 8
 import java.util.ArrayList;
9 9
 import java.util.Iterator;
10 10
 import java.util.List;
11 11
 import java.util.function.Function;
12
-import org.openzen.drawablegui.Destructible;
13
-import org.openzen.drawablegui.listeners.ListenerHandle;
14
-import org.openzen.drawablegui.listeners.ListenerList;
12
+import listeners.ListenerHandle;
13
+import listeners.ListenerList;
15 14
 
16
-/**
17
- *
18
- * @author Hoofdgebruiker
19
- */
20
-public class LiveMappedList<T, U> implements Destructible, LiveList<U> {
15
+// TODO: rewrite to zencode
16
+public class LiveMappedList<T, U> implements AutoCloseable, LiveList<U> {
21 17
 	private final ListenerList<Listener<U>> listeners = new ListenerList<>();
22 18
 	private final Function<T, U> projection;
23 19
 	private final List<U> mapped;
@@ -43,12 +39,12 @@ public class LiveMappedList<T, U> implements Destructible, LiveList<U> {
43 39
 	}
44 40
 	
45 41
 	@Override
46
-	public int size() {
42
+	public int getLength() {
47 43
 		return mapped.size();
48 44
 	}
49 45
 
50 46
 	@Override
51
-	public U get(int index) {
47
+	public U getAt(int index) {
52 48
 		return mapped.get(index);
53 49
 	}
54 50
 

DrawableGui/src/main/java/org/openzen/drawablegui/live/LivePredicateBool.java → Shared/src/main/java/live/LivePredicateBool.java Näytä tiedosto

@@ -3,22 +3,20 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.live;
6
+package live;
7 7
 
8
+import java.util.function.BiConsumer;
8 9
 import java.util.function.Predicate;
9
-import org.openzen.drawablegui.Destructible;
10
-import org.openzen.drawablegui.listeners.ListenerHandle;
11
-import org.openzen.drawablegui.listeners.ListenerList;
10
+import listeners.ListenerHandle;
11
+import listeners.ListenerList;
12
+import zsynthetic.FunctionBoolBoolToVoid;
12 13
 
13
-/**
14
- *
15
- * @author Hoofdgebruiker
16
- */
17
-public class LivePredicateBool<T> implements LiveBool, Destructible, LiveObject.Listener<T> {
18
-	private final ListenerList<LiveBool.Listener> listeners = new ListenerList<>();
14
+// TODO: rewrite to zencode
15
+public class LivePredicateBool<T> implements LiveBool, AutoCloseable, BiConsumer<T, T> {
16
+	private final ListenerList<FunctionBoolBoolToVoid> listeners = new ListenerList<>();
19 17
 	private final LiveObject<T> source;
20 18
 	private final Predicate<T> predicate;
21
-	private final ListenerHandle<LiveObject.Listener<T>> sourceListener;
19
+	private final ListenerHandle<BiConsumer<T, T>> sourceListener;
22 20
 	private boolean value;
23 21
 	
24 22
 	public LivePredicateBool(LiveObject<T> source, Predicate<T> predicate) {
@@ -39,7 +37,7 @@ public class LivePredicateBool<T> implements LiveBool, Destructible, LiveObject.
39 37
 	}
40 38
 
41 39
 	@Override
42
-	public ListenerHandle<Listener> addListener(Listener listener) {
40
+	public ListenerHandle<FunctionBoolBoolToVoid> addListener(FunctionBoolBoolToVoid listener) {
43 41
 		return listeners.add(listener);
44 42
 	}
45 43
 	
@@ -49,11 +47,11 @@ public class LivePredicateBool<T> implements LiveBool, Destructible, LiveObject.
49 47
 		
50 48
 		boolean oldValue = this.value;
51 49
 		this.value = value;
52
-		listeners.accept(listener -> listener.onChanged(oldValue, value));
50
+		listeners.accept(listener -> listener.invoke(oldValue, value));
53 51
 	}
54 52
 
55 53
 	@Override
56
-	public void onUpdated(T oldValue, T newValue) {
54
+	public void accept(T oldValue, T newValue) {
57 55
 		setValueInternal(predicate.test(newValue));
58 56
 	}
59 57
 }

DrawableGui/src/main/java/org/openzen/drawablegui/live/LivePrefixedList.java → Shared/src/main/java/live/LivePrefixedList.java Näytä tiedosto

@@ -1,18 +1,10 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.drawablegui.live;
1
+package live;
7 2
 
8 3
 import java.util.Iterator;
9
-import org.openzen.drawablegui.listeners.ListenerHandle;
10
-import org.openzen.drawablegui.listeners.ListenerList;
4
+import listeners.ListenerHandle;
5
+import listeners.ListenerList;
11 6
 
12
-/**
13
- *
14
- * @author Hoofdgebruiker
15
- */
7
+// TODO: convert to zencode
16 8
 public class LivePrefixedList<T> implements LiveList<T> {
17 9
 	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
18 10
 	private final T prefix;
@@ -73,13 +65,13 @@ public class LivePrefixedList<T> implements LiveList<T> {
73 65
 	}
74 66
 
75 67
 	@Override
76
-	public int size() {
77
-		return values.size() + 1;
68
+	public int getLength() {
69
+		return values.getLength() + 1;
78 70
 	}
79 71
 	
80 72
 	@Override
81
-	public T get(int index) {
82
-		return index == 0 ? prefix : values.get(index);
73
+	public T getAt(int index) {
74
+		return index == 0 ? prefix : values.getAt(index);
83 75
 	}
84 76
 
85 77
 	@Override

+ 4
- 4
Shared/src/main/java/live/MutableLiveBool.java Näytä tiedosto

@@ -2,8 +2,8 @@ package live;
2 2
 
3 3
 public interface MutableLiveBool extends LiveBool {
4 4
     void setValue(boolean value);
5
-	
6
-	default void toggle() {
7
-		setValue(!getValue());
8
-	}
5
+    
6
+    default void toggle() {
7
+        this.setValue(!getValue());
8
+    }
9 9
 }

+ 6
- 0
Shared/src/main/java/live/MutableLiveObject.java Näytä tiedosto

@@ -0,0 +1,6 @@
1
+package live;
2
+
3
+// TODO: write in ZenCode
4
+public interface MutableLiveObject<T> extends LiveObject<T> {
5
+	public void setValue(T value);
6
+}

+ 35
- 0
Shared/src/main/java/live/SimpleLiveObject.java Näytä tiedosto

@@ -0,0 +1,35 @@
1
+package live;
2
+
3
+import java.util.function.BiConsumer;
4
+import listeners.ListenerHandle;
5
+import listeners.ListenerList;
6
+
7
+// TODO: write in ZenCode
8
+public class SimpleLiveObject<T> implements MutableLiveObject<T> {
9
+	private final ListenerList<BiConsumer<T, T>> listeners = new ListenerList<>();
10
+	private T value;
11
+	
12
+	public SimpleLiveObject(T value) {
13
+		this.value = value;
14
+	}
15
+	
16
+	@Override
17
+	public T getValue() {
18
+		return value;
19
+	}
20
+	
21
+	@Override
22
+	public void setValue(T value) {
23
+		if (value == this.value)
24
+			return;
25
+		
26
+		T oldValue = this.value;
27
+		this.value = value;
28
+		listeners.accept(listener -> listener.accept(oldValue, value));
29
+	}
30
+	
31
+	@Override
32
+	public ListenerHandle<BiConsumer<T, T>> addListener(BiConsumer<T, T> listener) {
33
+		return listeners.add(listener);
34
+	}
35
+}

DrawableGui/src/main/java/org/openzen/drawablegui/live/SortedLiveList.java → Shared/src/main/java/live/SortedLiveList.java Näytä tiedosto

@@ -3,15 +3,16 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.live;
6
+package live;
7 7
 
8 8
 import java.util.ArrayList;
9 9
 import java.util.Collections;
10 10
 import java.util.Comparator;
11 11
 import java.util.Iterator;
12 12
 import java.util.List;
13
-import org.openzen.drawablegui.listeners.ListenerHandle;
14
-import org.openzen.drawablegui.listeners.ListenerList;
13
+
14
+import listeners.ListenerHandle;
15
+import listeners.ListenerList;
15 16
 
16 17
 /**
17 18
  *
@@ -48,12 +49,12 @@ public class SortedLiveList<T> implements LiveList<T>, LiveList.Listener<T> {
48 49
 	}
49 50
 
50 51
 	@Override
51
-	public int size() {
52
+	public int getLength() {
52 53
 		return sorted.size();
53 54
 	}
54 55
 
55 56
 	@Override
56
-	public T get(int index) {
57
+	public T getAt(int index) {
57 58
 		return sorted.get(index);
58 59
 	}
59 60
 

+ 6
- 2
Shared/src/main/java/org/openzen/zencode/shared/CompileException.java Näytä tiedosto

@@ -8,12 +8,12 @@ public final class CompileException extends Exception {
8 8
     public final CodePosition position;
9 9
     public final CompileExceptionCode code;
10 10
     public final String message;
11
-	
11
+    
12 12
     public CompileException(CodePosition position, CompileExceptionCode code, String message) {
13 13
         super(position.toString() + ": [" + code.toString() + "] " + message);
14 14
         this.position = position;
15 15
         this.code = code;
16
-		this.message = message;
16
+        this.message = message;
17 17
     }
18 18
     
19 19
     public CodePosition getPosition() {
@@ -23,4 +23,8 @@ public final class CompileException extends Exception {
23 23
     public CompileExceptionCode getCode() {
24 24
         return code;
25 25
     }
26
+    
27
+    public String getMessage() {
28
+        return message;
29
+    }
26 30
 }

Loading…
Peruuta
Tallenna