From ad548cf57ae5d729c4186ec8f710b0df2e6f24b4 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 15 Jan 2024 22:35:29 +0100 Subject: 64ld: Improved code and SDK. IDE: Also did improve code. Signed-off-by: Amlal El Mahrouss --- .../main/java/org/elmahrouss/CodeEditorView.java | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 IDE/src/main/java/org/elmahrouss/CodeEditorView.java (limited to 'IDE/src/main/java/org/elmahrouss/CodeEditorView.java') diff --git a/IDE/src/main/java/org/elmahrouss/CodeEditorView.java b/IDE/src/main/java/org/elmahrouss/CodeEditorView.java new file mode 100644 index 0000000..e82fa59 --- /dev/null +++ b/IDE/src/main/java/org/elmahrouss/CodeEditorView.java @@ -0,0 +1,92 @@ +/* + * ======================================================== + * + * MPCC + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + + package org.elmahrouss; + +import java.io.Console; + +import javafx.collections.ObservableList; +import javafx.scene.Node; +import javafx.scene.control.Label; +import javafx.scene.layout.*; +import javafx.scene.paint.Color; + +/* + * Editor view class + */ +public class CodeEditorView extends Pane { + private Pane linePane; + private Label codeText; + private boolean readOnly; + private ConsoleWindow consoleWindow; + private HBox codeBox; + private String filename = "untitled.c"; + + CodeEditorView(boolean readOnly) + { + super(); + + this.readOnly = readOnly; + + codeText = new Label(); + + codeText.setStyle("-fx-font-size: 20"); + codeText.setTextFill(Color.color(1, 1, 1)); + + codeText.setWrapText(true); + codeText.setTranslateX(70); + codeText.setTranslateY(30); + + linePane = new Pane(); + + linePane.setStyle("-fx-background-color: #" + CodeEditorTheme.lineTheme); + linePane.setMinSize(52, 720); + linePane.setMaxSize(52, 1080); + + this.setStyle("-fx-background-color: #" + CodeEditorTheme.backgroundTheme); + + this.setMinSize(1280, 720); + this.setMaxSize(1920, 1080); + + codeBox = new HBox(); + + if (!this.readOnly) { + consoleWindow = new ConsoleWindow(); + + codeBox.getChildren().add(consoleWindow); + codeBox.getChildren().add(codeText); + } + + this.getChildren().addAll(linePane, codeBox); + } + + public boolean isReadOnly() { return readOnly; } + + public void setReadOnly(Boolean readOnly) { this.readOnly = readOnly; } + + public String getFilename() { return filename; } + + public void setFilename(String filename) + { + if (readOnly) + return; + + this.filename = filename; + } + + public String getContents() { return codeText.getText(); } + + public void setContents(String content) + { + if (readOnly) + return; + + this.codeText.setText(content); + } +} -- cgit v1.2.3