()
| 515 | } |
| 516 | |
| 517 | function initDefaults() { |
| 518 | settings.bomlayout = readStorage("bomlayout"); |
| 519 | if (settings.bomlayout === null) { |
| 520 | settings.bomlayout = config.bom_view; |
| 521 | } |
| 522 | if (!['bom-only', 'left-right', 'top-bottom'].includes(settings.bomlayout)) { |
| 523 | settings.bomlayout = config.bom_view; |
| 524 | } |
| 525 | settings.bommode = readStorage("bommode"); |
| 526 | if (settings.bommode === null) { |
| 527 | settings.bommode = "grouped"; |
| 528 | } |
| 529 | if (settings.bommode == "netlist" && !pcbdata.nets) { |
| 530 | settings.bommode = "grouped"; |
| 531 | } |
| 532 | if (!["grouped", "ungrouped", "netlist"].includes(settings.bommode)) { |
| 533 | settings.bommode = "grouped"; |
| 534 | } |
| 535 | settings.canvaslayout = readStorage("canvaslayout"); |
| 536 | if (settings.canvaslayout === null) { |
| 537 | settings.canvaslayout = config.layer_view; |
| 538 | } |
| 539 | var bomCheckboxes = readStorage("bomCheckboxes"); |
| 540 | if (bomCheckboxes === null) { |
| 541 | bomCheckboxes = config.checkboxes; |
| 542 | } |
| 543 | settings.checkboxes = bomCheckboxes.split(",").filter((e) => e); |
| 544 | document.getElementById("bomCheckboxes").value = bomCheckboxes; |
| 545 | |
| 546 | var highlightpin1 = readStorage("highlightpin1") || config.highlight_pin1; |
| 547 | if (highlightpin1 === "false") highlightpin1 = "none"; |
| 548 | if (highlightpin1 === "true") highlightpin1 = "all"; |
| 549 | setHighlightPin1(highlightpin1); |
| 550 | document.forms.highlightpin1.highlightpin1.value = highlightpin1; |
| 551 | |
| 552 | settings.markWhenChecked = readStorage("markWhenChecked"); |
| 553 | if (settings.markWhenChecked == null) { |
| 554 | settings.markWhenChecked = config.mark_when_checked; |
| 555 | } |
| 556 | populateMarkWhenCheckedOptions(); |
| 557 | |
| 558 | function initBooleanSetting(storageString, def, elementId, func) { |
| 559 | var b = readStorage(storageString); |
| 560 | if (b === null) { |
| 561 | b = def; |
| 562 | } else { |
| 563 | b = (b == "true"); |
| 564 | } |
| 565 | document.getElementById(elementId).checked = b; |
| 566 | func(b); |
| 567 | } |
| 568 | |
| 569 | initBooleanSetting("padsVisible", config.show_pads, "padsCheckbox", padsVisible); |
| 570 | initBooleanSetting("fabricationVisible", config.show_fabrication, "fabricationCheckbox", fabricationVisible); |
| 571 | initBooleanSetting("silkscreenVisible", config.show_silkscreen, "silkscreenCheckbox", silkscreenVisible); |
| 572 | initBooleanSetting("referencesVisible", true, "referencesCheckbox", referencesVisible); |
| 573 | initBooleanSetting("valuesVisible", true, "valuesCheckbox", valuesVisible); |
| 574 | if ("tracks" in pcbdata) { |
no test coverage detected