Browse Source

Merge branch 'development' into feature/storagetags

Stan Hebben 6 years ago
parent
commit
9622419f00

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

96
 		
96
 		
97
 		if (cursor != null)
97
 		if (cursor != null)
98
 			cursor.close();
98
 			cursor.close();
99
-		cursor = parent.fillRect(2, DIRectangle.EMPTY, cursorBlink ? style.cursorColor : 0);
99
+		cursor = parent.fillRect(3, DIRectangle.EMPTY, cursorBlink ? style.cursorColor : 0);
100
 		
100
 		
101
 		if (selection != null)
101
 		if (selection != null)
102
 			selection.close();
102
 			selection.close();
152
 		text.setPosition(
152
 		text.setPosition(
153
 				bounds.x + style.margin.left + style.border.getPaddingLeft(),
153
 				bounds.x + style.margin.left + style.border.getPaddingLeft(),
154
 				bounds.y + style.margin.top + style.border.getPaddingTop() + fontMetrics.getAscent());
154
 				bounds.y + style.margin.top + style.border.getPaddingTop() + fontMetrics.getAscent());
155
+		
155
 		style.border.update(context, bounds);
156
 		style.border.update(context, bounds);
156
 	}
157
 	}
157
 	
158
 	

+ 22
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/DScalableSize.java View File

1
+/*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+package org.openzen.drawablegui;
7
+
8
+import org.openzen.drawablegui.style.DDimension;
9
+
10
+/**
11
+ *
12
+ * @author Hoofdgebruiker
13
+ */
14
+public class DScalableSize {
15
+	public final DDimension width;
16
+	public final DDimension height;
17
+	
18
+	public DScalableSize(DDimension width, DDimension height) {
19
+		this.width = width;
20
+		this.height = height;
21
+	}
22
+}

+ 4
- 4
DrawableGui/src/main/java/org/openzen/drawablegui/form/DFormStyle.java View File

28
 	public final int minimumFieldSize;
28
 	public final int minimumFieldSize;
29
 	
29
 	
30
 	public DFormStyle(DStyleDefinition style) {
30
 	public DFormStyle(DStyleDefinition style) {
31
-		paddingLeft = style.getDimension("paddingLeft", new DDpDimension(16));
32
-		paddingTop = style.getDimension("paddingTop", new DDpDimension(16));
33
-		paddingRight = style.getDimension("paddingRight", new DDpDimension(16));
34
-		paddingBottom = style.getDimension("paddingBottom", new DDpDimension(16));
31
+		paddingLeft = style.getDimension("paddingLeft", DPxDimension.ZERO);
32
+		paddingTop = style.getDimension("paddingTop", DPxDimension.ZERO);
33
+		paddingRight = style.getDimension("paddingRight", DPxDimension.ZERO);
34
+		paddingBottom = style.getDimension("paddingBottom", DPxDimension.ZERO);
35
 		spacing = style.getDimension("spacing", new DDpDimension(8));
35
 		spacing = style.getDimension("spacing", new DDpDimension(8));
36
 		
36
 		
37
 		labelColor = style.getColor("labelColor", 0xFF000000);
37
 		labelColor = style.getColor("labelColor", 0xFF000000);

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

244
 				DSizing preferences = element.component.getSizing().getValue();
244
 				DSizing preferences = element.component.getSizing().getValue();
245
 				int newX = x + preferences.preferredWidth;
245
 				int newX = x + preferences.preferredWidth;
246
 				layoutHorizontal(element, x, newX - x);
246
 				layoutHorizontal(element, x, newX - x);
247
-				x = newX;
247
+				x = newX + style.spacing;
248
 			}
248
 			}
249
 		} else {
249
 		} else {
250
 			float deltaScaled = delta / totalGrow;
250
 			float deltaScaled = delta / totalGrow;
269
 				DSizing preferences = element.component.getSizing().getValue();
269
 				DSizing preferences = element.component.getSizing().getValue();
270
 				int newY = y + preferences.preferredHeight;
270
 				int newY = y + preferences.preferredHeight;
271
 				layoutVertical(element, y, newY - y);
271
 				layoutVertical(element, y, newY - y);
272
-				y = newY;
272
+				y = newY + style.spacing;
273
 			}
273
 			}
274
 		} else {
274
 		} else {
275
 			float deltaScaled = delta / totalGrow;
275
 			float deltaScaled = delta / totalGrow;

+ 10
- 3
DrawableGui/src/main/java/org/openzen/drawablegui/scroll/DScrollPane.java View File

10
 import org.openzen.drawablegui.DSizing;
10
 import org.openzen.drawablegui.DSizing;
11
 import org.openzen.drawablegui.DIRectangle;
11
 import org.openzen.drawablegui.DIRectangle;
12
 import org.openzen.drawablegui.DMouseEvent;
12
 import org.openzen.drawablegui.DMouseEvent;
13
+import org.openzen.drawablegui.DScalableSize;
13
 import org.openzen.drawablegui.DTransform2D;
14
 import org.openzen.drawablegui.DTransform2D;
14
 import org.openzen.drawablegui.listeners.ListenerHandle;
15
 import org.openzen.drawablegui.listeners.ListenerHandle;
15
 import org.openzen.drawablegui.live.LiveInt;
16
 import org.openzen.drawablegui.live.LiveInt;
17
 import org.openzen.drawablegui.live.SimpleLiveInt;
18
 import org.openzen.drawablegui.live.SimpleLiveInt;
18
 import org.openzen.drawablegui.draw.DDrawnShape;
19
 import org.openzen.drawablegui.draw.DDrawnShape;
19
 import org.openzen.drawablegui.draw.DSubSurface;
20
 import org.openzen.drawablegui.draw.DSubSurface;
21
+import org.openzen.drawablegui.live.SimpleLiveObject;
20
 import org.openzen.drawablegui.style.DStyleClass;
22
 import org.openzen.drawablegui.style.DStyleClass;
21
 
23
 
22
 /**
24
 /**
37
 	private final LiveInt offsetX;
39
 	private final LiveInt offsetX;
38
 	private final LiveInt offsetY;
40
 	private final LiveInt offsetY;
39
 	
41
 	
40
-	private final LiveObject<DSizing> sizing;
42
+	private final SimpleLiveObject<DSizing> sizing = new SimpleLiveObject<>(DSizing.EMPTY);
43
+	private final LiveObject<DScalableSize> size;
41
 	
44
 	
42
 	private final ListenerHandle<LiveInt.Listener> contentsHeightListener;
45
 	private final ListenerHandle<LiveInt.Listener> contentsHeightListener;
43
 	private final ListenerHandle<LiveInt.Listener> offsetXListener;
46
 	private final ListenerHandle<LiveInt.Listener> offsetXListener;
48
 	
51
 	
49
 	private DSubSurface subSurface;
52
 	private DSubSurface subSurface;
50
 	
53
 	
51
-	public DScrollPane(DStyleClass styleClass, DComponent contents, LiveObject<DSizing> sizing) {
52
-		this.sizing = sizing;
54
+	public DScrollPane(DStyleClass styleClass, DComponent contents, LiveObject<DScalableSize> size) {
55
+		this.size = size;
53
 		this.styleClass = styleClass;
56
 		this.styleClass = styleClass;
54
 		this.contents = contents;
57
 		this.contents = contents;
55
 		
58
 		
81
 		DComponentContext newContext = new DComponentContext(this, context.path, 0, subSurface);
84
 		DComponentContext newContext = new DComponentContext(this, context.path, 0, subSurface);
82
 		contents.mount(newContext);
85
 		contents.mount(newContext);
83
 		scrollBar.mount(context);
86
 		scrollBar.mount(context);
87
+		
88
+		sizing.setValue(new DSizing(
89
+				size.getValue().width.evalInt(parent.getUIContext()),
90
+				size.getValue().height.evalInt(parent.getUIContext())));
84
 	}
91
 	}
85
 	
92
 	
86
 	@Override
93
 	@Override

+ 1
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingDrawnRectangle.java View File

53
 	public void paint(Graphics2D g, DIRectangle clip) {
53
 	public void paint(Graphics2D g, DIRectangle clip) {
54
 		g.setColor(awtColor);
54
 		g.setColor(awtColor);
55
 		g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
55
 		g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
56
+		//g.fillRect(clip.x, clip.y, 3, 3);
56
 	}
57
 	}
57
 }
58
 }

+ 1
- 0
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingRoot.java View File

88
 		Rectangle clipBounds = g.getClipBounds();
88
 		Rectangle clipBounds = g.getClipBounds();
89
 		DIRectangle clipBounds2 = clipBounds == null ? null : new DIRectangle(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height);
89
 		DIRectangle clipBounds2 = clipBounds == null ? null : new DIRectangle(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height);
90
 		Graphics2D g2d = (Graphics2D) g;
90
 		Graphics2D g2d = (Graphics2D) g;
91
+		//System.out.println("Transform: " + g2d.getTransform().getTranslateX() + ", " + g2d.getTransform().getTranslateY());
91
 		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
92
 		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
92
 		g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
93
 		g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
93
 		surface.paint(g2d, clipBounds2);
94
 		surface.paint(g2d, clipBounds2);

+ 34
- 14
DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeView.java View File

7
 
7
 
8
 import java.util.ArrayList;
8
 import java.util.ArrayList;
9
 import java.util.List;
9
 import java.util.List;
10
+import org.openzen.drawablegui.DColorableIcon;
10
 import org.openzen.drawablegui.DColorableIconInstance;
11
 import org.openzen.drawablegui.DColorableIconInstance;
11
 import org.openzen.drawablegui.DComponent;
12
 import org.openzen.drawablegui.DComponent;
12
 import org.openzen.drawablegui.DComponentContext;
13
 import org.openzen.drawablegui.DComponentContext;
20
 import org.openzen.drawablegui.Destructible;
21
 import org.openzen.drawablegui.Destructible;
21
 import org.openzen.drawablegui.listeners.ListenerHandle;
22
 import org.openzen.drawablegui.listeners.ListenerHandle;
22
 import org.openzen.drawablegui.live.LiveBool;
23
 import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.draw.DDrawSurface;
24
 import org.openzen.drawablegui.draw.DDrawnRectangle;
24
 import org.openzen.drawablegui.draw.DDrawnRectangle;
25
 import org.openzen.drawablegui.draw.DDrawnText;
25
 import org.openzen.drawablegui.draw.DDrawnText;
26
 import org.openzen.drawablegui.live.LiveList;
26
 import org.openzen.drawablegui.live.LiveList;
38
 	
38
 	
39
 	private DComponentContext context;
39
 	private DComponentContext context;
40
 	private DIRectangle bounds = DIRectangle.EMPTY;
40
 	private DIRectangle bounds = DIRectangle.EMPTY;
41
+	private float iconScale;
41
 	
42
 	
42
 	private int selectedRow = -1;
43
 	private int selectedRow = -1;
43
 	private N selectedNode = null;
44
 	private N selectedNode = null;
76
 		context = parent.getChildContext("tree", styleClass);
77
 		context = parent.getChildContext("tree", styleClass);
77
 		style = context.getStyle(DTreeViewStyle::new);
78
 		style = context.getStyle(DTreeViewStyle::new);
78
 		fontMetrics = context.getFontMetrics(style.font);
79
 		fontMetrics = context.getFontMetrics(style.font);
80
+		iconScale = context.getUIContext().getScale() / 1.75f;
79
 		
81
 		
80
 		background = context.fillRect(0, DIRectangle.EMPTY, style.backgroundColor);
82
 		background = context.fillRect(0, DIRectangle.EMPTY, style.backgroundColor);
81
 		selectedBackground = context.fillRect(1, DIRectangle.EMPTY, 0);
83
 		selectedBackground = context.fillRect(1, DIRectangle.EMPTY, 0);
123
 		int rowIndex = yToRow(e.y);
125
 		int rowIndex = yToRow(e.y);
124
 		if (rowIndex >= 0 && rowIndex < rows.size()) {
126
 		if (rowIndex >= 0 && rowIndex < rows.size()) {
125
 			Row rowEntry = rows.get(rowIndex);
127
 			Row rowEntry = rows.get(rowIndex);
126
-			if (e.x >= rowEntry.x && e.x < (rowEntry.x + nodeOpenedIcon.getNominalWidth())) {
128
+			if (e.x >= rowEntry.x && e.x < (rowEntry.x + getIconWidth(nodeOpenedIcon))) {
127
 				if (!rowEntry.node.isLeaf())
129
 				if (!rowEntry.node.isLeaf())
128
 					rowEntry.node.isCollapsed().toggle();
130
 					rowEntry.node.isCollapsed().toggle();
129
 				return;
131
 				return;
142
 				int selectionY = bounds.y + style.padding + rowIndex * (style.rowSpacing + fontMetrics.getAscent() + fontMetrics.getDescent()) - style.selectedPaddingTop;
144
 				int selectionY = bounds.y + style.padding + rowIndex * (style.rowSpacing + fontMetrics.getAscent() + fontMetrics.getDescent()) - style.selectedPaddingTop;
143
 				int selectionWidth = (int)(fontMetrics.getWidth(row.node.getTitle())
145
 				int selectionWidth = (int)(fontMetrics.getWidth(row.node.getTitle())
144
 						+ style.iconTextSpacing
146
 						+ style.iconTextSpacing
145
-						+ row.icon.getNominalWidth()
147
+						+ getIconWidth(row.icon)
146
 						+ style.iconTextSpacing
148
 						+ style.iconTextSpacing
147
-						+ row.node.getIcon().getNominalWidth()
149
+						+ getIconWidth(row.node.getIcon())
148
 						+ style.selectedPaddingLeft
150
 						+ style.selectedPaddingLeft
149
 						+ style.selectedPaddingRight);
151
 						+ style.selectedPaddingRight);
150
 				int selectionHeight = fontMetrics.getAscent() + fontMetrics.getDescent() + style.selectedPaddingTop + style.selectedPaddingBottom;
152
 				int selectionHeight = fontMetrics.getAscent() + fontMetrics.getDescent() + style.selectedPaddingTop + style.selectedPaddingBottom;
151
 				
153
 				
152
 				if (row.node.isLeaf()) {
154
 				if (row.node.isLeaf()) {
153
-					int delta = (int)(row.icon.getNominalWidth() + style.iconTextSpacing);
155
+					int delta = (int)(getIconWidth(row.icon) + style.iconTextSpacing);
154
 					selectionX += delta;
156
 					selectionX += delta;
155
 					selectionWidth -= delta;
157
 					selectionWidth -= delta;
156
 				}
158
 				}
181
 		return (y - bounds.y - style.padding) / (style.rowSpacing + fontMetrics.getAscent() + fontMetrics.getDescent());
183
 		return (y - bounds.y - style.padding) / (style.rowSpacing + fontMetrics.getAscent() + fontMetrics.getDescent());
182
 	}
184
 	}
183
 	
185
 	
186
+	private float getIconWidth(DDrawable drawable) {
187
+		return drawable.getNominalWidth() * iconScale;
188
+	}
189
+	
190
+	private float getIconHeight(DDrawable drawable) {
191
+		return drawable.getNominalHeight() * iconScale; 
192
+	}
193
+	
194
+	private float getIconWidth(DColorableIcon icon) {
195
+		return icon.getNominalWidth() * iconScale;
196
+	}
197
+	
198
+	private float getIconHeight(DColorableIcon icon) {
199
+		return icon.getNominalHeight() * iconScale; 
200
+	}
201
+	
184
 	private void updateLayout() {
202
 	private void updateLayout() {
185
 		int oldRowCount = rows.size();
203
 		int oldRowCount = rows.size();
186
 		
204
 		
264
 					context.surface,
282
 					context.surface,
265
 					context.z + 2,
283
 					context.z + 2,
266
 					node.getIcon(),
284
 					node.getIcon(),
267
-					DTransform2D.translate(baseX + icon.getNominalWidth() + style.iconTextSpacing, baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - icon.getNominalHeight()),
285
+					DTransform2D.scaleAndTranslate(baseX + getIconWidth(icon) + style.iconTextSpacing, baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - getIconHeight(icon), iconScale),
268
 					node == selectedNode ? style.selectedNodeTextColor : style.nodeTextColor);
286
 					node == selectedNode ? style.selectedNodeTextColor : style.nodeTextColor);
269
 			
287
 			
270
 			if (!node.isLeaf())
288
 			if (!node.isLeaf())
272
 						context.surface, 
290
 						context.surface, 
273
 						context.z + 2,
291
 						context.z + 2,
274
 						icon,
292
 						icon,
275
-						DTransform2D.translate(baseX, baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - icon.getNominalHeight()));
293
+						DTransform2D.scaleAndTranslate(baseX, baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - getIconHeight(icon), iconScale));
276
 			
294
 			
277
 			text = context.drawText(
295
 			text = context.drawText(
278
 					2,
296
 					2,
279
 					style.font,
297
 					style.font,
280
 					node == selectedNode ? style.selectedNodeTextColor : style.nodeTextColor,
298
 					node == selectedNode ? style.selectedNodeTextColor : style.nodeTextColor,
281
-					baseX + style.iconTextSpacing + icon.getNominalWidth() + style.iconTextSpacing + node.getIcon().getNominalWidth(),
299
+					baseX + style.iconTextSpacing + getIconWidth(icon) + style.iconTextSpacing + getIconWidth(node.getIcon()),
282
 					baseY + fontMetrics.getAscent(),
300
 					baseY + fontMetrics.getAscent(),
283
 					node.getTitle());
301
 					node.getTitle());
284
 		}
302
 		}
288
 			int baseY = (int)(bounds.y + style.padding + index * (fontMetrics.getAscent() + fontMetrics.getDescent() + style.rowSpacing));
306
 			int baseY = (int)(bounds.y + style.padding + index * (fontMetrics.getAscent() + fontMetrics.getDescent() + style.rowSpacing));
289
 			
307
 			
290
 			if (collapseIcon != null) {
308
 			if (collapseIcon != null) {
291
-				collapseIcon.setTransform(DTransform2D.translate(
309
+				collapseIcon.setTransform(DTransform2D.scaleAndTranslate(
292
 						baseX,
310
 						baseX,
293
-						baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - icon.getNominalHeight()));
311
+						baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - getIconHeight(icon),
312
+						iconScale));
294
 			}
313
 			}
295
-			nodeIcon.setTransform(DTransform2D.translate(
296
-					baseX + icon.getNominalWidth() + style.iconTextSpacing,
297
-					baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - icon.getNominalHeight()));
314
+			nodeIcon.setTransform(DTransform2D.scaleAndTranslate(
315
+					baseX + getIconWidth(icon) + style.iconTextSpacing,
316
+					baseY + fontMetrics.getAscent() + fontMetrics.getDescent() - getIconHeight(icon),
317
+					iconScale));
298
 			text.setPosition(
318
 			text.setPosition(
299
-					baseX + style.iconTextSpacing + icon.getNominalWidth() + style.iconTextSpacing + node.getIcon().getNominalWidth(),
319
+					baseX + style.iconTextSpacing + getIconWidth(icon) + style.iconTextSpacing + getIconWidth(node.getIcon()),
300
 					baseY + fontMetrics.getAscent());
320
 					baseY + fontMetrics.getAscent());
301
 		}
321
 		}
302
 
322
 

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

23
 import org.openzen.drawablegui.live.ImmutableLiveString;
23
 import org.openzen.drawablegui.live.ImmutableLiveString;
24
 import org.openzen.drawablegui.live.SimpleLiveString;
24
 import org.openzen.drawablegui.live.SimpleLiveString;
25
 import org.openzen.drawablegui.style.DDpDimension;
25
 import org.openzen.drawablegui.style.DDpDimension;
26
+import org.openzen.drawablegui.style.DSimpleStylesheet;
26
 import org.openzen.drawablegui.style.DStyleClass;
27
 import org.openzen.drawablegui.style.DStyleClass;
28
+import org.openzen.drawablegui.style.DStylesheetBuilder;
27
 import org.openzen.zenscript.ide.host.IDEModule;
29
 import org.openzen.zenscript.ide.host.IDEModule;
28
 import org.openzen.zenscript.ide.host.IDEPackage;
30
 import org.openzen.zenscript.ide.host.IDEPackage;
29
 import org.openzen.zenscript.ide.host.IDESourceFile;
31
 import org.openzen.zenscript.ide.host.IDESourceFile;
64
 		DButton ok = new DButton(DStyleClass.EMPTY, new SimpleLiveString("Create"), ImmutableLiveBool.FALSE, this::ok);
66
 		DButton ok = new DButton(DStyleClass.EMPTY, new SimpleLiveString("Create"), ImmutableLiveBool.FALSE, this::ok);
65
 		DButton cancel = new DButton(DStyleClass.EMPTY, new SimpleLiveString("Cancel"), ImmutableLiveBool.FALSE, this::cancel);
67
 		DButton cancel = new DButton(DStyleClass.EMPTY, new SimpleLiveString("Cancel"), ImmutableLiveBool.FALSE, this::cancel);
66
 		DLinearLayout buttons = new DLinearLayout(
68
 		DLinearLayout buttons = new DLinearLayout(
67
-				DStyleClass.EMPTY,
69
+				DStyleClass.inline(new DStylesheetBuilder()
70
+					.dimensionDp("spacing", 8)
71
+					.build()),
68
 				Orientation.HORIZONTAL,
72
 				Orientation.HORIZONTAL,
69
 				Alignment.RIGHT,
73
 				Alignment.RIGHT,
70
 				new Element(cancel, 0, 0, ElementAlignment.TOP),
74
 				new Element(cancel, 0, 0, ElementAlignment.TOP),
71
 				new Element(ok, 0, 0, ElementAlignment.TOP));
75
 				new Element(ok, 0, 0, ElementAlignment.TOP));
72
 
76
 
73
 		root = new DLinearLayout(
77
 		root = new DLinearLayout(
74
-				DStyleClass.EMPTY,
78
+				DStyleClass.inline(new DStylesheetBuilder()
79
+						.marginDp("margin", 16)
80
+						.build()),
75
 				Orientation.VERTICAL,
81
 				Orientation.VERTICAL,
76
 				Alignment.MIDDLE,
82
 				Alignment.MIDDLE,
77
 				new Element(form, 1, 1, ElementAlignment.CENTER),
83
 				new Element(form, 1, 1, ElementAlignment.CENTER),

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

47
 		context = parent.getChildContext("tabclose", DStyleClass.EMPTY);
47
 		context = parent.getChildContext("tabclose", DStyleClass.EMPTY);
48
 		style = context.getStyle(TabbedViewTabCloseStyle::new);
48
 		style = context.getStyle(TabbedViewTabCloseStyle::new);
49
 		sizing.setValue(new DSizing(style.size, style.size));
49
 		sizing.setValue(new DSizing(style.size, style.size));
50
-		icon = new ScalableCloseIcon(style.size / 24);
50
+		icon = new ScalableCloseIcon(style.size / 24 * parent.getScale() / 1.75f);
51
 		
51
 		
52
 		if (background != null)
52
 		if (background != null)
53
 			background.close();
53
 			background.close();

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

6
 package org.openzen.zenscript.ide.ui.view;
6
 package org.openzen.zenscript.ide.ui.view;
7
 
7
 
8
 import org.openzen.drawablegui.DEmptyView;
8
 import org.openzen.drawablegui.DEmptyView;
9
+import org.openzen.drawablegui.DScalableSize;
9
 import org.openzen.drawablegui.DSizing;
10
 import org.openzen.drawablegui.DSizing;
10
 import org.openzen.drawablegui.border.DLineBorder;
11
 import org.openzen.drawablegui.border.DLineBorder;
11
 import org.openzen.drawablegui.scroll.DScrollPane;
12
 import org.openzen.drawablegui.scroll.DScrollPane;
12
 import org.openzen.drawablegui.layout.DSideLayout;
13
 import org.openzen.drawablegui.layout.DSideLayout;
13
-import org.openzen.drawablegui.live.LiveArrayList;
14
 import org.openzen.drawablegui.live.LiveString;
14
 import org.openzen.drawablegui.live.LiveString;
15
-import org.openzen.drawablegui.live.MutableLiveList;
16
-import org.openzen.drawablegui.live.SimpleLiveInt;
17
 import org.openzen.drawablegui.live.SimpleLiveObject;
15
 import org.openzen.drawablegui.live.SimpleLiveObject;
18
 import org.openzen.drawablegui.live.SimpleLiveString;
16
 import org.openzen.drawablegui.live.SimpleLiveString;
17
+import org.openzen.drawablegui.style.DDpDimension;
19
 import org.openzen.drawablegui.style.DShadow;
18
 import org.openzen.drawablegui.style.DShadow;
20
 import org.openzen.drawablegui.style.DStyleClass;
19
 import org.openzen.drawablegui.style.DStyleClass;
21
 import org.openzen.drawablegui.style.DStylesheetBuilder;
20
 import org.openzen.drawablegui.style.DStylesheetBuilder;
25
 import org.openzen.zenscript.ide.ui.IDEWindow;
24
 import org.openzen.zenscript.ide.ui.IDEWindow;
26
 import org.openzen.zenscript.ide.ui.view.aspectbar.AspectBarView;
25
 import org.openzen.zenscript.ide.ui.view.aspectbar.AspectBarView;
27
 import org.openzen.zenscript.ide.ui.view.editor.SourceEditor;
26
 import org.openzen.zenscript.ide.ui.view.editor.SourceEditor;
28
-import org.openzen.zenscript.ide.ui.view.output.OutputLine;
29
 import org.openzen.zenscript.ide.ui.view.output.OutputView;
27
 import org.openzen.zenscript.ide.ui.view.output.OutputView;
30
 import org.openzen.zenscript.ide.ui.view.project.ProjectBrowser;
28
 import org.openzen.zenscript.ide.ui.view.project.ProjectBrowser;
31
 
29
 
49
 		
47
 		
50
 		OutputView output = new OutputView(DStyleClass.EMPTY, window.output);
48
 		OutputView output = new OutputView(DStyleClass.EMPTY, window.output);
51
 		
49
 		
50
+		DScalableSize outputSize = new DScalableSize(new DDpDimension(250), new DDpDimension(250));
52
 		DScrollPane scrollOutput = new DScrollPane(DStyleClass.inline(new DStylesheetBuilder()
51
 		DScrollPane scrollOutput = new DScrollPane(DStyleClass.inline(new DStylesheetBuilder()
53
-							//.border("border", context -> new DLineBorder(0xFF888888, 1))
54
 							.marginDp("margin", 3)
52
 							.marginDp("margin", 3)
55
 							.color("backgroundColor", 0xFFFFFFFF)
53
 							.color("backgroundColor", 0xFFFFFFFF)
56
 							.shadow("shadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()))
54
 							.shadow("shadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()))
57
-							.build()), output, new SimpleLiveObject<>(new DSizing(400, 400)));
55
+							.build()), output, new SimpleLiveObject<>(outputSize));
58
 		
56
 		
59
 		setMain(tabs = new TabbedView(DStyleClass.inline(new DStylesheetBuilder()
57
 		setMain(tabs = new TabbedView(DStyleClass.inline(new DStylesheetBuilder()
60
 				.marginDp("margin", 3)
58
 				.marginDp("margin", 3)
71
 		@Override
69
 		@Override
72
 		public void onOpen(IDESourceFile sourceFile) {
70
 		public void onOpen(IDESourceFile sourceFile) {
73
 			SourceEditor editor = new SourceEditor(DStyleClass.EMPTY, window, sourceFile);
71
 			SourceEditor editor = new SourceEditor(DStyleClass.EMPTY, window, sourceFile);
72
+			DScalableSize size = new DScalableSize(new DDpDimension(280), new DDpDimension(280));
74
 			TabbedViewComponent tab = new TabbedViewComponent(
73
 			TabbedViewComponent tab = new TabbedViewComponent(
75
 					sourceFile.getName(),
74
 					sourceFile.getName(),
76
 					null,
75
 					null,
77
 					new DScrollPane(DStyleClass.inline(new DStylesheetBuilder()
76
 					new DScrollPane(DStyleClass.inline(new DStylesheetBuilder()
78
 							.border("border", context -> new DLineBorder(0xFF888888, 1))
77
 							.border("border", context -> new DLineBorder(0xFF888888, 1))
79
 							//.shadow("shadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()))
78
 							//.shadow("shadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()))
80
-							.build()), editor, new SimpleLiveObject<>(new DSizing(500, 500))),
79
+							.build()), editor, new SimpleLiveObject<>(size)),
81
 					editor.isUpdated());
80
 					editor.isUpdated());
82
 			tabs.tabs.add(tab);
81
 			tabs.tabs.add(tab);
83
 			tabs.currentTab.setValue(tab);
82
 			tabs.currentTab.setValue(tab);

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

52
  */
52
  */
53
 public class SourceEditor implements DComponent {
53
 public class SourceEditor implements DComponent {
54
 	private final DStyleClass styleClass;
54
 	private final DStyleClass styleClass;
55
-	private final DFont font = new DFont(DFontFamily.CODE, false, false, false, 24);
56
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
55
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
57
 	private final String tab = "    ";
56
 	private final String tab = "    ";
58
 	private final IDESourceFile sourceFile;
57
 	private final IDESourceFile sourceFile;
65
 	private SourceEditorStyle style;
64
 	private SourceEditorStyle style;
66
 	private DTimerHandle blinkTimer;
65
 	private DTimerHandle blinkTimer;
67
 	
66
 	
67
+	private DFont font;
68
 	private DFontMetrics fontMetrics;
68
 	private DFontMetrics fontMetrics;
69
 	private int textLineHeight;
69
 	private int textLineHeight;
70
 	private int fullLineHeight;
70
 	private int fullLineHeight;
140
 		
140
 		
141
 		context = parent.getChildContext("sourceeditor", styleClass);
141
 		context = parent.getChildContext("sourceeditor", styleClass);
142
 		style = context.getStyle(SourceEditorStyle::new);
142
 		style = context.getStyle(SourceEditorStyle::new);
143
+		font = new DFont(DFontFamily.CODE, false, false, false, (int)(context.getScale() * 13.7 + 0.5f));
143
 		
144
 		
144
 		fontMetrics = context.getFontMetrics(font);
145
 		fontMetrics = context.getFontMetrics(font);
145
 		textLineHeight = fontMetrics.getAscent() + fontMetrics.getDescent();
146
 		textLineHeight = fontMetrics.getAscent() + fontMetrics.getDescent();

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

9
 import org.openzen.drawablegui.DFont;
9
 import org.openzen.drawablegui.DFont;
10
 import org.openzen.drawablegui.DFontFamily;
10
 import org.openzen.drawablegui.DFontFamily;
11
 import org.openzen.drawablegui.DLabel;
11
 import org.openzen.drawablegui.DLabel;
12
+import org.openzen.drawablegui.DScalableSize;
12
 import org.openzen.drawablegui.DSizing;
13
 import org.openzen.drawablegui.DSizing;
13
 import org.openzen.drawablegui.border.DEmptyBorder;
14
 import org.openzen.drawablegui.border.DEmptyBorder;
14
 import org.openzen.drawablegui.border.DPaddedBorder;
15
 import org.openzen.drawablegui.border.DPaddedBorder;
24
 import org.openzen.drawablegui.live.SimpleLiveObject;
25
 import org.openzen.drawablegui.live.SimpleLiveObject;
25
 import org.openzen.drawablegui.live.SimpleLiveString;
26
 import org.openzen.drawablegui.live.SimpleLiveString;
26
 import org.openzen.drawablegui.scroll.DScrollPane;
27
 import org.openzen.drawablegui.scroll.DScrollPane;
28
+import org.openzen.drawablegui.style.DDpDimension;
27
 import org.openzen.drawablegui.style.DRoundedRectangleShape;
29
 import org.openzen.drawablegui.style.DRoundedRectangleShape;
28
 import org.openzen.drawablegui.style.DShadow;
30
 import org.openzen.drawablegui.style.DShadow;
29
 import org.openzen.drawablegui.style.DStyleClass;
31
 import org.openzen.drawablegui.style.DStyleClass;
107
 				ExpandedArrow.INSTANCE,
109
 				ExpandedArrow.INSTANCE,
108
 				CollapsedArrow.INSTANCE,
110
 				CollapsedArrow.INSTANCE,
109
 				new RootTreeNode(this, host), false);
111
 				new RootTreeNode(this, host), false);
112
+		
113
+		DScalableSize treeSize = new DScalableSize(new DDpDimension(280), new DDpDimension(280));
110
 		DScrollPane treeScrollPane = new DScrollPane(
114
 		DScrollPane treeScrollPane = new DScrollPane(
111
 				DStyleClass.inline("projectView", new DStylesheetBuilder()
115
 				DStyleClass.inline("projectView", new DStylesheetBuilder()
112
 						.shape("shape", context -> new DRoundedRectangleShape(0, 0, context.dp(2), context.dp(2)))
116
 						.shape("shape", context -> new DRoundedRectangleShape(0, 0, context.dp(2), context.dp(2)))
114
 						.shadow("shadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()))
118
 						.shadow("shadow", context -> new DShadow(0xFF888888, 0, 0.5f * context.getScale(), 3 * context.getScale()))
115
 						.build()),
119
 						.build()),
116
 				projectTree,
120
 				projectTree,
117
-				new SimpleLiveObject<>(new DSizing(500, 500)));
121
+				new SimpleLiveObject<>(treeSize));
118
 		
122
 		
119
 		view = new DLinearLayout(
123
 		view = new DLinearLayout(
120
 				DStyleClass.inline(new DStylesheetBuilder()
124
 				DStyleClass.inline(new DStylesheetBuilder()

Loading…
Cancel
Save