change settings list button behavior and add save as in updated dialog

This commit is contained in:
Stewart Allen 2021-03-31 10:41:28 -04:00
commit 3e12be6919
6 changed files with 48 additions and 10 deletions

View file

@ -2,7 +2,8 @@
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
* `B` origin (and bed size) bug (Onshape?) when switching modes in 2.5 and 2.6
* `B` origin (and bed size) bug (Onshape?) when switching device modes
* `B` can't drag slider bar on ipad / ios
* `P` duplicate objects should share same slice data unless rotated or scaled
* `P` allow selection to me decimated on demand (context menu?)
@ -62,7 +63,7 @@
* `F` anchors should be generated anywhere needed in the print, not just head
* `F` brims should extend between branches and have a slight offset from part
* `F` slightly angle supports to lean into the Z of the part
* `F` arrange should just align down Z, not side to side.
* `F` arrange should align down Z, not side to side.
# CAM

View file

@ -80,7 +80,9 @@
SPACE.view.home();
setTimeout(() => { API.space.save(true) },500);
then();
if (!SETUP.debug) {
API.help.show();
}
});
return true;
}
@ -586,7 +588,7 @@
});
}
function settingsSave(ev) {
function settingsSave(ev, name) {
if (ev) {
ev.stopPropagation();
ev.preventDefault();
@ -598,10 +600,11 @@
def = "default",
cp = s.process,
pl = s.sproc[mode],
lp = s.cproc[mode];
UC.prompt("Save Settings As", cp ? lp || def : def).then(name => {
if (name) {
lp = s.cproc[mode],
saveAs = (name) => {
if (!name) {
return;
}
let np = pl[name] = {};
cp.processName = name;
pl[name] = Object.clone(cp);
@ -614,8 +617,13 @@
API.conf.save();
API.conf.update();
API.event.settings();
};
if (name) {
saveAs(name);
} else {
UC.prompt("Save Settings As", cp ? lp || def : def).then(saveAs);
}
});
}
function settingsLoad() {
@ -1833,10 +1841,18 @@
settingsGroup: UC.newGroup(LANG.se_menu, $('settings')),
settingsTable: UC.newRow([ UI.settingsLoad = UC.newButton(LANG.se_load, settingsLoad) ]),
settingsTable: UC.newRow([ UI.settingsSave = UC.newButton(LANG.se_save, settingsSave) ]),
settingsSave: $('settingsSave'),
settingsName: $('settingsName'),
layers: UC.setGroup($("layers")),
});
// override old style settings two-button menu
UI.settingsGroup.onclick = settingsLoad;
UI.settingsSave.onclick = () => {
settingsSave(undefined, UI.settingsName.value);
};
function spindleShow() {
return settings().device.spindleMax > 0;
}

View file

@ -2728,6 +2728,7 @@
if (sk == settings.process.processName) {
load.setAttribute('class', 'selected')
}
$('settingsName').value = settings.process.processName;
del.setAttribute('del', sk);
del.setAttribute('title', "remove '"+sk+"'");

View file

@ -917,6 +917,21 @@ th, tr, td, label {
border-bottom-right-radius: 10px;
background-color: var(--main-color);
}
#settingsNew {
margin-top: 5px;
padding-top: 5px;
border-top: 1px solid var(--main-color);
}
#settingsName {
margin-right: 4px;
padding-right: 4px;
padding-left: 4px;
text-align: center;
}
#settingsList {
max-height: 450px;
overflow-y: auto;
}
#settingsList button.selected {
font-weight: bold;
background-color: #ccc;

View file

@ -314,6 +314,10 @@
<div id="mod-saves" class="mdialog f-col">
<label class="set-header" lk="dm_savs">saved settings</label>
<div id="settingsList" class="f-col"></div>
<div id="settingsNew">
<input id="settingsName" class="grow"></input>
<button id="settingsSave" lk="dm_svas">Save As</button>
</div>
</div>
<div id="mod-tools" class="mdialog">
<div class="f-col">

View file

@ -63,6 +63,7 @@ kiri.lang['en-us'] = {
dm_rcnt: "recent files",
dm_savs: "saved settings",
dm_appp: "Application Preferences",
dm_svas: "Save As",
// CAM Tool Dialog
td_tyem: "end", // end mill