mirror of
https://github.com/aNNiMON/HotaruFX.git
synced 2024-09-19 14:14:21 +03:00
Ability to change editor font size
This commit is contained in:
parent
20c9a32e67
commit
b29d43a7e3
@ -24,6 +24,8 @@ public enum FontAwesome {
|
||||
QUESTION_CIRCLE("\uf059", "question-circle"),
|
||||
REDO("\uf01e", "redo"),
|
||||
SCISSORS("\uf0c4", "scissors", "cut"),
|
||||
SEARCH_PLUS("\uf00e", "search-plus"),
|
||||
SEARCH_MINUS("\uf010", "search-minus"),
|
||||
UNDO("\uf0e2", "undo");
|
||||
|
||||
@Getter
|
||||
|
@ -127,6 +127,23 @@ public class EditorController implements Initializable, DocumentListener {
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleMenuIncreaseFontSize(ActionEvent event) {
|
||||
changeFontSize(+1);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleMenuDecreaseFontSize(ActionEvent event) {
|
||||
changeFontSize(-1);
|
||||
}
|
||||
|
||||
private void changeFontSize(int delta) {
|
||||
if (editor.getFont() == null) return;
|
||||
val newSize = (int) editor.getFont().getSize() + delta;
|
||||
if (8 > newSize || newSize > 40) return;
|
||||
editor.setStyle("-fx-font-size: " + newSize + "px");
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleMenuAbout(ActionEvent event) {
|
||||
val stage = new Stage();
|
||||
|
@ -35,6 +35,8 @@
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="View">
|
||||
<CheckMenuItem fx:id="syntaxHighlightingItem" text="Syntax Highlighting" selected="true" />
|
||||
<MenuItem onAction="#handleMenuIncreaseFontSize" text="Increase fomt size" accelerator="Shortcut+Equals"/>
|
||||
<MenuItem onAction="#handleMenuDecreaseFontSize" text="Decrease fomt size" accelerator="Shortcut+Minus"/>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Composition">
|
||||
<MenuItem onAction="#handleMenuPlay" text="Preview" accelerator="F5"/>
|
||||
@ -95,6 +97,23 @@
|
||||
<Tooltip text="Preview composition"/>
|
||||
</tooltip>
|
||||
</Button>
|
||||
<Separator/>
|
||||
<Button onAction="#handleMenuIncreaseFontSize">
|
||||
<graphic>
|
||||
<FontAwesomeIcon icon="search-plus"/>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip text="Increase font size"/>
|
||||
</tooltip>
|
||||
</Button>
|
||||
<Button onAction="#handleMenuDecreaseFontSize">
|
||||
<graphic>
|
||||
<FontAwesomeIcon icon="search-minus"/>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip text="Decrease font size"/>
|
||||
</tooltip>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</VBox>
|
||||
</top>
|
||||
|
Loading…
Reference in New Issue
Block a user