diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-15 22:35:29 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-15 22:35:29 +0100 |
| commit | ad548cf57ae5d729c4186ec8f710b0df2e6f24b4 (patch) | |
| tree | 515826b0d36eab32395abe09c1727011cdf151ed /IDE/src/main/java/org/elmahrouss/CodeEditorView.java | |
| parent | b876a9ffb37882d1bc3b50b815a5b45af21735dc (diff) | |
64ld: Improved code and SDK.
IDE: Also did improve code.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'IDE/src/main/java/org/elmahrouss/CodeEditorView.java')
| -rw-r--r-- | IDE/src/main/java/org/elmahrouss/CodeEditorView.java | 92 |
1 files changed, 92 insertions, 0 deletions
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); + } +} |
