1
0
mirror of https://github.com/aNNiMON/HotaruFX.git synced 2024-09-19 14:14:21 +03:00

Add about window

This commit is contained in:
Victor 2017-09-06 22:04:06 +03:00
parent f9e1e6909e
commit 6468415592
5 changed files with 203 additions and 5 deletions

View File

@ -14,18 +14,29 @@ public class FontAwesome {
} }
public static final String public static final String
UNDO = "\uf0e2",
REDO = "\uf01e",
CLIPBOARD = "\uf0ea", CLIPBOARD = "\uf0ea",
PLAY = "\uf04b" COPYRIGHT = "\uf1f9",
FONT_AWESOME = "\uf2b4",
GITHUB = "\uf09b",
GLOBE = "\uf0ac",
PENCIL = "\uf040",
PLAY = "\uf04b",
REDO = "\uf01e",
UNDO = "\uf0e2"
; ;
static final Map<String, String> MAPPING; static final Map<String, String> MAPPING;
static { static {
MAPPING = new HashMap<>(); MAPPING = new HashMap<>();
MAPPING.put("undo", UNDO);
MAPPING.put("redo", REDO);
MAPPING.put("clipboard", CLIPBOARD); MAPPING.put("clipboard", CLIPBOARD);
MAPPING.put("copyright", COPYRIGHT);
MAPPING.put("earth", GLOBE);
MAPPING.put("font-awesome", FONT_AWESOME);
MAPPING.put("github", GITHUB);
MAPPING.put("globe", GLOBE);
MAPPING.put("pencil", PENCIL);
MAPPING.put("play", PLAY); MAPPING.put("play", PLAY);
MAPPING.put("redo", REDO);
MAPPING.put("undo", UNDO);
} }
} }

View File

@ -0,0 +1,62 @@
package com.annimon.hotarufx.ui;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.text.Text;
public class LineText extends Text {
private final BooleanProperty endLineBreak = new SimpleBooleanProperty(true);
private final StringProperty content = new SimpleStringProperty("");
public LineText() {
init();
}
public LineText(String text) {
super(text);
init();
}
public LineText(double x, double y, String text) {
super(x, y, text);
init();
}
private void init() {
getStyleClass().add("linetext");
setContent(getText());
textProperty().bind(
Bindings.when(endLineBreak)
.then(content.concat("\n"))
.otherwise(content)
);
}
public String getContent() {
return content.get();
}
public StringProperty contentProperty() {
return content;
}
public void setContent(String content) {
this.content.set(content.replace("\\n", "\n"));
}
public boolean isEndLineBreak() {
return endLineBreak.get();
}
public BooleanProperty endLineBreakProperty() {
return endLineBreak;
}
public void setEndLineBreak(boolean endLineBreak) {
this.endLineBreak.set(endLineBreak);
}
}

View File

@ -23,10 +23,13 @@ import javafx.application.Platform;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
import javafx.scene.control.TitledPane; import javafx.scene.control.TitledPane;
import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import lombok.val; import lombok.val;
import org.fxmisc.richtext.CodeArea; import org.fxmisc.richtext.CodeArea;
@ -89,6 +92,24 @@ public class EditorController implements Initializable, DocumentListener {
@FXML @FXML
private void handleMenuAbout(ActionEvent event) { private void handleMenuAbout(ActionEvent event) {
val stage = new Stage();
stage.setTitle("About");
stage.setResizable(false);
stage.initOwner(primaryStage);
stage.initModality(Modality.WINDOW_MODAL);
try {
val loader = new FXMLLoader(getClass().getResource("/fxml/About.fxml"));
val scene = new Scene(loader.load());
scene.getStylesheets().addAll(
getClass().getResource("/styles/theme-dark.css").toExternalForm(),
getClass().getResource("/styles/about.css").toExternalForm()
);
stage.setScene(scene);
stage.show();
} catch (Exception e) {
logError("Unable to open about window");
logPane.setExpanded(true);
}
} }
@FXML @FXML

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.text.TextFlow?>
<?import com.annimon.hotarufx.ui.LineText?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.control.Hyperlink?>
<?import com.annimon.hotarufx.ui.FontAwesomeIcon?>
<ScrollPane xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1"
prefWidth="400.0" prefHeight="300.0"
minWidth="NaN" minHeight="NaN"
maxWidth="-Infinity" maxHeight="-Infinity"
fitToWidth="true">
<TextFlow textAlignment="CENTER">
<LineText />
<Text styleClass="title" text="HotaruFX" />
<LineText />
<LineText />
<LineText styleClass="bold" content="0.9.1" />
<LineText />
<LineText content="Programming language for creating animations" />
<LineText styleClass="italic" content="(hotaru — jap. ホタル — firefly)" />
<LineText />
<FontAwesomeIcon icon="github"/>
<Hyperlink>https://github.com/aNNiMON/HotaruFX</Hyperlink>
<LineText />
<FontAwesomeIcon icon="globe"/>
<Hyperlink>https://annimon.com/</Hyperlink>
<LineText />
<LineText />
<FontAwesomeIcon icon="copyright" />
<LineText styleClass="h4" content=" 2017 aNNiMON" />
<LineText />
<LineText />
<LineText styleClass="h2" content="Third-party licenses" />
<LineText />
<FontAwesomeIcon styleClass="h3" icon="font-awesome" />
<LineText styleClass="h3" content=" Font Awesome" />
<LineText content="by Dave Gandy" />
<Hyperlink>http://fontawesome.io</Hyperlink>
<LineText />
<LineText styleClass="h3" />
<FontAwesomeIcon styleClass="h3" icon="pencil"/>
<LineText styleClass="h3" content=" RichTextFX" />
<LineText />
<LineText styleClass="copyright">
<content>
Copyright (c) 2013-2017, Tomas Mikula and contributors\n
All rights reserved.\n
\n
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n
\n
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n
\n
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n
\n
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</content>
</LineText>
</TextFlow>
</ScrollPane>

View File

@ -0,0 +1,35 @@
.linetext {
-fx-fill: #CCCCCC;
}
.title {
-fx-font-weight: bold;
-fx-font-size: 4em;
-fx-effect: dropshadow(three-pass-box, rgba(100,183,3,0.8), 18, 0, 0.5, 0.25);
-fx-fill: #FDFD42;
}
.h2 {
-fx-font-weight: bold;
-fx-font-size: 1.6em;
}
.h3 {
-fx-font-weight: bold;
-fx-font-size: 1.3em;
}
.h4 {
-fx-font-size: 1.19em;
}
.copyright {
-fx-font-size: 1em;
-fx-font-family: monospace;
-fx-background: #454545;
-fx-fill: #AAAAAA;
}
.bold {
-fx-font-weight: bold;
}
.italic {
-fx-font-style: italic;
}
.fa-icon {
-fx-fill: #fff;
}