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,7 +96,7 @@ public class DInputField implements DComponent {
96 96
 		
97 97
 		if (cursor != null)
98 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 101
 		if (selection != null)
102 102
 			selection.close();
@@ -152,6 +152,7 @@ public class DInputField implements DComponent {
152 152
 		text.setPosition(
153 153
 				bounds.x + style.margin.left + style.border.getPaddingLeft(),
154 154
 				bounds.y + style.margin.top + style.border.getPaddingTop() + fontMetrics.getAscent());
155
+		
155 156
 		style.border.update(context, bounds);
156 157
 	}
157 158
 	

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

@@ -0,0 +1,22 @@
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,10 +28,10 @@ public class DFormStyle {
28 28
 	public final int minimumFieldSize;
29 29
 	
30 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 35
 		spacing = style.getDimension("spacing", new DDpDimension(8));
36 36
 		
37 37
 		labelColor = style.getColor("labelColor", 0xFF000000);

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

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

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

@@ -10,6 +10,7 @@ import org.openzen.drawablegui.DComponentContext;
10 10
 import org.openzen.drawablegui.DSizing;
11 11
 import org.openzen.drawablegui.DIRectangle;
12 12
 import org.openzen.drawablegui.DMouseEvent;
13
+import org.openzen.drawablegui.DScalableSize;
13 14
 import org.openzen.drawablegui.DTransform2D;
14 15
 import org.openzen.drawablegui.listeners.ListenerHandle;
15 16
 import org.openzen.drawablegui.live.LiveInt;
@@ -17,6 +18,7 @@ import org.openzen.drawablegui.live.LiveObject;
17 18
 import org.openzen.drawablegui.live.SimpleLiveInt;
18 19
 import org.openzen.drawablegui.draw.DDrawnShape;
19 20
 import org.openzen.drawablegui.draw.DSubSurface;
21
+import org.openzen.drawablegui.live.SimpleLiveObject;
20 22
 import org.openzen.drawablegui.style.DStyleClass;
21 23
 
22 24
 /**
@@ -37,7 +39,8 @@ public class DScrollPane implements DComponent, DScrollContext {
37 39
 	private final LiveInt offsetX;
38 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 45
 	private final ListenerHandle<LiveInt.Listener> contentsHeightListener;
43 46
 	private final ListenerHandle<LiveInt.Listener> offsetXListener;
@@ -48,8 +51,8 @@ public class DScrollPane implements DComponent, DScrollContext {
48 51
 	
49 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 56
 		this.styleClass = styleClass;
54 57
 		this.contents = contents;
55 58
 		
@@ -81,6 +84,10 @@ public class DScrollPane implements DComponent, DScrollContext {
81 84
 		DComponentContext newContext = new DComponentContext(this, context.path, 0, subSurface);
82 85
 		contents.mount(newContext);
83 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 93
 	@Override

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

@@ -53,5 +53,6 @@ public class SwingDrawnRectangle extends SwingDrawnElement implements DDrawnRect
53 53
 	public void paint(Graphics2D g, DIRectangle clip) {
54 54
 		g.setColor(awtColor);
55 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,6 +88,7 @@ public final class SwingRoot extends Component implements ComponentListener, Mou
88 88
 		Rectangle clipBounds = g.getClipBounds();
89 89
 		DIRectangle clipBounds2 = clipBounds == null ? null : new DIRectangle(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height);
90 90
 		Graphics2D g2d = (Graphics2D) g;
91
+		//System.out.println("Transform: " + g2d.getTransform().getTranslateX() + ", " + g2d.getTransform().getTranslateY());
91 92
 		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
92 93
 		g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
93 94
 		surface.paint(g2d, clipBounds2);

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

@@ -7,6 +7,7 @@ package org.openzen.drawablegui.tree;
7 7
 
8 8
 import java.util.ArrayList;
9 9
 import java.util.List;
10
+import org.openzen.drawablegui.DColorableIcon;
10 11
 import org.openzen.drawablegui.DColorableIconInstance;
11 12
 import org.openzen.drawablegui.DComponent;
12 13
 import org.openzen.drawablegui.DComponentContext;
@@ -20,7 +21,6 @@ import org.openzen.drawablegui.DDrawableInstance;
20 21
 import org.openzen.drawablegui.Destructible;
21 22
 import org.openzen.drawablegui.listeners.ListenerHandle;
22 23
 import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.draw.DDrawSurface;
24 24
 import org.openzen.drawablegui.draw.DDrawnRectangle;
25 25
 import org.openzen.drawablegui.draw.DDrawnText;
26 26
 import org.openzen.drawablegui.live.LiveList;
@@ -38,6 +38,7 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
38 38
 	
39 39
 	private DComponentContext context;
40 40
 	private DIRectangle bounds = DIRectangle.EMPTY;
41
+	private float iconScale;
41 42
 	
42 43
 	private int selectedRow = -1;
43 44
 	private N selectedNode = null;
@@ -76,6 +77,7 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
76 77
 		context = parent.getChildContext("tree", styleClass);
77 78
 		style = context.getStyle(DTreeViewStyle::new);
78 79
 		fontMetrics = context.getFontMetrics(style.font);
80
+		iconScale = context.getUIContext().getScale() / 1.75f;
79 81
 		
80 82
 		background = context.fillRect(0, DIRectangle.EMPTY, style.backgroundColor);
81 83
 		selectedBackground = context.fillRect(1, DIRectangle.EMPTY, 0);
@@ -123,7 +125,7 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
123 125
 		int rowIndex = yToRow(e.y);
124 126
 		if (rowIndex >= 0 && rowIndex < rows.size()) {
125 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 129
 				if (!rowEntry.node.isLeaf())
128 130
 					rowEntry.node.isCollapsed().toggle();
129 131
 				return;
@@ -142,15 +144,15 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
142 144
 				int selectionY = bounds.y + style.padding + rowIndex * (style.rowSpacing + fontMetrics.getAscent() + fontMetrics.getDescent()) - style.selectedPaddingTop;
143 145
 				int selectionWidth = (int)(fontMetrics.getWidth(row.node.getTitle())
144 146
 						+ style.iconTextSpacing
145
-						+ row.icon.getNominalWidth()
147
+						+ getIconWidth(row.icon)
146 148
 						+ style.iconTextSpacing
147
-						+ row.node.getIcon().getNominalWidth()
149
+						+ getIconWidth(row.node.getIcon())
148 150
 						+ style.selectedPaddingLeft
149 151
 						+ style.selectedPaddingRight);
150 152
 				int selectionHeight = fontMetrics.getAscent() + fontMetrics.getDescent() + style.selectedPaddingTop + style.selectedPaddingBottom;
151 153
 				
152 154
 				if (row.node.isLeaf()) {
153
-					int delta = (int)(row.icon.getNominalWidth() + style.iconTextSpacing);
155
+					int delta = (int)(getIconWidth(row.icon) + style.iconTextSpacing);
154 156
 					selectionX += delta;
155 157
 					selectionWidth -= delta;
156 158
 				}
@@ -181,6 +183,22 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
181 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 202
 	private void updateLayout() {
185 203
 		int oldRowCount = rows.size();
186 204
 		
@@ -264,7 +282,7 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
264 282
 					context.surface,
265 283
 					context.z + 2,
266 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 286
 					node == selectedNode ? style.selectedNodeTextColor : style.nodeTextColor);
269 287
 			
270 288
 			if (!node.isLeaf())
@@ -272,13 +290,13 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
272 290
 						context.surface, 
273 291
 						context.z + 2,
274 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 295
 			text = context.drawText(
278 296
 					2,
279 297
 					style.font,
280 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 300
 					baseY + fontMetrics.getAscent(),
283 301
 					node.getTitle());
284 302
 		}
@@ -288,15 +306,17 @@ public class DTreeView<N extends DTreeNode<N>> implements DComponent {
288 306
 			int baseY = (int)(bounds.y + style.padding + index * (fontMetrics.getAscent() + fontMetrics.getDescent() + style.rowSpacing));
289 307
 			
290 308
 			if (collapseIcon != null) {
291
-				collapseIcon.setTransform(DTransform2D.translate(
309
+				collapseIcon.setTransform(DTransform2D.scaleAndTranslate(
292 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 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 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,7 +23,9 @@ import org.openzen.drawablegui.live.ImmutableLiveBool;
23 23
 import org.openzen.drawablegui.live.ImmutableLiveString;
24 24
 import org.openzen.drawablegui.live.SimpleLiveString;
25 25
 import org.openzen.drawablegui.style.DDpDimension;
26
+import org.openzen.drawablegui.style.DSimpleStylesheet;
26 27
 import org.openzen.drawablegui.style.DStyleClass;
28
+import org.openzen.drawablegui.style.DStylesheetBuilder;
27 29
 import org.openzen.zenscript.ide.host.IDEModule;
28 30
 import org.openzen.zenscript.ide.host.IDEPackage;
29 31
 import org.openzen.zenscript.ide.host.IDESourceFile;
@@ -64,14 +66,18 @@ public class CreateSourceFileDialog {
64 66
 		DButton ok = new DButton(DStyleClass.EMPTY, new SimpleLiveString("Create"), ImmutableLiveBool.FALSE, this::ok);
65 67
 		DButton cancel = new DButton(DStyleClass.EMPTY, new SimpleLiveString("Cancel"), ImmutableLiveBool.FALSE, this::cancel);
66 68
 		DLinearLayout buttons = new DLinearLayout(
67
-				DStyleClass.EMPTY,
69
+				DStyleClass.inline(new DStylesheetBuilder()
70
+					.dimensionDp("spacing", 8)
71
+					.build()),
68 72
 				Orientation.HORIZONTAL,
69 73
 				Alignment.RIGHT,
70 74
 				new Element(cancel, 0, 0, ElementAlignment.TOP),
71 75
 				new Element(ok, 0, 0, ElementAlignment.TOP));
72 76
 
73 77
 		root = new DLinearLayout(
74
-				DStyleClass.EMPTY,
78
+				DStyleClass.inline(new DStylesheetBuilder()
79
+						.marginDp("margin", 16)
80
+						.build()),
75 81
 				Orientation.VERTICAL,
76 82
 				Alignment.MIDDLE,
77 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,7 +47,7 @@ public class TabbedViewTabClose implements DComponent {
47 47
 		context = parent.getChildContext("tabclose", DStyleClass.EMPTY);
48 48
 		style = context.getStyle(TabbedViewTabCloseStyle::new);
49 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 52
 		if (background != null)
53 53
 			background.close();

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

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

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

@@ -52,7 +52,6 @@ import org.openzen.zenscript.ide.ui.view.IconButtonControl;
52 52
  */
53 53
 public class SourceEditor implements DComponent {
54 54
 	private final DStyleClass styleClass;
55
-	private final DFont font = new DFont(DFontFamily.CODE, false, false, false, 24);
56 55
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
57 56
 	private final String tab = "    ";
58 57
 	private final IDESourceFile sourceFile;
@@ -65,6 +64,7 @@ public class SourceEditor implements DComponent {
65 64
 	private SourceEditorStyle style;
66 65
 	private DTimerHandle blinkTimer;
67 66
 	
67
+	private DFont font;
68 68
 	private DFontMetrics fontMetrics;
69 69
 	private int textLineHeight;
70 70
 	private int fullLineHeight;
@@ -140,6 +140,7 @@ public class SourceEditor implements DComponent {
140 140
 		
141 141
 		context = parent.getChildContext("sourceeditor", styleClass);
142 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 145
 		fontMetrics = context.getFontMetrics(font);
145 146
 		textLineHeight = fontMetrics.getAscent() + fontMetrics.getDescent();

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

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

Loading…
Cancel
Save