Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into 22-Identifier-Completion-Suggestion-Tokeni…
Browse files Browse the repository at this point in the history
…ser-Edge-Cases
  • Loading branch information
setho246 committed May 24, 2021
2 parents 277c699 + 7d304d1 commit a65c5b3
Show file tree
Hide file tree
Showing 8 changed files with 715 additions and 161 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MIT License

Yarn Spinner Editor

Copyright (c) 2021 UTAS Yarn Spinner Editor Team
Copyright (c) 2021 UTAS Yarn Spinner Editor Team: Seth Hilder, Adam Scott, Cullie McElduff, Harry Clark and Nicky Milsom

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions src/controllers/themeReader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
WORK IN PROGRESS FILE
INTENDING TO EXPORT VARIABLES INTO YARNSPINNER MONARCH
AND THE CSS FILE
*/

//File to handle the list of variables

//Pink theme
/*
module.exports = {
primary_text: "#000000",
secondary_text: "#FFFFFF",
editor: "#f7c2c2",
commands: "#FF00AA",
fileTag: "#718C70",
interpolation: "#CC8400",
option: "#AD00C4",
variables: "#347F36",
float: "#063B0E",
number: "#063B0E",
yarnCommands: "#A30A70",
hashtag: "#AAAAAA",
operator: "#AAAFFF",
workingFile: "#fce5e5",
tabGap: "#ff7474",
divideColour: "#c64242",
lineSelection: "#eba0a0"
}
/**/

/*
//OG Blue theme
module.exports = {
primary_text: "#000000",
secondary_text: "#FFFFFF",
editor: "#CFD8DC",
commands: "#FF00AA",
fileTag: "#718C70",
interpolation: "#CC8400",
option: "#AD00C4",
variables: "#347F36",
float: "#063B0E",
number: "#063B0E",
yarnCommands: "#A30A70",
hashtag: "#AAAAAA",
operator: "#AAAFFF",
workingFile: "#d5dee2",
tabGap: "#546E7A",
divideColour: "#9eb5c0",
lineSelection: "#d5dee2"
}
/**/

//Night theme
module.exports = {
primary_text: "#FFFFFF",
secondary_text: "#000000",
editor: "#797979",

commands: "#FF00AA",
fileTag: "#718C70",
interpolation: "#CC8400",
option: "#AD00C4",
variables: "#347F36",
float: "#063B0E",
number: "#063B0E",
yarnCommands: "#A30A70",
hashtag: "#AAAAAA",
operator: "#AAAFFF",

workingFile: "#d7d7d7",
tabGap: "#5c5c5c",
divideColour: "#2c2c2c",
lineSelection: "#a5a5a5"

};
/**/

63 changes: 45 additions & 18 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</svg>
<span class="tooltiptext">Open File</span>
</div>
<div class="tooltip">
<div id="searchFolderIcon" class="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-list-search" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
Expand All @@ -76,42 +76,65 @@
<div id="iconTwo">
<p>Text Options</p>
<div id="textOptions">
<div text-hover="Bold text">
<object type="image/svg+xml" data="models/icons/bold.svg" alt="Bold" id="boldIcon"></object>
<div id="boldTextIcon" class="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-bold" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M7 5h6a3.5 3.5 0 0 1 0 7h-6z" />
<path d="M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" />
</svg>
<span class="tooltiptext">Bold text (ctrl + b)</span>
</div>
<div text-hover="Italicise text">
<object type="image/svg+xml" data="models/icons/italic.svg" alt="Italics" id="italicsIcon"></object>
<div id="italicTextIcon" class="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-italic" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<line x1="11" y1="5" x2="17" y2="5" />
<line x1="7" y1="19" x2="13" y2="19" />
<line x1="14" y1="5" x2="10" y2="19" />
</svg>
<span class="tooltiptext">Italicise text</span>
</div>
<div text-hover="Underline text">
<object type="image/svg+xml" data="models/icons/underline.svg" alt="Underline"
id="underlineIcon"></object>
<div id="underlineTextIcon" class="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-underline" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M7 5v5a5 5 0 0 0 10 0v-5" />
<path d="M5 19h14" />
</svg>
<span class="tooltiptext">Underline text</span>
</div>
<div class='psuedoButton'>
<div text-hover="Text colour">
<object type="image/svg+xml" data="models/icons/palette.svg" alt="Colour Picker"
id="paletteIcon"></object>
<input type="color" id="colourPicker">
<!-- TODO MAKE THIS ENTIRE SECTION A FORM POPUP, SO WE CAN ADD A CONFIRM BUTTON TO THE COLOUR -->

<div class="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-palette" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 21a9 9 0 1 1 0 -18a9 8 0 0 1 9 8a4.5 4 0 0 1 -4.5 4h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25" />
<circle cx="7.5" cy="10.5" r=".5" fill="currentColor" />
<circle cx="12" cy="7.5" r=".5" fill="currentColor" />
<circle cx="16.5" cy="10.5" r=".5" fill="currentColor" />
</svg>
<input type="color" id="colourPicker" value="currentColor">
<span class="tooltiptext">Colour text</span>
</div>
</div>
</div>
</div>

<div id="iconThree" horizontal layout>

<p>An editor for Yarn Spinner, lorem ipsum dolor sit</p>
<div><img src="views/YSLogo.png"></div>
</div>

<div id="iconFour" horizontal layout>
<!-- <div id="iconFour" horizontal layout>
</div>
</div> -->
</div>
<div class="parentLayout">
<div id="leftCont">
<div id="leftSideContainer">
<details id="workingFilesDetail">
<summary>Working files</summary>
<p>Samplefile.yarn</p>
<p>Samplefile2.yarn</p>
</details>
<!-- <div><p>Samplefile.yarn</p><button id="0">x</button></div> -->
</details>
</div>
</div>

Expand All @@ -122,6 +145,10 @@
<p>samplefile.yarn </p>
<button class="closeButton">x</button>
</div>
<div class="tabItem">
<p>samplefile.yarn </p>
<button class="closeButton">x</button>
</div>
</div>
<div class='editorView' id='container'></div>
</div>
Expand Down
92 changes: 84 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function createWindow()
{
// Create the browser window.
const mainWindow = new BrowserWindow({
height: 540,
height: 545,
width: 960,
minHeight: 480,
minWidth: 480,
minWidth: 540,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
Expand Down Expand Up @@ -61,22 +61,36 @@ const template = [
submenu: [
{
label: "New",
accelerator: "CmdOrCtrl+N",
click: async () =>
{
handleNewFile();
}
},
{
label: "Open",
accelerator: "CmdOrCtrl+O",
click: async () =>
{
handleFileOpen();
}
},
{ label: "save" },
{ label: "save as" },
{ label: "import" },
{ label: "export" },
{
label: "save",
accelerator: "CmdOrCtrl+S",
click: async () =>
{
handleFileSave();
}
},
{
label: "save as",
accelerator: "CmdOrCtrl+Shift+S",
click: async () =>
{
handleFileSaveAs();
}
},
isMac ? { role: "close" } : { role: "quit" },
]
},
Expand All @@ -91,8 +105,22 @@ const template = [
{ role: "cut" },
{ role: "paste" },
{ type: "separator" },
{ label: "find" },
{ label: "replace" },
{
label: "find",
accelerator: "CmdOrCtrl+F",
click: async () =>
{
handleFind();
}
},
{
label: "replace",
accelerator: "CmdOrCtrl+R",
click: async () =>
{
handleReplace();
}
},
...(isMac ?
[
{ role: "pasteAndMatchStyle" },
Expand Down Expand Up @@ -145,6 +173,7 @@ const template = [
])
]
},
// optionsMenu
{
label: "Options",
submenu: [
Expand Down Expand Up @@ -239,6 +268,9 @@ ipcMain.on("fileSaveAsToMain", (event, filePath, contents) =>
//BrowserWindow.getFocusedWindow()?.webContents.send("ChannelMessage", args);
//This should ONLY be used for menu interaction

//File Options
//----------------------------

/**
* Emits message to renderer to create new file.
*
Expand All @@ -262,4 +294,48 @@ function handleFileOpen()
{
BrowserWindow.getFocusedWindow()?.webContents.send("openFile", fileContent.path, fileContent.contents, fileContent.name); //Pass the result to renderer
}
}

/**
* Emits message to renderer to save the file.
*
* @returns {void}
*/
function handleFileSave()
{
BrowserWindow.getFocusedWindow()?.webContents.send("saveFile");
}

/**
* Emits message to renderer to saveAs the file.
*
* @returns {void}
*/
function handleFileSaveAs()
{
BrowserWindow.getFocusedWindow()?.webContents.send("mainRequestSaveAs");
}

//Edit Options
//----------------------------

/**
* Emits message to renderer to find the selected code within the file.
*
* @returns {void}
*/
function handleFind()
{
BrowserWindow.getFocusedWindow()?.webContents.send("findInFile");
}

/**
* Emits message to renderer to replace the selected code within the file.
*
* @returns {void}
*/
function handleReplace()
{
BrowserWindow.getFocusedWindow()?.webContents.send("ReplceInFile");
}

Binary file added src/views/YSLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a65c5b3

Please sign in to comment.