parent
d4e3684744
commit
471610accd
|
|
@ -25,6 +25,7 @@ pub enum DocumentsMessage {
|
||||||
CloseActiveDocumentWithConfirmation,
|
CloseActiveDocumentWithConfirmation,
|
||||||
CloseAllDocumentsWithConfirmation,
|
CloseAllDocumentsWithConfirmation,
|
||||||
CloseAllDocuments,
|
CloseAllDocuments,
|
||||||
|
RequestAboutGraphiteDialog,
|
||||||
NewDocument,
|
NewDocument,
|
||||||
OpenDocument,
|
OpenDocument,
|
||||||
OpenDocumentFile(String, String),
|
OpenDocumentFile(String, String),
|
||||||
|
|
@ -124,6 +125,9 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
|
||||||
use DocumentMessage::*;
|
use DocumentMessage::*;
|
||||||
use DocumentsMessage::*;
|
use DocumentsMessage::*;
|
||||||
match message {
|
match message {
|
||||||
|
RequestAboutGraphiteDialog => {
|
||||||
|
responses.push_back(FrontendMessage::DisplayAboutGraphiteDialog.into());
|
||||||
|
}
|
||||||
Document(message) => self.active_document_mut().process_action(message, ipp, responses),
|
Document(message) => self.active_document_mut().process_action(message, ipp, responses),
|
||||||
SelectDocument(index) => {
|
SelectDocument(index) => {
|
||||||
// NOTE: Potentially this will break if we ever exceed 56 bit values due to how the message parsing system works.
|
// NOTE: Potentially this will break if we ever exceed 56 bit values due to how the message parsing system works.
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ pub enum FrontendMessage {
|
||||||
DisplayPanic { panic_info: String, title: String, description: String },
|
DisplayPanic { panic_info: String, title: String, description: String },
|
||||||
DisplayConfirmationToCloseDocument { document_index: usize },
|
DisplayConfirmationToCloseDocument { document_index: usize },
|
||||||
DisplayConfirmationToCloseAllDocuments,
|
DisplayConfirmationToCloseAllDocuments,
|
||||||
|
DisplayAboutGraphiteDialog,
|
||||||
UpdateLayer { data: LayerPanelEntry },
|
UpdateLayer { data: LayerPanelEntry },
|
||||||
UpdateCanvas { document: String },
|
UpdateCanvas { document: String },
|
||||||
UpdateScrollbars { position: (f64, f64), size: (f64, f64), multiplier: (f64, f64) },
|
UpdateScrollbars { position: (f64, f64), size: (f64, f64), multiplier: (f64, f64) },
|
||||||
|
|
@ -22,8 +23,6 @@ pub enum FrontendMessage {
|
||||||
ExportDocument { document: String, name: String },
|
ExportDocument { document: String, name: String },
|
||||||
SaveDocument { document: String, name: String },
|
SaveDocument { document: String, name: String },
|
||||||
OpenDocumentBrowse,
|
OpenDocumentBrowse,
|
||||||
EnableTextInput,
|
|
||||||
DisableTextInput,
|
|
||||||
UpdateWorkingColors { primary: Color, secondary: Color },
|
UpdateWorkingColors { primary: Color, secondary: Color },
|
||||||
SetCanvasZoom { new_zoom: f64 },
|
SetCanvasZoom { new_zoom: f64 },
|
||||||
SetCanvasRotation { new_radians: f64 },
|
SetCanvasRotation { new_radians: f64 },
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<LayoutCol :class="'main-column'">
|
<LayoutCol :class="'main-column'">
|
||||||
<TextLabel :bold="true" :class="'heading'">{{ dialog.heading }}</TextLabel>
|
<TextLabel :bold="true" :class="'heading'">{{ dialog.heading }}</TextLabel>
|
||||||
<TextLabel :class="'details'">{{ dialog.details }}</TextLabel>
|
<TextLabel :class="'details'">{{ dialog.details }}</TextLabel>
|
||||||
<LayoutRow :class="'buttons-row'">
|
<LayoutRow :class="'buttons-row'" v-if="dialog.buttons.length > 0">
|
||||||
<TextButton v-for="(button, index) in dialog.buttons" :key="index" :title="button.tooltip" :action="button.callback" v-bind="button.props" />
|
<TextButton v-for="(button, index) in dialog.buttons" :key="index" :title="button.tooltip" :action="button.callback" v-bind="button.props" />
|
||||||
</LayoutRow>
|
</LayoutRow>
|
||||||
</LayoutCol>
|
</LayoutCol>
|
||||||
|
|
@ -57,12 +57,14 @@
|
||||||
|
|
||||||
.main-column {
|
.main-column {
|
||||||
.heading {
|
.heading {
|
||||||
|
user-select: text;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
|
user-select: text;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,14 +153,11 @@ const menuEntries: MenuListEntries = [
|
||||||
label: "Help",
|
label: "Help",
|
||||||
ref: undefined,
|
ref: undefined,
|
||||||
children: [
|
children: [
|
||||||
|
[{ label: "About Graphite", action: async () => (await wasm).request_about_graphite_dialog() }],
|
||||||
[
|
[
|
||||||
{ label: "Report a Bug", action: () => window.open("https://github.com/GraphiteEditor/Graphite/issues/new", "_blank") },
|
{ label: "Report a Bug", action: () => window.open("https://github.com/GraphiteEditor/Graphite/issues/new", "_blank") },
|
||||||
{ label: "Visit on GitHub", action: () => window.open("https://github.com/GraphiteEditor/Graphite", "_blank") },
|
{ label: "Visit on GitHub", action: () => window.open("https://github.com/GraphiteEditor/Graphite", "_blank") },
|
||||||
],
|
],
|
||||||
[
|
|
||||||
{ label: "Graphite License", action: () => window.open("https://raw.githubusercontent.com/GraphiteEditor/Graphite/master/LICENSE.txt", "_blank") },
|
|
||||||
{ label: "Third-Party Licenses", action: () => window.open("/third-party-licenses.txt", "_blank") },
|
|
||||||
],
|
|
||||||
[{ label: "Debug: Panic (DANGER)", action: async () => (await wasm).intentional_panic() }],
|
[{ label: "Debug: Panic (DANGER)", action: async () => (await wasm).intentional_panic() }],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
|
import "@/utilities/dialogs";
|
||||||
|
|
||||||
import Panel from "@/components/workspace/Panel.vue";
|
import Panel from "@/components/workspace/Panel.vue";
|
||||||
import LayoutRow from "@/components/layout/LayoutRow.vue";
|
import LayoutRow from "@/components/layout/LayoutRow.vue";
|
||||||
import LayoutCol from "@/components/layout/LayoutCol.vue";
|
import LayoutCol from "@/components/layout/LayoutCol.vue";
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Allows for runtime reflection of types in javascript.
|
// reflect-metadata allows for runtime reflection of types in JavaScript.
|
||||||
// It is needed for class-transformer to work and is imported as a side effect.
|
// It is needed for class-transformer to work and is imported as a side effect.
|
||||||
// The library replaces the Reflect Api on the window to support more features.
|
// The library replaces the Reflect API on the window to support more features.
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
|
|
||||||
import { fullscreenModeChanged } from "@/utilities/fullscreen";
|
import { fullscreenModeChanged } from "@/utilities/fullscreen";
|
||||||
import { onKeyUp, onKeyDown, onMouseMove, onMouseDown, onMouseUp, onMouseScroll, onWindowResize, onBeforeUnload } from "@/utilities/input";
|
import { onKeyUp, onKeyDown, onMouseMove, onMouseDown, onMouseUp, onMouseScroll, onWindowResize, onBeforeUnload } from "@/utilities/input";
|
||||||
import "@/utilities/errors";
|
import "@/utilities/errors";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
import { subscribeJsMessage } from "@/utilities/js-message-dispatcher";
|
||||||
|
import { DisplayAboutGraphiteDialog } from "@/utilities/js-messages";
|
||||||
|
import { createDialog } from "@/utilities/dialog";
|
||||||
|
import { TextButtonWidget } from "@/components/widgets/widgets";
|
||||||
|
|
||||||
|
subscribeJsMessage(DisplayAboutGraphiteDialog, () => {
|
||||||
|
const date = new Date(process.env.VUE_APP_COMMIT_DATE || "");
|
||||||
|
const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
||||||
|
const timeString = `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
||||||
|
const timezoneName = Intl.DateTimeFormat(undefined, { timeZoneName: "long" })
|
||||||
|
.formatToParts(new Date())
|
||||||
|
.find((part) => part.type === "timeZoneName");
|
||||||
|
const timezoneNameString = timezoneName && timezoneName.value;
|
||||||
|
|
||||||
|
const hash = (process.env.VUE_APP_COMMIT_HASH || "").substring(0, 12);
|
||||||
|
|
||||||
|
const details = `
|
||||||
|
Release Series: ${process.env.VUE_APP_RELEASE_SERIES}
|
||||||
|
|
||||||
|
Date: ${dateString} ${timeString} ${timezoneNameString}
|
||||||
|
Hash: ${hash}
|
||||||
|
Branch: ${process.env.VUE_APP_COMMIT_BRANCH}
|
||||||
|
`.trim();
|
||||||
|
|
||||||
|
const buttons: TextButtonWidget[] = [
|
||||||
|
{
|
||||||
|
kind: "TextButton",
|
||||||
|
callback: () => window.open("https://www.graphite.design", "_blank"),
|
||||||
|
props: { label: "Website", emphasized: false, minWidth: 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: "TextButton",
|
||||||
|
callback: () => window.open("https://github.com/GraphiteEditor/Graphite/graphs/contributors", "_blank"),
|
||||||
|
props: { label: "Credits", emphasized: false, minWidth: 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: "TextButton",
|
||||||
|
callback: () => window.open("https://raw.githubusercontent.com/GraphiteEditor/Graphite/master/LICENSE.txt", "_blank"),
|
||||||
|
props: { label: "License", emphasized: false, minWidth: 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: "TextButton",
|
||||||
|
callback: () => window.open("/third-party-licenses.txt", "_blank"),
|
||||||
|
props: { label: "Third-Party Licenses", emphasized: false, minWidth: 0 },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
createDialog("GraphiteLogo", "Graphite", details, buttons);
|
||||||
|
});
|
||||||
|
|
@ -21,6 +21,7 @@ import {
|
||||||
UpdateScrollbars,
|
UpdateScrollbars,
|
||||||
UpdateWorkingColors,
|
UpdateWorkingColors,
|
||||||
UpdateLayer,
|
UpdateLayer,
|
||||||
|
DisplayAboutGraphiteDialog,
|
||||||
} from "@/utilities/js-messages";
|
} from "@/utilities/js-messages";
|
||||||
|
|
||||||
const messageConstructors = {
|
const messageConstructors = {
|
||||||
|
|
@ -42,6 +43,7 @@ const messageConstructors = {
|
||||||
DisplayPanic,
|
DisplayPanic,
|
||||||
DisplayConfirmationToCloseDocument,
|
DisplayConfirmationToCloseDocument,
|
||||||
DisplayConfirmationToCloseAllDocuments,
|
DisplayConfirmationToCloseAllDocuments,
|
||||||
|
DisplayAboutGraphiteDialog,
|
||||||
} as const;
|
} as const;
|
||||||
type JsMessageType = keyof typeof messageConstructors;
|
type JsMessageType = keyof typeof messageConstructors;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ export class DisplayConfirmationToCloseDocument extends JsMessage {
|
||||||
|
|
||||||
export class DisplayConfirmationToCloseAllDocuments extends JsMessage {}
|
export class DisplayConfirmationToCloseAllDocuments extends JsMessage {}
|
||||||
|
|
||||||
|
export class DisplayAboutGraphiteDialog extends JsMessage {}
|
||||||
|
|
||||||
export class UpdateCanvas extends JsMessage {
|
export class UpdateCanvas extends JsMessage {
|
||||||
readonly document!: string;
|
readonly document!: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"types": [],
|
"types": [
|
||||||
|
"node"
|
||||||
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
"src/*"
|
"src/*"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires, no-console */
|
/* eslint-disable @typescript-eslint/no-var-requires, no-console */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { spawnSync } = require("child_process");
|
const { execSync, spawnSync } = require("child_process");
|
||||||
|
|
||||||
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
||||||
const LicenseCheckerWebpackPlugin = require("license-checker-webpack-plugin");
|
const LicenseCheckerWebpackPlugin = require("license-checker-webpack-plugin");
|
||||||
|
|
@ -34,6 +34,11 @@ function generateRustLicenses() {
|
||||||
return eval(stdout);
|
return eval(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.env.VUE_APP_COMMIT_DATE = execSync("git log -1 --format=%cd", { encoding: "utf-8" }).trim();
|
||||||
|
process.env.VUE_APP_COMMIT_HASH = execSync("git rev-parse HEAD", { encoding: "utf-8" }).trim();
|
||||||
|
process.env.VUE_APP_COMMIT_BRANCH = execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
|
||||||
|
process.env.VUE_APP_RELEASE_SERIES = "Pre-Alpha";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
lintOnSave: "warning",
|
lintOnSave: "warning",
|
||||||
// https://cli.vuejs.org/guide/webpack.html
|
// https://cli.vuejs.org/guide/webpack.html
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,12 @@ pub fn close_all_documents_with_confirmation() {
|
||||||
dispatch(message);
|
dispatch(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn request_about_graphite_dialog() {
|
||||||
|
let message = DocumentsMessage::RequestAboutGraphiteDialog;
|
||||||
|
dispatch(message);
|
||||||
|
}
|
||||||
|
|
||||||
/// Send new bounds when document panel viewports get resized or moved within the editor
|
/// Send new bounds when document panel viewports get resized or moved within the editor
|
||||||
/// [left, top, right, bottom]...
|
/// [left, top, right, bottom]...
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue