Bläddra i källkod

- Continued work on borderless window (but: text rendering changes!)

- Improved shadow code
Stan Hebben 6 år sedan
förälder
incheckning
53efeba9ce
61 ändrade filer med 1542 tillägg och 520 borttagningar
  1. 3
    5
      DrawableGui/src/main/java/org/openzen/drawablegui/DCanvas.java
  2. 10
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/DPath.java
  3. 3
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/DUIContext.java
  4. 35
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/DUIWindow.java
  5. 184
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/border/DCustomWindowBorder.java
  6. 35
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/border/DCustomWindowBorderStyle.java
  7. 39
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/live/ImmutableLiveBool.java
  8. 6
    18
      DrawableGui/src/main/java/org/openzen/drawablegui/live/LiveBool.java
  9. 64
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/live/LivePredicateBool.java
  10. 46
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/live/SimpleLiveBool.java
  11. 2
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollBarStyle.java
  12. 6
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollPane.java
  13. 1
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/style/DDimension.java
  14. 1
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/style/DDpDimension.java
  15. 5
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/style/DEmptyStyleDefinition.java
  16. 1
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/style/DPxDimension.java
  17. 26
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/style/DShadow.java
  18. 2
    1
      DrawableGui/src/main/java/org/openzen/drawablegui/style/DStyleDefinition.java
  19. 25
    7
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingCanvas.java
  20. 11
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingGraphicsContext.java
  21. 5
    0
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingRoot.java
  22. 117
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingWindow.java
  23. 2
    2
      DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeViewStyle.java
  24. 2
    2
      DrawableGuiIconConverter/src/main/java/org/openzen/drawablegui/iconconverter/Main.java
  25. 1
    1
      IDE/src/main/java/org/openzen/zenscript/ide/Main.java
  26. 3
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEAspectToolbar.java
  27. 8
    6
      IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEWindow.java
  28. 3
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/AddBoxIcon.java
  29. 15
    18
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/CloseIcon.java
  30. 26
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/CodeIcon.java
  31. 0
    47
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableFolderIcon.java
  32. 0
    59
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableLibraryIcon.java
  33. 0
    53
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableModuleIcon.java
  34. 0
    60
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableProjectIcon.java
  35. 0
    57
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableSaveIcon.java
  36. 21
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/FolderIcon.java
  37. 32
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/LibraryIcon.java
  38. 26
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ModuleIcon.java
  39. 33
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ProjectIcon.java
  40. 32
    4
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/SaveIcon.java
  41. 41
    0
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ScalableCloseIcon.java
  42. 42
    0
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ScalableMaximizeIcon.java
  43. 43
    0
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ScalableMinimizeIcon.java
  44. 5
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/SettingsIcon.java
  45. 71
    10
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControl.java
  46. 46
    0
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControlStyle.java
  47. 71
    15
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButton.java
  48. 13
    13
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButtonStyle.java
  49. 23
    19
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarStyle.java
  50. 178
    64
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarView.java
  51. 142
    0
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/WindowActionButton.java
  52. 14
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditor.java
  53. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditorStyle.java
  54. 6
    3
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/TokenRelexer.java
  55. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/LibraryTreeNode.java
  56. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ModuleTreeNode.java
  57. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/PackageTreeNode.java
  58. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectOverviewNode.java
  59. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectTreeNode.java
  60. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/RootTreeNode.java
  61. 2
    2
      IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/SourceFileTreeNode.java

+ 3
- 5
DrawableGui/src/main/java/org/openzen/drawablegui/DCanvas.java Visa fil

@@ -6,6 +6,7 @@
6 6
 package org.openzen.drawablegui;
7 7
 
8 8
 import org.openzen.drawablegui.listeners.DIRectangle;
9
+import org.openzen.drawablegui.style.DShadow;
9 10
 
10 11
 /**
11 12
  *
@@ -50,12 +51,9 @@ public interface DCanvas {
50 51
 	 * 
51 52
 	 * @param path
52 53
 	 * @param transform
53
-	 * @param color
54
-	 * @param dx
55
-	 * @param dy
56
-	 * @param radius 
54
+	 * @param shadow
57 55
 	 */
58
-	void shadowPath(DPath path, DTransform2D transform, int color, float dx, float dy, float radius);
56
+	void shadowPath(DPath path, DTransform2D transform, DShadow shadow);
59 57
 	
60 58
 	/**
61 59
 	 * Fills a rectangle.

+ 10
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/DPath.java Visa fil

@@ -34,6 +34,16 @@ public interface DPath {
34 34
 		};
35 35
 	}
36 36
 	
37
+	public static DPath rectangle(float x, float y, float width, float height) {
38
+		return tracer -> {
39
+			tracer.moveTo(x, y);
40
+			tracer.lineTo(x + width, y);
41
+			tracer.lineTo(x + width, y + height);
42
+			tracer.lineTo(x, y + height);
43
+			tracer.close();
44
+		};
45
+	}
46
+	
37 47
 	public static DPath roundedRectangle(float x, float y, float width, float height, float radius) {
38 48
 		return tracer -> {
39 49
 			float c = radius - radius * 0.551915024494f;

+ 3
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/DUIContext.java Visa fil

@@ -6,6 +6,7 @@
6 6
 package org.openzen.drawablegui;
7 7
 
8 8
 import org.openzen.drawablegui.listeners.DIRectangle;
9
+import org.openzen.drawablegui.live.LiveObject;
9 10
 import org.openzen.drawablegui.style.DStyleSheets;
10 11
 
11 12
 /**
@@ -35,6 +36,8 @@ public interface DUIContext {
35 36
 	
36 37
 	DFontMetrics getFontMetrics(DFont font);
37 38
 	
39
+	DUIWindow getWindow();
40
+		
38 41
 	enum Cursor {
39 42
 		NORMAL,
40 43
 		HAND,

+ 35
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/DUIWindow.java Visa fil

@@ -0,0 +1,35 @@
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;
7
+
8
+import org.openzen.drawablegui.live.LiveBool;
9
+import org.openzen.drawablegui.live.LiveObject;
10
+
11
+/**
12
+ *
13
+ * @author Hoofdgebruiker
14
+ */
15
+public interface DUIWindow {
16
+	public boolean hasTitleBar();
17
+	
18
+	public void close();
19
+	
20
+	public void maximize();
21
+	
22
+	public void restore();
23
+	
24
+	public void minimize();
25
+	
26
+	LiveObject<State> getWindowState();
27
+	
28
+	LiveBool getActive();
29
+	
30
+	enum State {
31
+		NORMAL,
32
+		MAXIMIZED,
33
+		MINIMIZED
34
+	};
35
+}

+ 184
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/border/DCustomWindowBorder.java Visa fil

@@ -0,0 +1,184 @@
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.border;
7
+
8
+import org.openzen.drawablegui.DCanvas;
9
+import org.openzen.drawablegui.DComponent;
10
+import org.openzen.drawablegui.DDimensionPreferences;
11
+import org.openzen.drawablegui.DMouseEvent;
12
+import org.openzen.drawablegui.DPath;
13
+import org.openzen.drawablegui.DTransform2D;
14
+import org.openzen.drawablegui.DUIContext;
15
+import org.openzen.drawablegui.DUIWindow;
16
+import org.openzen.drawablegui.listeners.DIRectangle;
17
+import org.openzen.drawablegui.listeners.ListenerHandle;
18
+import org.openzen.drawablegui.live.ImmutableLiveObject;
19
+import org.openzen.drawablegui.live.LiveBool;
20
+import org.openzen.drawablegui.live.LiveObject;
21
+import org.openzen.drawablegui.style.DStyleClass;
22
+import org.openzen.drawablegui.style.DStylePath;
23
+
24
+/**
25
+ *
26
+ * @author Hoofdgebruiker
27
+ */
28
+public class DCustomWindowBorder implements DComponent {
29
+	private final DStyleClass styleClass;
30
+	private final DComponent content;
31
+	private final LiveObject<DDimensionPreferences> preferences = new ImmutableLiveObject<>(DDimensionPreferences.EMPTY);
32
+	
33
+	private DUIContext context;
34
+	private DCustomWindowBorderStyle style;
35
+	private DIRectangle bounds;
36
+	private DPath border;
37
+	
38
+	private LiveBool active;
39
+	private LiveObject<DUIWindow.State> state;
40
+	
41
+	private ListenerHandle<LiveObject.Listener<DUIWindow.State>> stateListener;
42
+	private ListenerHandle<LiveBool.Listener> activeListener;
43
+	
44
+	public DCustomWindowBorder(DStyleClass styleClass, DComponent content) {
45
+		this.styleClass = styleClass;
46
+		this.content = content;
47
+	}
48
+
49
+	@Override
50
+	public void setContext(DStylePath parent, DUIContext context) {
51
+		this.context = context;
52
+		content.setContext(parent, context);
53
+		
54
+		state = context.getWindow().getWindowState();
55
+		active = context.getWindow().getActive();
56
+		stateListener = state.addListener(this::onStateChanged);
57
+		activeListener = active.addListener(this::onActiveChanged);
58
+		
59
+		DStylePath path = parent.getChild("customwindowborder", styleClass);
60
+		style = new DCustomWindowBorderStyle(context.getStylesheets().get(context, path));
61
+		
62
+		if (bounds != null)
63
+			layout();
64
+	}
65
+
66
+	@Override
67
+	public LiveObject<DDimensionPreferences> getDimensionPreferences() {
68
+		return preferences;
69
+	}
70
+
71
+	@Override
72
+	public DIRectangle getBounds() {
73
+		return bounds;
74
+	}
75
+
76
+	@Override
77
+	public void setBounds(DIRectangle bounds) {
78
+		this.bounds = bounds;
79
+		layout();
80
+	}
81
+	
82
+	private void layout() {	
83
+		if (style == null)
84
+			return;
85
+		
86
+		if (state.getValue() != DUIWindow.State.MAXIMIZED) {
87
+			border = DPath.rectangle(
88
+				bounds.x + style.padding,
89
+				bounds.y + style.padding,
90
+				bounds.width - 2 * style.padding - style.borderWidth,
91
+				bounds.height - 2 * style.padding - style.borderWidth);
92
+			
93
+			int spacing = style.borderWidth + style.padding;
94
+			DIRectangle inner = new DIRectangle(
95
+					bounds.x + spacing,
96
+					bounds.y + spacing,
97
+					bounds.width - 2 * spacing,
98
+					bounds.height - 2 * spacing);
99
+
100
+			content.setBounds(inner);
101
+		} else {
102
+			content.setBounds(bounds);
103
+		}
104
+		context.repaint(bounds);
105
+	}
106
+
107
+	@Override
108
+	public void paint(DCanvas canvas) {
109
+		if (state.getValue() != DUIWindow.State.MAXIMIZED) {
110
+			int spacing = style.borderWidth + style.padding;
111
+			DIRectangle canvasBounds = canvas.getBounds();
112
+			if (canvasBounds == null
113
+					|| canvasBounds.x < bounds.x + spacing
114
+					|| canvasBounds.y < bounds.y + spacing
115
+					|| canvasBounds.x + canvasBounds.width > bounds.x + bounds.width - spacing
116
+					|| canvasBounds.y + canvasBounds.height > bounds.y + bounds.height - spacing) {
117
+				canvas.shadowPath(border, DTransform2D.IDENTITY, style.shadow);
118
+				canvas.fillPath(border, DTransform2D.IDENTITY, style.backgroundColor);
119
+				canvas.strokePath(
120
+						border,
121
+						DTransform2D.IDENTITY,
122
+						active.getValue() ? style.focusedBorderColor : style.inactiveBorderColor,
123
+						style.borderWidth);
124
+			}
125
+		} else {
126
+			canvas.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height, style.backgroundColor);
127
+		}
128
+		
129
+		content.paint(canvas);
130
+	}
131
+
132
+	@Override
133
+	public void onMouseEnter(DMouseEvent e) {
134
+		content.onMouseEnter(e);
135
+	}
136
+	
137
+	@Override
138
+	public void onMouseExit(DMouseEvent e) {
139
+		content.onMouseExit(e);
140
+	}
141
+	
142
+	@Override
143
+	public void onMouseMove(DMouseEvent e) {
144
+		content.onMouseMove(e);
145
+	}
146
+	
147
+	@Override
148
+	public void onMouseDrag(DMouseEvent e) {
149
+		content.onMouseDrag(e);
150
+	}
151
+	
152
+	@Override
153
+	public void onMouseClick(DMouseEvent e) {
154
+		content.onMouseClick(e);
155
+	}
156
+	
157
+	@Override
158
+	public void onMouseDown(DMouseEvent e) {
159
+		content.onMouseDown(e);
160
+	}
161
+	
162
+	@Override
163
+	public void onMouseRelease(DMouseEvent e) {
164
+		content.onMouseRelease(e);
165
+	}
166
+	
167
+	@Override
168
+	public void onMouseScroll(DMouseEvent e) {
169
+		content.onMouseScroll(e);
170
+	}
171
+	
172
+	@Override
173
+	public void close() {
174
+		
175
+	}
176
+	
177
+	private void onStateChanged(DUIWindow.State oldValue, DUIWindow.State newValue) {
178
+		layout();
179
+	}
180
+	
181
+	private void onActiveChanged(boolean oldValue, boolean newValue) {
182
+		context.repaint(bounds);
183
+	}
184
+}

+ 35
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/border/DCustomWindowBorderStyle.java Visa fil

@@ -0,0 +1,35 @@
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.border;
7
+
8
+import org.openzen.drawablegui.style.DDpDimension;
9
+import org.openzen.drawablegui.style.DPxDimension;
10
+import org.openzen.drawablegui.style.DShadow;
11
+import org.openzen.drawablegui.style.DStyleDefinition;
12
+
13
+/**
14
+ *
15
+ * @author Hoofdgebruiker
16
+ */
17
+public class DCustomWindowBorderStyle {
18
+	public final int padding;
19
+	public final DShadow shadow;
20
+	public final int borderWidth;
21
+	public final int backgroundColor;
22
+	
23
+	public final int focusedBorderColor;
24
+	public final int inactiveBorderColor;
25
+	
26
+	public DCustomWindowBorderStyle(DStyleDefinition style) {
27
+		padding = style.getDimension("padding", new DDpDimension(8));
28
+		shadow = style.getShadow("shadow", context -> new DShadow(0x80888888, 0, 0, 6 * context.getScale()));
29
+		borderWidth = style.getDimension("borderWidth", new DPxDimension(1));
30
+		backgroundColor = style.getColor("backgroundColor", 0xFFEEEEEE);
31
+		
32
+		focusedBorderColor = style.getColor("focusedBorderColor", 0xFF18B0FB);
33
+		inactiveBorderColor = style.getColor("inactiveBorderColor", 0xFF515252);
34
+	}
35
+}

+ 39
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/live/ImmutableLiveBool.java Visa fil

@@ -0,0 +1,39 @@
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.DummyListenerHandle;
9
+import org.openzen.drawablegui.listeners.ListenerHandle;
10
+
11
+/**
12
+ *
13
+ * @author Hoofdgebruiker
14
+ */
15
+public class ImmutableLiveBool implements LiveBool {
16
+	public static final ImmutableLiveBool TRUE = new ImmutableLiveBool(true);
17
+	public static final ImmutableLiveBool FALSE = new ImmutableLiveBool(false);
18
+	
19
+	private final boolean value;
20
+	
21
+	private ImmutableLiveBool(boolean value) {
22
+		this.value = value;
23
+	}
24
+
25
+	@Override
26
+	public boolean getValue() {
27
+		return value;
28
+	}
29
+
30
+	@Override
31
+	public void setValue(boolean value) {
32
+		throw new UnsupportedOperationException("Cannot modify an immutable value");
33
+	}
34
+
35
+	@Override
36
+	public ListenerHandle<Listener> addListener(Listener listener) {
37
+		return new DummyListenerHandle<>(listener);
38
+	}
39
+}

+ 6
- 18
DrawableGui/src/main/java/org/openzen/drawablegui/live/LiveBool.java Visa fil

@@ -6,33 +6,21 @@
6 6
 package org.openzen.drawablegui.live;
7 7
 
8 8
 import org.openzen.drawablegui.listeners.ListenerHandle;
9
-import org.openzen.drawablegui.listeners.ListenerList;
10 9
 
11 10
 /**
12 11
  *
13 12
  * @author Hoofdgebruiker
14 13
  */
15
-public class LiveBool {
16
-	private final ListenerList<Listener> listeners = new ListenerList<>();
17
-	private boolean value;
14
+public interface LiveBool {
15
+	public boolean getValue();
18 16
 	
19
-	public boolean getValue() {
20
-		return value;
21
-	}
22
-	
23
-	public void setValue(boolean value) {
24
-		boolean oldValue = this.value;
25
-		this.value = value;
26
-		listeners.accept(listener -> listener.onChanged(oldValue, value));
27
-	}
17
+	public void setValue(boolean value);
28 18
 	
29
-	public void toggle() {
30
-		setValue(!value);
19
+	default void toggle() {
20
+		setValue(!getValue());
31 21
 	}
32 22
 	
33
-	public ListenerHandle<Listener> addListener(Listener listener) {
34
-		return listeners.add(listener);
35
-	}
23
+	public ListenerHandle<Listener> addListener(Listener listener);
36 24
 	
37 25
 	public interface Listener {
38 26
 		void onChanged(boolean oldValue, boolean newValue);

+ 64
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/live/LivePredicateBool.java Visa fil

@@ -0,0 +1,64 @@
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 java.io.Closeable;
9
+import java.util.function.Predicate;
10
+import org.openzen.drawablegui.listeners.ListenerHandle;
11
+import org.openzen.drawablegui.listeners.ListenerList;
12
+
13
+/**
14
+ *
15
+ * @author Hoofdgebruiker
16
+ */
17
+public class LivePredicateBool<T> implements LiveBool, Closeable, LiveObject.Listener<T> {
18
+	private final ListenerList<LiveBool.Listener> listeners = new ListenerList<>();
19
+	private final LiveObject<T> source;
20
+	private final Predicate<T> predicate;
21
+	private final ListenerHandle<LiveObject.Listener<T>> sourceListener;
22
+	private boolean value;
23
+	
24
+	public LivePredicateBool(LiveObject<T> source, Predicate<T> predicate) {
25
+		this.source = source;
26
+		this.predicate = predicate;
27
+		this.sourceListener = source.addListener(this);
28
+		setValueInternal(predicate.test(source.getValue()));
29
+	}
30
+	
31
+	@Override
32
+	public void close() {
33
+		sourceListener.close();
34
+	}
35
+	
36
+	@Override
37
+	public void setValue(boolean value) {
38
+		throw new UnsupportedOperationException("Cannot modify a calculated value");
39
+	}
40
+
41
+	@Override
42
+	public boolean getValue() {
43
+		return value;
44
+	}
45
+
46
+	@Override
47
+	public ListenerHandle<Listener> addListener(Listener listener) {
48
+		return listeners.add(listener);
49
+	}
50
+	
51
+	private void setValueInternal(boolean value) {
52
+		if (value == this.value)
53
+			return;
54
+		
55
+		boolean oldValue = this.value;
56
+		this.value = value;
57
+		listeners.accept(listener -> listener.onChanged(oldValue, value));
58
+	}
59
+
60
+	@Override
61
+	public void onUpdated(T oldValue, T newValue) {
62
+		setValueInternal(predicate.test(newValue));
63
+	}
64
+}

+ 46
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/live/SimpleLiveBool.java Visa fil

@@ -0,0 +1,46 @@
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 SimpleLiveBool implements LiveBool {
16
+	private final ListenerList<LiveBool.Listener> listeners = new ListenerList<>();
17
+	private boolean value;
18
+	
19
+	public SimpleLiveBool() {
20
+		this(false);
21
+	}
22
+	
23
+	public SimpleLiveBool(boolean value) {
24
+		this.value = value;
25
+	}
26
+	
27
+	@Override
28
+	public boolean getValue() {
29
+		return value;
30
+	}
31
+	
32
+	@Override
33
+	public void setValue(boolean value) {
34
+		if (value == this.value)
35
+			return;
36
+		
37
+		boolean oldValue = this.value;
38
+		this.value = value;
39
+		listeners.accept(listener -> listener.onChanged(oldValue, value));
40
+	}
41
+	
42
+	@Override
43
+	public ListenerHandle<LiveBool.Listener> addListener(LiveBool.Listener listener) {
44
+		return listeners.add(listener);
45
+	}
46
+}

+ 2
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollBarStyle.java Visa fil

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.drawablegui.scroll;
7 7
 
8
-import org.openzen.drawablegui.dimension.DDimension;
9
-import org.openzen.drawablegui.dimension.DDpDimension;
8
+import org.openzen.drawablegui.style.DDimension;
9
+import org.openzen.drawablegui.style.DDpDimension;
10 10
 import org.openzen.drawablegui.DUIContext;
11 11
 import org.openzen.drawablegui.style.DStyleDefinition;
12 12
 

+ 6
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollPane.java Visa fil

@@ -19,6 +19,7 @@ import org.openzen.drawablegui.live.LiveInt;
19 19
 import org.openzen.drawablegui.live.LiveObject;
20 20
 import org.openzen.drawablegui.live.SimpleLiveInt;
21 21
 import org.openzen.drawablegui.DUIContext;
22
+import org.openzen.drawablegui.DUIWindow;
22 23
 import org.openzen.drawablegui.style.DStyleClass;
23 24
 import org.openzen.drawablegui.style.DStylePath;
24 25
 import org.openzen.drawablegui.style.DStyleSheets;
@@ -283,6 +284,11 @@ public class DScrollPane implements DComponent {
283 284
 		public DClipboard getClipboard() {
284 285
 			return context.getClipboard();
285 286
 		}
287
+
288
+		@Override
289
+		public DUIWindow getWindow() {
290
+			return context.getWindow();
291
+		}
286 292
 	}
287 293
 	
288 294
 	private class ScrollListener implements LiveInt.Listener {

DrawableGui/src/main/java/org/openzen/drawablegui/dimension/DDimension.java → DrawableGui/src/main/java/org/openzen/drawablegui/style/DDimension.java Visa fil

@@ -3,7 +3,7 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.dimension;
6
+package org.openzen.drawablegui.style;
7 7
 
8 8
 import org.openzen.drawablegui.DUIContext;
9 9
 

DrawableGui/src/main/java/org/openzen/drawablegui/dimension/DDpDimension.java → DrawableGui/src/main/java/org/openzen/drawablegui/style/DDpDimension.java Visa fil

@@ -3,7 +3,7 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.dimension;
6
+package org.openzen.drawablegui.style;
7 7
 
8 8
 import org.openzen.drawablegui.DUIContext;
9 9
 

+ 5
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/style/DEmptyStyleDefinition.java Visa fil

@@ -9,7 +9,6 @@ import java.util.function.Function;
9 9
 import org.openzen.drawablegui.DFont;
10 10
 import org.openzen.drawablegui.DUIContext;
11 11
 import org.openzen.drawablegui.border.DBorder;
12
-import org.openzen.drawablegui.dimension.DDimension;
13 12
 
14 13
 /**
15 14
  *
@@ -37,6 +36,11 @@ public class DEmptyStyleDefinition implements DStyleDefinition {
37 36
 		return defaultValue;
38 37
 	}
39 38
 
39
+	@Override
40
+	public DShadow getShadow(String name, Function<DUIContext, DShadow> defaultValue) {
41
+		return defaultValue.apply(context);
42
+	}
43
+
40 44
 	@Override
41 45
 	public DFont getFont(String name, Function<DUIContext, DFont> defaultValue) {
42 46
 		return defaultValue.apply(context);

DrawableGui/src/main/java/org/openzen/drawablegui/dimension/DPxDimension.java → DrawableGui/src/main/java/org/openzen/drawablegui/style/DPxDimension.java Visa fil

@@ -3,7 +3,7 @@
3 3
  * To change this template file, choose Tools | Templates
4 4
  * and open the template in the editor.
5 5
  */
6
-package org.openzen.drawablegui.dimension;
6
+package org.openzen.drawablegui.style;
7 7
 
8 8
 import org.openzen.drawablegui.DUIContext;
9 9
 

+ 26
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/style/DShadow.java Visa fil

@@ -0,0 +1,26 @@
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.style;
7
+
8
+/**
9
+ *
10
+ * @author Hoofdgebruiker
11
+ */
12
+public class DShadow {
13
+	public static final DShadow NONE = new DShadow(0, 0, 0, 0);
14
+	
15
+	public final int color;
16
+	public final float offsetX;
17
+	public final float offsetY;
18
+	public final float radius;
19
+	
20
+	public DShadow(int color, float offsetX, float offsetY, float radius) {
21
+		this.color = color;
22
+		this.offsetX = offsetX;
23
+		this.offsetY = offsetY;
24
+		this.radius = radius;
25
+	}
26
+}

+ 2
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/style/DStyleDefinition.java Visa fil

@@ -9,7 +9,6 @@ import java.util.function.Function;
9 9
 import org.openzen.drawablegui.DFont;
10 10
 import org.openzen.drawablegui.DUIContext;
11 11
 import org.openzen.drawablegui.border.DBorder;
12
-import org.openzen.drawablegui.dimension.DDimension;
13 12
 
14 13
 /**
15 14
  *
@@ -22,6 +21,8 @@ public interface DStyleDefinition {
22 21
 	
23 22
 	public int getColor(String name, int defaultValue);
24 23
 	
24
+	public DShadow getShadow(String name, Function<DUIContext, DShadow> defaultValue);
25
+	
25 26
 	public DFont getFont(String name, Function<DUIContext, DFont> defaultValue);
26 27
 	
27 28
 	public DBorder getBorder(String name, Function<DUIContext, DBorder> defaultValue);

+ 25
- 7
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingCanvas.java Visa fil

@@ -25,6 +25,7 @@ import org.openzen.drawablegui.listeners.DIRectangle;
25 25
 import org.openzen.drawablegui.DPath;
26 26
 import org.openzen.drawablegui.DPathBoundsCalculator;
27 27
 import org.openzen.drawablegui.DUIContext;
28
+import org.openzen.drawablegui.style.DShadow;
28 29
 
29 30
 /**
30 31
  *
@@ -91,6 +92,9 @@ public class SwingCanvas implements DCanvas {
91 92
 
92 93
 	@Override
93 94
 	public void strokePath(DPath path, DTransform2D transform, int color, float lineWidth) {
95
+		if (color == 0)
96
+			return;
97
+		
94 98
 		AffineTransform old = g.getTransform();
95 99
 		GeneralPath jPath = context.getPath(path);
96 100
 		g.setColor(new Color(color, true));
@@ -102,6 +106,9 @@ public class SwingCanvas implements DCanvas {
102 106
 
103 107
 	@Override
104 108
 	public void fillPath(DPath path, DTransform2D transform, int color) {
109
+		if (color == 0)
110
+			return;
111
+		
105 112
 		AffineTransform old = g.getTransform();
106 113
 		GeneralPath jPath = context.getPath(path);
107 114
 		g.setColor(new Color(color, true));
@@ -111,9 +118,17 @@ public class SwingCanvas implements DCanvas {
111 118
 	}
112 119
 
113 120
 	@Override
114
-	public void shadowPath(DPath path, DTransform2D transform, int color, float dx, float dy, float radius) {
115
-		DIRectangle bounds = DPathBoundsCalculator.getBounds(path, transform.offset(dx, dy));
116
-		int offset = 2 * (int)Math.ceil(radius);
121
+	public void shadowPath(DPath path, DTransform2D transform, DShadow shadow) {
122
+		if (shadow.color == 0)
123
+			return;
124
+		
125
+		if (shadow.radius == 0) {
126
+			fillPath(path, transform, shadow.color);
127
+			return;
128
+		}
129
+		
130
+		DIRectangle bounds = DPathBoundsCalculator.getBounds(path, transform.offset(shadow.offsetX, shadow.offsetY));
131
+		int offset = 2 * (int)Math.ceil(shadow.radius);
117 132
 		
118 133
 		GeneralPath jPath = context.getPath(path);
119 134
 		
@@ -121,17 +136,20 @@ public class SwingCanvas implements DCanvas {
121 136
 		Graphics2D imageG = (Graphics2D) image.getGraphics();
122 137
 		
123 138
 		imageG.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
124
-		imageG.setColor(new Color(color, true));
125
-		imageG.setTransform(getTransform(transform.offset(offset + dx - bounds.x, offset + dy - bounds.y)));
139
+		imageG.setColor(new Color(shadow.color, true));
140
+		imageG.setTransform(getTransform(transform.offset(offset + shadow.offsetX - bounds.x, offset + shadow.offsetY - bounds.y)));
126 141
 		imageG.fill(jPath);
127 142
 		
128
-		image = getGaussianBlurFilter((int)Math.ceil(radius), true).filter(image, null);
129
-		image = getGaussianBlurFilter((int)Math.ceil(radius), false).filter(image, null);
143
+		image = getGaussianBlurFilter((int)Math.ceil(shadow.radius), true).filter(image, null);
144
+		image = getGaussianBlurFilter((int)Math.ceil(shadow.radius), false).filter(image, null);
130 145
 		g.drawImage(image, bounds.x - offset, bounds.y - offset, null);
131 146
 	}
132 147
 
133 148
 	@Override
134 149
 	public void fillRectangle(int x, int y, int width, int height, int color) {
150
+		if (color == 0)
151
+			return;
152
+		
135 153
 		g.setColor(new Color(color, true));
136 154
 		g.fillRect(x, y, width, height);
137 155
 	}

+ 11
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingGraphicsContext.java Visa fil

@@ -18,6 +18,7 @@ import org.openzen.drawablegui.DFontMetrics;
18 18
 import org.openzen.drawablegui.DPathTracer;
19 19
 import org.openzen.drawablegui.DTimerHandle;
20 20
 import org.openzen.drawablegui.DUIContext;
21
+import org.openzen.drawablegui.DUIWindow;
21 22
 import org.openzen.drawablegui.style.DStyleSheets;
22 23
 
23 24
 /**
@@ -31,6 +32,7 @@ public class SwingGraphicsContext implements DUIContext {
31 32
 	private final SwingRoot root;
32 33
 	private final JavaClipboard clipboard = new JavaClipboard();
33 34
 	private Graphics graphics;
35
+	private DUIWindow window;
34 36
 	
35 37
 	public SwingGraphicsContext(DStyleSheets stylesheets, float scale, SwingRoot root) {
36 38
 		this.stylesheets = stylesheets;
@@ -48,6 +50,10 @@ public class SwingGraphicsContext implements DUIContext {
48 50
 		return generalPath;
49 51
 	}
50 52
 	
53
+	public void setWindow(DUIWindow window) {
54
+		this.window = window;
55
+	}
56
+	
51 57
 	@Override
52 58
 	public DStyleSheets getStylesheets() {
53 59
 		return stylesheets;
@@ -125,6 +131,11 @@ public class SwingGraphicsContext implements DUIContext {
125 131
 	public DClipboard getClipboard() {
126 132
 		return clipboard;
127 133
 	}
134
+
135
+	@Override
136
+	public DUIWindow getWindow() {
137
+		return window;
138
+	}
128 139
 	
129 140
 	private class PathTracer implements DPathTracer {
130 141
 		private final GeneralPath path;

+ 5
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingRoot.java Visa fil

@@ -24,6 +24,7 @@ import org.openzen.drawablegui.listeners.DIRectangle;
24 24
 import org.openzen.drawablegui.DKeyEvent;
25 25
 import static org.openzen.drawablegui.DKeyEvent.KeyCode.*;
26 26
 import org.openzen.drawablegui.DMouseEvent;
27
+import org.openzen.drawablegui.DUIWindow;
27 28
 import org.openzen.drawablegui.style.DEmptyStylesheets;
28 29
 import org.openzen.drawablegui.style.DStylePathRoot;
29 30
 
@@ -54,6 +55,10 @@ public final class SwingRoot extends Component implements ComponentListener, Mou
54 55
 		addKeyListener(this);
55 56
 	}
56 57
 	
58
+	public void setWindow(DUIWindow window) {
59
+		context.setWindow(window);
60
+	}
61
+	
57 62
 	public void focus(DComponent component) {
58 63
 		if (component == focus)
59 64
 			return;

+ 117
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingWindow.java Visa fil

@@ -6,25 +6,140 @@
6 6
 package org.openzen.drawablegui.swing;
7 7
 
8 8
 import java.awt.BorderLayout;
9
+import java.awt.Color;
10
+import java.awt.event.WindowEvent;
11
+import java.awt.event.WindowListener;
12
+import java.awt.event.WindowStateListener;
9 13
 import javax.swing.JFrame;
10 14
 import org.openzen.drawablegui.DComponent;
11 15
 import org.openzen.drawablegui.DUIContext;
16
+import org.openzen.drawablegui.DUIWindow;
17
+import org.openzen.drawablegui.border.DCustomWindowBorder;
18
+import org.openzen.drawablegui.live.LiveBool;
19
+import org.openzen.drawablegui.live.LiveObject;
20
+import org.openzen.drawablegui.live.SimpleLiveBool;
21
+import org.openzen.drawablegui.live.SimpleLiveObject;
22
+import org.openzen.drawablegui.style.DStyleClass;
12 23
 
13 24
 /**
14 25
  *
15 26
  * @author Hoofdgebruiker
16 27
  */
17
-public final class SwingWindow extends JFrame {
28
+public final class SwingWindow extends JFrame implements WindowListener, WindowStateListener, DUIWindow {
18 29
 	private final SwingRoot swingComponent;
30
+	private final boolean noTitleBar;
31
+	private final SimpleLiveObject<State> state = new SimpleLiveObject<>(State.NORMAL);
32
+	private final SimpleLiveBool active = new SimpleLiveBool(true);
19 33
 	
20
-	public SwingWindow(String title, DComponent root) {
34
+	public SwingWindow(String title, DComponent root, boolean noTitleBar) {
21 35
 		super(title);
36
+		this.noTitleBar = noTitleBar;
37
+		
38
+		if (noTitleBar) {
39
+		    setUndecorated(true);
40
+			root = new DCustomWindowBorder(DStyleClass.EMPTY, root);
41
+			setBackground(new Color(0, 0, 0, 0));
42
+		}
43
+		
44
+		addWindowListener(this);
45
+		addWindowStateListener(this);
22 46
 		
23 47
 		getContentPane().add(swingComponent = new SwingRoot(root), BorderLayout.CENTER);
48
+		swingComponent.setWindow(this);
24 49
 		swingComponent.requestFocusInWindow();
25 50
 	}
26 51
 	
27 52
 	public DUIContext getContext() {
28 53
 		return swingComponent.context;
29 54
 	}
55
+
56
+	@Override
57
+	public boolean hasTitleBar() {
58
+		return !noTitleBar;
59
+	}
60
+
61
+	@Override
62
+	public void close() {
63
+		System.exit(0);
64
+	}
65
+
66
+	@Override
67
+	public void maximize() {
68
+		setExtendedState(JFrame.MAXIMIZED_BOTH);
69
+	}
70
+
71
+	@Override
72
+	public void restore() {
73
+		setExtendedState(JFrame.NORMAL);
74
+	}
75
+
76
+	@Override
77
+	public void minimize() {
78
+		setExtendedState(JFrame.ICONIFIED);
79
+	}
80
+
81
+	@Override
82
+	public LiveObject<State> getWindowState() {
83
+		return state;
84
+	}
85
+	
86
+	@Override
87
+	public LiveBool getActive() {
88
+		return active;
89
+	}
90
+
91
+	@Override
92
+	public void windowOpened(WindowEvent e) {
93
+		
94
+	}
95
+
96
+	@Override
97
+	public void windowClosing(WindowEvent e) {
98
+		
99
+	}
100
+
101
+	@Override
102
+	public void windowClosed(WindowEvent e) {
103
+		
104
+	}
105
+
106
+	@Override
107
+	public void windowIconified(WindowEvent e) {
108
+		
109
+	}
110
+
111
+	@Override
112
+	public void windowDeiconified(WindowEvent e) {
113
+		
114
+	}
115
+
116
+	@Override
117
+	public void windowActivated(WindowEvent e) {
118
+		active.setValue(true);
119
+	}
120
+
121
+	@Override
122
+	public void windowDeactivated(WindowEvent e) {
123
+		active.setValue(false);
124
+	}
125
+
126
+	@Override
127
+	public void windowStateChanged(WindowEvent e) {
128
+		state.setValue(getStateFromWindowState());
129
+	}
130
+	
131
+	private State getStateFromWindowState() {
132
+		switch (getExtendedState()) {
133
+			case NORMAL:
134
+				return State.NORMAL;
135
+			case ICONIFIED:
136
+				return State.MINIMIZED;
137
+			case MAXIMIZED_HORIZ:
138
+			case MAXIMIZED_VERT:
139
+			case MAXIMIZED_BOTH:
140
+				return State.MAXIMIZED;
141
+			default:
142
+				return State.NORMAL;
143
+		}
144
+	}
30 145
 }

+ 2
- 2
DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeViewStyle.java Visa fil

@@ -8,8 +8,8 @@ package org.openzen.drawablegui.tree;
8 8
 import org.openzen.drawablegui.DDrawable;
9 9
 import org.openzen.drawablegui.DFont;
10 10
 import org.openzen.drawablegui.DFontFamily;
11
-import org.openzen.drawablegui.dimension.DDimension;
12
-import org.openzen.drawablegui.dimension.DDpDimension;
11
+import org.openzen.drawablegui.style.DDimension;
12
+import org.openzen.drawablegui.style.DDpDimension;
13 13
 import org.openzen.drawablegui.DUIContext;
14 14
 
15 15
 /**

+ 2
- 2
DrawableGuiIconConverter/src/main/java/org/openzen/drawablegui/iconconverter/Main.java Visa fil

@@ -21,9 +21,9 @@ import org.w3c.dom.NodeList;
21 21
  */
22 22
 public class Main {
23 23
 	public static void main(String[] args) throws Exception {
24
-		String filename = "baseline-settings-20px.svg"; //args[0];
24
+		String filename = "baseline-close-24px.svg"; //args[0];
25 25
 		//String filename = "baseline-dashboard-24px.svg";
26
-		String className = "ColorableSettingsIcon";
26
+		String className = "ColorableCloseIcon";
27 27
 		File file = new File(filename);
28 28
 		if (!file.exists()) {
29 29
 			System.out.println("No such file: " + filename);

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/Main.java Visa fil

@@ -27,7 +27,7 @@ public class Main {
27 27
 		IDEWindow window = new IDEWindow();
28 28
 		WindowView root = new WindowView(window, host);
29 29
 		
30
-		SwingWindow swingWindow = new SwingWindow("ZenCode IDE - " + host.getName(), root);
30
+		SwingWindow swingWindow = new SwingWindow("ZenCode IDE - " + host.getName(), root, false);
31 31
 		swingWindow.setSize(800 * pixelPerInch / 96, 600 * pixelPerInch / 96);
32 32
 		swingWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
33 33
 		swingWindow.setVisible(true);

+ 3
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEAspectToolbar.java Visa fil

@@ -5,7 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
-import org.openzen.drawablegui.DColorableIcon;
8
+import org.openzen.drawablegui.DDrawable;
9 9
 import org.openzen.drawablegui.live.LiveArrayList;
10 10
 import org.openzen.drawablegui.live.LiveList;
11 11
 
@@ -15,12 +15,12 @@ import org.openzen.drawablegui.live.LiveList;
15 15
  */
16 16
 public class IDEAspectToolbar {
17 17
 	public final int order;
18
-	public final DColorableIcon icon;
18
+	public final DDrawable icon;
19 19
 	public final String title;
20 20
 	public final String description;
21 21
 	public final LiveList<IDEAspectBarControl> controls = new LiveArrayList<>();
22 22
 	
23
-	public IDEAspectToolbar(int order, DColorableIcon icon, String title, String description) {
23
+	public IDEAspectToolbar(int order, DDrawable icon, String title, String description) {
24 24
 		this.order = order;
25 25
 		this.icon = icon;
26 26
 		this.title = title;

+ 8
- 6
IDE/src/main/java/org/openzen/zenscript/ide/ui/IDEWindow.java Visa fil

@@ -5,10 +5,12 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui;
7 7
 
8
+import org.openzen.drawablegui.live.SimpleLiveBool;
9
+import org.openzen.drawablegui.style.DStyleClass;
8 10
 import org.openzen.zenscript.ide.host.IDESourceFile;
9
-import org.openzen.zenscript.ide.ui.icons.ColorableAddBoxIcon;
10
-import org.openzen.zenscript.ide.ui.icons.ColorableProjectIcon;
11
-import org.openzen.zenscript.ide.ui.icons.ColorableSettingsIcon;
11
+import org.openzen.zenscript.ide.ui.icons.AddBoxIcon;
12
+import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
13
+import org.openzen.zenscript.ide.ui.icons.SettingsIcon;
12 14
 import org.openzen.zenscript.ide.ui.view.IconButtonControl;
13 15
 
14 16
 /**
@@ -39,9 +41,9 @@ public class IDEWindow {
39 41
 	}
40 42
 	
41 43
 	private void init() {
42
-		IDEAspectToolbar projectToolbar = new IDEAspectToolbar(0, ColorableProjectIcon.INSTANCE, "Project", "Project management");
43
-		projectToolbar.controls.add(() -> new IconButtonControl(ColorableAddBoxIcon.BLACK, e -> {}));
44
-		projectToolbar.controls.add(() -> new IconButtonControl(ColorableSettingsIcon.BLACK, e -> {}));
44
+		IDEAspectToolbar projectToolbar = new IDEAspectToolbar(0, ProjectIcon.GREY, "Project", "Project management");
45
+		projectToolbar.controls.add(() -> new IconButtonControl(DStyleClass.EMPTY, AddBoxIcon.BLACK, e -> {}));
46
+		projectToolbar.controls.add(() -> new IconButtonControl(DStyleClass.EMPTY, SettingsIcon.BLACK, e -> {}));
45 47
 		aspectBar.addToolbar(projectToolbar);
46 48
 	}
47 49
 }

IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableAddBoxIcon.java → IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/AddBoxIcon.java Visa fil

@@ -9,11 +9,11 @@ import org.openzen.drawablegui.DPath;
9 9
 import org.openzen.drawablegui.DTransform2D;
10 10
 import org.openzen.drawablegui.DColorableIcon;
11 11
 
12
-public class ColorableAddBoxIcon implements DColorableIcon {
13
-	public static final ColorableAddBoxIcon INSTANCE = new ColorableAddBoxIcon();
12
+public class AddBoxIcon implements DColorableIcon {
13
+	public static final AddBoxIcon INSTANCE = new AddBoxIcon();
14 14
 	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
15 15
 	
16
-	private ColorableAddBoxIcon() {}
16
+	private AddBoxIcon() {}
17 17
 	
18 18
 	private static final DPath PATH = tracer -> {
19 19
 		tracer.moveTo(19f, 3f);

IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableCodeIcon.java → IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/CloseIcon.java Visa fil

@@ -10,27 +10,24 @@ import org.openzen.drawablegui.DPath;
10 10
 import org.openzen.drawablegui.DTransform2D;
11 11
 import org.openzen.drawablegui.DColorableIcon;
12 12
 
13
-public class ColorableCodeIcon implements DColorableIcon {
14
-	public static final ColorableCodeIcon INSTANCE = new ColorableCodeIcon();
13
+public class CloseIcon implements DColorableIcon {
14
+	public static final CloseIcon INSTANCE = new CloseIcon();
15 15
 	
16
-	private ColorableCodeIcon() {}
16
+	private CloseIcon() {}
17 17
 	
18 18
 	private static final DPath PATH = tracer -> {
19
-		tracer.moveTo(9.4f, 16.6f);
20
-		tracer.lineTo(4.8f, 12f);
21
-		tracer.lineTo(9.4f, 7.4f);
22
-		tracer.lineTo(8f, 6f);
23
-		tracer.lineTo(2.0f, 12.0f);
24
-		tracer.lineTo(8.0f, 18.0f);
25
-		tracer.lineTo(9.4f, 16.6f);
26
-		tracer.close();
27
-		tracer.moveTo(14.599999f, 16.6f);
28
-		tracer.lineTo(19.199999f, 12.0f);
29
-		tracer.lineTo(14.599998f, 7.4f);
30
-		tracer.lineTo(16f, 6f);
31
-		tracer.lineTo(22.0f, 12.0f);
32
-		tracer.lineTo(16.0f, 18.0f);
33
-		tracer.lineTo(14.6f, 16.6f);
19
+		tracer.moveTo(19f, 6.41f);
20
+		tracer.lineTo(17.59f, 5f);
21
+		tracer.lineTo(12f, 10.59f);
22
+		tracer.lineTo(6.41f, 5f);
23
+		tracer.lineTo(5f, 6.41f);
24
+		tracer.lineTo(10.59f, 12f);
25
+		tracer.lineTo(5f, 17.59f);
26
+		tracer.lineTo(6.41f, 19f);
27
+		tracer.lineTo(12f, 13.41f);
28
+		tracer.lineTo(17.59f, 19f);
29
+		tracer.lineTo(19f, 17.59f);
30
+		tracer.lineTo(13.41f, 12f);
34 31
 		tracer.close();
35 32
 	};
36 33
 	

+ 26
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/CodeIcon.java Visa fil

@@ -6,17 +6,39 @@
6 6
 package org.openzen.zenscript.ide.ui.icons;
7 7
 
8 8
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DDrawable;
9
+import org.openzen.drawablegui.DPath;
10 10
 import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
11 12
 
12
-public class CodeIcon implements DDrawable {
13
+public class CodeIcon implements DColorableIcon {
13 14
 	public static final CodeIcon INSTANCE = new CodeIcon();
15
+	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
16
+	public static final ColoredIcon GREY = new ColoredIcon(INSTANCE, 0xFF888888);
14 17
 	
15 18
 	private CodeIcon() {}
16 19
 	
20
+	private static final DPath PATH = tracer -> {
21
+		tracer.moveTo(9.4f, 16.6f);
22
+		tracer.lineTo(4.8f, 12f);
23
+		tracer.lineTo(9.4f, 7.4f);
24
+		tracer.lineTo(8f, 6f);
25
+		tracer.lineTo(2.0f, 12.0f);
26
+		tracer.lineTo(8.0f, 18.0f);
27
+		tracer.lineTo(9.4f, 16.6f);
28
+		tracer.close();
29
+		tracer.moveTo(14.599999f, 16.6f);
30
+		tracer.lineTo(19.199999f, 12.0f);
31
+		tracer.lineTo(14.599998f, 7.4f);
32
+		tracer.lineTo(16f, 6f);
33
+		tracer.lineTo(22.0f, 12.0f);
34
+		tracer.lineTo(16.0f, 18.0f);
35
+		tracer.lineTo(14.6f, 16.6f);
36
+		tracer.close();
37
+	};
38
+	
17 39
 	@Override
18
-	public void draw(DCanvas canvas, DTransform2D transform) {
19
-		ColorableCodeIcon.INSTANCE.draw(canvas, transform, 0xFF000000);
40
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
41
+		canvas.fillPath(PATH, transform, color);
20 42
 	}
21 43
 
22 44
 	@Override

+ 0
- 47
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableFolderIcon.java Visa fil

@@ -1,47 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.ide.ui.icons;
7
-
8
-import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DPath;
10
-import org.openzen.drawablegui.DTransform2D;
11
-import org.openzen.drawablegui.DColorableIcon;
12
-
13
-public class ColorableFolderIcon implements DColorableIcon {
14
-	public static final ColorableFolderIcon INSTANCE = new ColorableFolderIcon();
15
-	
16
-	private ColorableFolderIcon() {}
17
-	
18
-	private static final DPath PATH = tracer -> {
19
-		tracer.moveTo(10f, 4f);
20
-		tracer.lineTo(4.0f, 4.0f);
21
-		tracer.bezierCubic(2.9f, 4.0f, 2.01f, 4.9f, 2.01f, 6.0f);
22
-		tracer.lineTo(2f, 18f);
23
-		tracer.bezierCubic(2.0f, 19.1f, 2.9f, 20.0f, 4.0f, 20.0f);
24
-		tracer.lineTo(20.0f, 20.0f);
25
-		tracer.bezierCubic(21.1f, 20.0f, 22.0f, 19.1f, 22.0f, 18.0f);
26
-		tracer.lineTo(22.0f, 8.0f);
27
-		tracer.bezierCubic(22.0f, 6.9f, 21.1f, 6.0f, 20.0f, 6.0f);
28
-		tracer.lineTo(12.0f, 6.0f);
29
-		tracer.lineTo(10.0f, 4.0f);
30
-		tracer.close();
31
-	};
32
-	
33
-	@Override
34
-	public void draw(DCanvas canvas, DTransform2D transform, int color) {
35
-		canvas.fillPath(PATH, transform, color);
36
-	}
37
-
38
-	@Override
39
-	public float getNominalWidth() {
40
-		return 24;
41
-	}
42
-
43
-	@Override
44
-	public float getNominalHeight() {
45
-		return 24;
46
-	}
47
-}

+ 0
- 59
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableLibraryIcon.java Visa fil

@@ -1,59 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.ide.ui.icons;
7
-
8
-/**
9
- *
10
- * @author Hoofdgebruiker
11
- */
12
-import org.openzen.drawablegui.DCanvas;
13
-import org.openzen.drawablegui.DPath;
14
-import org.openzen.drawablegui.DTransform2D;
15
-import org.openzen.drawablegui.DColorableIcon;
16
-
17
-public class ColorableLibraryIcon implements DColorableIcon {
18
-	public static final ColorableLibraryIcon INSTANCE = new ColorableLibraryIcon();
19
-	
20
-	private ColorableLibraryIcon() {}
21
-	
22
-	private static final DPath PATH_0 = tracer -> {
23
-		tracer.moveTo(20.54f, 5.23f);
24
-		tracer.lineTo(19.15f, 3.55f);
25
-		tracer.bezierCubic(18.88f, 3.21f, 18.47f, 3.0f, 18.0f, 3.0f);
26
-		tracer.lineTo(6f, 3f);
27
-		tracer.bezierCubic(5.53f, 3.0f, 5.12f, 3.21f, 4.84f, 3.55f);
28
-		tracer.lineTo(3.46f, 5.23f);
29
-		tracer.bezierCubic(3.17f, 5.57f, 3.0f, 6.02f, 3.0f, 6.5f);
30
-		tracer.lineTo(3f, 19f);
31
-		tracer.bezierCubic(3.0f, 20.1f, 3.9f, 21.0f, 5.0f, 21.0f);
32
-		tracer.lineTo(19f, 21f);
33
-		tracer.bezierCubic(20.1f, 21.0f, 21.0f, 20.1f, 21.0f, 19.0f);
34
-		tracer.lineTo(21f, 6.5f);
35
-		tracer.bezierCubic(21.0f, 6.02f, 20.83f, 5.57f, 20.54f, 5.23f);
36
-		tracer.close();
37
-		tracer.moveTo(5.12f, 5f);
38
-		tracer.lineTo(5.93f, 4f);
39
-		tracer.lineTo(17.93f, 4f);
40
-		tracer.lineTo(18.87f, 5f);
41
-		tracer.lineTo(5.12f, 5f);
42
-		tracer.close();
43
-	};
44
-	
45
-	@Override
46
-	public void draw(DCanvas canvas, DTransform2D transform, int color) {
47
-		canvas.fillPath(PATH_0, transform, color);
48
-	}
49
-
50
-	@Override
51
-	public float getNominalWidth() {
52
-		return 24;
53
-	}
54
-
55
-	@Override
56
-	public float getNominalHeight() {
57
-		return 24;
58
-	}
59
-}

+ 0
- 53
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableModuleIcon.java Visa fil

@@ -1,53 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.ide.ui.icons;
7
-
8
-import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DPath;
10
-import org.openzen.drawablegui.DTransform2D;
11
-import org.openzen.drawablegui.DColorableIcon;
12
-
13
-public class ColorableModuleIcon implements DColorableIcon {
14
-	public static final ColorableModuleIcon INSTANCE = new ColorableModuleIcon();
15
-	
16
-	private ColorableModuleIcon() {}
17
-	
18
-	private static final DPath PATH = tracer -> {
19
-		tracer.moveTo(3f, 19f);
20
-		tracer.lineTo(9.0f, 19.0f);
21
-		tracer.lineTo(9.0f, 12.0f);
22
-		tracer.lineTo(3.0f, 12.0f);
23
-		tracer.lineTo(3.0f, 19.0f);
24
-		tracer.close();
25
-		tracer.moveTo(10.0f, 19.0f);
26
-		tracer.lineTo(22.0f, 19.0f);
27
-		tracer.lineTo(22.0f, 12.0f);
28
-		tracer.lineTo(10.0f, 12.0f);
29
-		tracer.lineTo(10.0f, 19.0f);
30
-		tracer.close();
31
-		tracer.moveTo(3f, 5f);
32
-		tracer.lineTo(3.0f, 11.0f);
33
-		tracer.lineTo(22.0f, 11.0f);
34
-		tracer.lineTo(22.0f, 5.0f);
35
-		tracer.lineTo(3.0f, 5.0f);
36
-		tracer.close();
37
-	};
38
-	
39
-	@Override
40
-	public void draw(DCanvas canvas, DTransform2D transform, int color) {
41
-		canvas.fillPath(PATH, transform, color);
42
-	}
43
-
44
-	@Override
45
-	public float getNominalWidth() {
46
-		return 24;
47
-	}
48
-
49
-	@Override
50
-	public float getNominalHeight() {
51
-		return 24;
52
-	}
53
-}

+ 0
- 60
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableProjectIcon.java Visa fil

@@ -1,60 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.ide.ui.icons;
7
-
8
-import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DPath;
10
-import org.openzen.drawablegui.DTransform2D;
11
-import org.openzen.drawablegui.DColorableIcon;
12
-
13
-public class ColorableProjectIcon implements DColorableIcon {
14
-	public static final ColorableProjectIcon INSTANCE = new ColorableProjectIcon();
15
-	public static final ColoredIcon GREY = new ColoredIcon(INSTANCE, 0xFF888888);
16
-	
17
-	private ColorableProjectIcon() {}
18
-	
19
-	private static final DPath PATH_0 = tracer -> {
20
-		tracer.moveTo(3f, 13f);
21
-		tracer.lineTo(11.0f, 13.0f);
22
-		tracer.lineTo(11.0f, 3.0f);
23
-		tracer.lineTo(3.0f, 3.0f);
24
-		tracer.lineTo(3.0f, 13.0f);
25
-		tracer.close();
26
-		tracer.moveTo(3.0f, 21.0f);
27
-		tracer.lineTo(11.0f, 21.0f);
28
-		tracer.lineTo(11.0f, 15.0f);
29
-		tracer.lineTo(3.0f, 15.0f);
30
-		tracer.lineTo(3.0f, 21.0f);
31
-		tracer.close();
32
-		tracer.moveTo(13.0f, 21.0f);
33
-		tracer.lineTo(21.0f, 21.0f);
34
-		tracer.lineTo(21.0f, 11.0f);
35
-		tracer.lineTo(13.0f, 11.0f);
36
-		tracer.lineTo(13.0f, 21.0f);
37
-		tracer.close();
38
-		tracer.moveTo(13.0f, 3.0f);
39
-		tracer.lineTo(13.0f, 9.0f);
40
-		tracer.lineTo(21.0f, 9.0f);
41
-		tracer.lineTo(21.0f, 3.0f);
42
-		tracer.lineTo(13.0f, 3.0f);
43
-		tracer.close();
44
-	};
45
-	
46
-	@Override
47
-	public void draw(DCanvas canvas, DTransform2D transform, int color) {
48
-		canvas.fillPath(PATH_0, transform, color);
49
-	}
50
-
51
-	@Override
52
-	public float getNominalWidth() {
53
-		return 24;
54
-	}
55
-
56
-	@Override
57
-	public float getNominalHeight() {
58
-		return 24;
59
-	}
60
-}

+ 0
- 57
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableSaveIcon.java Visa fil

@@ -1,57 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.ide.ui.icons;
7
-
8
-import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DPath;
10
-import org.openzen.drawablegui.DTransform2D;
11
-import org.openzen.drawablegui.DColorableIcon;
12
-
13
-public class ColorableSaveIcon implements DColorableIcon {
14
-	public static final ColorableSaveIcon INSTANCE = new ColorableSaveIcon();
15
-	
16
-	private ColorableSaveIcon() {}
17
-	
18
-	private static final DPath PATH = tracer -> {
19
-		tracer.moveTo(17f, 3f);
20
-		tracer.lineTo(5.0f, 3.0f);
21
-		tracer.bezierCubic(3.8899999f, 3.0f, 3.0f, 3.9f, 3.0f, 5.0f);
22
-		tracer.lineTo(3.0f, 19.0f);
23
-		tracer.bezierCubic(3.0f, 20.1f, 3.8899999f, 21.0f, 5.0f, 21.0f);
24
-		tracer.lineTo(19.0f, 21.0f);
25
-		tracer.bezierCubic(20.1f, 21.0f, 21.0f, 20.1f, 21.0f, 19.0f);
26
-		tracer.lineTo(21.0f, 7.0f);
27
-		tracer.lineTo(17.0f, 3.0f);
28
-		tracer.close();
29
-		tracer.moveTo(12.0f, 19.0f);
30
-		tracer.bezierCubic(10.34f, 19.0f, 9.0f, 17.66f, 9.0f, 16.0f);
31
-		tracer.bezierCubic(9.0f, 14.34f, 10.34f, 13.0f, 12.0f, 13.0f);
32
-		tracer.bezierCubic(13.66f, 13.0f, 15.0f, 14.34f, 15.0f, 16.0f);
33
-		tracer.bezierCubic(15.0f, 17.66f, 13.66f, 19.0f, 12.0f, 19.0f);
34
-		tracer.close();
35
-		tracer.moveTo(15.0f, 9.0f);
36
-		tracer.lineTo(5.0f, 9.0f);
37
-		tracer.lineTo(5.0f, 5.0f);
38
-		tracer.lineTo(15.0f, 5.0f);
39
-		tracer.lineTo(15.0f, 9.0f);
40
-		tracer.close();
41
-	};
42
-	
43
-	@Override
44
-	public void draw(DCanvas canvas, DTransform2D transform, int color) {
45
-		canvas.fillPath(PATH, transform, color);
46
-	}
47
-
48
-	@Override
49
-	public float getNominalWidth() {
50
-		return 24;
51
-	}
52
-
53
-	@Override
54
-	public float getNominalHeight() {
55
-		return 24;
56
-	}
57
-}

+ 21
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/FolderIcon.java Visa fil

@@ -6,17 +6,34 @@
6 6
 package org.openzen.zenscript.ide.ui.icons;
7 7
 
8 8
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DDrawable;
9
+import org.openzen.drawablegui.DPath;
10 10
 import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
11 12
 
12
-public class FolderIcon implements DDrawable {
13
+public class FolderIcon implements DColorableIcon {
13 14
 	public static final FolderIcon INSTANCE = new FolderIcon();
15
+	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
14 16
 	
15 17
 	private FolderIcon() {}
16 18
 	
19
+	private static final DPath PATH = tracer -> {
20
+		tracer.moveTo(10f, 4f);
21
+		tracer.lineTo(4.0f, 4.0f);
22
+		tracer.bezierCubic(2.9f, 4.0f, 2.01f, 4.9f, 2.01f, 6.0f);
23
+		tracer.lineTo(2f, 18f);
24
+		tracer.bezierCubic(2.0f, 19.1f, 2.9f, 20.0f, 4.0f, 20.0f);
25
+		tracer.lineTo(20.0f, 20.0f);
26
+		tracer.bezierCubic(21.1f, 20.0f, 22.0f, 19.1f, 22.0f, 18.0f);
27
+		tracer.lineTo(22.0f, 8.0f);
28
+		tracer.bezierCubic(22.0f, 6.9f, 21.1f, 6.0f, 20.0f, 6.0f);
29
+		tracer.lineTo(12.0f, 6.0f);
30
+		tracer.lineTo(10.0f, 4.0f);
31
+		tracer.close();
32
+	};
33
+	
17 34
 	@Override
18
-	public void draw(DCanvas canvas, DTransform2D transform) {
19
-		ColorableFolderIcon.INSTANCE.draw(canvas, transform, 0xFF000000);
35
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
36
+		canvas.fillPath(PATH, transform, color);
20 37
 	}
21 38
 
22 39
 	@Override

+ 32
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/LibraryIcon.java Visa fil

@@ -5,19 +5,47 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.icons;
7 7
 
8
+/**
9
+ *
10
+ * @author Hoofdgebruiker
11
+ */
8 12
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DDrawable;
10 13
 import org.openzen.drawablegui.DPath;
11 14
 import org.openzen.drawablegui.DTransform2D;
15
+import org.openzen.drawablegui.DColorableIcon;
12 16
 
13
-public class LibraryIcon implements DDrawable {
17
+public class LibraryIcon implements DColorableIcon {
14 18
 	public static final LibraryIcon INSTANCE = new LibraryIcon();
19
+	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
15 20
 	
16 21
 	private LibraryIcon() {}
17 22
 	
23
+	private static final DPath PATH_0 = tracer -> {
24
+		tracer.moveTo(20.54f, 5.23f);
25
+		tracer.lineTo(19.15f, 3.55f);
26
+		tracer.bezierCubic(18.88f, 3.21f, 18.47f, 3.0f, 18.0f, 3.0f);
27
+		tracer.lineTo(6f, 3f);
28
+		tracer.bezierCubic(5.53f, 3.0f, 5.12f, 3.21f, 4.84f, 3.55f);
29
+		tracer.lineTo(3.46f, 5.23f);
30
+		tracer.bezierCubic(3.17f, 5.57f, 3.0f, 6.02f, 3.0f, 6.5f);
31
+		tracer.lineTo(3f, 19f);
32
+		tracer.bezierCubic(3.0f, 20.1f, 3.9f, 21.0f, 5.0f, 21.0f);
33
+		tracer.lineTo(19f, 21f);
34
+		tracer.bezierCubic(20.1f, 21.0f, 21.0f, 20.1f, 21.0f, 19.0f);
35
+		tracer.lineTo(21f, 6.5f);
36
+		tracer.bezierCubic(21.0f, 6.02f, 20.83f, 5.57f, 20.54f, 5.23f);
37
+		tracer.close();
38
+		tracer.moveTo(5.12f, 5f);
39
+		tracer.lineTo(5.93f, 4f);
40
+		tracer.lineTo(17.93f, 4f);
41
+		tracer.lineTo(18.87f, 5f);
42
+		tracer.lineTo(5.12f, 5f);
43
+		tracer.close();
44
+	};
45
+	
18 46
 	@Override
19
-	public void draw(DCanvas canvas, DTransform2D transform) {
20
-		ColorableLibraryIcon.INSTANCE.draw(canvas, transform, 0xFF888888);
47
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
48
+		canvas.fillPath(PATH_0, transform, color);
21 49
 	}
22 50
 
23 51
 	@Override

+ 26
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ModuleIcon.java Visa fil

@@ -6,18 +6,40 @@
6 6
 package org.openzen.zenscript.ide.ui.icons;
7 7
 
8 8
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DDrawable;
10 9
 import org.openzen.drawablegui.DPath;
11 10
 import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
12 12
 
13
-public class ModuleIcon implements DDrawable {
13
+public class ModuleIcon implements DColorableIcon {
14 14
 	public static final ModuleIcon INSTANCE = new ModuleIcon();
15
+	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
15 16
 	
16 17
 	private ModuleIcon() {}
17 18
 	
19
+	private static final DPath PATH = tracer -> {
20
+		tracer.moveTo(3f, 19f);
21
+		tracer.lineTo(9.0f, 19.0f);
22
+		tracer.lineTo(9.0f, 12.0f);
23
+		tracer.lineTo(3.0f, 12.0f);
24
+		tracer.lineTo(3.0f, 19.0f);
25
+		tracer.close();
26
+		tracer.moveTo(10.0f, 19.0f);
27
+		tracer.lineTo(22.0f, 19.0f);
28
+		tracer.lineTo(22.0f, 12.0f);
29
+		tracer.lineTo(10.0f, 12.0f);
30
+		tracer.lineTo(10.0f, 19.0f);
31
+		tracer.close();
32
+		tracer.moveTo(3f, 5f);
33
+		tracer.lineTo(3.0f, 11.0f);
34
+		tracer.lineTo(22.0f, 11.0f);
35
+		tracer.lineTo(22.0f, 5.0f);
36
+		tracer.lineTo(3.0f, 5.0f);
37
+		tracer.close();
38
+	};
39
+	
18 40
 	@Override
19
-	public void draw(DCanvas canvas, DTransform2D transform) {
20
-		ColorableModuleIcon.INSTANCE.draw(canvas, transform, 0xFF000000);
41
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
42
+		canvas.fillPath(PATH, transform, color);
21 43
 	}
22 44
 
23 45
 	@Override

+ 33
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ProjectIcon.java Visa fil

@@ -6,18 +6,47 @@
6 6
 package org.openzen.zenscript.ide.ui.icons;
7 7
 
8 8
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DDrawable;
10 9
 import org.openzen.drawablegui.DPath;
11 10
 import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
12 12
 
13
-public class ProjectIcon implements DDrawable {
13
+public class ProjectIcon implements DColorableIcon {
14 14
 	public static final ProjectIcon INSTANCE = new ProjectIcon();
15
+	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
16
+	public static final ColoredIcon GREY = new ColoredIcon(INSTANCE, 0xFF888888);
15 17
 	
16 18
 	private ProjectIcon() {}
17 19
 	
20
+	private static final DPath PATH = tracer -> {
21
+		tracer.moveTo(3f, 13f);
22
+		tracer.lineTo(11.0f, 13.0f);
23
+		tracer.lineTo(11.0f, 3.0f);
24
+		tracer.lineTo(3.0f, 3.0f);
25
+		tracer.lineTo(3.0f, 13.0f);
26
+		tracer.close();
27
+		tracer.moveTo(3.0f, 21.0f);
28
+		tracer.lineTo(11.0f, 21.0f);
29
+		tracer.lineTo(11.0f, 15.0f);
30
+		tracer.lineTo(3.0f, 15.0f);
31
+		tracer.lineTo(3.0f, 21.0f);
32
+		tracer.close();
33
+		tracer.moveTo(13.0f, 21.0f);
34
+		tracer.lineTo(21.0f, 21.0f);
35
+		tracer.lineTo(21.0f, 11.0f);
36
+		tracer.lineTo(13.0f, 11.0f);
37
+		tracer.lineTo(13.0f, 21.0f);
38
+		tracer.close();
39
+		tracer.moveTo(13.0f, 3.0f);
40
+		tracer.lineTo(13.0f, 9.0f);
41
+		tracer.lineTo(21.0f, 9.0f);
42
+		tracer.lineTo(21.0f, 3.0f);
43
+		tracer.lineTo(13.0f, 3.0f);
44
+		tracer.close();
45
+	};
46
+	
18 47
 	@Override
19
-	public void draw(DCanvas canvas, DTransform2D transform) {
20
-		ColorableProjectIcon.INSTANCE.draw(canvas, transform, 0xFF000000);
48
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
49
+		canvas.fillPath(PATH, transform, color);
21 50
 	}
22 51
 
23 52
 	@Override

+ 32
- 4
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/SaveIcon.java Visa fil

@@ -6,17 +6,45 @@
6 6
 package org.openzen.zenscript.ide.ui.icons;
7 7
 
8 8
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DDrawable;
9
+import org.openzen.drawablegui.DPath;
10 10
 import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
11 12
 
12
-public class SaveIcon implements DDrawable {
13
+public class SaveIcon implements DColorableIcon {
13 14
 	public static final SaveIcon INSTANCE = new SaveIcon();
15
+	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
16
+	public static final ColoredIcon GREY = new ColoredIcon(INSTANCE, 0xFF888888);
14 17
 	
15 18
 	private SaveIcon() {}
16 19
 	
20
+	private static final DPath PATH = tracer -> {
21
+		tracer.moveTo(17f, 3f);
22
+		tracer.lineTo(5.0f, 3.0f);
23
+		tracer.bezierCubic(3.8899999f, 3.0f, 3.0f, 3.9f, 3.0f, 5.0f);
24
+		tracer.lineTo(3.0f, 19.0f);
25
+		tracer.bezierCubic(3.0f, 20.1f, 3.8899999f, 21.0f, 5.0f, 21.0f);
26
+		tracer.lineTo(19.0f, 21.0f);
27
+		tracer.bezierCubic(20.1f, 21.0f, 21.0f, 20.1f, 21.0f, 19.0f);
28
+		tracer.lineTo(21.0f, 7.0f);
29
+		tracer.lineTo(17.0f, 3.0f);
30
+		tracer.close();
31
+		tracer.moveTo(12.0f, 19.0f);
32
+		tracer.bezierCubic(10.34f, 19.0f, 9.0f, 17.66f, 9.0f, 16.0f);
33
+		tracer.bezierCubic(9.0f, 14.34f, 10.34f, 13.0f, 12.0f, 13.0f);
34
+		tracer.bezierCubic(13.66f, 13.0f, 15.0f, 14.34f, 15.0f, 16.0f);
35
+		tracer.bezierCubic(15.0f, 17.66f, 13.66f, 19.0f, 12.0f, 19.0f);
36
+		tracer.close();
37
+		tracer.moveTo(15.0f, 9.0f);
38
+		tracer.lineTo(5.0f, 9.0f);
39
+		tracer.lineTo(5.0f, 5.0f);
40
+		tracer.lineTo(15.0f, 5.0f);
41
+		tracer.lineTo(15.0f, 9.0f);
42
+		tracer.close();
43
+	};
44
+	
17 45
 	@Override
18
-	public void draw(DCanvas canvas, DTransform2D transform) {
19
-		ColorableSaveIcon.INSTANCE.draw(canvas, transform, 0xFF000000);
46
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
47
+		canvas.fillPath(PATH, transform, color);
20 48
 	}
21 49
 
22 50
 	@Override

+ 41
- 0
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ScalableCloseIcon.java Visa fil

@@ -0,0 +1,41 @@
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.ui.icons;
7
+
8
+import org.openzen.drawablegui.DCanvas;
9
+import org.openzen.drawablegui.DPath;
10
+import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
12
+
13
+public class ScalableCloseIcon implements DColorableIcon {
14
+	private final DPath path;
15
+	private final float size;
16
+	
17
+	public ScalableCloseIcon(float scale) {
18
+		size = 24 * scale;
19
+		path = tracer -> {
20
+			tracer.moveTo(scale * 8, scale * 8);
21
+			tracer.lineTo(scale * 16, scale * 16);
22
+			tracer.moveTo(scale * 8, scale * 16);
23
+			tracer.lineTo(scale * 16, scale * 8);
24
+		};
25
+	}
26
+	
27
+	@Override
28
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
29
+		canvas.strokePath(path, transform, color, 1);
30
+	}
31
+
32
+	@Override
33
+	public float getNominalWidth() {
34
+		return size;
35
+	}
36
+
37
+	@Override
38
+	public float getNominalHeight() {
39
+		return size;
40
+	}
41
+}

+ 42
- 0
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ScalableMaximizeIcon.java Visa fil

@@ -0,0 +1,42 @@
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.ui.icons;
7
+
8
+import org.openzen.drawablegui.DCanvas;
9
+import org.openzen.drawablegui.DPath;
10
+import org.openzen.drawablegui.DTransform2D;
11
+import org.openzen.drawablegui.DColorableIcon;
12
+
13
+public class ScalableMaximizeIcon implements DColorableIcon {
14
+	private final DPath path;
15
+	private final float size;
16
+	
17
+	public ScalableMaximizeIcon(float scale) {
18
+		size = 24 * scale;
19
+		path = tracer -> {
20
+			tracer.moveTo(scale * 8, scale * 8);
21
+			tracer.lineTo(scale * 16, scale * 8);
22
+			tracer.lineTo(scale * 16, scale * 16);
23
+			tracer.lineTo(scale * 8, scale * 16);
24
+			tracer.close();
25
+		};
26
+	}
27
+	
28
+	@Override
29
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
30
+		canvas.strokePath(path, transform, color, 1);
31
+	}
32
+
33
+	@Override
34
+	public float getNominalWidth() {
35
+		return size;
36
+	}
37
+
38
+	@Override
39
+	public float getNominalHeight() {
40
+		return size;
41
+	}
42
+}

+ 43
- 0
IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ScalableMinimizeIcon.java Visa fil

@@ -0,0 +1,43 @@
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.ui.icons;
7
+
8
+import org.openzen.drawablegui.DCanvas;
9
+import org.openzen.drawablegui.DColorableIcon;
10
+import org.openzen.drawablegui.DPath;
11
+import org.openzen.drawablegui.DTransform2D;
12
+
13
+/**
14
+ *
15
+ * @author Hoofdgebruiker
16
+ */
17
+public class ScalableMinimizeIcon implements DColorableIcon {
18
+	private final float scale;
19
+	private final DPath path;
20
+	
21
+	public ScalableMinimizeIcon(float scale) {
22
+		this.scale = scale;
23
+		path = tracer -> {
24
+			tracer.moveTo(scale * 8, scale * 14);
25
+			tracer.lineTo(scale * 16, scale * 14);
26
+		};
27
+	}
28
+
29
+	@Override
30
+	public void draw(DCanvas canvas, DTransform2D transform, int color) {
31
+		canvas.strokePath(path, transform, color, 1);
32
+	}
33
+
34
+	@Override
35
+	public float getNominalWidth() {
36
+		return 24 * scale;
37
+	}
38
+
39
+	@Override
40
+	public float getNominalHeight() {
41
+		return 24 * scale;
42
+	}
43
+}

IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/ColorableSettingsIcon.java → IDE/src/main/java/org/openzen/zenscript/ide/ui/icons/SettingsIcon.java Visa fil

@@ -8,12 +8,13 @@ import org.openzen.drawablegui.DCanvas;
8 8
 import org.openzen.drawablegui.DPath;
9 9
 import org.openzen.drawablegui.DTransform2D;
10 10
 import org.openzen.drawablegui.DColorableIcon;
11
+import org.openzen.drawablegui.style.DShadow;
11 12
 
12
-public class ColorableSettingsIcon implements DColorableIcon {
13
-	public static final ColorableSettingsIcon INSTANCE = new ColorableSettingsIcon();
13
+public class SettingsIcon implements DColorableIcon {
14
+	public static final SettingsIcon INSTANCE = new SettingsIcon();
14 15
 	public static final ColoredIcon BLACK = new ColoredIcon(INSTANCE, 0xFF000000);
15 16
 	
16
-	private ColorableSettingsIcon() {}
17
+	private SettingsIcon() {}
17 18
 	
18 19
 	private static final DPath PATH = tracer -> {
19 20
 		tracer.moveTo(15.95f, 10.78f);
@@ -66,6 +67,7 @@ public class ColorableSettingsIcon implements DColorableIcon {
66 67
 	
67 68
 	@Override
68 69
 	public void draw(DCanvas canvas, DTransform2D transform, int color) {
70
+		//canvas.shadowPath(PATH, transform, new DShadow(0xFF888888, 0, 1, 3.5f));
69 71
 		canvas.fillPath(PATH, transform, color);
70 72
 	}
71 73
 

+ 71
- 10
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControl.java Visa fil

@@ -11,11 +11,16 @@ import org.openzen.drawablegui.DComponent;
11 11
 import org.openzen.drawablegui.DDimensionPreferences;
12 12
 import org.openzen.drawablegui.DDrawable;
13 13
 import org.openzen.drawablegui.DMouseEvent;
14
+import org.openzen.drawablegui.DPath;
14 15
 import org.openzen.drawablegui.DTransform2D;
15 16
 import org.openzen.drawablegui.DUIContext;
16 17
 import org.openzen.drawablegui.listeners.DIRectangle;
18
+import org.openzen.drawablegui.listeners.ListenerHandle;
19
+import org.openzen.drawablegui.live.ImmutableLiveBool;
20
+import org.openzen.drawablegui.live.LiveBool;
17 21
 import org.openzen.drawablegui.live.LiveObject;
18 22
 import org.openzen.drawablegui.live.SimpleLiveObject;
23
+import org.openzen.drawablegui.style.DStyleClass;
19 24
 import org.openzen.drawablegui.style.DStylePath;
20 25
 
21 26
 /**
@@ -23,25 +28,48 @@ import org.openzen.drawablegui.style.DStylePath;
23 28
  * @author Hoofdgebruiker
24 29
  */
25 30
 public class IconButtonControl implements DComponent {
31
+	private final DStyleClass styleClass;
26 32
 	private final DDrawable icon;
33
+	private final DDrawable iconDisabled;
27 34
 	private final Consumer<DMouseEvent> onClick;
35
+	private final LiveBool disabled;
36
+	private final ListenerHandle<LiveBool.Listener> disabledListener;
28 37
 	
29 38
 	private DUIContext context;
39
+	private IconButtonControlStyle style;
30 40
 	private DIRectangle bounds;
31 41
 	private final LiveObject<DDimensionPreferences> preferences = new SimpleLiveObject<>(DDimensionPreferences.EMPTY);
32 42
 	private boolean hover;
43
+	private boolean press;
44
+	private DPath shape;
33 45
 	
34
-	public IconButtonControl(DDrawable icon, Consumer<DMouseEvent> onClick) {
46
+	public IconButtonControl(DStyleClass styleClass, DDrawable icon, DDrawable iconDisabled, LiveBool disabled, Consumer<DMouseEvent> onClick) {
47
+		this.styleClass = styleClass;
35 48
 		this.icon = icon;
49
+		this.iconDisabled = iconDisabled;
36 50
 		this.onClick = onClick;
51
+		this.disabled = disabled;
52
+		disabledListener = disabled.addListener((oldValue, newValue) -> repaint());
53
+	}
54
+	
55
+	public IconButtonControl(DStyleClass styleClass, DDrawable icon, Consumer<DMouseEvent> onClick) {
56
+		this(styleClass, icon, icon, ImmutableLiveBool.FALSE, onClick);
37 57
 	}
38 58
 
39 59
 	@Override
40 60
 	public void setContext(DStylePath parent, DUIContext context) {
41 61
 		this.context = context;
42
-		preferences.setValue(new DDimensionPreferences(
43
-				(int)(icon.getNominalWidth() * context.getScale() + 0.5f),
44
-				(int)(icon.getNominalHeight() * context.getScale() + 0.5f)));
62
+		DStylePath path = parent.getChild("iconbutton", styleClass);
63
+		style = new IconButtonControlStyle(context.getStylesheets().get(context, path));
64
+		
65
+		int iconWidth = (int)(icon.getNominalWidth() * context.getScale() + 0.5f);
66
+		int iconHeight = (int)(icon.getNominalWidth() * context.getScale() + 0.5f);
67
+		int width = iconWidth + 2 * style.padding + 2 * style.margin;
68
+		int height = iconHeight + 2 * style.padding + 2 * style.margin;
69
+		preferences.setValue(new DDimensionPreferences(width, height));
70
+		
71
+		if (bounds != null)
72
+			setBounds(bounds);
45 73
 	}
46 74
 
47 75
 	@Override
@@ -57,13 +85,33 @@ public class IconButtonControl implements DComponent {
57 85
 	@Override
58 86
 	public void setBounds(DIRectangle bounds) {
59 87
 		this.bounds = bounds;
88
+		
89
+		if (context != null)
90
+			shape = DPath.roundedRectangle(
91
+					bounds.x + style.margin,
92
+					bounds.y + style.margin,
93
+					bounds.width - 2 * style.margin,
94
+					bounds.height - 2 * style.margin,
95
+					style.roundingRadius);
60 96
 	}
61 97
 
62 98
 	@Override
63 99
 	public void paint(DCanvas canvas) {
64
-		if (hover) {
65
-			canvas.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height, 0xFFE0E0E0);
100
+		if (disabled.getValue()) {
101
+			canvas.shadowPath(shape, DTransform2D.IDENTITY, style.shadowDisabled);
102
+			canvas.fillPath(shape, DTransform2D.IDENTITY, style.colorDisabled);
103
+		} else if (press) {
104
+			canvas.shadowPath(shape, DTransform2D.IDENTITY, style.shadowPress);
105
+			canvas.fillPath(shape, DTransform2D.IDENTITY, style.colorPress);
106
+		} else if (hover) {
107
+			canvas.shadowPath(shape, DTransform2D.IDENTITY, style.shadowHover);
108
+			canvas.fillPath(shape, DTransform2D.IDENTITY, style.colorHover);
109
+		} else {
110
+			canvas.shadowPath(shape, DTransform2D.IDENTITY, style.shadowNormal);
111
+			canvas.fillPath(shape, DTransform2D.IDENTITY, style.colorNormal);
66 112
 		}
113
+		
114
+		DDrawable icon = disabled.getValue() ? iconDisabled : this.icon;
67 115
 		icon.draw(canvas, DTransform2D.scaleAndTranslate(
68 116
 				bounds.x + (bounds.width - icon.getNominalWidth() * context.getScale()) / 2,
69 117
 				bounds.y + (bounds.height - icon.getNominalHeight() * context.getScale()) / 2,
@@ -72,19 +120,32 @@ public class IconButtonControl implements DComponent {
72 120
 
73 121
 	@Override
74 122
 	public void close() {
75
-		// nothing to clean up
123
+		disabledListener.close();
76 124
 	}
77 125
 	
78 126
 	@Override
79 127
 	public void onMouseEnter(DMouseEvent e) {
80 128
 		hover = true;
81
-		context.repaint(bounds);
129
+		repaint();
82 130
 	}
83 131
 	
84 132
 	@Override
85 133
 	public void onMouseExit(DMouseEvent e) {
86 134
 		hover = false;
87
-		context.repaint(bounds);
135
+		press = false;
136
+		repaint();
137
+	}
138
+	
139
+	@Override
140
+	public void onMouseDown(DMouseEvent e) {
141
+		press = true;
142
+		repaint();
143
+	}
144
+	
145
+	@Override
146
+	public void onMouseRelease(DMouseEvent e) {
147
+		press = false;
148
+		repaint();
88 149
 	}
89 150
 	
90 151
 	@Override
@@ -93,6 +154,6 @@ public class IconButtonControl implements DComponent {
93 154
 	}
94 155
 	
95 156
 	private void repaint() {
96
-		
157
+		context.repaint(bounds);
97 158
 	}
98 159
 }

+ 46
- 0
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/IconButtonControlStyle.java Visa fil

@@ -0,0 +1,46 @@
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.ui.view;
7
+
8
+import org.openzen.drawablegui.style.DDpDimension;
9
+import org.openzen.drawablegui.style.DShadow;
10
+import org.openzen.drawablegui.style.DStyleDefinition;
11
+
12
+/**
13
+ *
14
+ * @author Hoofdgebruiker
15
+ */
16
+public class IconButtonControlStyle {
17
+	public final int margin;
18
+	public final int padding;
19
+	public final int roundingRadius;
20
+	
21
+	public final int colorNormal;
22
+	public final int colorHover;
23
+	public final int colorPress;
24
+	public final int colorDisabled;
25
+	
26
+	public final DShadow shadowNormal;
27
+	public final DShadow shadowHover;
28
+	public final DShadow shadowPress;
29
+	public final DShadow shadowDisabled;
30
+	
31
+	public IconButtonControlStyle(DStyleDefinition style) {
32
+		margin = style.getDimension("margin", new DDpDimension(3));
33
+		padding = style.getDimension("padding", new DDpDimension(2));
34
+		roundingRadius = style.getDimension("roundingRadius", new DDpDimension(4));
35
+		
36
+		colorNormal = style.getColor("colorNormal", 0);
37
+		colorHover = style.getColor("colorHover", 0xFFFFFFFF);
38
+		colorPress = style.getColor("colorPress", 0xFFF0F0F0);
39
+		colorDisabled = style.getColor("colorDisabled", 0);
40
+		
41
+		shadowNormal = style.getShadow("shadowNormal", context -> DShadow.NONE);
42
+		shadowHover = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 2.0f * context.getScale()));
43
+		shadowPress = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 1.5f * context.getScale()));
44
+		shadowDisabled = style.getShadow("shadowDisabled", context -> DShadow.NONE);
45
+	}
46
+}

+ 71
- 15
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButton.java Visa fil

@@ -5,18 +5,21 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7 7
 
8
+import java.util.function.Consumer;
8 9
 import org.openzen.drawablegui.DCanvas;
9
-import org.openzen.drawablegui.DColorableIcon;
10 10
 import org.openzen.drawablegui.DComponent;
11 11
 import org.openzen.drawablegui.DDimensionPreferences;
12 12
 import org.openzen.drawablegui.DDrawable;
13
+import org.openzen.drawablegui.DMouseEvent;
13 14
 import org.openzen.drawablegui.DPath;
14 15
 import org.openzen.drawablegui.DTransform2D;
15 16
 import org.openzen.drawablegui.DUIContext;
16 17
 import org.openzen.drawablegui.listeners.DIRectangle;
18
+import org.openzen.drawablegui.listeners.ListenerHandle;
17 19
 import org.openzen.drawablegui.live.LiveBool;
18 20
 import org.openzen.drawablegui.live.LiveObject;
19 21
 import org.openzen.drawablegui.live.SimpleLiveObject;
22
+import org.openzen.drawablegui.style.DShadow;
20 23
 import org.openzen.drawablegui.style.DStyleClass;
21 24
 import org.openzen.drawablegui.style.DStylePath;
22 25
 
@@ -26,19 +29,28 @@ import org.openzen.drawablegui.style.DStylePath;
26 29
  */
27 30
 public class AspectBarSelectorButton implements DComponent {
28 31
 	
29
-	public final LiveBool active = new LiveBool();
32
+	public final LiveBool active;
30 33
 	
31 34
 	private final DStyleClass styleClass;
32 35
 	private final DDrawable icon;
33 36
 	private final LiveObject<DDimensionPreferences> preferences = new SimpleLiveObject<>(DDimensionPreferences.EMPTY);
37
+	private final Consumer<DMouseEvent> onClick;
34 38
 	private DUIContext context;
35 39
 	private AspectBarSelectorButtonStyle style;
36 40
 	private DIRectangle bounds;
37 41
 	private DPath shape;
42
+	private boolean hovering;
43
+	private boolean pressing;
38 44
 	
39
-	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon) {
45
+	private final ListenerHandle<LiveBool.Listener> activeListener;
46
+	
47
+	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon, LiveBool active, Consumer<DMouseEvent> onClick) {
48
+		this.active = active;
40 49
 		this.styleClass = styleClass;
41 50
 		this.icon = icon;
51
+		this.onClick = onClick;
52
+		
53
+		activeListener = active.addListener((oldValue, newValue) -> repaint());
42 54
 	}
43 55
 
44 56
 	@Override
@@ -46,6 +58,7 @@ public class AspectBarSelectorButton implements DComponent {
46 58
 		this.context = context;
47 59
 		DStylePath path = parent.getChild("selectorbutton", styleClass);
48 60
 		style = new AspectBarSelectorButtonStyle(context.getStylesheets().get(context, path));
61
+		preferences.setValue(new DDimensionPreferences(style.width, style.height));
49 62
 		shape = DPath.roundedRectangle(
50 63
 				0,
51 64
 				0,
@@ -71,25 +84,68 @@ public class AspectBarSelectorButton implements DComponent {
71 84
 
72 85
 	@Override
73 86
 	public void paint(DCanvas canvas) {
87
+		int color = style.colorNormal;
88
+		DShadow shadow = style.shadowNormal;
89
+		if (active.getValue()) {
90
+			color = style.colorActive;
91
+			shadow = style.shadowActive;
92
+		} else if (pressing) {
93
+			color = style.colorPress;
94
+			shadow = style.shadowPress;
95
+		} else if (hovering) {
96
+			color = style.colorHover;
97
+			shadow = style.shadowHover;
98
+		}
99
+		
74 100
 		canvas.shadowPath(
75 101
 					shape,
76 102
 					DTransform2D.translate(bounds.x, bounds.y),
77
-					style.shadowColor,
78
-					style.shadowOffsetX,
79
-					style.shadowOffsetY,
80
-					style.shadowRadius);
81
-			canvas.fillPath(
82
-					shape,
83
-					DTransform2D.translate(bounds.x, bounds.y),
84
-					style.colorNormal);
85
-			icon.draw(canvas, DTransform2D.scaleAndTranslate(
86
-					bounds.x + (style.width - icon.getNominalWidth() * context.getScale()) / 2,
87
-					bounds.y + (style.height - icon.getNominalHeight() * context.getScale()) / 2,
88
-					context.getScale()));
103
+					shadow);
104
+		canvas.fillPath(
105
+				shape,
106
+				DTransform2D.translate(bounds.x, bounds.y),
107
+				color);
108
+		icon.draw(canvas, DTransform2D.scaleAndTranslate(
109
+				bounds.x + (style.width - icon.getNominalWidth() * context.getScale()) / 2,
110
+				bounds.y + (style.height - icon.getNominalHeight() * context.getScale()) / 2,
111
+				context.getScale()));
112
+	}
113
+	
114
+	@Override
115
+	public void onMouseEnter(DMouseEvent e) {
116
+		hovering = true;
117
+		repaint();
118
+	}
119
+	
120
+	@Override
121
+	public void onMouseExit(DMouseEvent e) {
122
+		hovering = false;
123
+		pressing = false;
124
+		repaint();
125
+	}
126
+	
127
+	@Override
128
+	public void onMouseDown(DMouseEvent e) {
129
+		pressing = true;
130
+		repaint();
131
+	}
132
+	
133
+	@Override
134
+	public void onMouseRelease(DMouseEvent e) {
135
+		if (pressing)
136
+			onClick.accept(e);
137
+		
138
+		pressing = false;
139
+		repaint();
89 140
 	}
90 141
 
91 142
 	@Override
92 143
 	public void close() {
93 144
 		// nothing
94 145
 	}
146
+	
147
+	private void repaint() {
148
+		if (context != null)
149
+			context.repaint(bounds);
150
+	}
95 151
 }

+ 13
- 13
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButtonStyle.java Visa fil

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7 7
 
8
-import org.openzen.drawablegui.dimension.DDimension;
9
-import org.openzen.drawablegui.dimension.DDpDimension;
8
+import org.openzen.drawablegui.style.DDpDimension;
9
+import org.openzen.drawablegui.style.DShadow;
10 10
 import org.openzen.drawablegui.style.DStyleDefinition;
11 11
 
12 12
 /**
@@ -23,10 +23,10 @@ public class AspectBarSelectorButtonStyle {
23 23
 	public final int colorPress;
24 24
 	public final int colorActive;
25 25
 	
26
-	public final int shadowColor;
27
-	public final float shadowOffsetX;
28
-	public final float shadowOffsetY;
29
-	public final float shadowRadius;
26
+	public final DShadow shadowNormal;
27
+	public final DShadow shadowHover;
28
+	public final DShadow shadowPress;
29
+	public final DShadow shadowActive;
30 30
 	
31 31
 	public AspectBarSelectorButtonStyle(DStyleDefinition style) {
32 32
 		width = style.getDimension("width", new DDpDimension(24));
@@ -34,13 +34,13 @@ public class AspectBarSelectorButtonStyle {
34 34
 		roundingRadius = style.getDimension("roundingRadius", new DDpDimension(4));
35 35
 		
36 36
 		colorNormal = style.getColor("colorNormal", 0xFFFFFFFF);
37
-		colorHover = style.getColor("colorHover", 0xFFCCCCCC);
38
-		colorPress = style.getColor("colorPress", 0xFFBBBBBB);
39
-		colorActive = style.getColor("colorActive", 0xFFBBBBBB);
37
+		colorHover = style.getColor("colorHover", 0xFFE0E0E0);
38
+		colorPress = style.getColor("colorPress", 0xFFCCCCCC);
39
+		colorActive = style.getColor("colorActive", 0xFFCCCCCC);
40 40
 		
41
-		shadowRadius = style.getDimension("shadowRadius", new DDpDimension(3));
42
-		shadowColor = style.getColor("ashadowColor", 0xFF888888);
43
-		shadowOffsetX = style.getDimension("shadowOffsetX", new DDpDimension(0));
44
-		shadowOffsetY = style.getDimension("shadowOffsetY", new DDpDimension(0.5f));
41
+		shadowNormal = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()));
42
+		shadowHover = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()));
43
+		shadowPress = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()));
44
+		shadowActive = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()));
45 45
 	}
46 46
 }

+ 23
- 19
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarStyle.java Visa fil

@@ -5,7 +5,10 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.aspectbar;
7 7
 
8
-import org.openzen.drawablegui.dimension.DDpDimension;
8
+import org.openzen.drawablegui.DFont;
9
+import org.openzen.drawablegui.DFontFamily;
10
+import org.openzen.drawablegui.style.DDpDimension;
11
+import org.openzen.drawablegui.style.DShadow;
9 12
 import org.openzen.drawablegui.style.DStyleDefinition;
10 13
 
11 14
 /**
@@ -20,44 +23,45 @@ public class AspectBarStyle {
20 23
 	public final int backgroundColor;
21 24
 	public final int foregroundColor;
22 25
 	
23
-	public final int aspectSelectorButtonRadius;
24 26
 	public final int aspectSelectorButtonSpacing;
25
-	public final int aspectSelectorButtonShadowRadius;
26
-	public final int aspectSelectorButtonShadowColor;
27
-	public final float aspectSelectorButtonShadowOffsetX;
28
-	public final float aspectSelectorButtonShadowOffsetY;
27
+	public final int toolbarTitleToControlsSpacing;
29 28
 	
30
-	public final int aspectBarShadowRadius;
31
-	public final int aspectBarShadowColor;
32
-	public final float aspectBarShadowOffsetX;
33
-	public final float aspectBarShadowOffsetY;
29
+	public final DShadow aspectBarShadow;
34 30
 	public final int aspectBarPaddingTop;
35 31
 	
36 32
 	public final int controlPaddingTop;
37 33
 	public final int controlPaddingBottom;
38 34
 	
35
+	public final DFont activeToolbarTitleFont;
36
+	public final int activeToolbarTitleColor;
37
+	
38
+	public final int windowControlSpacingLeft;
39
+	public final int windowControlSpacingBottom;
40
+	public final DShadow windowControlShadow;
41
+	
39 42
 	public AspectBarStyle(DStyleDefinition style) {
40 43
 		height = style.getDimension("height", new DDpDimension(32));
41 44
 		aspectSelectorPaddingLeft = style.getDimension("aspectSelectorPaddingLeft", new DDpDimension(4));
42 45
 		aspectSelectorToToolbarSpacing = style.getDimension("aspectSelectorToToolbarSpacing", new DDpDimension(16));
46
+		toolbarTitleToControlsSpacing = style.getDimension("toolbarTitleToControlsSpacing", new DDpDimension(8));
43 47
 		aspectSelectorBottomSize = style.getDimension("aspectSelectorBottomSize", new DDpDimension(4));
44 48
 		backgroundColor = style.getColor("backgroundColor", 0xFFF0F0F0);
45 49
 		foregroundColor = style.getColor("foregroundColor", 0xFFFFFFFF);
46 50
 		
47
-		aspectSelectorButtonRadius = style.getDimension("aspectSelectorButtonRadius", new DDpDimension(12));
48 51
 		aspectSelectorButtonSpacing = style.getDimension("aspectSelectorButtonSpacing", new DDpDimension(4));
49
-		aspectSelectorButtonShadowRadius = style.getDimension("aspectSelectorButtonShadowRadius", new DDpDimension(3));
50
-		aspectSelectorButtonShadowColor = style.getColor("aspectSelectorButtonShadowColor", 0xFF888888);
51
-		aspectSelectorButtonShadowOffsetX = style.getDimension("aspectSelectorButtonShadowOffsetX", new DDpDimension(0));
52
-		aspectSelectorButtonShadowOffsetY = style.getDimension("aspectSelectorButtonShadowOffsetY", new DDpDimension(0.5f));
53 52
 		
54
-		aspectBarShadowRadius = style.getDimension("aspectBarShadowRadius", new DDpDimension(2));
55
-		aspectBarShadowColor = style.getColor("aspectBarShadowColor", 0xFF888888);
56
-		aspectBarShadowOffsetX = style.getDimension("aspectBarShadowOffsetX", new DDpDimension(0));
57
-		aspectBarShadowOffsetY = style.getDimension("aspectBarShadowOffsetX", new DDpDimension(0.5f));
53
+		aspectBarShadow = style.getShadow("aspectBarShadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 2 * context.getScale()));
58 54
 		aspectBarPaddingTop = style.getDimension("aspectBarPaddingTop", new DDpDimension(2));
59 55
 		
60 56
 		controlPaddingTop = style.getDimension("controlPaddingTop", new DDpDimension(2));
61 57
 		controlPaddingBottom = style.getDimension("controlPaddingBottom", new DDpDimension(2));
58
+		
59
+		activeToolbarTitleFont = style.getFont("activeToolbarTitleFont", context -> new DFont(DFontFamily.UI, false, false, false, (int)(12.0f * context.getScale())));
60
+		activeToolbarTitleColor = style.getColor("activeToolbarTitleColor", 0xFF888888);
61
+		
62
+		windowControlSpacingLeft = style.getDimension("windowControlSpacingLeft", new DDpDimension(4));
63
+		windowControlSpacingBottom = style.getDimension("windowControlSpacingBottom", new DDpDimension(4));
64
+		//windowControlShadow = style.getShadow("windowControlShadow", context -> DShadow.NONE);
65
+		windowControlShadow = style.getShadow("windowControlShadow", context -> new DShadow(0x80888888, 0, 0, 2 * context.getScale()));
62 66
 	}
63 67
 }

+ 178
- 64
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarView.java Visa fil

@@ -13,6 +13,7 @@ import org.openzen.drawablegui.BaseComponentGroup;
13 13
 import org.openzen.drawablegui.DCanvas;
14 14
 import org.openzen.drawablegui.DComponent;
15 15
 import org.openzen.drawablegui.DDimensionPreferences;
16
+import org.openzen.drawablegui.DFontMetrics;
16 17
 import org.openzen.drawablegui.DPath;
17 18
 import org.openzen.drawablegui.DTransform2D;
18 19
 import org.openzen.drawablegui.listeners.DIRectangle;
@@ -21,12 +22,20 @@ import org.openzen.drawablegui.live.SimpleLiveObject;
21 22
 import org.openzen.zenscript.ide.ui.IDEAspectBar;
22 23
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
23 24
 import org.openzen.drawablegui.DUIContext;
25
+import org.openzen.drawablegui.DUIWindow;
24 26
 import org.openzen.drawablegui.listeners.ListenerHandle;
27
+import org.openzen.drawablegui.live.LiveBool;
25 28
 import org.openzen.drawablegui.live.LiveList;
26 29
 import org.openzen.drawablegui.live.LiveMappedList;
30
+import org.openzen.drawablegui.live.LivePredicateBool;
31
+import org.openzen.drawablegui.live.SimpleLiveBool;
27 32
 import org.openzen.drawablegui.style.DStyleClass;
28 33
 import org.openzen.drawablegui.style.DStylePath;
29 34
 import org.openzen.zenscript.ide.ui.IDEAspectBarControl;
35
+import org.openzen.zenscript.ide.ui.icons.CloseIcon;
36
+import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
37
+import org.openzen.zenscript.ide.ui.icons.ScalableMaximizeIcon;
38
+import org.openzen.zenscript.ide.ui.icons.ScalableMinimizeIcon;
30 39
 
31 40
 /**
32 41
  *
@@ -42,11 +51,25 @@ public class AspectBarView extends BaseComponentGroup {
42 51
 	private DUIContext context;
43 52
 	private DStylePath path;
44 53
 	private AspectBarStyle style;
54
+	private DFontMetrics activeToolbarTitleFontMetrics;
55
+	private boolean showWindowControls;
56
+	
57
+	private final LiveMappedList<IDEAspectToolbar, AspectBarSelectorButton> selectorButtons;
45 58
 	public final LiveObject<IDEAspectToolbar> active = new SimpleLiveObject<>(null);
46 59
 	private LiveMappedList<IDEAspectBarControl, DComponent> activeToolbarComponents;
47 60
 	
48 61
 	private final ListenerHandle<LiveList.Listener<IDEAspectToolbar>> listener;
49 62
 	private DPath aspectBarShape;
63
+	private DPath windowControlsShape;
64
+	private int aspectSelectorEndX = 0;
65
+	
66
+	private WindowActionButton minimize;
67
+	private WindowActionButton maximizeRestore;
68
+	private WindowActionButton close;
69
+	
70
+	private final ListenerHandle<LiveObject.Listener<DDimensionPreferences>> minimizeRelayout;
71
+	private final ListenerHandle<LiveObject.Listener<DDimensionPreferences>> maximizeRestoreRelayout;
72
+	private final ListenerHandle<LiveObject.Listener<DDimensionPreferences>> closeRelayout;
50 73
 	
51 74
 	public AspectBarView(DStyleClass styleClass, IDEAspectBar aspectBar) {
52 75
 		this.styleClass = styleClass;
@@ -55,6 +78,29 @@ public class AspectBarView extends BaseComponentGroup {
55 78
 		active.addListener(this::onActiveChanged);
56 79
 		listener = aspectBar.aspectToolbars.addListener(new ToolbarListListener());
57 80
 		
81
+		minimize = new WindowActionButton(scale -> new ScalableMinimizeIcon(scale), e -> context.getWindow().minimize());
82
+		minimizeRelayout = minimize.getDimensionPreferences().addListener((a, b) -> layout());
83
+		maximizeRestore = new WindowActionButton(ScalableMaximizeIcon::new, e -> {
84
+			if (context.getWindow().getWindowState().getValue() == DUIWindow.State.MAXIMIZED)
85
+				context.getWindow().restore();
86
+			else
87
+				context.getWindow().maximize();
88
+		});
89
+		maximizeRestoreRelayout = maximizeRestore.getDimensionPreferences().addListener((a, b) -> layout());
90
+		close = new WindowActionButton(scale -> new ScalableCloseIcon(scale), e -> context.getWindow().close());
91
+		closeRelayout = close.getDimensionPreferences().addListener((a, b) -> layout());
92
+		
93
+		selectorButtons = new LiveMappedList<>(
94
+				aspectBar.aspectToolbars,
95
+				bar -> {
96
+					LiveBool buttonActive = new LivePredicateBool<>(active, activeBar -> activeBar == bar);
97
+					AspectBarSelectorButton button = new AspectBarSelectorButton(DStyleClass.EMPTY, bar.icon, buttonActive, e -> active.setValue(bar));
98
+					if (context != null)
99
+						button.setContext(path, context);
100
+					
101
+					return button;
102
+				});
103
+		
58 104
 		if (aspectBar.aspectToolbars.size() > 0)
59 105
 			active.setValue(aspectBar.aspectToolbars.get(0));
60 106
 	}
@@ -64,11 +110,24 @@ public class AspectBarView extends BaseComponentGroup {
64 110
 		this.context = context;
65 111
 		this.path = parent.getChild("aspectbar", styleClass);
66 112
 		this.style = new AspectBarStyle(context.getStylesheets().get(context, path));
113
+		activeToolbarTitleFontMetrics = context.getFontMetrics(style.activeToolbarTitleFont);
114
+		showWindowControls = !context.getWindow().hasTitleBar();
115
+		
116
+		for (DComponent selectorButton : selectorButtons)
117
+			selectorButton.setContext(path, context);
67 118
 		
68 119
 		if (bounds != null) {
69
-			calculateAspectBarShape();
120
+			layout();
70 121
 			active.setValue(active.getValue());
71 122
 		}
123
+		
124
+		if (activeToolbarComponents != null)
125
+			for (DComponent component : activeToolbarComponents)
126
+				component.setContext(path, context);
127
+		
128
+		minimize.setContext(path, context);
129
+		maximizeRestore.setContext(path, context);
130
+		close.setContext(path, context);
72 131
 	}
73 132
 	
74 133
 	@Override
@@ -86,7 +145,7 @@ public class AspectBarView extends BaseComponentGroup {
86 145
 		this.bounds = bounds;
87 146
 		
88 147
 		if (context != null) {
89
-			calculateAspectBarShape();
148
+			layout();
90 149
 			context.repaint(bounds);
91 150
 		}
92 151
 	}
@@ -96,70 +155,45 @@ public class AspectBarView extends BaseComponentGroup {
96 155
 		canvas.pushBounds(bounds);
97 156
 		canvas.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height, style.backgroundColor);
98 157
 		
99
-		//DPath circle = DPath.circle(0, 0, style.aspectSelectorButtonRadius);
100
-		DPath circle = DPath.roundedRectangle(
101
-				-style.aspectSelectorButtonRadius,
102
-				-style.aspectSelectorButtonRadius,
103
-				2 * style.aspectSelectorButtonRadius,
104
-				2 * style.aspectSelectorButtonRadius,
105
-				8);
106
-		int x = bounds.x + style.aspectSelectorPaddingLeft;
107
-		int y = bounds.y;
108
-		for (IDEAspectToolbar toolbar : aspectBar.aspectToolbars) {
109
-			canvas.shadowPath(
110
-					circle,
111
-					DTransform2D.translate(x + style.aspectSelectorButtonRadius, y + style.height / 2),
112
-					style.aspectSelectorButtonShadowColor,
113
-					style.aspectSelectorButtonShadowOffsetX,
114
-					style.aspectSelectorButtonShadowOffsetY,
115
-					style.aspectSelectorButtonShadowRadius);
116
-			canvas.fillPath(
117
-					circle,
118
-					DTransform2D.translate(x + style.aspectSelectorButtonRadius, y + style.height / 2),
119
-					style.foregroundColor);
120
-			toolbar.icon.draw(canvas, DTransform2D.scaleAndTranslate(
121
-					x + (2 * style.aspectSelectorButtonRadius - toolbar.icon.getNominalWidth() * context.getScale()) / 2,
122
-					y + (style.height - toolbar.icon.getNominalHeight() * context.getScale()) / 2,
123
-					context.getScale()), 0xFF888888);
124
-			x += style.aspectSelectorButtonRadius * 2 + style.aspectSelectorButtonSpacing;
125
-		}
126
-		for (IDEAspectToolbar toolbar : contextBars) {
127
-			canvas.shadowPath(
128
-					circle,
129
-					DTransform2D.translate(x + style.aspectSelectorButtonRadius, y + style.height / 2),
130
-					style.aspectSelectorButtonShadowColor,
131
-					style.aspectSelectorButtonShadowOffsetX,
132
-					style.aspectSelectorButtonShadowOffsetY,
133
-					style.aspectSelectorButtonShadowRadius);
134
-			canvas.fillPath(
135
-					circle,
136
-					DTransform2D.translate(x + style.aspectSelectorButtonRadius, y + style.height / 2),
137
-					style.foregroundColor);
138
-			toolbar.icon.draw(canvas, DTransform2D.scaleAndTranslate(
139
-					x + (2 * style.aspectSelectorButtonRadius - toolbar.icon.getNominalWidth() * context.getScale()) / 2,
140
-					y + (style.height - toolbar.icon.getNominalHeight() * context.getScale()) / 2,
141
-					context.getScale()), 0xFF000000);
142
-			x += style.aspectSelectorButtonRadius * 2 + style.aspectSelectorButtonSpacing;
143
-		}
144
-		
158
+		for (DComponent button : selectorButtons)
159
+			button.paint(canvas);
145 160
 		
146 161
 		canvas.shadowPath(
147 162
 				aspectBarShape,
148 163
 				DTransform2D.IDENTITY,
149
-				style.aspectBarShadowColor,
150
-				style.aspectBarShadowOffsetX,
151
-				style.aspectBarShadowOffsetY,
152
-				style.aspectBarShadowRadius);
164
+				style.aspectBarShadow);
153 165
 		canvas.fillPath(
154 166
 				aspectBarShape,
155 167
 				DTransform2D.IDENTITY,
156 168
 				style.foregroundColor);
157 169
 		
170
+		if (active.getValue() != null) {
171
+			int y = bounds.y
172
+					+ style.aspectBarPaddingTop
173
+					+ (int)(activeToolbarTitleFontMetrics.getAscent() * 0.35f)
174
+					+ (bounds.height - style.aspectBarPaddingTop) / 2;
175
+			int x = aspectSelectorEndX + style.aspectSelectorToToolbarSpacing;
176
+			canvas.drawText(style.activeToolbarTitleFont, style.activeToolbarTitleColor, x, y, active.getValue().title);
177
+			canvas.fillRectangle(
178
+					x + activeToolbarTitleFontMetrics.getWidth(active.getValue().title) + 8,
179
+					bounds.y + style.aspectBarPaddingTop + 8,
180
+					2,
181
+					bounds.height - style.aspectBarPaddingTop - 16,
182
+					0xFFCCCCCC);
183
+		}
184
+		
158 185
 		if (activeToolbarComponents != null) {
159 186
 			for (DComponent component : activeToolbarComponents)
160 187
 				component.paint(canvas);
161 188
 		}
162 189
 		
190
+		if (showWindowControls) {
191
+			canvas.shadowPath(windowControlsShape, DTransform2D.IDENTITY, style.windowControlShadow);
192
+			minimize.paint(canvas);
193
+			maximizeRestore.paint(canvas);
194
+			close.paint(canvas);
195
+		}
196
+		
163 197
 		canvas.popBounds();
164 198
 	}
165 199
 
@@ -182,14 +216,54 @@ public class AspectBarView extends BaseComponentGroup {
182 216
 		layoutActiveToolbarComponents();
183 217
 	}
184 218
 	
219
+	private void layout() {
220
+		if (bounds == null)
221
+			return;
222
+		
223
+		layoutAspectSelectorButtons();
224
+		layoutActiveToolbarComponents();
225
+		
226
+		int x = bounds.x + bounds.width;
227
+		DDimensionPreferences closeSize = close.getDimensionPreferences().getValue();
228
+		DDimensionPreferences maximizeRestoreSize = maximizeRestore.getDimensionPreferences().getValue();
229
+		DDimensionPreferences minimizeSize = minimize.getDimensionPreferences().getValue();
230
+		
231
+		x -= closeSize.preferredWidth;
232
+		close.setBounds(new DIRectangle(x, bounds.y, closeSize.preferredWidth, closeSize.preferredHeight));
233
+		x -= maximizeRestoreSize.preferredWidth;
234
+		maximizeRestore.setBounds(new DIRectangle(x, bounds.y, maximizeRestoreSize.preferredWidth, maximizeRestoreSize.preferredHeight));
235
+		x -= minimizeSize.preferredWidth;
236
+		minimize.setBounds(new DIRectangle(x, bounds.y, minimizeSize.preferredWidth, minimizeSize.preferredHeight));
237
+		
238
+		calculateAspectBarShape();
239
+	}
240
+	
241
+	private void layoutAspectSelectorButtons() {
242
+		if (bounds == null)
243
+			return;
244
+		
245
+		int x = bounds.x + style.aspectSelectorPaddingLeft;
246
+		
247
+		for (DComponent component : selectorButtons) {
248
+			int width = component.getDimensionPreferences().getValue().preferredWidth;
249
+			int height = component.getDimensionPreferences().getValue().preferredHeight;
250
+			int y = bounds.y + (bounds.height - style.aspectSelectorBottomSize - height) / 2;
251
+			component.setBounds(new DIRectangle(x, y, width, height));
252
+			
253
+			x += width + style.aspectSelectorButtonSpacing;
254
+		}
255
+		
256
+		aspectSelectorEndX = x;
257
+	}
258
+	
185 259
 	private void layoutActiveToolbarComponents() {
186 260
 		if (bounds == null)
187 261
 			return;
188 262
 		
189
-		int x = bounds.x
190
-				+ style.aspectSelectorPaddingLeft
191
-				+ (style.aspectSelectorButtonRadius * 2 + style.aspectSelectorButtonSpacing) * (aspectBar.aspectToolbars.size() + contextBars.size())
192
-				+ style.aspectSelectorToToolbarSpacing;
263
+		int x = aspectSelectorEndX
264
+				+ style.aspectSelectorToToolbarSpacing
265
+				+ activeToolbarTitleFontMetrics.getWidth(active.getValue().title)
266
+				+ style.toolbarTitleToControlsSpacing;
193 267
 		
194 268
 		int y = style.aspectBarPaddingTop + style.controlPaddingTop;
195 269
 		int height = bounds.height - y - style.controlPaddingBottom;
@@ -210,6 +284,14 @@ public class AspectBarView extends BaseComponentGroup {
210 284
 		
211 285
 		for (DComponent component : activeToolbarComponents)
212 286
 			children.accept(component);
287
+		for (DComponent component : selectorButtons)
288
+			children.accept(component);
289
+		
290
+		if (showWindowControls) {
291
+			children.accept(minimize);
292
+			children.accept(maximizeRestore);
293
+			children.accept(close);
294
+		}
213 295
 	}
214 296
 
215 297
 	@Override
@@ -220,14 +302,24 @@ public class AspectBarView extends BaseComponentGroup {
220 302
 		for (DComponent component : activeToolbarComponents)
221 303
 			if (predicate.test(component))
222 304
 				return component;
305
+		for (DComponent component : selectorButtons)
306
+			if (predicate.test(component))
307
+				return component;
308
+		
309
+		if (showWindowControls) {
310
+			if (predicate.test(minimize))
311
+				return minimize;
312
+			if (predicate.test(maximizeRestore))
313
+				return maximizeRestore;
314
+			if (predicate.test(close))
315
+				return close;
316
+		}
223 317
 		
224 318
 		return null;
225 319
 	}
226 320
 	
227 321
 	private void calculateAspectBarShape() {
228
-		int toX = bounds.x
229
-				+ style.aspectSelectorPaddingLeft
230
-				+ (style.aspectSelectorButtonRadius * 2 + style.aspectSelectorButtonSpacing) * (aspectBar.aspectToolbars.size() + contextBars.size());
322
+		int toX = aspectSelectorEndX;
231 323
 		
232 324
 		aspectBarShape = tracer -> {
233 325
 			int baseY = bounds.y + bounds.height - style.aspectSelectorBottomSize;
@@ -237,11 +329,33 @@ public class AspectBarView extends BaseComponentGroup {
237 329
 					toX + 6 * context.getScale(), baseY,
238 330
 					toX + style.aspectSelectorToToolbarSpacing - 6 * context.getScale(), bounds.y + style.aspectBarPaddingTop,
239 331
 					toX + style.aspectSelectorToToolbarSpacing, bounds.y + style.aspectBarPaddingTop);
240
-			tracer.lineTo(bounds.x + bounds.width, bounds.y + style.aspectBarPaddingTop);
332
+			
333
+			if (showWindowControls) {
334
+				int spacingLeft = style.windowControlSpacingLeft;
335
+				int spacingBottom = style.windowControlSpacingBottom;
336
+				int cornerX = minimize.getBounds().x - spacingLeft;
337
+				int cornerY = minimize.getBounds().y + minimize.getBounds().height + spacingBottom;
338
+				tracer.lineTo(cornerX, bounds.y + style.aspectBarPaddingTop);
339
+				tracer.lineTo(cornerX, cornerY);
340
+				tracer.lineTo(bounds.x + bounds.width, cornerY);
341
+			} else {
342
+				tracer.lineTo(bounds.x + bounds.width, bounds.y + style.aspectBarPaddingTop);
343
+			}
344
+			
241 345
 			tracer.lineTo(bounds.x + bounds.width, bounds.y + bounds.height);
242 346
 			tracer.lineTo(bounds.x, bounds.y + bounds.height);
243 347
 			tracer.close();
244 348
 		};
349
+		
350
+		if (showWindowControls) {
351
+			DIRectangle minimizeBounds = minimize.getBounds();
352
+			DIRectangle closeBounds = close.getBounds();
353
+			windowControlsShape = DPath.rectangle(
354
+					minimizeBounds.x,
355
+					minimizeBounds.y,
356
+					closeBounds.x + closeBounds.width - minimizeBounds.x,
357
+					closeBounds.height);
358
+		}
245 359
 	}
246 360
 	
247 361
 	private class ToolbarListListener implements LiveList.Listener<IDEAspectToolbar> {
@@ -251,14 +365,15 @@ public class AspectBarView extends BaseComponentGroup {
251 365
 			if (index == 0 && activeToolbarComponents == null)
252 366
 				active.setValue(value);
253 367
 			
254
-			layoutActiveToolbarComponents();
255
-			calculateAspectBarShape();
368
+			layout();
256 369
 		}
257 370
 
258 371
 		@Override
259 372
 		public void onChanged(int index, IDEAspectToolbar oldValue, IDEAspectToolbar newValue) {
260 373
 			if (oldValue == active.getValue())
261 374
 				active.setValue(newValue);
375
+			
376
+			layoutAspectSelectorButtons();
262 377
 		}
263 378
 
264 379
 		@Override
@@ -266,8 +381,7 @@ public class AspectBarView extends BaseComponentGroup {
266 381
 			if (oldValue == active.getValue())
267 382
 				active.setValue(aspectBar.aspectToolbars.size() == 0 ? null : aspectBar.aspectToolbars.get(0));
268 383
 			
269
-			layoutActiveToolbarComponents();
270
-			calculateAspectBarShape();
384
+			layout();
271 385
 		}
272 386
 	}
273 387
 }

+ 142
- 0
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/WindowActionButton.java Visa fil

@@ -0,0 +1,142 @@
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.ui.view.aspectbar;
7
+
8
+import java.util.function.Consumer;
9
+import java.util.function.Function;
10
+import org.openzen.drawablegui.DCanvas;
11
+import org.openzen.drawablegui.DColorableIcon;
12
+import org.openzen.drawablegui.DComponent;
13
+import org.openzen.drawablegui.DDimensionPreferences;
14
+import org.openzen.drawablegui.DMouseEvent;
15
+import org.openzen.drawablegui.DTransform2D;
16
+import org.openzen.drawablegui.DUIContext;
17
+import org.openzen.drawablegui.listeners.DIRectangle;
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.SimpleLiveObject;
22
+import org.openzen.drawablegui.style.DStylePath;
23
+import org.openzen.zenscript.ide.ui.icons.ScalableCloseIcon;
24
+
25
+/**
26
+ *
27
+ * @author Hoofdgebruiker
28
+ */
29
+public class WindowActionButton implements DComponent {
30
+	private final SimpleLiveObject<DDimensionPreferences> preferences = new SimpleLiveObject<>(DDimensionPreferences.EMPTY);
31
+	
32
+	private final Function<Float, DColorableIcon> scalableIcon;
33
+	private final Consumer<DMouseEvent> action;
34
+	
35
+	private LiveBool windowFocused;
36
+	private ListenerHandle<LiveBool.Listener> windowFocusedListener;
37
+	
38
+	private DColorableIcon icon;
39
+	private DIRectangle bounds;
40
+	private boolean hover;
41
+	private boolean press;
42
+	private DUIContext context;
43
+	
44
+	public WindowActionButton(Function<Float, DColorableIcon> icon, Consumer<DMouseEvent> action) {
45
+		this.scalableIcon = icon;
46
+		this.action = action;
47
+	}
48
+
49
+	@Override
50
+	public void setContext(DStylePath parent, DUIContext context) {
51
+		this.context = context;
52
+		
53
+		windowFocused = context.getWindow().getActive();
54
+		windowFocusedListener = windowFocused.addListener((a, b) -> repaint());
55
+		
56
+		icon = scalableIcon == null ? null : scalableIcon.apply(context.getScale());
57
+		preferences.setValue(new DDimensionPreferences(
58
+				(int)(48 * context.getScale()),
59
+				(int)(24 * context.getScale())));
60
+	}
61
+
62
+	@Override
63
+	public LiveObject<DDimensionPreferences> getDimensionPreferences() {
64
+		return preferences;
65
+	}
66
+
67
+	@Override
68
+	public DIRectangle getBounds() {
69
+		return bounds;
70
+	}
71
+
72
+	@Override
73
+	public void setBounds(DIRectangle bounds) {
74
+		this.bounds = bounds;
75
+	}
76
+
77
+	@Override
78
+	public void paint(DCanvas canvas) {
79
+		int color = 0xFFFFFFFF;
80
+		int iconColor = windowFocused.getValue() ? 0xFF000000 : 0xFF999999;
81
+		
82
+		if (hover) {
83
+			if (icon instanceof ScalableCloseIcon) {
84
+				color = 0xFFE81123;
85
+				iconColor = 0xFFFFFFFF;
86
+			} else {
87
+				color = 0xFFE0E0E0;
88
+			}
89
+		}
90
+		if (press)
91
+			color = 0xFFCCCCCC;
92
+		
93
+		
94
+		canvas.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height, color);
95
+		
96
+		if (scalableIcon != null) {
97
+			int iconX = bounds.x + (int)(bounds.width - icon.getNominalWidth()) / 2;
98
+			int iconY = bounds.y + (int)(bounds.height - icon.getNominalHeight()) / 2;
99
+			icon.draw(canvas, DTransform2D.translate(iconX, iconY), iconColor);
100
+		}
101
+	}
102
+
103
+	@Override
104
+	public void close() {
105
+		windowFocusedListener.close();
106
+	}
107
+	
108
+	@Override
109
+	public void onMouseEnter(DMouseEvent e) {
110
+		hover = true;
111
+		repaint();
112
+	}
113
+	
114
+	@Override
115
+	public void onMouseExit(DMouseEvent e) {
116
+		hover = false;
117
+		press = false;
118
+		repaint();
119
+	}
120
+	
121
+	@Override
122
+	public void onMouseDown(DMouseEvent e) {
123
+		press = true;
124
+		repaint();
125
+	}
126
+	
127
+	@Override
128
+	public void onMouseRelease(DMouseEvent e) {
129
+		if (press)
130
+			action.accept(e);
131
+		
132
+		press = false;
133
+		repaint();
134
+	}
135
+	
136
+	private void repaint() {
137
+		if (context == null)
138
+			return;
139
+		
140
+		context.repaint(bounds);
141
+	}
142
+}

+ 14
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditor.java Visa fil

@@ -22,13 +22,14 @@ import org.openzen.drawablegui.live.SimpleLiveObject;
22 22
 import org.openzen.zenscript.ide.host.IDESourceFile;
23 23
 import org.openzen.zenscript.ide.ui.IDEAspectToolbar;
24 24
 import org.openzen.zenscript.ide.ui.IDEWindow;
25
-import org.openzen.zenscript.ide.ui.icons.ColorableCodeIcon;
25
+import org.openzen.zenscript.ide.ui.icons.CodeIcon;
26 26
 import org.openzen.zenscript.lexer.ReaderCharReader;
27 27
 import org.openzen.zenscript.lexer.TokenParser;
28 28
 import org.openzen.zenscript.lexer.ZSToken;
29 29
 import org.openzen.zenscript.lexer.ZSTokenParser;
30 30
 import org.openzen.zenscript.lexer.ZSTokenType;
31 31
 import org.openzen.drawablegui.DUIContext;
32
+import org.openzen.drawablegui.live.SimpleLiveBool;
32 33
 import org.openzen.drawablegui.style.DStyleClass;
33 34
 import org.openzen.drawablegui.style.DStylePath;
34 35
 import org.openzen.zenscript.ide.ui.icons.SaveIcon;
@@ -46,6 +47,7 @@ public class SourceEditor implements DComponent {
46 47
 	private final IDESourceFile sourceFile;
47 48
 	private final TokenModel tokens;
48 49
 	private final ListenerHandle<TokenModel.Listener> tokenListener;
50
+	private final SimpleLiveBool unchanged = new SimpleLiveBool(true);
49 51
 	
50 52
 	private DIRectangle bounds;
51 53
 	private DUIContext context;
@@ -67,7 +69,7 @@ public class SourceEditor implements DComponent {
67 69
 	private boolean dragging = false;
68 70
 	
69 71
 	private final IDEWindow window;
70
-	private final IDEAspectToolbar editToolbar = new IDEAspectToolbar(0, ColorableCodeIcon.INSTANCE, "Edit", "Source code editor");
72
+	private final IDEAspectToolbar editToolbar = new IDEAspectToolbar(0, CodeIcon.GREY, "Edit", "Source code editor");
71 73
 	
72 74
 	public SourceEditor(DStyleClass styleClass, IDEWindow window, IDESourceFile sourceFile) {
73 75
 		this.styleClass = styleClass;
@@ -77,7 +79,7 @@ public class SourceEditor implements DComponent {
77 79
 		tokens = new TokenModel(sourceFile.getName(), tab.length());
78 80
 		tokenListener = tokens.addListener(new TokenListener());
79 81
 		
80
-		editToolbar.controls.add(() -> new IconButtonControl(SaveIcon.INSTANCE, e -> save()));
82
+		editToolbar.controls.add(() -> new IconButtonControl(DStyleClass.EMPTY, SaveIcon.BLACK, SaveIcon.GREY, unchanged, e -> save()));
81 83
 		window.aspectBar.addToolbar(editToolbar);
82 84
 		
83 85
 		try {
@@ -94,6 +96,7 @@ public class SourceEditor implements DComponent {
94 96
 	@Override
95 97
 	public void close() {
96 98
 		window.aspectBar.removeToolbar(editToolbar);
99
+		tokenListener.close();
97 100
 	}
98 101
 
99 102
 	@Override
@@ -374,6 +377,7 @@ public class SourceEditor implements DComponent {
374 377
 		
375 378
 		SourcePosition cursor = SourcePosition.min(cursorStart, cursorEnd);
376 379
 		setCursor(cursor, cursor);
380
+		unchanged.setValue(false);
377 381
 	}
378 382
 	
379 383
 	private void paste() {
@@ -386,11 +390,13 @@ public class SourceEditor implements DComponent {
386 390
 		
387 391
 		SourcePosition cursor = cursorEnd.advance(text.length());
388 392
 		setCursor(cursor, cursor);
393
+		unchanged.setValue(false);
389 394
 	}
390 395
 	
391 396
 	private void save() {
392 397
 		String content = tokens.toString();
393 398
 		sourceFile.update(content);
399
+		unchanged.setValue(true);
394 400
 	}
395 401
 	
396 402
 	private void delete() {
@@ -405,6 +411,7 @@ public class SourceEditor implements DComponent {
405 411
 		}
406 412
 		
407 413
 		tokens.deleteCharacter(cursorEnd.line, cursorEnd.offset);
414
+		unchanged.setValue(false);
408 415
 	}
409 416
 	
410 417
 	private boolean hasSelection() {
@@ -417,6 +424,7 @@ public class SourceEditor implements DComponent {
417 424
 			SourcePosition max = SourcePosition.max(cursorStart, cursorEnd);
418 425
 			tokens.delete(min, max);
419 426
 			setCursor(min, min);
427
+			unchanged.setValue(false);
420 428
 			return true;
421 429
 		}
422 430
 		
@@ -433,6 +441,7 @@ public class SourceEditor implements DComponent {
433 441
 			
434 442
 			int length = tokens.getLineLength(cursorEnd.line - 1);
435 443
 			tokens.deleteNewline(cursorEnd.line - 1);
444
+			unchanged.setValue(false);
436 445
 			
437 446
 			SourcePosition position = new SourcePosition(tokens, cursorEnd.line - 1, length);
438 447
 			setCursor(position, position);
@@ -454,6 +463,7 @@ public class SourceEditor implements DComponent {
454 463
 		tokens.insert(cursorEnd, value);
455 464
 		SourcePosition position = new SourcePosition(tokens, cursorEnd.line, cursorEnd.offset + value.length());
456 465
 		setCursor(position, position);
466
+		unchanged.setValue(false);
457 467
 	}
458 468
 	
459 469
 	private void newline() {
@@ -463,6 +473,7 @@ public class SourceEditor implements DComponent {
463 473
 		tokens.insert(cursorEnd, "\n" + indent);
464 474
 		SourcePosition position = new SourcePosition(tokens, cursorEnd.line + 1, indent.length());
465 475
 		setCursor(position, position);
476
+		unchanged.setValue(false);
466 477
 	}
467 478
 	
468 479
 	private void repaint(SourcePosition from, SourcePosition to) {

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditorStyle.java Visa fil

@@ -5,8 +5,8 @@
5 5
  */
6 6
 package org.openzen.zenscript.ide.ui.view.editor;
7 7
 
8
-import org.openzen.drawablegui.dimension.DDpDimension;
9
-import org.openzen.drawablegui.dimension.DPxDimension;
8
+import org.openzen.drawablegui.style.DDpDimension;
9
+import org.openzen.drawablegui.style.DPxDimension;
10 10
 import org.openzen.drawablegui.style.DStyleDefinition;
11 11
 
12 12
 /**

+ 6
- 3
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/TokenRelexer.java Visa fil

@@ -101,9 +101,12 @@ public class TokenRelexer {
101 101
 			int result = peek();
102 102
 			tokenOffset++;
103 103
 			if (tokenOffset == token.length()) {
104
-				advance();
105
-				token = get();
106
-				tokenOffset = 0;
104
+				if (advance()) {
105
+					token = get();
106
+					tokenOffset = 0;
107
+				} else {
108
+					token = null;
109
+				}
107 110
 			}
108 111
 			return result;
109 112
 		}

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/LibraryTreeNode.java Visa fil

@@ -10,7 +10,7 @@ import org.openzen.drawablegui.live.LiveList;
10 10
 import org.openzen.drawablegui.live.LiveMappedList;
11 11
 import org.openzen.zenscript.ide.host.IDELibrary;
12 12
 import org.openzen.zenscript.ide.ui.IDEWindow;
13
-import org.openzen.zenscript.ide.ui.icons.ColorableLibraryIcon;
13
+import org.openzen.zenscript.ide.ui.icons.LibraryIcon;
14 14
 
15 15
 /**
16 16
  *
@@ -28,7 +28,7 @@ public class LibraryTreeNode extends ProjectOverviewNode {
28 28
 	
29 29
 	@Override
30 30
 	public DColorableIcon getIcon() {
31
-		return ColorableLibraryIcon.INSTANCE;
31
+		return LibraryIcon.INSTANCE;
32 32
 	}
33 33
 
34 34
 	@Override

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ModuleTreeNode.java Visa fil

@@ -8,7 +8,7 @@ package org.openzen.zenscript.ide.ui.view.project;
8 8
 import org.openzen.drawablegui.DColorableIcon;
9 9
 import org.openzen.zenscript.ide.host.IDEModule;
10 10
 import org.openzen.zenscript.ide.ui.IDEWindow;
11
-import org.openzen.zenscript.ide.ui.icons.ColorableModuleIcon;
11
+import org.openzen.zenscript.ide.ui.icons.ModuleIcon;
12 12
 
13 13
 /**
14 14
  *
@@ -29,7 +29,7 @@ public class ModuleTreeNode extends PackageTreeNode {
29 29
 
30 30
 	@Override
31 31
 	public DColorableIcon getIcon() {
32
-		return ColorableModuleIcon.INSTANCE;
32
+		return ModuleIcon.INSTANCE;
33 33
 	}
34 34
 
35 35
 	@Override

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/PackageTreeNode.java Visa fil

@@ -11,7 +11,7 @@ import org.openzen.drawablegui.live.LiveList;
11 11
 import org.openzen.drawablegui.live.LiveMappedList;
12 12
 import org.openzen.zenscript.ide.host.IDEPackage;
13 13
 import org.openzen.zenscript.ide.ui.IDEWindow;
14
-import org.openzen.zenscript.ide.ui.icons.ColorableFolderIcon;
14
+import org.openzen.zenscript.ide.ui.icons.FolderIcon;
15 15
 
16 16
 /**
17 17
  *
@@ -42,7 +42,7 @@ public class PackageTreeNode extends ProjectOverviewNode {
42 42
 
43 43
 	@Override
44 44
 	public DColorableIcon getIcon() {
45
-		return ColorableFolderIcon.INSTANCE;
45
+		return FolderIcon.INSTANCE;
46 46
 	}
47 47
 
48 48
 	@Override

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectOverviewNode.java Visa fil

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

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/ProjectTreeNode.java Visa fil

@@ -10,7 +10,7 @@ import org.openzen.drawablegui.live.LiveList;
10 10
 import org.openzen.drawablegui.live.LiveMappedList;
11 11
 import org.openzen.zenscript.ide.host.DevelopmentHost;
12 12
 import org.openzen.zenscript.ide.ui.IDEWindow;
13
-import org.openzen.zenscript.ide.ui.icons.ColorableProjectIcon;
13
+import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
14 14
 
15 15
 /**
16 16
  *
@@ -28,7 +28,7 @@ public class ProjectTreeNode extends ProjectOverviewNode {
28 28
 	
29 29
 	@Override
30 30
 	public DColorableIcon getIcon() {
31
-		return ColorableProjectIcon.INSTANCE;
31
+		return ProjectIcon.INSTANCE;
32 32
 	}
33 33
 
34 34
 	@Override

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/RootTreeNode.java Visa fil

@@ -11,7 +11,7 @@ import org.openzen.drawablegui.live.LiveMappedList;
11 11
 import org.openzen.drawablegui.live.LivePrefixedList;
12 12
 import org.openzen.zenscript.ide.host.DevelopmentHost;
13 13
 import org.openzen.zenscript.ide.ui.IDEWindow;
14
-import org.openzen.zenscript.ide.ui.icons.ColorableProjectIcon;
14
+import org.openzen.zenscript.ide.ui.icons.ProjectIcon;
15 15
 
16 16
 /**
17 17
  *
@@ -31,7 +31,7 @@ public class RootTreeNode extends ProjectOverviewNode {
31 31
 	
32 32
 	@Override
33 33
 	public DColorableIcon getIcon() {
34
-		return ColorableProjectIcon.INSTANCE;
34
+		return ProjectIcon.INSTANCE;
35 35
 	}
36 36
 	
37 37
 	@Override

+ 2
- 2
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/project/SourceFileTreeNode.java Visa fil

@@ -11,7 +11,7 @@ import org.openzen.drawablegui.live.LiveEmptyList;
11 11
 import org.openzen.drawablegui.live.LiveList;
12 12
 import org.openzen.zenscript.ide.host.IDESourceFile;
13 13
 import org.openzen.zenscript.ide.ui.IDEWindow;
14
-import org.openzen.zenscript.ide.ui.icons.ColorableCodeIcon;
14
+import org.openzen.zenscript.ide.ui.icons.CodeIcon;
15 15
 
16 16
 /**
17 17
  *
@@ -33,7 +33,7 @@ public class SourceFileTreeNode extends ProjectOverviewNode {
33 33
 
34 34
 	@Override
35 35
 	public DColorableIcon getIcon() {
36
-		return ColorableCodeIcon.INSTANCE;
36
+		return CodeIcon.INSTANCE;
37 37
 	}
38 38
 
39 39
 	@Override

Loading…
Avbryt
Spara