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 {
AngleEdit,
ComboBox,
LengthEdit,
ToolBarButton,
} from "../../widgets.slint";
import {
Data,
PackageTabData,
WindowSectionData,
} from "../../api.slint";
export component DrawFootprintPolygonToolBar inherits HorizontalLayout {
in property <int> section-index;
in-out property <WindowSectionData> section;
in property <bool> show-angle-edt: true;
in property <bool> show-fill-sw: true;
in property <bool> show-grab-area-sw: true;
property <[PackageTabData]> tabs: section.package-tabs;
spacing: 2px;
layer-cbx := ComboBox {
model: tabs[section.current-tab-index].tool-layer.items;
current-index: tabs[section.current-tab-index].tool-layer.current-index;
accessible-label: "layer";
current-index-changed(index) => {
tabs[section.current-tab-index].tool-layer.current-index = index;
}
}
line-width-edt := LengthEdit {
data: tabs[section.current-tab-index].tool-line-width;
icon: @image-url("../../../../bootstrap-icons/icons/border-width.svg");
tooltip: @tr("Line Width");
min-width-text: "1.234";
value-changed(v) => {
tabs[section.current-tab-index].tool-line-width.value = v;
}
unit-changed(u) => {
tabs[section.current-tab-index].tool-line-width.unit = u;
}
increase-triggered => {
tabs[section.current-tab-index].tool-line-width.increase = true;
}
decrease-triggered => {
tabs[section.current-tab-index].tool-line-width.decrease = true;
}
}
if show-angle-edt: angle-edt := AngleEdit {
data: tabs[section.current-tab-index].tool-angle;
tooltip: @tr("Arc Angle");
min-width-text: "123.4 °";
value-changed(v) => {
tabs[section.current-tab-index].tool-angle.value = v;
}
increase-triggered => {
tabs[section.current-tab-index].tool-angle.increase = true;
}
decrease-triggered => {
tabs[section.current-tab-index].tool-angle.decrease = true;
}
}
if show-fill-sw: fill-sw := ToolBarButton {
icon: @image-url("../../../../font-awesome/svgs/solid/fill-drip.svg");
tooltip: @tr("Fill Area");
status-tip: @tr("Fill the polygon with its outline color (only when closed)");
checked: tabs[section.current-tab-index].tool-filled;
checkable: true;
clicked => {
tabs[section.current-tab-index].tool-filled = !self.checked;
}
}
if show-grab-area-sw: grab-area-sw := ToolBarButton {
icon: @image-url("../../../../font-awesome/svgs/solid/hand.svg");
tooltip: @tr("Grab Area");
status-tip: @tr("Allow grabbing the footprint within the polygon's area");
checked: tabs[section.current-tab-index].tool-grab-area;
checkable: true;
clicked => {
tabs[section.current-tab-index].tool-grab-area = !self.checked;
}
}
}