diff --git a/app.go b/app.go index 8a8b970..fa5a4df 100644 --- a/app.go +++ b/app.go @@ -257,6 +257,22 @@ func (a *App) SetDefaultAppMenu() { wruntime.MenuUpdateApplicationMenu(a.ctx) } +// EnableExportMenus: it enables the menus for the export layout view +func (a *App) EnableExportMenus() { + exportMenu := menu.NewMenu() + exportMenu.AddText("Back to Project", keys.Shift("b"), func(cd *menu.CallbackData) { + wruntime.EventsEmit(a.ctx, video.EVT_CHANGE_ROUTE, "video") + }) + + appMenu := a.AppMenu() + appMenu.Items = append(appMenu.Items, &menu.MenuItem{ + Label: "Export", + SubMenu: exportMenu, + }) + wruntime.MenuSetApplicationMenu(a.ctx, appMenu) + wruntime.MenuUpdateApplicationMenu(a.ctx) +} + // EnableVideoMenus: It enables the menus for the video layout view func (a *App) EnableVideoMenus() { timelineMenu := menu.NewMenu() @@ -280,6 +296,13 @@ func (a *App) EnableVideoMenus() { timelineMenu.AddText("Mark/Unmark Lossless Export", keys.Key("m"), func(cd *menu.CallbackData) { wruntime.EventsEmit(a.ctx, video.EVT_TOGGLE_LOSSLESS) }) + timelineMenu.AddText("Change Project", keys.Shift("b"), func(cd *menu.CallbackData) { + wruntime.EventsEmit(a.ctx, video.EVT_CHANGE_ROUTE, "main") + }) + + timelineMenu.AddText("Export Project", keys.Shift("e"), func(cd *menu.CallbackData) { + wruntime.EventsEmit(a.ctx, video.EVT_CHANGE_ROUTE, "export") + }) timelineMenu.AddText("Toggle Vim Mode", keys.CmdOrCtrl("i"), func(cd *menu.CallbackData) { wruntime.EventsEmit(a.ctx, video.EVT_TOGGLE_VIM_MODE) wruntime.EventsEmit(a.ctx, video.EVT_TRACK_MOVE, 0) diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 6698fa8..68e2c90 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,10 +1,26 @@
diff --git a/frontend/src/ExportMenuLayout.svelte b/frontend/src/ExportMenuLayout.svelte index f0d54ca..e31f9ca 100644 --- a/frontend/src/ExportMenuLayout.svelte +++ b/frontend/src/ExportMenuLayout.svelte @@ -6,6 +6,7 @@ FFmpegQuery, ToggleLossless, OpenFile, + EnableExportMenus, } from "../wailsjs/go/main/App"; import { exportOptionsStore, router, projectName } from "./stores"; import { onDestroy, onMount } from "svelte"; @@ -54,6 +55,7 @@ videoNodes = [...timeline.video_nodes]; }) .catch(() => console.log("could not load timeline")); + EnableExportMenus(); }); $: { @@ -123,21 +125,21 @@ setProgressPercentage(0); setIsProcessingVid(false); }); - EventsOn("evt_export_msg", (msg: string) => { - setProcessingMsg(msg); - }); EventsOn("evt_ffmpeg_result", (result: any) => { addProcessingResult(result); }); + EventsOn("evt_export_msg", (msg: string) => { + setProcessingMsg(msg); + }); onDestroy(() => { + resetExportOptionsStore(); EventsOff( "evt_encoding_progress", "evt_ffmpeg_exec_ended", "evt_ffmpeg_result", "evt_export_msg", ); - resetExportOptionsStore(); }); diff --git a/frontend/src/VideoLayout.svelte b/frontend/src/VideoLayout.svelte index 6724026..913f7d4 100644 --- a/frontend/src/VideoLayout.svelte +++ b/frontend/src/VideoLayout.svelte @@ -57,7 +57,7 @@ setVideoFilesError, resetVideoFiles, } = videoFiles; - const { setRoute } = router; + const { setRoute, route } = router; const { actionMessage, setActionMsg } = toolingStore; onMount(() => { @@ -124,7 +124,7 @@ }); onDestroy(() => { - SetDefaultAppMenu(); + if ($route === "main") SetDefaultAppMenu(); EventsOff( "evt_proxy_file_created", "evt_error_msg", diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index 6ceeb63..1f82af4 100755 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -14,6 +14,8 @@ export function DeleteProjectFile(arg1:string):Promise; export function DeleteRIDReferences(arg1:string):Promise; +export function EnableExportMenus():Promise; + export function EnableVideoMenus():Promise; export function FFmpegQuery(arg1:string,arg2:video.ProcessingOpts):Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index 6616d9e..481235a 100755 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -22,6 +22,10 @@ export function DeleteRIDReferences(arg1) { return window['go']['main']['App']['DeleteRIDReferences'](arg1); } +export function EnableExportMenus() { + return window['go']['main']['App']['EnableExportMenus'](); +} + export function EnableVideoMenus() { return window['go']['main']['App']['EnableVideoMenus'](); } diff --git a/internal/video/video.go b/internal/video/video.go index 2f9754b..21b8d3f 100644 --- a/internal/video/video.go +++ b/internal/video/video.go @@ -32,7 +32,8 @@ const ( QUERY_CREATE_PROXY_FILE = "q_create_proxy_file" QUERY_CREATE_THUMBNAIL = "q_create_thumbnail" // Epsilon: margin for floating point checks - Epsilon = 1e-6 + Epsilon = 1e-6 + EVT_CHANGE_ROUTE = "evt_change_route" // EVT_FFMPEG_RESULT: signals the result of a FFmpeg query in the form of a VideoProcessingResult EVT_FFMPEG_RESULT = "evt_ffmpeg_result" // EVT_FFMPEG_EXEC_ENDED: signals that the ffmpeg query has ended (does not indicate success of the query)