Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Renamed app. Fixed configuration file reading bug. Code formatting.

Authordjarvis <email>
Date2016-10-17 23:18:05 GMT-0700
Commitac6bf4935ad3c7bace315d4e83ca8bf20e538adb
Parent2a42516
Delta145 lines added, 12 lines removed, 133-line increase
src/main/resources/org/markdownwriterfx/messages.properties
#---- MainWindow ----
-MainWindow.fileMenu=File
+MainWindow.fileMenu=_File
MainWindow.fileNewAction=New
MainWindow.fileOpenAction=Open...
MainWindow.fileCloseAction=Close
MainWindow.fileCloseAllAction=Close All
MainWindow.fileSaveAction=Save
MainWindow.fileSaveAllAction=Save All
MainWindow.fileExitAction=Exit
-MainWindow.editMenu=Edit
+MainWindow.editMenu=_Edit
MainWindow.editUndoAction=Undo
MainWindow.editRedoAction=Redo
-MainWindow.insertMenu=Insert
+MainWindow.insertMenu=_Insert
MainWindow.insertBoldAction=Bold
MainWindow.insertItalicAction=Italic
MainWindow.insertHorizontalRuleAction=Horizontal Rule
-MainWindow.toolsMenu=Tools
+MainWindow.toolsMenu=_Tools
MainWindow.toolsOptionsAction=Options
-
-MainWindow.helpMenu=Help
-MainWindow.helpAboutAction=About Markdown Writer FX
-MainWindow.about.title=About
-MainWindow.about.headerText=Markdown Writer FX
-MainWindow.about.contentText=Copyright (c) 2015 Karl Tauber <karl at jformdesigner dot com>\nAll rights reserved.
+MainWindow.helpMenu=_Help
+MainWindow.helpAboutAction=About Scrivano
+MainWindow.about.title=_About
+MainWindow.about.headerText=Scrivano
+MainWindow.about.contentText=Copyright (c) 2016 White Magic Software, Ltd.
#---- FileEditor ----
MarkdownOptionsPane.hardwrapsExtCheckBox.text=_Newlines in paragraph-like content as real line breaks, see
MarkdownOptionsPane.hardwrapsExtLink.text=Github-flavoured-Markdown
-MarkdownOptionsPane.quotesExtCheckBox.text=Beautify single _quotes, double quotes and double angle quotes (� and �)
+MarkdownOptionsPane.quotesExtCheckBox.text=Beautify single _quotes, double quotes and double angle quotes (\u00ab and \u00bb)
MarkdownOptionsPane.relaxedHrRulesExtCheckBox.text=Allow horizontal rules without a blank line following them
MarkdownOptionsPane.smartsExtCheckBox.text=Beautify apostrophes, _ellipses ("..." and ". . .") and dashes ("--" and "---")
src/main/resources/org/markdownwriterfx/settings.properties
-application.title=AuthorEd
+application.title=Scrivano
# Comma-separated list of markdown filename extensions.
src/main/java/org/markdownwriterfx/Scrivano.java
+/*
+ * Copyright (c) 2015 Karl Tauber <karl at jformdesigner dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * o 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.
+ *
+ * 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.
+ */
+package org.markdownwriterfx;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.image.Image;
+import javafx.stage.Stage;
+import org.markdownwriterfx.service.Options;
+import org.markdownwriterfx.service.Settings;
+import org.markdownwriterfx.util.StageState;
+
+/**
+ * Markdown Writer FX application.
+ *
+ * @author Karl Tauber
+ */
+public final class Scrivano extends Application {
+
+ private static Application app;
+
+ private MainWindow mainWindow;
+ private StageState stageState;
+ private final Settings settings = Services.load( Settings.class );
+ private final Options options = Services.load( Options.class );
+
+ public static void main( String[] args ) {
+ launch( args );
+ }
+
+ /**
+ * Application entry point.
+ *
+ * @param stage The primary application stage.
+ *
+ * @throws Exception Could not read configuration file.
+ */
+ @Override
+ public void start( Stage stage ) throws Exception {
+ initApplication();
+ initWindow();
+ initState( stage );
+ initStage( stage );
+
+ stage.show();
+ }
+
+ private void initApplication() {
+ app = this;
+ }
+
+ private Settings getSettings() {
+ return this.settings;
+ }
+
+ private Options getOptions() {
+ return this.options;
+ }
+
+ private String getApplicationTitle() {
+ return getSettings().getSetting( "application.title", "Scrivano" );
+ }
+
+ private void initWindow() {
+ setWindow( new MainWindow() );
+ }
+
+ private void initState( Stage stage ) {
+ stageState = new StageState( stage, getOptions().getState() );
+ }
+
+ private void initStage( Stage stage ) {
+ stage.getIcons().addAll(
+ new Image( "org/markdownwriterfx/markdownwriterfx16.png" ),
+ new Image( "org/markdownwriterfx/markdownwriterfx32.png" ),
+ new Image( "org/markdownwriterfx/markdownwriterfx128.png" ),
+ new Image( "org/markdownwriterfx/markdownwriterfx256.png" ),
+ new Image( "org/markdownwriterfx/markdownwriterfx512.png" ) );
+ stage.setTitle( getApplicationTitle() );
+ stage.setScene( getScene() );
+ }
+
+ private Scene getScene() {
+ return getMainWindow().getScene();
+ }
+
+ protected MainWindow getMainWindow() {
+ return this.mainWindow;
+ }
+
+ private void setWindow( MainWindow mainWindow ) {
+ this.mainWindow = mainWindow;
+ }
+
+ private StageState getStageState() {
+ return this.stageState;
+ }
+
+ private void setStageState( StageState stageState ) {
+ this.stageState = stageState;
+ }
+
+ private static Application getApplication() {
+ return app;
+ }
+
+ public static void showDocument( String uri ) {
+ getApplication().getHostServices().showDocument( uri );
+ }
+}