Skip to content

Commit

Permalink
Merge branch 'development' into RELEASE-3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dgthanhan committed Dec 31, 2022
2 parents f1309bc + 19e9e98 commit 8eca012
Show file tree
Hide file tree
Showing 143 changed files with 25,668 additions and 4,748 deletions.
5 changes: 2 additions & 3 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {clipboard, remote, nativeImage, shell, ipcRenderer, webFrame} = require("electron");
const {clipboard, nativeImage, shell, ipcRenderer, webFrame} = require("electron");

const _ = require("lodash");
const rimraf = require("rimraf");
Expand All @@ -13,9 +13,8 @@ const jimp = require("jimp");
const pkgInfo = require("./package.json");
const QueueHandler = require("./pencil-core/common/QueueHandler");
const sharedUtil = require("./pencil-core/common/shared-util");

const dialog = remote.dialog;

const freehand = require("perfect-freehand");
tmp.setGracefulCleanup();

// webFrame.registerURLSchemeAsPrivileged("file");
Expand Down
14 changes: 10 additions & 4 deletions app/app.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://evolus.vn/Namespaces/WebUI/1.0">
<head>
<title>Pencil</title>

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="css/material-icons.css" />

<link rel="stylesheet" href="css/pencil.css"/>
Expand All @@ -15,6 +15,7 @@
<script type="text/javascript" src="lib/codemirror/codemirror.js"></script>
<link rel="stylesheet" href="lib/codemirror/codemirror.css"/>
<script type="text/javascript" src="lib/codemirror/javascript.js"></script>
<script type="text/javascript" src="lib/codemirror/xml.js"></script>

<!-- Pencil Core -->
<script type="text/javascript" src="pencil-core/common/pencilNamespaces.js"></script>
Expand Down Expand Up @@ -86,6 +87,7 @@
<script type="text/javascript" src="pencil-core/propertyType/alignment.js"></script>
<script type="text/javascript" src="pencil-core/propertyType/strokeStyle.js"></script>
<script type="text/javascript" src="pencil-core/propertyType/bool.js"></script>
<script type="text/javascript" src="pencil-core/propertyType/num.js"></script>
<script type="text/javascript" src="pencil-core/propertyType/enum.js"></script>
<script type="text/javascript" src="pencil-core/propertyType/plainText.js"></script>
<script type="text/javascript" src="pencil-core/propertyType/richText.js"></script>
Expand Down Expand Up @@ -147,7 +149,9 @@

<script type="text/javascript" src="pencil-core/clipartBrowser/webUtil.js"></script>
<script type="text/javascript" src="pencil-core/clipartBrowser/searchEngine.js"></script>
<script type="text/javascript" src="pencil-core/clipartBrowser/openClipartSearch.js"></script>
<script type="text/javascript" src="pencil-core/clipartBrowser/newOpenClipartSearch.js"></script>

<script type="text/javascript" src="pencil-core/canvasHelper/GestureHelper.js"></script>

<!--<script type="text/javascript" src="pencil-core/mainWindow.js"></script>-->

Expand Down Expand Up @@ -181,6 +185,7 @@
<script type="text/javascript" src="views/editors/ComboTest.js"></script>
<script type="text/javascript" src="views/editors/DataTable.js"></script>
<script type="text/javascript" src="views/editors/EnumEditor.js"></script>
<script type="text/javascript" src="views/editors/NumEditor.js"></script>
<script type="text/javascript" src="views/editors/FontEditor.js"></script>
<script type="text/javascript" src="views/editors/OnMenuEditor.js"></script>
<script type="text/javascript" src="views/editors/OnScreenRichTextEditor.js"></script>
Expand All @@ -196,12 +201,12 @@
<script type="text/javascript" src="views/editors/StrokeStyleEditor.js"></script>
<script type="text/javascript" src="views/editors/TextToolOverlay.js"></script>
<script type="text/javascript" src="views/editors/NPatchSpecEditorDialog.js"></script>

<script type="text/javascript" src="views/editors/image-editor/ExternalImageEditorDialog.js"></script>
<script type="text/javascript" src="views/editors/image-editor/ImageEditorDialog.js"></script>
<script type="text/javascript" src="views/editors/image-editor/tools/BaseSimpleArgumentTool.js"></script>
<script type="text/javascript" src="views/editors/image-editor/tools/BaseImmediateActionTool.js"></script>

<script type="text/javascript" src="views/EditPageNoteDialog.js"></script>
<script type="text/javascript" src="views/ExportDialog.js"></script>
<script type="text/javascript" src="views/menus/Menu.js"></script>
Expand All @@ -216,6 +221,7 @@
<script type="text/javascript" src="views/toolbars/FileToolbar.js"></script>
<script type="text/javascript" src="views/toolbars/SizeToolbar.js"></script>
<script type="text/javascript" src="views/toolbars/ZoomToolbar.js"></script>
<script type="text/javascript" src="views/toolbars/GestureModeToolbar.js"></script>
<script type="text/javascript" src="views/tools/FontDetailDialog.js"></script>
<script type="text/javascript" src="views/tools/FontManagementDialog.js"></script>
<script type="text/javascript" src="views/tools/NPatchDialog.js"></script>
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/css/canvas.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
}
*[pencil-canvas='true'] svg {
}
*[pencil-canvas='true'] svg|g[p|type='Shape'] {
.AnonId_contentBody[gesture-mode='selection'] *[pencil-canvas='true'] svg|g[p|type='Shape'] {
cursor: move;
}
*[pencil-canvas='true'] svg|g[p|type='Shape'][p|locked='true'] {
.AnonId_contentBody[gesture-mode='selection'] *[pencil-canvas='true'] svg|g[p|type='Shape'][p|locked='true'] {
cursor: default;
}
body[format-painter='true'] *[pencil-canvas='true'],
Expand Down
17 changes: 15 additions & 2 deletions app/css/material-icons.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
@font-face {
font-family: 'Material Icons Original';
font-style: normal;
font-weight: 400;
src: url(../fonts/MaterialIcons-Regular.ttf) format('truetype');
}

@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(../fonts/Material-Icons.woff2) format('woff2');
src: url(../fonts/MaterialIconsTwoTone-Regular.otf) format('opentype');
}

.material-icons-original {
font-family: 'Material Icons Original';
}
.material-icons {
font-family: 'Material Icons';
}
.material-icons-original,
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
Expand Down
45 changes: 39 additions & 6 deletions app/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ button {
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
border: 1px solid #CCC;
border: none;
border-radius: 4px;

line-height: 2.4em;
Expand All @@ -27,11 +27,11 @@ button {

border-radius: 0.3ex;

background: #FFF;
background: #FEFEFE;
color: #000000DD;
outline: none;

text-shadow: 0px 1px 0px #FFF;
background-image: linear-gradient(to bottom, #FFF 0px, #E0E0E0 100%);
background-repeat: repeat-x;
display: inline-flex;
align-items: center;
Expand All @@ -40,6 +40,10 @@ button:focus {
outline: dotted 1px rgba(0, 0, 0, 0.3);
outline-offset: -0.3em;
}
button:hover {
background: #dbeeff;
}

button[disabled] {
background: rgba(255, 255, 255, 0.2);
cursor: default;
Expand Down Expand Up @@ -134,7 +138,7 @@ hbox.ButtonGroup {

button[selected='true'],
button[checked='true'] {
background: #C8C8C8;
background: #c6e4ff;
}
button[active='true'],
button:active:not([disabled]) {
Expand Down Expand Up @@ -165,6 +169,17 @@ input[type="number"] {
input[type=number]::-webkit-inner-spin-button {
height: 2.4em;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
opacity: 0.2;
}

input[type=number]:focus::-webkit-inner-spin-button,
input[type=number]:focus::-webkit-outer-spin-button,
input[type=number]:hover::-webkit-inner-spin-button,
input[type=number]:hover::-webkit-outer-spin-button {
opacity: 1;
}
textarea {
font: inherit;
font-size: 1em;
Expand All @@ -190,7 +205,7 @@ input[type="text"]:focus,
textarea:focus,
input[type="number"]:focus {
border-color: #336699;
box-shadow: 0px 0px 0.3ex #336699;
background-color: #e5f3ff;
}

.UIWidget:not(.widget_ApplicationPane) input[type='checkbox'],
Expand Down Expand Up @@ -219,7 +234,7 @@ input[type="number"]:focus {
cursor: pointer;

display: inline-block;
font-family: 'Material Icons';
font-family: 'Material Icons Original';
font-weight: bold;
font-style: normal;
letter-spacing: normal;
Expand Down Expand Up @@ -249,3 +264,21 @@ input[type="number"]:focus {
.UIWidget:not(.widget_ApplicationPane) input[type='radio']:checked:after {
content:'\E837';
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
position: absolute !important;
overflow: visible;
}
*:not(:hover)::-webkit-scrollbar {
}
::-webkit-scrollbar-track {
background: #DDD;
}
::-webkit-scrollbar-thumb {
background: #00000022;
transition: background-color 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
background: #00000044;
}
2 changes: 2 additions & 0 deletions app/css/theme.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url('variables.less');

html {
user-select: none;
-o-user-select:none;
Expand Down
14 changes: 13 additions & 1 deletion app/css/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
@popup_bg: lighten(@app_bg, 3%);
@popup_border: darken(@app_bg, 5%);
@toolbar_spacing: 0.4em;
@selected_button_bg: #C8C8C8;
@selected_button_bg: #c6e4ff;
@pane_bg: #dae9f7;
@toolbar_gap: 0.4em;
@iconify: {
display: inline-block;
Expand All @@ -25,3 +26,14 @@
-webkit-font-smoothing: antialiased;
opacity: 0.54;
};
@button_hover_bg: lighten(@selected_bg, 50%);

@number_input: {
border: none !important;
background: #F4F4F4;
padding-right: 0em !important;
}
@property_input: {
border-radius: 2px;
border: none !important;
}
Binary file added app/fonts/MaterialIcons-Regular.ttf
Binary file not shown.
Binary file added app/fonts/MaterialIconsTwoTone-Regular.otf
Binary file not shown.
48 changes: 33 additions & 15 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,39 @@ const {app, protocol, shell, BrowserWindow} = require("electron");
const pkg = require("./package.json");
const fs = require("fs");
const path = require("path");
const os = require("os");

app.commandLine.appendSwitch("allow-file-access-from-files");
app.commandLine.appendSwitch("allow-file-access");
app.commandLine.appendSwitch("no-sandbox");
app.commandLine.appendSwitch("allow-file-access-from-files", "1");
app.commandLine.appendSwitch("allow-file-access", "1");
app.commandLine.appendSwitch("disable-smooth-scrolling");
app.commandLine.appendSwitch("disable-site-isolation-trials");

const remoteMain = require("@electron/remote/main");
remoteMain.initialize();

// Disable hardware acceleration by default for Linux
// TODO: implement a setting for this one and requires a restart after changing that value
if (process.platform.trim().toLowerCase() == "linux" && app.disableHardwareAcceleration) {
if (process.argv.indexOf("--with-hwa") < 0) {
console.log("Hardware acceleration disabled for Linux.");
var useHWAConfig = getAppConfig("core.useHardwareAcceleration");
console.log("useHWAConfig: ", useHWAConfig);
if (process.argv.indexOf("--with-hwa") < 0 && !useHWAConfig) {
console.log("**************** Hardware acceleration disabled for Linux.");
app.disableHardwareAcceleration();
} else {
console.log("Hardware acceleration forcibly enabled.");
}
}

function getAppConfig(name) {
var p = path.join(path.join(os.homedir(), ".pencil"), "config.json");
try {
var json = fs.readFileSync(p, "utf8");
var data = JSON.parse(json);
return data[name];
} catch (e) {
return undefined;
}
}
global.sharedObject = { appArguments: process.argv };

var handleRedirect = (e, url) => {
Expand All @@ -38,14 +54,20 @@ function createWindow() {
allowRunningInsecureContent: true,
allowDisplayingInsecureContent: true,
defaultEncoding: "UTF-8",
nodeIntegration: true
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
experimentalFeatures: true,
disableDialogs: true,
enableBlinkFeatures: "FontAccess"
},
};

var iconFile = process.platform == "win32" ? "app.ico" : "css/images/logo-shadow.png";
mainWindowProperties.icon = path.join(__dirname, iconFile);

mainWindow = new BrowserWindow(mainWindowProperties);
remoteMain.enable(mainWindow.webContents)

var devEnable = false;
if (process.argv.indexOf("--enable-dev") >= 0) {
Expand All @@ -56,11 +78,11 @@ function createWindow() {

app.devEnable = devEnable;

mainWindow.hide();
//mainWindow.hide();
mainWindow.maximize();

if (devEnable) {
mainWindow.webContents.openDevTools();
//mainWindow.webContents.openDevTools();
} else {
mainWindow.setMenu(null);
}
Expand All @@ -69,7 +91,7 @@ function createWindow() {
mainWindow.loadURL(mainUrl);
mainWindow.show();

//mainWindow.webContents.openDevTools();
if (devEnable) mainWindow.webContents.openDevTools();

mainWindow.on("closed", function() {
mainWindow = null;
Expand Down Expand Up @@ -106,16 +128,12 @@ app.on('ready', function() {

fs.readFile(path, function (err, data) {
if (err) {
callback({mimeType: "text/html", data: new Buffer("Not found")});
callback({mimeType: "text/html", data: Buffer.from("Not found")});
} else {
callback({mimeType: "image/jpeg", data: new Buffer(data)});
callback({mimeType: "image/jpeg", data: Buffer.from(data)});
}
});

}, function (error, scheme) {
if (error) {
console.log("ERROR REGISTERING", error);
}
});


Expand Down
Loading

0 comments on commit 8eca012

Please sign in to comment.