diff --git a/src-electron/electron-main.ts b/src-electron/electron-main.ts index 3572234..54ed762 100644 --- a/src-electron/electron-main.ts +++ b/src-electron/electron-main.ts @@ -37,7 +37,7 @@ function createWindow() { }); mainWindow.loadURL(process.env.APP_URL); - + nativeTheme.themeSource = 'dark' if (process.env.DEBUGGING) { // if on DEV or Production with debug enabled mainWindow.webContents.openDevTools(); @@ -69,9 +69,11 @@ app.whenReady().then(async () => { ipcMain.handle('exportSvg', ({ }, fileStr: string) => projectH.exportSvg(fileStr)) ipcMain.handle('openSvgWithInkscape', () => projectH.openSvgWithInkscape()) + ipcMain.handle('askInkscapePath', () => projectH.askInkscapePath()) ipcMain.handle('openSvgWithDefaultProgram', () => projectH.openSvgWithDefaultProgram()) ipcMain.handle('closeApp', () => closeApp()) mainWindow?.webContents.send('updatedSvg') + projectH.openSvgWithInkscape() }); diff --git a/src-electron/electron-preload.ts b/src-electron/electron-preload.ts index 0d3ef1b..4730964 100644 --- a/src-electron/electron-preload.ts +++ b/src-electron/electron-preload.ts @@ -21,6 +21,7 @@ contextBridge.exposeInMainWorld('eapi', { exportSvg: (fileStr: string) => ipcRenderer.invoke('exportSvg', fileStr), openSvgWithDefaultProgram: () => ipcRenderer.invoke('openSvgWithDefaultProgram'), openSvgWithInkscape: () => ipcRenderer.invoke('openSvgWithInkscape'), + askInkscapePath: () => ipcRenderer.invoke('askInkscapePath'), closeApp: () => ipcRenderer.invoke('closeApp'), updatedSvg: (callback: any) => ipcRenderer.on('updatedSvg', callback), }) diff --git a/src-electron/handlers/project_h.ts b/src-electron/handlers/project_h.ts index 693564c..5d1696e 100644 --- a/src-electron/handlers/project_h.ts +++ b/src-electron/handlers/project_h.ts @@ -21,6 +21,8 @@ try { watchTempSvg() } catch { } export const projectH = { async createProject({ doImportSvg }: createProjectParams) { let data = svgTemplate + writeTempSvg(data) + this.openSvgWithInkscape() if (doImportSvg) { const importedFilePath = (await dialog.showOpenDialog(mainWindow!, { @@ -32,8 +34,9 @@ export const projectH = { })).filePaths[0] if (!importedFilePath) return false data = await p.readFile(importedFilePath, 'utf-8') + writeTempSvg(data) + this.openSvgWithInkscape() } - writeTempSvg(data) return true }, async loadProject({ filePath }: loadProjectParams = {}): Promise { @@ -53,6 +56,7 @@ export const projectH = { let project = JSON.parse(projectStr) as any writeTempSvg(project.svgFile) + this.openSvgWithInkscape() // delete project.svgFile return { data: project, filePath: filePath } @@ -157,7 +161,10 @@ export const projectH = { } async function refreshInkscapeUI() { - await exec(`gdbus call --session --dest org.inkscape.Inkscape --object-path /org/inkscape/Inkscape/window/1 --method org.gtk.Actions.Activate document-revert [] {}`) + const inkscapePath = await projectH.getInkscapePath() + if (!inkscapePath) return + console.log("_INKSCAPE_GC=disable " + inkscapePath + " --actions='file-rebase' -q") + exec(`_INKSCAPE_GC=disable "${inkscapePath}" --actions='file-rebase' -q`); } async function writeTempSvg(data: string) { diff --git a/src/components/ActionButtons.vue b/src/components/ActionButtons.vue index 69f69b9..e73f1d7 100644 --- a/src/components/ActionButtons.vue +++ b/src/components/ActionButtons.vue @@ -10,8 +10,9 @@ Save Export - Open SVG with - Inkscape + Select inkscape application + Open SVG with default + program Open SVG with default program @@ -89,11 +90,70 @@
-
- +
+ + + + + + + + + + + + + +
- + + + + + +
@@ -182,7 +242,6 @@ const closeApp = async () => await eapi.closeApp() display: grid; grid-template-columns: 70% auto; width: 99%; - gap: 1%; position: absolute; top: 0; } @@ -192,6 +251,11 @@ const closeApp = async () => await eapi.closeApp() user-select: none; -webkit-app-region: drag; } +.btnAttrs * { + height: 18px !important; + stroke: var(--lightWhite); + stroke-width: 5px; +} /* #windowButtons { display: flex; @@ -203,5 +267,11 @@ const closeApp = async () => await eapi.closeApp() height: 1.2rem; background-color: var(--bgColor1); color: var(--fontColor1); + border-style:solid; + border-width:1px; + margin-left:-1px; + border-color:var(--bgColor2); + margin:2px -1px 2px 0; + font-size:0.8rem; } diff --git a/src/components/AnimEditor/AnimEditor.vue b/src/components/AnimEditor/AnimEditor.vue index 42113bf..1bcdd46 100644 --- a/src/components/AnimEditor/AnimEditor.vue +++ b/src/components/AnimEditor/AnimEditor.vue @@ -31,7 +31,6 @@ const zoomTime = (e: WheelEvent) => ConfigM.zoomPx -= e.deltaY / ConfigM.numDeci diff --git a/src/components/AnimEditor/ElsList/ListAttr.vue b/src/components/AnimEditor/ElsList/ListAttr.vue index 882e315..d8b56c3 100644 --- a/src/components/AnimEditor/ElsList/ListAttr.vue +++ b/src/components/AnimEditor/ElsList/ListAttr.vue @@ -2,7 +2,7 @@
   - {{ el.showAttrs ? '▲' : '▼' }} + > attrs
diff --git a/src/components/AnimEditor/ElsList/ListEl.vue b/src/components/AnimEditor/ElsList/ListEl.vue index 1872739..b2799f6 100644 --- a/src/components/AnimEditor/ElsList/ListEl.vue +++ b/src/components/AnimEditor/ElsList/ListEl.vue @@ -1,7 +1,7 @@ @@ -39,6 +40,10 @@ async function createProject(doImportSvg = false) { if (success) await router.push({ path: '/', query: { refreshApp: true } as any }) } +async function askInkscapePath() { + const newInkscapePath = await ProjectM.askInkscapePath() + if (newInkscapePath) exec(`"${newInkscapePath}" ${tempFilePath()}`) +} const searchStr = ref('') const loadProject = async (path: string) => {