add files -> new menu option

This commit is contained in:
Stewart Allen 2025-02-23 08:43:39 -05:00
commit 265c0b5d9d
3 changed files with 19 additions and 1 deletions

View file

@ -559,6 +559,17 @@ gapp.register("kiri.init", (root, exports) => {
});
}
function workspaceNew() {
uc.confirm("Clear Workspace?", {ok:true, cancel: false}).then(value => {
if (value === true) {
let proc = api.settings.proc();
proc.ops && (proc.ops.length = 0);
proc.op2 && (proc.op2.length = 0);
api.platform.clear();
}
});
}
function profileExport() {
const opt = {pre: [
"<div class='f-col a-center gap5 mlr10'>",
@ -1972,6 +1983,7 @@ gapp.register("kiri.init", (root, exports) => {
ui.acct.mesh.onclick = (ev) => { ev.stopPropagation(); WIN.location = "/mesh" };
ui.acct.export.onclick = (ev) => { ev.stopPropagation(); profileExport() };
ui.acct.export.title = LANG.acct_xpo;
$('file-new').onclick = (ev) => { ev.stopPropagation(); workspaceNew() };
$('file-recent').onclick = () => { api.modal.show('files') };
$('file-import').onclick = (ev) => { api.event.import(ev); };
ui.func.slice.onclick = (ev) => { ev.stopPropagation(); api.function.slice() };

View file

@ -93,6 +93,11 @@
<label>files</label>
<div class="top-menu-drop top-menu-right">
<div class="content">
<div id="file-new">
<label lk="new">new</label>
<span><i class="fas fa-file"></i></span>
</div>
<hr>
<div id="file-recent">
<label lk="recent">recent</label>
<span><i class="fas fa-list"></i></span>

View file

@ -29,10 +29,11 @@ self.kiri.lang['en-us'] = {
import: "import",
language: "language",
left: "left",
machines: "machines", // device or machine
machines: "machines", // device or machine
mesh: "mesh", // mesh editing
metric: "metric",
name: "name",
new: "new", // file new
off: "off", // turn something off (like a lightbulb)
on: "on", // turn something on (like a lightbulb)
profs: "profiles", // right menu "profiles"