Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
0e185510cThis file is pinned to the selected release. Download the original to open it in your design tool.
import {
ComboBox,
LengthEdit,
MenuItem,
MenuPopup,
} from "../../widgets.slint";
import {
Backend,
Board2dTabData,
TabAction,
WindowSectionData,
} from "../../api.slint";
export component AddViaToolBar inherits HorizontalLayout {
in property <int> section-index;
in-out property <WindowSectionData> section;
property <[Board2dTabData]> tabs: section.board-2d-tabs;
spacing: 2px;
net-cbx := ComboBox {
model: tabs[section.current-tab-index].tool-net.items;
current-index: tabs[section.current-tab-index].tool-net.current-index;
current-index-changed(index) => {
tabs[section.current-tab-index].tool-net.current-index = index;
}
}
via-drill-edt := LengthEdit {
data: tabs[section.current-tab-index].tool-drill;
icon: @image-url("../../../../font-awesome/svgs/solid/bore-hole.svg");
tooltip: @tr("Via Drill Diameter");
min-width-text: "1.234";
auto-supported: true;
auto-checked: tabs[section.current-tab-index].tool-pressfit;
has-dropdown: true;
value-changed(v) => {
tabs[section.current-tab-index].tool-pressfit = false;
tabs[section.current-tab-index].tool-drill.value = v;
}
unit-changed(u) => {
tabs[section.current-tab-index].tool-drill.unit = u;
}
increase-triggered => {
tabs[section.current-tab-index].tool-pressfit = false;
tabs[section.current-tab-index].tool-drill.increase = true;
}
decrease-triggered => {
tabs[section.current-tab-index].tool-pressfit = false;
tabs[section.current-tab-index].tool-drill.decrease = true;
}
auto-toggled(checked) => {
tabs[section.current-tab-index].tool-pressfit = checked;
}
dropdown-triggered => {
via-drill-popup.show();
}
via-drill-popup := MenuPopup {
x: 0;
y: parent.height;
via-drill-save-in-board-item := MenuItem {
icon: @image-url("../../../../font-awesome/svgs/solid/download.svg");
text: @tr("Set as Default in Board");
status-tip: @tr("Saves the entered value in the board design rules as default value");
clicked => {
Backend.trigger-tab(section-index, section.current-tab-index, TabAction.toolbar-via-drill-save-in-board);
}
}
via-drill-save-in-netclass-item := MenuItem {
icon: @image-url("../../../../font-awesome/svgs/solid/download.svg");
text: @tr("Set as Default in Net Class '{}'", tabs[section.current-tab-index].tool-netclass-name);
status-tip: @tr("Saves the entered value as default value for the current net class");
enabled: !tabs[section.current-tab-index].tool-netclass-name.is-empty;
clicked => {
Backend.trigger-tab(section-index, section.current-tab-index, TabAction.toolbar-via-drill-save-in-netclass);
}
}
}
}
via-size-edt := LengthEdit {
data: tabs[section.current-tab-index].tool-size;
icon: @image-url("../../../../bootstrap-icons/icons/record-circle-fill.svg");
tooltip: @tr("Via Outer Diameter");
min-width-text: "1.234";
auto-supported: true;
auto-checked: tabs[section.current-tab-index].tool-mirrored;
enabled: !via-drill-edt.auto-checked;
value-changed(v) => {
tabs[section.current-tab-index].tool-mirrored = false;
tabs[section.current-tab-index].tool-size.value = v;
}
unit-changed(u) => {
tabs[section.current-tab-index].tool-size.unit = u;
}
increase-triggered => {
tabs[section.current-tab-index].tool-mirrored = false;
tabs[section.current-tab-index].tool-size.increase = true;
}
decrease-triggered => {
tabs[section.current-tab-index].tool-mirrored = false;
tabs[section.current-tab-index].tool-size.decrease = true;
}
auto-toggled(checked) => {
tabs[section.current-tab-index].tool-mirrored = checked;
}
}
}