Verified Commit c772b5de authored by Konstantin Kopper's avatar Konstantin Kopper
Browse files

Added button to clear the console

parent ba5bd752
Pipeline #7466 passed with stages
in 6 minutes and 15 seconds
......@@ -28,6 +28,8 @@ Use the following template:
-->
## [Unreleased][]
### Added
* Button for clearing the console window.
## [2.0.2][] - 2019-05-27
### Fixed
......
......@@ -182,4 +182,11 @@ internal object FontAwesome {
* @author Konstantin Kopper
*/
const val FA_TIMES_CIRCLE = "\uf057"
/**
* See [fa-trash-o](https://fontawesome.com/v4.7.0/icon/trash-o/).
*
* @author Konstantin Kopper
*/
const val FA_TRASH_O = "\uf014"
}
......@@ -241,6 +241,15 @@ internal class MainPane(private val stage: Window) : AnchorPane() {
@FXML
private lateinit var console: Console
/**
* The button clearing the console.
*
* @author Konstantin Kopper
* @since 2.0.3
*/
@FXML
private lateinit var consoleClearButton: Button
/**
* The currently opened file.
*
......@@ -335,6 +344,11 @@ internal class MainPane(private val stage: Window) : AnchorPane() {
tooltip = Tooltip("Help")
}
this.consoleClearButton.apply {
text = FontAwesome.FA_TRASH_O
tooltip = Tooltip("Clear the console")
}
// Make console output non editable
this.consoleTextArea.isEditable = false
......@@ -928,6 +942,15 @@ internal class MainPane(private val stage: Window) : AnchorPane() {
}.show()
}
/**
* Clears the console.
*
* @author Konstantin Kopper
* @since 2.0.3
*/
@FXML
fun clearConsole() = console.clear()
companion object {
/**
* Regular expression matching *.pseuco files (ignoring lower-/uppercase).
......
......@@ -63,6 +63,22 @@
-fx-text-fill: #ffffff;
}
#consoleClearButton {
-fx-border-width: 0;
-fx-font-size: 100%;
-fx-text-fill: -console-text;
}
#consoleClearButton:hover {
-fx-background-color: transparent;
-fx-text-fill: white;
}
#consoleClearButton:pressed {
-fx-background-color: transparent;
-fx-text-fill: -red-dark;
}
/* File Tree */
#fileTree {
......
......@@ -59,12 +59,17 @@
<items>
<AnchorPane fx:id="codeAnchor" minHeight="0.0" minWidth="0.0">
<children>
<PseuCoArea fx:id="codeArea" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" disable="true" />
<PseuCoArea fx:id="codeArea" disable="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
<AnchorPane fx:id="consoleAnchor" minHeight="0.0" minWidth="0.0">
<children>
<TextArea fx:id="consoleTextArea" promptText="Console output will appear here." AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<StackPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<TextArea fx:id="consoleTextArea" promptText="Console output will appear here." />
<Button fx:id="consoleClearButton" mnemonicParsing="false" onAction="#clearConsole" text="Clear" StackPane.alignment="TOP_RIGHT" />
</children>
</StackPane>
</children>
</AnchorPane>
</items>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment