Browse Source

- Refactored usage of live objects in the IDE

- Save collapse state of the project browser tree
Stan Hebben 6 years ago
parent
commit
3f29d8bf0c
83 changed files with 582 additions and 413 deletions
  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 View File

14
 }
14
 }
15
 
15
 
16
 dependencies {
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 View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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
 import org.openzen.drawablegui.draw.DDrawnShape;
13
 import org.openzen.drawablegui.draw.DDrawnShape;
9
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DShadow;
15
 import org.openzen.drawablegui.style.DShadow;
15
 import org.openzen.drawablegui.style.DStyleClass;
16
 import org.openzen.drawablegui.style.DStyleClass;
16
 
17
 

+ 1
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/DComponent.java View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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 View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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 View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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
 import org.openzen.drawablegui.draw.DDrawnRectangle;
14
 import org.openzen.drawablegui.draw.DDrawnRectangle;
9
 import org.openzen.drawablegui.draw.DDrawnShape;
15
 import org.openzen.drawablegui.draw.DDrawnShape;
10
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DDimension;
17
 import org.openzen.drawablegui.style.DDimension;
17
 import org.openzen.drawablegui.style.DStyleClass;
18
 import org.openzen.drawablegui.style.DStyleClass;
18
 
19
 
22
  */
23
  */
23
 public class DInputField implements DComponent {
24
 public class DInputField implements DComponent {
24
 	public final MutableLiveString value;
25
 	public final MutableLiveString value;
25
-	private final ListenerHandle<LiveString.Listener> valueListener;
26
+	private final ListenerHandle<BiConsumer<String, String>> valueListener;
26
 	
27
 	
27
 	private final DStyleClass styleClass;
28
 	private final DStyleClass styleClass;
28
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
29
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/DLabel.java View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
15
 import org.openzen.drawablegui.style.DStyleClass;
14
 
16
 
15
 /**
17
 /**
20
 	private final LiveString label;
22
 	private final LiveString label;
21
 	private final DStyleClass styleClass;
23
 	private final DStyleClass styleClass;
22
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
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
 	private DComponentContext context;
27
 	private DComponentContext context;
26
 	private DIRectangle bounds;
28
 	private DIRectangle bounds;

+ 2
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltip.java View File

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

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltipComponent.java View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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
 import org.openzen.drawablegui.draw.DDrawnRectangle;
14
 import org.openzen.drawablegui.draw.DDrawnRectangle;
9
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
16
 import org.openzen.drawablegui.style.DStyleClass;
15
 
17
 
16
 /**
18
 /**
21
 	private final DStyleClass styleClass;
23
 	private final DStyleClass styleClass;
22
 	private final LiveString tooltip;
24
 	private final LiveString tooltip;
23
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
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
 	private DComponentContext context;
28
 	private DComponentContext context;
27
 	private DIRectangle bounds;
29
 	private DIRectangle bounds;

+ 2
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/DSizing.java View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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 View File

5
  */
5
  */
6
 package org.openzen.drawablegui;
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 View File

5
  */
5
  */
6
 package org.openzen.drawablegui.border;
6
 package org.openzen.drawablegui.border;
7
 
7
 
8
+import java.util.function.BiConsumer;
8
 import org.openzen.drawablegui.DComponent;
9
 import org.openzen.drawablegui.DComponent;
9
 import org.openzen.drawablegui.DComponentContext;
10
 import org.openzen.drawablegui.DComponentContext;
10
 import org.openzen.drawablegui.DSizing;
11
 import org.openzen.drawablegui.DSizing;
15
 import org.openzen.drawablegui.DIRectangle;
16
 import org.openzen.drawablegui.DIRectangle;
16
 import org.openzen.drawablegui.draw.DDrawnRectangle;
17
 import org.openzen.drawablegui.draw.DDrawnRectangle;
17
 import org.openzen.drawablegui.draw.DDrawnShape;
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
 import org.openzen.drawablegui.style.DStyleClass;
23
 import org.openzen.drawablegui.style.DStyleClass;
24
+import zsynthetic.FunctionBoolBoolToVoid;
23
 
25
 
24
 /**
26
 /**
25
  *
27
  *
35
 	private DIRectangle bounds;
37
 	private DIRectangle bounds;
36
 	
38
 	
37
 	private LiveBool active;
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
 	private DDrawnRectangle background;
45
 	private DDrawnRectangle background;
44
 	private DDrawnShape shadowedBackground;
46
 	private DDrawnShape shadowedBackground;

+ 3
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/form/DForm.java View File

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

+ 7
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/layout/DLinearLayout.java View File

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

+ 8
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/layout/DSideLayout.java View File

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

+ 0
- 42
DrawableGui/src/main/java/org/openzen/drawablegui/live/SimpleLiveObject.java View File

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 View File

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

+ 15
- 12
DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollPane.java View File

5
  */
5
  */
6
 package org.openzen.drawablegui.scroll;
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
 import org.openzen.drawablegui.DComponent;
15
 import org.openzen.drawablegui.DComponent;
9
 import org.openzen.drawablegui.DComponentContext;
16
 import org.openzen.drawablegui.DComponentContext;
10
 import org.openzen.drawablegui.DSizing;
17
 import org.openzen.drawablegui.DSizing;
12
 import org.openzen.drawablegui.DMouseEvent;
19
 import org.openzen.drawablegui.DMouseEvent;
13
 import org.openzen.drawablegui.DScalableSize;
20
 import org.openzen.drawablegui.DScalableSize;
14
 import org.openzen.drawablegui.DTransform2D;
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
 import org.openzen.drawablegui.draw.DDrawnShape;
22
 import org.openzen.drawablegui.draw.DDrawnShape;
20
 import org.openzen.drawablegui.draw.DSubSurface;
23
 import org.openzen.drawablegui.draw.DSubSurface;
21
-import org.openzen.drawablegui.live.SimpleLiveObject;
22
 import org.openzen.drawablegui.style.DStyleClass;
24
 import org.openzen.drawablegui.style.DStyleClass;
25
+import zsynthetic.FunctionIntIntToVoid;
23
 
26
 
24
 /**
27
 /**
25
  *
28
  *
44
 	private final SimpleLiveObject<DSizing> sizing = new SimpleLiveObject<>(DSizing.EMPTY);
47
 	private final SimpleLiveObject<DSizing> sizing = new SimpleLiveObject<>(DSizing.EMPTY);
45
 	private final LiveObject<DScalableSize> size;
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
 	private DComponent hovering = null;
56
 	private DComponent hovering = null;
54
 	
57
 	
311
 		return bounds.height;
314
 		return bounds.height;
312
 	}
315
 	}
313
 	
316
 	
314
-	private class ScrollListener implements LiveInt.Listener {
317
+	private class ScrollListener implements FunctionIntIntToVoid {
315
 
318
 
316
 		@Override
319
 		@Override
317
-		public void onChanged(int oldValue, int newValue) {
320
+		public void invoke(int oldValue, int newValue) {
318
 			int valueX = offsetX.getValue();
321
 			int valueX = offsetX.getValue();
319
 			if (valueX > contentsWidth.getValue() - bounds.width)
322
 			if (valueX > contentsWidth.getValue() - bounds.width)
320
 				valueX = contentsWidth.getValue() - bounds.width;
323
 				valueX = contentsWidth.getValue() - bounds.width;

+ 7
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingDialog.java View File

13
 import java.awt.event.WindowListener;
13
 import java.awt.event.WindowListener;
14
 import java.awt.event.WindowStateListener;
14
 import java.awt.event.WindowStateListener;
15
 import javax.swing.JDialog;
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
 import org.openzen.drawablegui.DComponent;
23
 import org.openzen.drawablegui.DComponent;
18
 import org.openzen.drawablegui.DSizing;
24
 import org.openzen.drawablegui.DSizing;
19
 import org.openzen.drawablegui.DIRectangle;
25
 import org.openzen.drawablegui.DIRectangle;
20
 import org.openzen.drawablegui.DUIContext;
26
 import org.openzen.drawablegui.DUIContext;
21
 import org.openzen.drawablegui.DUIWindow;
27
 import org.openzen.drawablegui.DUIWindow;
22
 import org.openzen.drawablegui.border.DCustomWindowBorder;
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
 import org.openzen.drawablegui.style.DStyleClass;
29
 import org.openzen.drawablegui.style.DStyleClass;
29
 
30
 
30
 /**
31
 /**

+ 8
- 6
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingInlineWindow.java View File

12
 import java.awt.event.WindowListener;
12
 import java.awt.event.WindowListener;
13
 import java.awt.event.WindowStateListener;
13
 import java.awt.event.WindowStateListener;
14
 import javax.swing.JWindow;
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
 import org.openzen.drawablegui.DComponent;
23
 import org.openzen.drawablegui.DComponent;
16
 import org.openzen.drawablegui.DIRectangle;
24
 import org.openzen.drawablegui.DIRectangle;
17
 import org.openzen.drawablegui.DUIContext;
25
 import org.openzen.drawablegui.DUIContext;
18
 import org.openzen.drawablegui.DUIWindow;
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 View File

13
 import java.awt.event.WindowListener;
13
 import java.awt.event.WindowListener;
14
 import java.awt.event.WindowStateListener;
14
 import java.awt.event.WindowStateListener;
15
 import javax.swing.JFrame;
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
 import org.openzen.drawablegui.DComponent;
23
 import org.openzen.drawablegui.DComponent;
17
 import org.openzen.drawablegui.DSizing;
24
 import org.openzen.drawablegui.DSizing;
18
 import org.openzen.drawablegui.DIRectangle;
25
 import org.openzen.drawablegui.DIRectangle;
19
 import org.openzen.drawablegui.DUIContext;
26
 import org.openzen.drawablegui.DUIContext;
20
 import org.openzen.drawablegui.DUIWindow;
27
 import org.openzen.drawablegui.DUIWindow;
21
 import org.openzen.drawablegui.border.DCustomWindowBorder;
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
 import org.openzen.drawablegui.style.DStyleClass;
29
 import org.openzen.drawablegui.style.DStyleClass;
28
 
30
 
29
 /**
31
 /**

+ 3
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeNode.java View File

5
  */
5
  */
6
 package org.openzen.drawablegui.tree;
6
 package org.openzen.drawablegui.tree;
7
 
7
 
8
+import live.LiveList;
9
+import live.MutableLiveBool;
10
+
8
 import org.openzen.drawablegui.DColorableIcon;
11
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DMouseEvent;
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 View File

7
 
7
 
8
 import java.util.ArrayList;
8
 import java.util.ArrayList;
9
 import java.util.List;
9
 import java.util.List;
10
+
11
+import listeners.ListenerHandle;
12
+import live.LiveList;
13
+import live.LiveObject;
14
+import live.MutableLiveObject;
15
+
10
 import org.openzen.drawablegui.DColorableIcon;
16
 import org.openzen.drawablegui.DColorableIcon;
11
 import org.openzen.drawablegui.DColorableIconInstance;
17
 import org.openzen.drawablegui.DColorableIconInstance;
12
 import org.openzen.drawablegui.DComponent;
18
 import org.openzen.drawablegui.DComponent;
19
 import org.openzen.drawablegui.DIRectangle;
25
 import org.openzen.drawablegui.DIRectangle;
20
 import org.openzen.drawablegui.DDrawableInstance;
26
 import org.openzen.drawablegui.DDrawableInstance;
21
 import org.openzen.drawablegui.Destructible;
27
 import org.openzen.drawablegui.Destructible;
22
-import org.openzen.drawablegui.listeners.ListenerHandle;
23
-import org.openzen.drawablegui.live.LiveBool;
24
 import org.openzen.drawablegui.draw.DDrawnRectangle;
28
 import org.openzen.drawablegui.draw.DDrawnRectangle;
25
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
30
 import org.openzen.drawablegui.style.DStyleClass;
31
+import zsynthetic.FunctionBoolBoolToVoid;
30
 
32
 
31
 /**
33
 /**
32
  *
34
  *
252
 		// nothing to clean up
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
 		private final int x;
258
 		private final int x;
257
 		private final int index;
259
 		private final int index;
258
 		private final N node;
260
 		private final N node;
259
 		private final DDrawable icon;
261
 		private final DDrawable icon;
260
-		private final ListenerHandle<LiveBool.Listener> collapseListener;
262
+		private final ListenerHandle<FunctionBoolBoolToVoid> collapseListener;
261
 		private final ListenerHandle<LiveList.Listener<N>> childListener;
263
 		private final ListenerHandle<LiveList.Listener<N>> childListener;
262
 		
264
 		
263
 		private DDrawnText text;
265
 		private DDrawnText text;
268
 			this.x = x;
270
 			this.x = x;
269
 			this.index = index;
271
 			this.index = index;
270
 			this.node = node;
272
 			this.node = node;
271
-			this.collapseListener = node.isCollapsed().addListener(this);
273
+			this.collapseListener = node.isCollapsed().addListener(this::onCollapsedChanged);
272
 			this.childListener = node.getChildren().addListener(this);
274
 			this.childListener = node.getChildren().addListener(this);
273
 			
275
 			
274
 			if (node == selectedNode)
276
 			if (node == selectedNode)
319
 					baseX + style.iconTextSpacing + getIconWidth(icon) + style.iconTextSpacing + getIconWidth(node.getIcon()),
321
 					baseX + style.iconTextSpacing + getIconWidth(icon) + style.iconTextSpacing + getIconWidth(node.getIcon()),
320
 					baseY + fontMetrics.getAscent());
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
 			updateLayout();
326
 			updateLayout();
326
 		}
327
 		}
327
 
328
 

+ 24
- 12
IDE/src/main/java/org/openzen/zenscript/ide/Main.java View File

1
 package org.openzen.zenscript.ide;
1
 package org.openzen.zenscript.ide;
2
 
2
 
3
+import java.awt.event.WindowAdapter;
4
+import java.awt.event.WindowEvent;
3
 import java.io.File;
5
 import java.io.File;
4
 import java.io.IOException;
6
 import java.io.IOException;
5
 import javax.swing.JFrame;
7
 import javax.swing.JFrame;
8
+import live.MutableLiveBool;
6
 import org.openzen.drawablegui.DUIWindow;
9
 import org.openzen.drawablegui.DUIWindow;
7
 import org.openzen.zenscript.ide.host.DevelopmentHost;
10
 import org.openzen.zenscript.ide.host.DevelopmentHost;
8
 import org.openzen.zenscript.ide.host.local.LocalProjectDevelopmentHost;
11
 import org.openzen.zenscript.ide.host.local.LocalProjectDevelopmentHost;
37
 		IDEPropertyDirectory runState = properties.getRoot().getSubdirectory("runState");
40
 		IDEPropertyDirectory runState = properties.getRoot().getSubdirectory("runState");
38
 		if (target == null)
41
 		if (target == null)
39
 			target = runState.getString("target", null);
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
 		IDEPropertyDirectory uiState = properties.getRoot().getSubdirectory("uiState");
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
 		int pixelPerInch = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
50
 		int pixelPerInch = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
51
+		MutableLiveBool maximized = uiState.getLiveBool("maximized", false);
49
 		SwingWindow swingWindow = new SwingWindow("ZenCode IDE - " + host.getName(), root, false);
52
 		SwingWindow swingWindow = new SwingWindow("ZenCode IDE - " + host.getName(), root, false);
50
 		swingWindow.setSize(
53
 		swingWindow.setSize(
51
 				uiState.getInt("width", 800 * pixelPerInch / 96),
54
 				uiState.getInt("width", 800 * pixelPerInch / 96),
54
 				uiState.getInt("x", 0),
57
 				uiState.getInt("x", 0),
55
 				uiState.getInt("y", 0));
58
 				uiState.getInt("y", 0));
56
 		swingWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
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
 		swingWindow.setVisible(true);
61
 		swingWindow.setVisible(true);
62
+		swingWindow.addWindowListener(new MyWindowListener(properties));
59
 		
63
 		
60
 		swingWindow.getWindowBounds().addListener((oldBounds, newBounds) -> {
64
 		swingWindow.getWindowBounds().addListener((oldBounds, newBounds) -> {
61
 			if (swingWindow.getWindowState().getValue() == DUIWindow.State.NORMAL) {
65
 			if (swingWindow.getWindowState().getValue() == DUIWindow.State.NORMAL) {
63
 				uiState.setInt("y", newBounds.y);
67
 				uiState.setInt("y", newBounds.y);
64
 				uiState.setInt("width", newBounds.width);
68
 				uiState.setInt("width", newBounds.width);
65
 				uiState.setInt("height", newBounds.height);
69
 				uiState.setInt("height", newBounds.height);
66
-				properties.save();
67
 			}
70
 			}
68
 		});
71
 		});
69
 		swingWindow.getWindowState().addListener((oldState, newState) -> {
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 View File

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

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/host/DevelopmentHost.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.host;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.host;
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 View File

16
 public interface IDEModule {
16
 public interface IDEModule {
17
 	public String getName();
17
 	public String getName();
18
 	
18
 	
19
+	public IDEModuleType getType();
20
+	
19
 	public IDEPackage getRootPackage();
21
 	public IDEPackage getRootPackage();
20
 	
22
 	
21
 	void prebuild(ModuleLoader loader, Consumer<IDECodeError> errors);
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 View File

3
  * To change this template file, choose Tools | Templates
3
  * To change this template file, choose Tools | Templates
4
  * and open the template in the editor.
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
  * @author Hoofdgebruiker
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.host;
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 View File

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

+ 2
- 1
IDE/src/main/java/org/openzen/zenscript/ide/host/IDESourceFile.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.host;
6
 package org.openzen.zenscript.ide.host;
7
 
7
 
8
-import org.openzen.drawablegui.live.LiveString;
8
+import live.LiveString;
9
+
9
 import org.openzen.zencode.shared.SourceFile;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.host.local;
6
 package org.openzen.zenscript.ide.host.local;
7
 
7
 
8
+import listeners.ListenerHandle;
9
+import listeners.ListenerList;
10
+import live.MutableLiveBool;
8
 import org.json.JSONObject;
11
 import org.json.JSONObject;
9
 import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
12
 import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13
+import zsynthetic.FunctionBoolBoolToVoid;
10
 
14
 
11
 /**
15
 /**
12
  *
16
  *
29
 		data.put(name, value);
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
 	@Override
41
 	@Override
33
 	public int getInt(String name, int defaultValue) {
42
 	public int getInt(String name, int defaultValue) {
34
 		return data.optInt(name, defaultValue);
43
 		return data.optInt(name, defaultValue);
57
 		
66
 		
58
 		return new JSONPropertyDirectory(data.getJSONObject(name));
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.host.local;
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
 import org.openzen.zenscript.constructor.Library;
12
 import org.openzen.zenscript.constructor.Library;
12
 import org.openzen.zenscript.constructor.module.ModuleReference;
13
 import org.openzen.zenscript.constructor.module.ModuleReference;
13
 import org.openzen.zenscript.ide.host.IDELibrary;
14
 import org.openzen.zenscript.ide.host.IDELibrary;

+ 6
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalModule.java View File

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

+ 6
- 4
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalPackage.java View File

8
 import java.io.File;
8
 import java.io.File;
9
 import java.io.IOException;
9
 import java.io.IOException;
10
 import java.util.Arrays;
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
 import org.openzen.zencode.shared.FileSourceFile;
17
 import org.openzen.zencode.shared.FileSourceFile;
16
 import org.openzen.zencode.shared.SourceFile;
18
 import org.openzen.zencode.shared.SourceFile;
17
 import org.openzen.zenscript.constructor.module.SourcePackage;
19
 import org.openzen.zenscript.constructor.module.SourcePackage;

+ 5
- 3
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalProjectDevelopmentHost.java View File

6
 package org.openzen.zenscript.ide.host.local;
6
 package org.openzen.zenscript.ide.host.local;
7
 
7
 
8
 import java.io.File;
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
 import org.openzen.zenscript.constructor.Library;
14
 import org.openzen.zenscript.constructor.Library;
13
 import org.openzen.zenscript.constructor.Project;
15
 import org.openzen.zenscript.constructor.Project;
14
 import org.openzen.zenscript.constructor.module.ModuleReference;
16
 import org.openzen.zenscript.constructor.module.ModuleReference;

+ 5
- 3
IDE/src/main/java/org/openzen/zenscript/ide/host/local/LocalSourceFile.java View File

11
 import java.io.OutputStreamWriter;
11
 import java.io.OutputStreamWriter;
12
 import java.io.Writer;
12
 import java.io.Writer;
13
 import java.nio.charset.StandardCharsets;
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
 import org.openzen.zencode.shared.FileSourceFile;
19
 import org.openzen.zencode.shared.FileSourceFile;
18
 import org.openzen.zencode.shared.SourceFile;
20
 import org.openzen.zencode.shared.SourceFile;
19
 import org.openzen.zenscript.ide.host.IDESourceFile;
21
 import org.openzen.zenscript.ide.host.IDESourceFile;

+ 23
- 0
IDE/src/main/java/org/openzen/zenscript/ide/host/local/UniversalModuleType.java View File

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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui;
6
 package org.openzen.zenscript.ide.ui;
7
 
7
 
8
+import live.LiveArrayList;
9
+import live.MutableLiveList;
10
+
8
 import org.openzen.drawablegui.DDrawable;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui;
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
 import org.openzen.zenscript.ide.host.IDESourceFile;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui;
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
 import org.openzen.drawablegui.style.DStyleClass;
12
 import org.openzen.drawablegui.style.DStyleClass;
12
 import org.openzen.zenscript.ide.host.DevelopmentHost;
13
 import org.openzen.zenscript.ide.host.DevelopmentHost;
13
 import org.openzen.zenscript.ide.host.IDESourceFile;
14
 import org.openzen.zenscript.ide.host.IDESourceFile;

+ 3
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/dialog/CreatePackageDialog.java View File

19
 import org.openzen.drawablegui.layout.DLinearLayout.Element;
19
 import org.openzen.drawablegui.layout.DLinearLayout.Element;
20
 import org.openzen.drawablegui.layout.DLinearLayout.ElementAlignment;
20
 import org.openzen.drawablegui.layout.DLinearLayout.ElementAlignment;
21
 import org.openzen.drawablegui.layout.DLinearLayout.Orientation;
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
 import org.openzen.drawablegui.style.DDpDimension;
25
 import org.openzen.drawablegui.style.DDpDimension;
26
 import org.openzen.drawablegui.style.DStyleClass;
26
 import org.openzen.drawablegui.style.DStyleClass;
27
 import org.openzen.zenscript.ide.host.IDEModule;
27
 import org.openzen.zenscript.ide.host.IDEModule;

+ 4
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/dialog/CreateSourceFileDialog.java View File

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

+ 10
- 7
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControl.java View File

6
 package org.openzen.zenscript.ide.ui.view;
6
 package org.openzen.zenscript.ide.ui.view;
7
 
7
 
8
 import java.util.function.Consumer;
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
 import org.openzen.drawablegui.DComponent;
17
 import org.openzen.drawablegui.DComponent;
10
 import org.openzen.drawablegui.DComponentContext;
18
 import org.openzen.drawablegui.DComponentContext;
11
 import org.openzen.drawablegui.DSizing;
19
 import org.openzen.drawablegui.DSizing;
17
 import org.openzen.drawablegui.DIRectangle;
25
 import org.openzen.drawablegui.DIRectangle;
18
 import org.openzen.drawablegui.DSimpleTooltip;
26
 import org.openzen.drawablegui.DSimpleTooltip;
19
 import org.openzen.drawablegui.draw.DDrawnShape;
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
 import org.openzen.drawablegui.style.DShadow;
28
 import org.openzen.drawablegui.style.DShadow;
27
 import org.openzen.drawablegui.style.DStyleClass;
29
 import org.openzen.drawablegui.style.DStyleClass;
30
+import zsynthetic.FunctionBoolBoolToVoid;
28
 
31
 
29
 /**
32
 /**
30
  *
33
  *
36
 	private final DDrawable iconDisabled;
39
 	private final DDrawable iconDisabled;
37
 	private final Consumer<DMouseEvent> onClick;
40
 	private final Consumer<DMouseEvent> onClick;
38
 	private final LiveBool disabled;
41
 	private final LiveBool disabled;
39
-	private final ListenerHandle<LiveBool.Listener> disabledListener;
42
+	private final ListenerHandle<FunctionBoolBoolToVoid> disabledListener;
40
 	private final DSimpleTooltip tooltip;
43
 	private final DSimpleTooltip tooltip;
41
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
44
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
42
 	
45
 	

+ 4
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/StatusBarView.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view;
6
 package org.openzen.zenscript.ide.ui.view;
7
 
7
 
8
+import live.LiveObject;
9
+import live.LiveString;
10
+import live.SimpleLiveObject;
11
+
8
 import org.openzen.drawablegui.DComponent;
12
 import org.openzen.drawablegui.DComponent;
9
 import org.openzen.drawablegui.DComponentContext;
13
 import org.openzen.drawablegui.DComponentContext;
10
 import org.openzen.drawablegui.DSizing;
14
 import org.openzen.drawablegui.DSizing;
12
 import org.openzen.drawablegui.DIRectangle;
16
 import org.openzen.drawablegui.DIRectangle;
13
 import org.openzen.drawablegui.DPath;
17
 import org.openzen.drawablegui.DPath;
14
 import org.openzen.drawablegui.DTransform2D;
18
 import org.openzen.drawablegui.DTransform2D;
15
-import org.openzen.drawablegui.live.LiveObject;
16
-import org.openzen.drawablegui.live.SimpleLiveObject;
17
 import org.openzen.drawablegui.draw.DDrawnShape;
19
 import org.openzen.drawablegui.draw.DDrawnShape;
18
 import org.openzen.drawablegui.draw.DDrawnText;
20
 import org.openzen.drawablegui.draw.DDrawnText;
19
-import org.openzen.drawablegui.live.LiveString;
20
 import org.openzen.drawablegui.style.DStyleClass;
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 View File

7
 
7
 
8
 import java.util.HashMap;
8
 import java.util.HashMap;
9
 import java.util.Map;
9
 import java.util.Map;
10
+import java.util.function.BiConsumer;
10
 import java.util.function.Consumer;
11
 import java.util.function.Consumer;
11
 import java.util.function.Predicate;
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
 import org.openzen.drawablegui.BaseComponentGroup;
23
 import org.openzen.drawablegui.BaseComponentGroup;
13
 import org.openzen.drawablegui.DComponent;
24
 import org.openzen.drawablegui.DComponent;
14
 import org.openzen.drawablegui.DComponentContext;
25
 import org.openzen.drawablegui.DComponentContext;
15
 import org.openzen.drawablegui.DSizing;
26
 import org.openzen.drawablegui.DSizing;
16
 import org.openzen.drawablegui.DFontMetrics;
27
 import org.openzen.drawablegui.DFontMetrics;
17
 import org.openzen.drawablegui.DIRectangle;
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
 import org.openzen.drawablegui.style.DStyleClass;
29
 import org.openzen.drawablegui.style.DStyleClass;
28
-import org.openzen.drawablegui.style.DStylePath;
29
 
30
 
30
 /**
31
 /**
31
  *
32
  *
37
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
38
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
38
 	public final MutableLiveObject<TabbedViewComponent> currentTab = new SimpleLiveObject<>(null);
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
 	private DComponentContext context;
43
 	private DComponentContext context;
43
 	private TabbedViewStyle style;
44
 	private TabbedViewStyle style;
127
 
128
 
128
 	@Override
129
 	@Override
129
 	public void close() {
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
 			entry.getValue().close();
132
 			entry.getValue().close();
132
 		}
133
 		}
133
 		
134
 		
199
 		@Override
200
 		@Override
200
 		public void onRemoved(int index, TabbedViewComponent oldValue) {
201
 		public void onRemoved(int index, TabbedViewComponent oldValue) {
201
 			if (oldValue == currentTab.getValue())
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
 			layoutTabs();
205
 			layoutTabs();
205
 		}
206
 		}

+ 3
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewComponent.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view;
6
 package org.openzen.zenscript.ide.ui.view;
7
 
7
 
8
+import live.LiveBool;
9
+import live.LiveString;
10
+
8
 import org.openzen.drawablegui.DComponent;
11
 import org.openzen.drawablegui.DComponent;
9
 import org.openzen.drawablegui.DDrawable;
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 View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view;
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
 import org.openzen.drawablegui.DComponent;
13
 import org.openzen.drawablegui.DComponent;
9
 import org.openzen.drawablegui.DComponentContext;
14
 import org.openzen.drawablegui.DComponentContext;
10
 import org.openzen.drawablegui.DSizing;
15
 import org.openzen.drawablegui.DSizing;
15
 import org.openzen.drawablegui.DTransform2D;
20
 import org.openzen.drawablegui.DTransform2D;
16
 import org.openzen.drawablegui.draw.DDrawnShape;
21
 import org.openzen.drawablegui.draw.DDrawnShape;
17
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
23
 import org.openzen.drawablegui.style.DStyleClass;
24
+import zsynthetic.FunctionBoolBoolToVoid;
24
 
25
 
25
 /**
26
 /**
26
  *
27
  *
41
 	private int textWidth;
42
 	private int textWidth;
42
 	private DIRectangle bounds;
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
 	private boolean hover;
49
 	private boolean hover;
49
 	private boolean press;
50
 	private boolean press;
61
 		
62
 		
62
 		titleListener = tab.title.addListener((oldValue, newValue) -> calculateSizing());
63
 		titleListener = tab.title.addListener((oldValue, newValue) -> calculateSizing());
63
 		updatedListener = tab.updated.addListener((oldValue, newValue) -> calculateSizing());
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
 	public void closeTab() {
68
 	public void closeTab() {
199
 	}
200
 	}
200
 	
201
 	
201
 	private void update() {
202
 	private void update() {
203
+		update(currentTab.getValue());
204
+	}
205
+	
206
+	private void update(TabbedViewComponent currentTab) {
202
 		if (style == null || shape == null)
207
 		if (style == null || shape == null)
203
 			return;
208
 			return;
204
 		
209
 		
210
+		System.out.println("Updating tab " + tab.title.getValue() + (currentTab == tab ? " (current)" : ""));
205
 		int color = style.tabColorNormal;
211
 		int color = style.tabColorNormal;
206
-		if (currentTab.getValue() == tab)
212
+		if (currentTab == tab)
207
 			color = style.tabColorActive;
213
 			color = style.tabColorActive;
208
 		else if (press)
214
 		else if (press)
209
 			color = style.tabColorPress;
215
 			color = style.tabColorPress;

+ 3
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/TabbedViewTabClose.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view;
6
 package org.openzen.zenscript.ide.ui.view;
7
 
7
 
8
+import live.LiveObject;
9
+import live.MutableLiveObject;
10
+
8
 import org.openzen.drawablegui.DColorableIcon;
11
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DColorableIconInstance;
12
 import org.openzen.drawablegui.DColorableIconInstance;
10
 import org.openzen.drawablegui.DComponent;
13
 import org.openzen.drawablegui.DComponent;
14
 import org.openzen.drawablegui.DMouseEvent;
17
 import org.openzen.drawablegui.DMouseEvent;
15
 import org.openzen.drawablegui.DTransform2D;
18
 import org.openzen.drawablegui.DTransform2D;
16
 import org.openzen.drawablegui.draw.DDrawnRectangle;
19
 import org.openzen.drawablegui.draw.DDrawnRectangle;
17
-import org.openzen.drawablegui.live.LiveObject;
18
-import org.openzen.drawablegui.live.MutableLiveObject;
19
 import org.openzen.drawablegui.style.DStyleClass;
20
 import org.openzen.drawablegui.style.DStyleClass;
20
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
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 View File

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

6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7
 
7
 
8
 import java.util.function.Consumer;
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
 import org.openzen.drawablegui.DComponent;
16
 import org.openzen.drawablegui.DComponent;
10
 import org.openzen.drawablegui.DComponentContext;
17
 import org.openzen.drawablegui.DComponentContext;
11
 import org.openzen.drawablegui.DSizing;
18
 import org.openzen.drawablegui.DSizing;
17
 import org.openzen.drawablegui.DIRectangle;
24
 import org.openzen.drawablegui.DIRectangle;
18
 import org.openzen.drawablegui.DSimpleTooltip;
25
 import org.openzen.drawablegui.DSimpleTooltip;
19
 import org.openzen.drawablegui.draw.DDrawnShape;
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
 import org.openzen.drawablegui.style.DShadow;
27
 import org.openzen.drawablegui.style.DShadow;
26
 import org.openzen.drawablegui.style.DStyleClass;
28
 import org.openzen.drawablegui.style.DStyleClass;
29
+import zsynthetic.FunctionBoolBoolToVoid;
27
 
30
 
28
 /**
31
 /**
29
  *
32
  *
48
 	private boolean pressing;
51
 	private boolean pressing;
49
 	private final DSimpleTooltip tooltip;
52
 	private final DSimpleTooltip tooltip;
50
 	
53
 	
51
-	private final ListenerHandle<LiveBool.Listener> activeListener;
54
+	private final ListenerHandle<FunctionBoolBoolToVoid> activeListener;
52
 	
55
 	
53
 	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon, LiveBool active, String tooltip, Consumer<DMouseEvent> onClick) {
56
 	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon, LiveBool active, String tooltip, Consumer<DMouseEvent> onClick) {
54
 		this.active = active;
57
 		this.active = active;

+ 16
- 15
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarView.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7
 
7
 
8
+import java.util.function.BiConsumer;
8
 import java.util.function.Consumer;
9
 import java.util.function.Consumer;
9
 import java.util.function.Predicate;
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
 import org.openzen.drawablegui.BaseComponentGroup;
20
 import org.openzen.drawablegui.BaseComponentGroup;
11
 import org.openzen.drawablegui.DComponent;
21
 import org.openzen.drawablegui.DComponent;
12
 import org.openzen.drawablegui.DComponentContext;
22
 import org.openzen.drawablegui.DComponentContext;
15
 import org.openzen.drawablegui.DPath;
25
 import org.openzen.drawablegui.DPath;
16
 import org.openzen.drawablegui.DTransform2D;
26
 import org.openzen.drawablegui.DTransform2D;
17
 import org.openzen.drawablegui.DIRectangle;
27
 import org.openzen.drawablegui.DIRectangle;
18
-import org.openzen.drawablegui.live.LiveObject;
19
 import org.openzen.zenscript.ide.ui.IDEAspectBar;
28
 import org.openzen.zenscript.ide.ui.IDEAspectBar;
20
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
29
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
21
 import org.openzen.drawablegui.DUIWindow;
30
 import org.openzen.drawablegui.DUIWindow;
22
-import org.openzen.drawablegui.draw.DDrawSurface;
23
 import org.openzen.drawablegui.draw.DDrawnRectangle;
31
 import org.openzen.drawablegui.draw.DDrawnRectangle;
24
 import org.openzen.drawablegui.draw.DDrawnShape;
32
 import org.openzen.drawablegui.draw.DDrawnShape;
25
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
34
 import org.openzen.drawablegui.style.DStyleClass;
33
-import org.openzen.drawablegui.style.DStylePath;
34
 import org.openzen.zenscript.ide.ui.IDEAspectBarControl;
35
 import org.openzen.zenscript.ide.ui.IDEAspectBarControl;
35
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
36
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
36
 import org.openzen.zenscript.ide.ui.icons.ScalableMaximizeIcon;
37
 import org.openzen.zenscript.ide.ui.icons.ScalableMaximizeIcon;
62
 	private WindowActionButton maximizeRestore;
63
 	private WindowActionButton maximizeRestore;
63
 	private WindowActionButton close;
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
 	private DDrawnRectangle topBackground;
70
 	private DDrawnRectangle topBackground;
70
 	private DDrawnRectangle bottomBackground;
71
 	private DDrawnRectangle bottomBackground;
105
 				});
106
 				});
106
 		selectorButtons.addListener(new SelectorButtonListListener());
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
 	@Override
113
 	@Override
451
 		@Override
452
 		@Override
452
 		public void onRemoved(int index, IDEAspectToolbar oldValue) {
453
 		public void onRemoved(int index, IDEAspectToolbar oldValue) {
453
 			if (oldValue == aspectBar.active.getValue())
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 View File

7
 
7
 
8
 import java.util.function.Consumer;
8
 import java.util.function.Consumer;
9
 import java.util.function.Function;
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
 import org.openzen.drawablegui.DColorableIcon;
16
 import org.openzen.drawablegui.DColorableIcon;
11
 import org.openzen.drawablegui.DColorableIconInstance;
17
 import org.openzen.drawablegui.DColorableIconInstance;
12
 import org.openzen.drawablegui.DComponent;
18
 import org.openzen.drawablegui.DComponent;
16
 import org.openzen.drawablegui.DTransform2D;
22
 import org.openzen.drawablegui.DTransform2D;
17
 import org.openzen.drawablegui.DIRectangle;
23
 import org.openzen.drawablegui.DIRectangle;
18
 import org.openzen.drawablegui.draw.DDrawnRectangle;
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
 import org.openzen.drawablegui.style.DStyleClass;
25
 import org.openzen.drawablegui.style.DStyleClass;
24
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
26
 import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
27
+import zsynthetic.FunctionBoolBoolToVoid;
25
 
28
 
26
 /**
29
 /**
27
  *
30
  *
34
 	private final Consumer<DMouseEvent> action;
37
 	private final Consumer<DMouseEvent> action;
35
 	
38
 	
36
 	private LiveBool windowFocused;
39
 	private LiveBool windowFocused;
37
-	private ListenerHandle<LiveBool.Listener> windowFocusedListener;
40
+	private ListenerHandle<FunctionBoolBoolToVoid> windowFocusedListener;
38
 	
41
 	
39
 	private DComponentContext context;
42
 	private DComponentContext context;
40
 	private DColorableIcon icon;
43
 	private DColorableIcon icon;

+ 9
- 7
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditor.java View File

9
 import java.io.Reader;
9
 import java.io.Reader;
10
 import java.util.ArrayList;
10
 import java.util.ArrayList;
11
 import java.util.List;
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
 import org.openzen.drawablegui.DComponent;
21
 import org.openzen.drawablegui.DComponent;
13
 import org.openzen.drawablegui.DComponentContext;
22
 import org.openzen.drawablegui.DComponentContext;
14
 import org.openzen.drawablegui.DSizing;
23
 import org.openzen.drawablegui.DSizing;
20
 import org.openzen.drawablegui.DMouseEvent;
29
 import org.openzen.drawablegui.DMouseEvent;
21
 import org.openzen.drawablegui.DTimerHandle;
30
 import org.openzen.drawablegui.DTimerHandle;
22
 import org.openzen.drawablegui.DTransform2D;
31
 import org.openzen.drawablegui.DTransform2D;
23
-import org.openzen.drawablegui.listeners.ListenerHandle;
24
-import org.openzen.drawablegui.live.LiveObject;
25
 import org.openzen.zenscript.ide.host.IDESourceFile;
32
 import org.openzen.zenscript.ide.host.IDESourceFile;
26
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
33
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
27
 import org.openzen.zenscript.ide.ui.IDEWindow;
34
 import org.openzen.zenscript.ide.ui.IDEWindow;
35
 import org.openzen.drawablegui.draw.DDrawnRectangle;
42
 import org.openzen.drawablegui.draw.DDrawnRectangle;
36
 import org.openzen.drawablegui.draw.DDrawnShape;
43
 import org.openzen.drawablegui.draw.DDrawnShape;
37
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
45
 import org.openzen.drawablegui.style.DStyleClass;
44
 import org.openzen.zenscript.ide.ui.icons.SaveIcon;
46
 import org.openzen.zenscript.ide.ui.icons.SaveIcon;
45
 import org.openzen.zenscript.ide.ui.icons.ShadedCodeIcon;
47
 import org.openzen.zenscript.ide.ui.icons.ShadedCodeIcon;

+ 4
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/TokenModel.java View File

11
 import java.util.Iterator;
11
 import java.util.Iterator;
12
 import java.util.List;
12
 import java.util.List;
13
 import java.util.Set;
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
 import org.openzen.zencode.shared.SourceFile;
18
 import org.openzen.zencode.shared.SourceFile;
17
 import org.openzen.zenscript.lexer.ParseException;
19
 import org.openzen.zenscript.lexer.ParseException;
18
 import org.openzen.zenscript.lexer.TokenStream;
20
 import org.openzen.zenscript.lexer.TokenStream;

+ 6
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/output/OutputView.java View File

7
 
7
 
8
 import java.util.ArrayList;
8
 import java.util.ArrayList;
9
 import java.util.List;
9
 import java.util.List;
10
+import listeners.ListenerHandle;
11
+import live.LiveList;
12
+import live.LiveObject;
13
+import live.MutableLiveObject;
14
+
10
 import org.openzen.drawablegui.DComponent;
15
 import org.openzen.drawablegui.DComponent;
11
 import org.openzen.drawablegui.DComponentContext;
16
 import org.openzen.drawablegui.DComponentContext;
12
 import org.openzen.drawablegui.DFontMetrics;
17
 import org.openzen.drawablegui.DFontMetrics;
16
 import org.openzen.drawablegui.Destructible;
21
 import org.openzen.drawablegui.Destructible;
17
 import org.openzen.drawablegui.draw.DDrawnShape;
22
 import org.openzen.drawablegui.draw.DDrawnShape;
18
 import org.openzen.drawablegui.draw.DDrawnText;
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
 import org.openzen.drawablegui.style.DStyleClass;
24
 import org.openzen.drawablegui.style.DStyleClass;
24
 
25
 
25
 /**
26
 /**
108
 	}
109
 	}
109
 	
110
 	
110
 	private void updateSizing() {
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
 	private List<DDrawnText> draw(OutputLine line) {
115
 	private List<DDrawnText> draw(OutputLine line) {

+ 8
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/LibraryTreeNode.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view.project;
6
 package org.openzen.zenscript.ide.ui.view.project;
7
 
7
 
8
+import live.LiveList;
9
+import live.LiveMappedList;
10
+
8
 import org.openzen.drawablegui.DColorableIcon;
11
 import org.openzen.drawablegui.DColorableIcon;
9
-import org.openzen.drawablegui.live.LiveList;
10
-import org.openzen.drawablegui.live.LiveMappedList;
11
 import org.openzen.zenscript.ide.host.IDELibrary;
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
 import org.openzen.zenscript.ide.ui.icons.LibraryIcon;
14
 import org.openzen.zenscript.ide.ui.icons.LibraryIcon;
14
 
15
 
15
 /**
16
 /**
20
 	private final IDELibrary library;
21
 	private final IDELibrary library;
21
 	private final LiveList<ProjectOverviewNode> modules;
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
 		this.library = library;
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
 	@Override
32
 	@Override

+ 5
- 5
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ModuleTreeNode.java View File

8
 import org.openzen.drawablegui.DColorableIcon;
8
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DMouseEvent;
9
 import org.openzen.drawablegui.DMouseEvent;
10
 import org.openzen.zenscript.ide.host.IDEModule;
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
 import org.openzen.zenscript.ide.ui.icons.ModuleIcon;
12
 import org.openzen.zenscript.ide.ui.icons.ModuleIcon;
13
 
13
 
14
 /**
14
 /**
16
  * @author Hoofdgebruiker
16
  * @author Hoofdgebruiker
17
  */
17
  */
18
 public class ModuleTreeNode extends PackageTreeNode {
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
 	@Override
25
 	@Override
34
 
34
 
35
 	@Override
35
 	@Override
36
 	public String getTitle() {
36
 	public String getTitle() {
37
-		return module.getName();
37
+		return module.getName() + " [" + module.getType().getName() + "]";
38
 	}
38
 	}
39
 	
39
 	
40
 	@Override
40
 	@Override

+ 13
- 8
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/PackageTreeNode.java View File

7
 
7
 
8
 import org.openzen.drawablegui.DColorableIcon;
8
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DMouseEvent;
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
 import org.openzen.zenscript.ide.host.IDEModule;
13
 import org.openzen.zenscript.ide.host.IDEModule;
14
 import org.openzen.zenscript.ide.host.IDEPackage;
14
 import org.openzen.zenscript.ide.host.IDEPackage;
15
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
15
 import org.openzen.zenscript.ide.ui.icons.FolderIcon;
16
 import org.openzen.zenscript.ide.ui.icons.FolderIcon;
16
 
17
 
17
 /**
18
 /**
24
 	private final IDEPackage pkg;
25
 	private final IDEPackage pkg;
25
 	private LiveList<ProjectOverviewNode> contents;
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
 		this.browser = browser;
31
 		this.browser = browser;
29
 		this.pkg = pkg;
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
 		this.browser = browser;
38
 		this.browser = browser;
34
 		this.module = module;
39
 		this.module = module;
35
 		this.pkg = pkg;
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
 		this.module = module;
46
 		this.module = module;
42
 		contents = new LiveConcatList<>(
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
 				new LiveMappedList<>(pkg.getSourceFiles(), source -> new SourceFileTreeNode(browser, source))
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 View File

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

+ 6
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectOverviewNode.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view.project;
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
 import org.openzen.drawablegui.tree.DTreeNode;
9
 import org.openzen.drawablegui.tree.DTreeNode;
11
 
10
 
12
 /**
11
 /**
14
  * @author Hoofdgebruiker
13
  * @author Hoofdgebruiker
15
  */
14
  */
16
 public abstract class ProjectOverviewNode implements DTreeNode<ProjectOverviewNode> {
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
 	public abstract Kind getKind();
22
 	public abstract Kind getKind();
20
 	
23
 	

+ 8
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectTreeNode.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view.project;
6
 package org.openzen.zenscript.ide.ui.view.project;
7
 
7
 
8
+import live.LiveList;
9
+import live.LiveMappedList;
10
+
8
 import org.openzen.drawablegui.DColorableIcon;
11
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DMouseEvent;
12
 import org.openzen.drawablegui.DMouseEvent;
10
-import org.openzen.drawablegui.live.LiveList;
11
-import org.openzen.drawablegui.live.LiveMappedList;
12
 import org.openzen.zenscript.ide.host.DevelopmentHost;
13
 import org.openzen.zenscript.ide.host.DevelopmentHost;
14
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13
 import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
15
 import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
14
 
16
 
15
 /**
17
 /**
21
 	private final DevelopmentHost host;
23
 	private final DevelopmentHost host;
22
 	private final LiveList<ProjectOverviewNode> modules;
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
 		this.browser = browser;
29
 		this.browser = browser;
26
 		this.host = host;
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
 	@Override
35
 	@Override

+ 11
- 6
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/RootTreeNode.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view.project;
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
 import org.openzen.drawablegui.DColorableIcon;
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
 import org.openzen.zenscript.ide.host.DevelopmentHost;
14
 import org.openzen.zenscript.ide.host.DevelopmentHost;
15
+import org.openzen.zenscript.ide.host.IDEPropertyDirectory;
13
 import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
16
 import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
14
 
17
 
15
 /**
18
 /**
20
 	private final DevelopmentHost host;
23
 	private final DevelopmentHost host;
21
 	private final LiveList<ProjectOverviewNode> children;
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
 		this.host = host;
29
 		this.host = host;
25
 		
30
 		
26
 		children = new LivePrefixedList<>(
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
 	@Override
36
 	@Override

+ 5
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/SourceFileTreeNode.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.ide.ui.view.project;
6
 package org.openzen.zenscript.ide.ui.view.project;
7
 
7
 
8
+import live.SimpleLiveBool;
8
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DColorableIcon;
9
 import org.openzen.drawablegui.DMouseEvent;
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
 import org.openzen.zenscript.ide.host.IDESourceFile;
13
 import org.openzen.zenscript.ide.host.IDESourceFile;
13
 import org.openzen.zenscript.ide.ui.icons.CodeIcon;
14
 import org.openzen.zenscript.ide.ui.icons.CodeIcon;
14
 
15
 
21
 	private final IDESourceFile sourceFile;
22
 	private final IDESourceFile sourceFile;
22
 	
23
 	
23
 	public SourceFileTreeNode(ProjectBrowser browser, IDESourceFile sourceFile) {
24
 	public SourceFileTreeNode(ProjectBrowser browser, IDESourceFile sourceFile) {
25
+		super(new SimpleLiveBool(false));
26
+		
24
 		this.browser = browser;
27
 		this.browser = browser;
25
 		this.sourceFile = sourceFile;
28
 		this.sourceFile = sourceFile;
26
 	}
29
 	}

+ 1
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaClass.java View File

32
 	public static final JavaClass DOUBLE = new JavaClass("java.lang", "Double", Kind.CLASS);
32
 	public static final JavaClass DOUBLE = new JavaClass("java.lang", "Double", Kind.CLASS);
33
 	public static final JavaClass CHARACTER = new JavaClass("java.lang", "Character", Kind.CLASS);
33
 	public static final JavaClass CHARACTER = new JavaClass("java.lang", "Character", Kind.CLASS);
34
 	public static final JavaClass COLLECTION = new JavaClass("java.util", "Collection", Kind.INTERFACE);
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
 	public static final JavaClass SHARED = new JavaClass("zsynthetic", "Shared", Kind.CLASS);
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 View File

32
 import org.openzen.zenscript.javashared.JavaCompiledModule;
32
 import org.openzen.zenscript.javashared.JavaCompiledModule;
33
 import org.openzen.zenscript.javashared.JavaContext;
33
 import org.openzen.zenscript.javashared.JavaContext;
34
 import org.openzen.zenscript.javashared.JavaMethod;
34
 import org.openzen.zenscript.javashared.JavaMethod;
35
+import org.openzen.zenscript.javashared.JavaModifiers;
35
 import org.openzen.zenscript.javashared.JavaVariantOption;
36
 import org.openzen.zenscript.javashared.JavaVariantOption;
36
 
37
 
37
 /**
38
 /**
94
 		
95
 		
95
 		{
96
 		{
96
 			JavaNativeClass iterator = new JavaNativeClass(JavaClass.ITERATOR);
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
 			iterator.addInstanceMethod("hasNext", "hasNext", "()Z");
99
 			iterator.addInstanceMethod("hasNext", "hasNext", "()Z");
98
 			iterator.addInstanceMethod("next", "next", "()Ljava/lang/Object;");
100
 			iterator.addInstanceMethod("next", "next", "()Ljava/lang/Object;");
99
 			nativeClasses.put("stdlib::Iterator", iterator);
101
 			nativeClasses.put("stdlib::Iterator", iterator);

+ 1
- 1
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/BaseMemberCompiler.java View File

84
 			output.append("abstract ");
84
 			output.append("abstract ");
85
 		if (Modifiers.isStatic(modifiers))
85
 		if (Modifiers.isStatic(modifiers))
86
 			output.append("static ");
86
 			output.append("static ");
87
-		if (Modifiers.isFinal(modifiers))
87
+		if (Modifiers.isFinal(modifiers) && !definition.isInterface())
88
 			output.append("final ");
88
 			output.append("final ");
89
 	}
89
 	}
90
 	
90
 	

+ 2
- 1
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/FormattingUtils.java View File

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
 		if (arguments == null || arguments.typeArguments == null)
49
 		if (arguments == null || arguments.typeArguments == null)
50
 			throw new IllegalArgumentException("Arguments cannot be null!");
50
 			throw new IllegalArgumentException("Arguments cannot be null!");
51
 		
51
 		
61
 			}
61
 			}
62
 			result.append(">");
62
 			result.append(">");
63
 		}
63
 		}
64
+		result.append(name);
64
 		result.append("(");
65
 		result.append("(");
65
 		int index = 0;
66
 		int index = 0;
66
 		for (Expression argument : arguments.arguments) {
67
 		for (Expression argument : arguments.arguments) {

+ 0
- 1
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/JavaMemberCompiler.java View File

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

+ 11
- 16
JavaSourceCompiler/src/main/java/org/openzen/zenscript/javasource/JavaSourceExpressionFormatter.java View File

203
 				StringBuilder output = new StringBuilder();
203
 				StringBuilder output = new StringBuilder();
204
 				output.append(getValue(target).value);
204
 				output.append(getValue(target).value);
205
 				output.append('.');
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
 				return new ExpressionString(output.toString(), JavaOperator.CALL);
207
 				return new ExpressionString(output.toString(), JavaOperator.CALL);
209
 			}
208
 			}
210
 			default:
209
 			default:
227
 		StringBuilder result = new StringBuilder();
226
 		StringBuilder result = new StringBuilder();
228
 		result.append(scope.type(method.cls));
227
 		result.append(scope.type(method.cls));
229
 		result.append('.');
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
 		return new ExpressionString(result.toString(), JavaOperator.CALL);
230
 		return new ExpressionString(result.toString(), JavaOperator.CALL);
233
 	}
231
 	}
234
 
232
 
394
 	@Override
392
 	@Override
395
 	public ExpressionString visitConstructorThisCall(ConstructorThisCallExpression expression) {
393
 	public ExpressionString visitConstructorThisCall(ConstructorThisCallExpression expression) {
396
 		StringBuilder result = new StringBuilder();
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
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
396
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
400
 	}
397
 	}
401
 
398
 
402
 	@Override
399
 	@Override
403
 	public ExpressionString visitConstructorSuperCall(ConstructorSuperCallExpression expression) {
400
 	public ExpressionString visitConstructorSuperCall(ConstructorSuperCallExpression expression) {
404
 		StringBuilder result = new StringBuilder();
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
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
403
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
408
 	}
404
 	}
409
 
405
 
500
 	@Override
496
 	@Override
501
 	public ExpressionString visitGlobalCall(GlobalCallExpression expression) {
497
 	public ExpressionString visitGlobalCall(GlobalCallExpression expression) {
502
 		StringBuilder result = new StringBuilder();
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
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
500
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
506
 	}
501
 	}
507
 
502
 
566
 				StringBuilder output = new StringBuilder();
561
 				StringBuilder output = new StringBuilder();
567
 				output.append(scope.type(method.cls));
562
 				output.append(scope.type(method.cls));
568
 				output.append('.');
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
 				return new ExpressionString(output.toString(), JavaOperator.CALL);
565
 				return new ExpressionString(output.toString(), JavaOperator.CALL);
572
 			}
566
 			}
573
 			case CONSTRUCTOR: {
567
 			case CONSTRUCTOR: {
574
 				StringBuilder output = new StringBuilder();
568
 				StringBuilder output = new StringBuilder();
575
 				output.append("new ");
569
 				output.append("new ");
576
 				output.append(scope.type(expression.type, method.cls));
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
 				return new ExpressionString(output.toString(), JavaOperator.PRIMARY);
572
 				return new ExpressionString(output.toString(), JavaOperator.PRIMARY);
579
 			}
573
 			}
580
 			default:
574
 			default:
663
 
657
 
664
 	@Override
658
 	@Override
665
 	public ExpressionString visitSetter(SetterExpression expression) {
659
 	public ExpressionString visitSetter(SetterExpression expression) {
660
+		JavaMethod setter = context.getJavaMethod(expression.setter);
666
 		return new ExpressionString(
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
 	@Override
666
 	@Override
771
 		
766
 		
772
 		StringBuilder result = new StringBuilder();
767
 		StringBuilder result = new StringBuilder();
773
 		result.append("new ").append(scope.type(option.variantOptionClass));
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
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
770
 		return new ExpressionString(result.toString(), JavaOperator.PRIMARY);
776
 	}
771
 	}
777
 
772
 

+ 17
- 0
ScriptingExample/src/main/java/org/openzen/zenscript/scriptingexample/TestInterface.java View File

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 View File

3
  * To change this template file, choose Tools | Templates
3
  * To change this template file, choose Tools | Templates
4
  * and open the template in the editor.
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.Iterator;
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
  * @author Hoofdgebruiker
14
  * @author Hoofdgebruiker
16
  */
15
  */
17
-public class LiveConcatList<T> implements Destructible, LiveList<T> {
16
+public class LiveConcatList<T> implements AutoCloseable, LiveList<T> {
18
 	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
17
 	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
19
 	private final LiveList<T> a;
18
 	private final LiveList<T> a;
20
 	private final LiveList<T> b;
19
 	private final LiveList<T> b;
43
 			return result;
42
 			return result;
44
 		
43
 		
45
 		result = b.indexOf(value);
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
 	@Override
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
 	@Override
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
 	@Override
58
 	@Override
114
 	private class SecondListListener implements Listener<T> {
113
 	private class SecondListListener implements Listener<T> {
115
 		@Override
114
 		@Override
116
 		public void onInserted(int index, T value) {
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
 		@Override
119
 		@Override
121
 		public void onChanged(int index, T oldValue, T newValue) {
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
 		@Override
124
 		@Override
126
 		public void onRemoved(int index, T oldValue) {
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 View File

3
  * To change this template file, choose Tools | Templates
3
  * To change this template file, choose Tools | Templates
4
  * and open the template in the editor.
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.Collections;
8
 import java.util.Collections;
9
 import java.util.Iterator;
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
 	}
32
 	}
33
 	
33
 	
34
 	@Override
34
 	@Override
35
-	public int size() {
35
+	public int getLength() {
36
 		return 0;
36
 		return 0;
37
 	}
37
 	}
38
 	
38
 	
39
 	@Override
39
 	@Override
40
-	public T get(int index) {
40
+	public T getAt(int index) {
41
 		throw new ArrayIndexOutOfBoundsException(index);
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 View File

3
  * To change this template file, choose Tools | Templates
3
  * To change this template file, choose Tools | Templates
4
  * and open the template in the editor.
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.ArrayList;
8
 import java.util.ArrayList;
9
 import java.util.Iterator;
9
 import java.util.Iterator;
10
 import java.util.List;
10
 import java.util.List;
11
 import java.util.function.Function;
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
 	private final ListenerList<Listener<U>> listeners = new ListenerList<>();
17
 	private final ListenerList<Listener<U>> listeners = new ListenerList<>();
22
 	private final Function<T, U> projection;
18
 	private final Function<T, U> projection;
23
 	private final List<U> mapped;
19
 	private final List<U> mapped;
43
 	}
39
 	}
44
 	
40
 	
45
 	@Override
41
 	@Override
46
-	public int size() {
42
+	public int getLength() {
47
 		return mapped.size();
43
 		return mapped.size();
48
 	}
44
 	}
49
 
45
 
50
 	@Override
46
 	@Override
51
-	public U get(int index) {
47
+	public U getAt(int index) {
52
 		return mapped.get(index);
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 View File

3
  * To change this template file, choose Tools | Templates
3
  * To change this template file, choose Tools | Templates
4
  * and open the template in the editor.
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
 import java.util.function.Predicate;
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
 	private final LiveObject<T> source;
17
 	private final LiveObject<T> source;
20
 	private final Predicate<T> predicate;
18
 	private final Predicate<T> predicate;
21
-	private final ListenerHandle<LiveObject.Listener<T>> sourceListener;
19
+	private final ListenerHandle<BiConsumer<T, T>> sourceListener;
22
 	private boolean value;
20
 	private boolean value;
23
 	
21
 	
24
 	public LivePredicateBool(LiveObject<T> source, Predicate<T> predicate) {
22
 	public LivePredicateBool(LiveObject<T> source, Predicate<T> predicate) {
39
 	}
37
 	}
40
 
38
 
41
 	@Override
39
 	@Override
42
-	public ListenerHandle<Listener> addListener(Listener listener) {
40
+	public ListenerHandle<FunctionBoolBoolToVoid> addListener(FunctionBoolBoolToVoid listener) {
43
 		return listeners.add(listener);
41
 		return listeners.add(listener);
44
 	}
42
 	}
45
 	
43
 	
49
 		
47
 		
50
 		boolean oldValue = this.value;
48
 		boolean oldValue = this.value;
51
 		this.value = value;
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
 	@Override
53
 	@Override
56
-	public void onUpdated(T oldValue, T newValue) {
54
+	public void accept(T oldValue, T newValue) {
57
 		setValueInternal(predicate.test(newValue));
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 View File

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
 import java.util.Iterator;
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
 public class LivePrefixedList<T> implements LiveList<T> {
8
 public class LivePrefixedList<T> implements LiveList<T> {
17
 	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
9
 	private final ListenerList<Listener<T>> listeners = new ListenerList<>();
18
 	private final T prefix;
10
 	private final T prefix;
73
 	}
65
 	}
74
 
66
 
75
 	@Override
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
 	@Override
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
 	@Override
77
 	@Override

+ 4
- 4
Shared/src/main/java/live/MutableLiveBool.java View File

2
 
2
 
3
 public interface MutableLiveBool extends LiveBool {
3
 public interface MutableLiveBool extends LiveBool {
4
     void setValue(boolean value);
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 View File

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 View File

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 View File

3
  * To change this template file, choose Tools | Templates
3
  * To change this template file, choose Tools | Templates
4
  * and open the template in the editor.
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.ArrayList;
8
 import java.util.ArrayList;
9
 import java.util.Collections;
9
 import java.util.Collections;
10
 import java.util.Comparator;
10
 import java.util.Comparator;
11
 import java.util.Iterator;
11
 import java.util.Iterator;
12
 import java.util.List;
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
 	}
49
 	}
49
 
50
 
50
 	@Override
51
 	@Override
51
-	public int size() {
52
+	public int getLength() {
52
 		return sorted.size();
53
 		return sorted.size();
53
 	}
54
 	}
54
 
55
 
55
 	@Override
56
 	@Override
56
-	public T get(int index) {
57
+	public T getAt(int index) {
57
 		return sorted.get(index);
58
 		return sorted.get(index);
58
 	}
59
 	}
59
 
60
 

+ 6
- 2
Shared/src/main/java/org/openzen/zencode/shared/CompileException.java View File

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

Loading…
Cancel
Save