Loading files
c730ec352This file is pinned to the selected release. Download the original to open it in your design tool.
import {
Action,
BoardAction,
EditorCommand,
EditorTool,
FeatureState,
PadShape,
PanelPage,
ProjectAction,
SchematicAction,
TabAction,
TabType,
WireMode,
} from "types.slint";
import { Backend } from "backend.slint";
import { Constants } from "constants.slint";
import { Data } from "data.slint";
import { EditorCommandSet as Cmd } from "editorcommandset.slint";
export global Shortcuts {
property <int> section: Data.current-section-index;
property <int> tab: Data.current-section.current-tab-index;
public function process-project-shortcuts(project: int, event: KeyEvent) -> bool {
if Backend.is-shortcut(event, Cmd.file-manager) {
Backend.trigger-project(project, ProjectAction.open-folder);
return true;
} else if Backend.is-shortcut(event, Cmd.save) && Data.projects[project].writable {
Backend.trigger-project(project, ProjectAction.save);
return true;
} else if Backend.is-shortcut(event, Cmd.project-setup) {
Backend.trigger-project(project, ProjectAction.open-setup-dialog);
return true;
} else if Backend.is-shortcut(event, Cmd.project-library-manager) {
Backend.trigger-project(project, ProjectAction.open-library-manager);
return true;
} else if Backend.is-shortcut(event, Cmd.sheet-new) {
Backend.trigger-project(project, ProjectAction.new-sheet);
return true;
} else if Backend.is-shortcut(event, Cmd.board-new) {
Backend.trigger-project(project, ProjectAction.new-board);
return true;
} else if Backend.is-shortcut(event, Cmd.export-lppz) {
Backend.trigger-project(project, ProjectAction.export-lppz);
return true;
} else if Backend.is-shortcut(event, Cmd.bill-of-materials) {
Backend.trigger-project(project, ProjectAction.bill-of-materials);
return true;
} else if Backend.is-shortcut(event, Cmd.output-jobs) {
Backend.trigger-project(project, ProjectAction.open-output-jobs);
return true;
} else if Backend.is-shortcut(event, Cmd.project-close) {
Backend.trigger-project(project, ProjectAction.close);
return true;
}
false
}
public function process-schematic-shortcuts(project: int, schematic: int, event: KeyEvent) -> bool {
if Backend.is-shortcut(event, Cmd.sheet-new) {
Backend.trigger-project(project, ProjectAction.new-sheet);
return true;
} else if Backend.is-shortcut(event, Cmd.sheet-rename) {
Backend.trigger-schematic(project, schematic, SchematicAction.rename);
return true;
} else if Backend.is-shortcut(event, Cmd.sheet-remove) {
Backend.trigger-schematic(project, schematic, SchematicAction.delete);
return true;
}
false
}
public function process-board-shortcuts(project: int, board: int, event: KeyEvent) -> bool {
if Backend.is-shortcut(event, Cmd.board-new) {
Backend.trigger-project(project, ProjectAction.new-board);
return true;
} else if Backend.is-shortcut(event, Cmd.board-copy) {
Backend.trigger-board(project, board, BoardAction.copy);
return true;
} else if Backend.is-shortcut(event, Cmd.board-remove) {
Backend.trigger-board(project, board, BoardAction.delete);
return true;
} else if Backend.is-shortcut(event, Cmd.board-setup) {
Backend.trigger-board(project, board, BoardAction.open-setup-dialog);
return true;
} else if Backend.is-shortcut(event, Cmd.export-step) {
Backend.trigger-board(project, board, BoardAction.export-step);
return true;
} else if Backend.is-shortcut(event, Cmd.run-quick-check) {
Backend.trigger-board(project, board, BoardAction.run-quick-check);
Data.set-panel-page(PanelPage.rule-check);
return true;
} else if Backend.is-shortcut(event, Cmd.run-design-rule-check) {
Backend.trigger-board(project, board, BoardAction.run-drc);
Data.set-panel-page(PanelPage.rule-check);
return true;
}
false
}
public function process-tab-shortcuts(event: KeyEvent) -> bool {
if Backend.is-shortcut(event, Cmd.save) && (Data.current-tab.features.save == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.save);
return true;
} else if Backend.is-shortcut(event, Cmd.select-all) && (Data.current-tab.features.select == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.select-all);
return true;
} else if Backend.is-shortcut(event, Cmd.find-next) && (Data.current-tab.features.find == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.find-next);
return true;
} else if Backend.is-shortcut(event, Cmd.find-previous) && (Data.current-tab.features.find == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.find-previous);
return true;
} else if Backend.is-shortcut(event, Cmd.export-image) && (Data.current-tab.features.export-graphics == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.export-image);
return true;
} else if Backend.is-shortcut(event, Cmd.export-pdf) && (Data.current-tab.features.export-graphics == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.export-pdf);
return true;
} else if Backend.is-shortcut(event, Cmd.print) && (Data.current-tab.features.export-graphics == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.print);
return true;
} else if Backend.is-shortcut(event, Cmd.undo) && (Data.current-tab.features.undo == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.undo);
return true;
} else if Backend.is-shortcut(event, Cmd.redo) && (Data.current-tab.features.redo == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.redo);
return true;
} else if Backend.is-shortcut(event, Cmd.clipboard-cut) && (Data.current-tab.features.cut == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.cut);
return true;
} else if Backend.is-shortcut(event, Cmd.clipboard-copy) && (Data.current-tab.features.copy == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.copy);
return true;
} else if Backend.is-shortcut(event, Cmd.clipboard-paste) && (Data.current-tab.features.paste == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.paste);
return true;
} else if Backend.is-shortcut(event, Cmd.move-left) {
Backend.trigger-tab(section, tab, TabAction.move-left);
return true;
} else if Backend.is-shortcut(event, Cmd.move-right) {
Backend.trigger-tab(section, tab, TabAction.move-right);
return true;
} else if Backend.is-shortcut(event, Cmd.move-up) {
Backend.trigger-tab(section, tab, TabAction.move-up);
return true;
} else if Backend.is-shortcut(event, Cmd.move-down) {
Backend.trigger-tab(section, tab, TabAction.move-down);
return true;
} else if Backend.is-shortcut(event, Cmd.rotate-ccw) && (Data.current-tab.features.rotate == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.rotate-ccw);
return true;
} else if Backend.is-shortcut(event, Cmd.rotate-cw) && (Data.current-tab.features.rotate == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.rotate-cw);
return true;
} else if Backend.is-shortcut(event, Cmd.mirror-horizontal) && (Data.current-tab.features.mirror == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.mirror-horizontally);
return true;
} else if Backend.is-shortcut(event, Cmd.mirror-vertical) && (Data.current-tab.features.mirror == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.mirror-vertically);
return true;
} else if Backend.is-shortcut(event, Cmd.flip-horizontal) && (Data.current-tab.features.flip == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.flip-horizontally);
return true;
} else if Backend.is-shortcut(event, Cmd.flip-vertical) && (Data.current-tab.features.flip == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.flip-vertically);
return true;
} else if Backend.is-shortcut(event, Cmd.move-align) && (Data.current-tab.features.move-align == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.move-align);
return true;
} else if Backend.is-shortcut(event, Cmd.snap-to-grid) && (Data.current-tab.features.snap-to-grid == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.snap-to-grid);
return true;
} else if Backend.is-shortcut(event, Cmd.lock) && (Data.current-tab.features.lock == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.lock);
return true;
} else if Backend.is-shortcut(event, Cmd.unlock) && (Data.current-tab.features.unlock == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.unlock);
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) && (Data.current-tab.features.modify-line-width == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.line-width-increase);
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && (Data.current-tab.features.modify-line-width == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.line-width-decrease);
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-set) && (Data.current-tab.features.modify-line-width == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.line-width-set);
return true;
} else if Backend.is-shortcut(event, Cmd.device-reset-text-all) && (Data.current-tab.features.reset-texts == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.reset-texts);
return true;
} else if Backend.is-shortcut(event, Cmd.properties) && (Data.current-tab.features.edit-properties == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.edit-properties);
return true;
} else if Backend.is-shortcut(event, Cmd.remove) && (Data.current-tab.features.remove == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.delete);
return true;
} else if Backend.is-shortcut(event, Cmd.zoom-fit-content) {
Backend.trigger-tab(section, tab, TabAction.zoom-fit);
return true;
} else if Backend.is-shortcut(event, Cmd.zoom-in) {
Backend.trigger-tab(section, tab, TabAction.zoom-in);
return true;
} else if Backend.is-shortcut(event, Cmd.zoom-out) {
Backend.trigger-tab(section, tab, TabAction.zoom-out);
return true;
} else if Backend.is-shortcut(event, Cmd.grid-increase) {
Backend.trigger-tab(section, tab, TabAction.grid-interval-increase);
return true;
} else if Backend.is-shortcut(event, Cmd.grid-decrease) {
Backend.trigger-tab(section, tab, TabAction.grid-interval-decrease);
return true;
} else if Backend.is-shortcut(event, Cmd.abort) {
Backend.trigger-tab(section, tab, TabAction.abort);
return true;
}
false
}
public function process-symbol-tab-shortcuts(event: KeyEvent) -> bool {
// Tool-specific shortcuts
if Data.current-section.symbol-tabs[tab].tool == EditorTool.line {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index < (Data.current-section.symbol-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.symbol-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.symbol-tabs[tab].tool-line-width.can-decrease {
Data.current-section.symbol-tabs[tab].tool-line-width.decrease = true;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.rect {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index < (Data.current-section.symbol-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.symbol-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.symbol-tabs[tab].tool-line-width.can-decrease {
Data.current-section.symbol-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.symbol-tabs[tab].tool-filled = !Data.current-section.symbol-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.grab-area-toggle) {
Data.current-section.symbol-tabs[tab].tool-grab-area = !Data.current-section.symbol-tabs[tab].tool-grab-area;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.polygon {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index < (Data.current-section.symbol-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.symbol-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.symbol-tabs[tab].tool-line-width.can-decrease {
Data.current-section.symbol-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.symbol-tabs[tab].tool-filled = !Data.current-section.symbol-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.grab-area-toggle) {
Data.current-section.symbol-tabs[tab].tool-grab-area = !Data.current-section.symbol-tabs[tab].tool-grab-area;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.circle {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index < (Data.current-section.symbol-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.symbol-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.symbol-tabs[tab].tool-line-width.can-decrease {
Data.current-section.symbol-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.symbol-tabs[tab].tool-filled = !Data.current-section.symbol-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.grab-area-toggle) {
Data.current-section.symbol-tabs[tab].tool-grab-area = !Data.current-section.symbol-tabs[tab].tool-grab-area;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.arc {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index < (Data.current-section.symbol-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.symbol-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.symbol-tabs[tab].tool-line-width.can-decrease {
Data.current-section.symbol-tabs[tab].tool-line-width.decrease = true;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.name {
if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.symbol-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.symbol-tabs[tab].tool-size.can-decrease {
Data.current-section.symbol-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-left) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.left;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-center) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-right) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.right;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-top) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.top;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-center) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-bottom) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.bottom;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.value {
if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.symbol-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.symbol-tabs[tab].tool-size.can-decrease {
Data.current-section.symbol-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-left) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.left;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-center) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-right) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.right;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-top) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.top;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-center) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-bottom) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.bottom;
return true;
}
} else if Data.current-section.symbol-tabs[tab].tool == EditorTool.text {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.symbol-tabs[tab].tool-layer.current-index < (Data.current-section.symbol-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.symbol-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.symbol-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.symbol-tabs[tab].tool-size.can-decrease {
Data.current-section.symbol-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-left) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.left;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-center) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-right) {
Data.current-section.symbol-tabs[tab].tool-halign = TextHorizontalAlignment.right;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-top) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.top;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-center) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-bottom) {
Data.current-section.symbol-tabs[tab].tool-valign = TextVerticalAlignment.bottom;
return true;
}
}
// Common shortcuts
if Backend.is-shortcut(event, Cmd.import-dxf) && (Data.current-tab.features.import-graphics == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.import-dxf);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-select) {
Backend.trigger-tab(section, tab, TabAction.tool-select);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-line) {
Backend.trigger-tab(section, tab, TabAction.tool-line);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-rect) {
Backend.trigger-tab(section, tab, TabAction.tool-rect);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-polygon) {
Backend.trigger-tab(section, tab, TabAction.tool-polygon);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-circle) {
Backend.trigger-tab(section, tab, TabAction.tool-circle);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-arc) {
Backend.trigger-tab(section, tab, TabAction.tool-arc);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-name) {
Backend.trigger-tab(section, tab, TabAction.tool-name);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-value) {
Backend.trigger-tab(section, tab, TabAction.tool-value);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-text) {
Backend.trigger-tab(section, tab, TabAction.tool-text);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-image) {
Backend.trigger-tab(section, tab, TabAction.tool-image);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pin) {
Backend.trigger-tab(section, tab, TabAction.tool-pin);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-measure) {
Backend.trigger-tab(section, tab, TabAction.tool-measure);
return true;
} else if Backend.is-shortcut(event, Cmd.abort) {
Backend.trigger-tab(section, tab, TabAction.abort);
return true;
} else if process-tab-shortcuts(event) {
return true;
} else if Backend.scene-key-pressed(section, event) {
return true;
}
false
}
public function process-package-tab-shortcuts(event: KeyEvent) -> bool {
// Tool-specific shortcuts
if Data.current-section.package-tabs[tab].tool == EditorTool.line {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.package-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-layer.current-index < (Data.current-section.package-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.rect {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.package-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-layer.current-index < (Data.current-section.package-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.package-tabs[tab].tool-filled = !Data.current-section.package-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.grab-area-toggle) {
Data.current-section.package-tabs[tab].tool-grab-area = !Data.current-section.package-tabs[tab].tool-grab-area;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.polygon {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.package-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-layer.current-index < (Data.current-section.package-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.package-tabs[tab].tool-filled = !Data.current-section.package-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.grab-area-toggle) {
Data.current-section.package-tabs[tab].tool-grab-area = !Data.current-section.package-tabs[tab].tool-grab-area;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.circle {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.package-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-layer.current-index < (Data.current-section.package-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.package-tabs[tab].tool-filled = !Data.current-section.package-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.grab-area-toggle) {
Data.current-section.package-tabs[tab].tool-grab-area = !Data.current-section.package-tabs[tab].tool-grab-area;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.arc {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.package-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-layer.current-index < (Data.current-section.package-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.name {
if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.package-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.package-tabs[tab].tool-size.can-decrease {
Data.current-section.package-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-left) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.left;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-center) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-right) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.right;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-top) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.top;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-center) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-bottom) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.bottom;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.value {
if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.package-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.package-tabs[tab].tool-size.can-decrease {
Data.current-section.package-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-left) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.left;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-center) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-right) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.right;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-top) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.top;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-center) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-bottom) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.bottom;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.text {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.package-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-layer.current-index < (Data.current-section.package-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.package-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.package-tabs[tab].tool-size.can-decrease {
Data.current-section.package-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-left) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.left;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-center) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-horizontal-right) {
Data.current-section.package-tabs[tab].tool-halign = TextHorizontalAlignment.right;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-top) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.top;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-center) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.center;
return true;
} else if Backend.is-shortcut(event, Cmd.align-vertical-bottom) {
Data.current-section.package-tabs[tab].tool-valign = TextVerticalAlignment.bottom;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.pad-tht {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-package-pad.current-index > 0) {
Data.current-section.package-tabs[tab].tool-package-pad.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-package-pad.current-index < (Data.current-section.package-tabs[tab].tool-package-pad.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-package-pad.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-round) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.round;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rounded-rect) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.rounded-rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rect) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-octagon) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.octagon;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.package-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.package-tabs[tab].tool-size.can-decrease {
Data.current-section.package-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-increase) {
Data.current-section.package-tabs[tab].tool-drill.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-decrease) && Data.current-section.package-tabs[tab].tool-drill.can-decrease {
Data.current-section.package-tabs[tab].tool-drill.decrease = true;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.pad-smt {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.package-tabs[tab].tool-package-pad.current-index > 0) {
Data.current-section.package-tabs[tab].tool-package-pad.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.package-tabs[tab].tool-package-pad.current-index < (Data.current-section.package-tabs[tab].tool-package-pad.items.length - 1)) {
Data.current-section.package-tabs[tab].tool-package-pad.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.flip-horizontal) {
Data.current-section.package-tabs[tab].tool-bottom = !Data.current-section.package-tabs[tab].tool-bottom;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-round) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.round;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rounded-rect) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.rounded-rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rect) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-octagon) {
Data.current-section.package-tabs[tab].tool-shape = PadShape.octagon;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.package-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.package-tabs[tab].tool-size.can-decrease {
Data.current-section.package-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.package-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.package-tabs[tab].tool-line-width.can-decrease {
Data.current-section.package-tabs[tab].tool-line-width.decrease = true;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.hole {
if Backend.is-shortcut(event, Cmd.drill-increase) {
Data.current-section.package-tabs[tab].tool-drill.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-decrease) && Data.current-section.package-tabs[tab].tool-drill.can-decrease {
Data.current-section.package-tabs[tab].tool-drill.decrease = true;
return true;
}
} else if Data.current-section.package-tabs[tab].tool == EditorTool.renumber-pads {
if Backend.is-shortcut(event, Cmd.input-accept-add) {
Backend.trigger-tab(section, tab, TabAction.accept);
return true;
}
}
// Common shortcuts
if Backend.is-shortcut(event, Cmd.import-dxf) && (Data.current-tab.features.import-graphics == FeatureState.enabled) {
Backend.trigger-tab(section, tab, TabAction.import-dxf);
return true;
} else if Backend.is-shortcut(event, Cmd.toggle-3d) && (Data.current-package-tab.page-index == 2) {
Data.current-section.package-tabs[Data.current-section.current-tab-index].view-3d = !Data.current-package-tab.view-3d;
return true;
} else if Backend.is-shortcut(event, Cmd.tool-select) {
Backend.trigger-tab(section, tab, TabAction.tool-select);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-line) {
Backend.trigger-tab(section, tab, TabAction.tool-line);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-rect) {
Backend.trigger-tab(section, tab, TabAction.tool-rect);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-polygon) {
Backend.trigger-tab(section, tab, TabAction.tool-polygon);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-circle) {
Backend.trigger-tab(section, tab, TabAction.tool-circle);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-arc) {
Backend.trigger-tab(section, tab, TabAction.tool-arc);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-name) {
Backend.trigger-tab(section, tab, TabAction.tool-name);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-value) {
Backend.trigger-tab(section, tab, TabAction.tool-value);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-text) {
Backend.trigger-tab(section, tab, TabAction.tool-text);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-tht) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-tht);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-smt) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-smt);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-thermal) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-thermal);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-bga) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-bga);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-edge-connector) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-edge-connector);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-test-point) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-test-point);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-local-fiducial) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-local-fiducial);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-global-fiducial) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-global-fiducial);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-zone) {
Backend.trigger-tab(section, tab, TabAction.tool-zone);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-hole) {
Backend.trigger-tab(section, tab, TabAction.tool-hole);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-generate-outline) {
Backend.trigger-tab(section, tab, TabAction.package-generate-outline);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-generate-courtyard) {
Backend.trigger-tab(section, tab, TabAction.package-generate-courtyard);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-renumber-pads) {
Backend.trigger-tab(section, tab, TabAction.tool-renumber-pads);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-measure) {
Backend.trigger-tab(section, tab, TabAction.tool-measure);
return true;
} else if Backend.is-shortcut(event, Cmd.abort) {
Backend.trigger-tab(section, tab, TabAction.abort);
return true;
} else if process-tab-shortcuts(event) {
return true;
} else if Backend.scene-key-pressed(section, event) {
return true;
}
false
}
public function process-device-tab-shortcuts(event: KeyEvent) -> bool {
if Backend.is-shortcut(event, Cmd.tool-measure) {
Backend.trigger-tab(section, tab, TabAction.tool-measure);
return true;
} else if Backend.is-shortcut(event, Cmd.abort) {
Backend.trigger-tab(section, tab, TabAction.abort);
return true;
} else if process-tab-shortcuts(event) {
return true;
} else if Backend.scene-key-pressed(section, event) {
return true;
}
false
}
public function process-schematic-tab-shortcuts(event: KeyEvent) -> bool {
// Tool-specific shortcuts
if Data.current-section.schematic-tabs[tab].tool == EditorTool.wire {
if Backend.is-shortcut(event, Cmd.wire-mode-h-v) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.h-v;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-v-h) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.v-h;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-90-45) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.deg90-45;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-45-90) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.deg45-90;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-straight) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.straight;
return true;
}
} else if Data.current-section.schematic-tabs[tab].tool == EditorTool.bus {
if Backend.is-shortcut(event, Cmd.wire-mode-h-v) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.h-v;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-v-h) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.v-h;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-90-45) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.deg90-45;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-45-90) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.deg45-90;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-straight) {
Data.current-section.schematic-tabs[tab].tool-wire-mode = WireMode.straight;
return true;
}
} else if Data.current-section.schematic-tabs[tab].tool == EditorTool.polygon {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.schematic-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.schematic-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.schematic-tabs[tab].tool-layer.current-index < (Data.current-section.schematic-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.schematic-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.schematic-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.schematic-tabs[tab].tool-line-width.can-decrease {
Data.current-section.schematic-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.schematic-tabs[tab].tool-filled = !Data.current-section.schematic-tabs[tab].tool-filled;
return true;
}
} else if Data.current-section.schematic-tabs[tab].tool == EditorTool.text {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.schematic-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.schematic-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.schematic-tabs[tab].tool-layer.current-index < (Data.current-section.schematic-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.schematic-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.schematic-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.schematic-tabs[tab].tool-size.can-decrease {
Data.current-section.schematic-tabs[tab].tool-size.decrease = true;
return true;
}
}
// Common shortcuts
if Backend.is-shortcut(event, Cmd.ignore-locks) {
Data.current-section.schematic-tabs[tab].ignore-placement-locks = !Data.current-section.schematic-tabs[tab].ignore-placement-locks;
return true;
} else if Backend.is-shortcut(event, Cmd.tool-select) {
Backend.trigger-tab(section, tab, TabAction.tool-select);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-polygon) {
Backend.trigger-tab(section, tab, TabAction.tool-polygon);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-text) {
Backend.trigger-tab(section, tab, TabAction.tool-text);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-image) {
Backend.trigger-tab(section, tab, TabAction.tool-image);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-wire) {
Backend.trigger-tab(section, tab, TabAction.tool-wire);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-bus) {
Backend.trigger-tab(section, tab, TabAction.tool-bus);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-label) {
Backend.trigger-tab(section, tab, TabAction.tool-label);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-component) {
Backend.trigger-tab(section, tab, TabAction.tool-component);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-measure) {
Backend.trigger-tab(section, tab, TabAction.tool-measure);
return true;
} else if Backend.is-shortcut(event, Cmd.abort) {
Backend.trigger-tab(section, tab, TabAction.abort);
return true;
} else if process-tab-shortcuts(event) {
return true;
} else if Backend.scene-key-pressed(section, event) {
return true;
} else if process-schematic-shortcuts(Data.current-schematic-tab.project-index, Data.current-schematic-tab.schematic-index, event) {
return true;
} else if process-project-shortcuts(Data.current-schematic-tab.project-index, event) {
return true;
}
false
}
public function process-board-2d-tab-shortcuts(event: KeyEvent) -> bool {
// Tool-specific shortcuts
if Data.current-section.board-2d-tabs[tab].tool == EditorTool.wire {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index < (Data.current-section.board-2d-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.flip-horizontal) {
// Support 'f' shortcut for toggling between top/bottom layers, see
// https://librepcb.discourse.group/t/wire-routing-controls/1032.
Data.current-section.board-2d-tabs[tab].tool-layer.current-index = (Data.current-section.board-2d-tabs[tab].tool-layer.items.length - 1) - Data.current-section.board-2d-tabs[tab].tool-layer.current-index;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.board-2d-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.board-2d-tabs[tab].tool-line-width.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.width-auto-toggle) {
Data.current-section.board-2d-tabs[tab].tool-filled = !Data.current-section.board-2d-tabs[tab].tool-filled;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.board-2d-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.board-2d-tabs[tab].tool-size.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-increase) {
Data.current-section.board-2d-tabs[tab].tool-drill.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-decrease) && Data.current-section.board-2d-tabs[tab].tool-drill.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-drill.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-h-v) {
Data.current-section.board-2d-tabs[tab].tool-wire-mode = WireMode.h-v;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-v-h) {
Data.current-section.board-2d-tabs[tab].tool-wire-mode = WireMode.v-h;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-90-45) {
Data.current-section.board-2d-tabs[tab].tool-wire-mode = WireMode.deg90-45;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-45-90) {
Data.current-section.board-2d-tabs[tab].tool-wire-mode = WireMode.deg45-90;
return true;
} else if Backend.is-shortcut(event, Cmd.wire-mode-straight) {
Data.current-section.board-2d-tabs[tab].tool-wire-mode = WireMode.straight;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.via {
if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.board-2d-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.board-2d-tabs[tab].tool-size.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-increase) {
Data.current-section.board-2d-tabs[tab].tool-drill.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-decrease) && Data.current-section.board-2d-tabs[tab].tool-drill.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-drill.decrease = true;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.polygon {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index < (Data.current-section.board-2d-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.board-2d-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.board-2d-tabs[tab].tool-line-width.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.fill-toggle) {
Data.current-section.board-2d-tabs[tab].tool-filled = !Data.current-section.board-2d-tabs[tab].tool-filled;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.text {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index < (Data.current-section.board-2d-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index += 1;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.board-2d-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.board-2d-tabs[tab].tool-size.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-size.decrease = true;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.plane {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index < (Data.current-section.board-2d-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index += 1;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.zone {
if Backend.is-shortcut(event, Cmd.layer-up) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index > 0) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index -= 1;
return true;
} else if Backend.is-shortcut(event, Cmd.layer-down) && (Data.current-section.board-2d-tabs[tab].tool-layer.current-index < (Data.current-section.board-2d-tabs[tab].tool-layer.items.length - 1)) {
Data.current-section.board-2d-tabs[tab].tool-layer.current-index += 1;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.pad-tht {
if Backend.is-shortcut(event, Cmd.shape-round) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.round;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rounded-rect) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.rounded-rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rect) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-octagon) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.octagon;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.board-2d-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.board-2d-tabs[tab].tool-size.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.board-2d-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.board-2d-tabs[tab].tool-line-width.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-line-width.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-increase) {
Data.current-section.board-2d-tabs[tab].tool-drill.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-decrease) && Data.current-section.board-2d-tabs[tab].tool-drill.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-drill.decrease = true;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.pad-smt {
if Backend.is-shortcut(event, Cmd.flip-horizontal) {
Data.current-section.board-2d-tabs[tab].tool-bottom = !Data.current-section.board-2d-tabs[tab].tool-bottom;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-round) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.round;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rounded-rect) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.rounded-rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-rect) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.rect;
return true;
} else if Backend.is-shortcut(event, Cmd.shape-octagon) {
Data.current-section.board-2d-tabs[tab].tool-shape = PadShape.octagon;
return true;
} else if Backend.is-shortcut(event, Cmd.size-increase) {
Data.current-section.board-2d-tabs[tab].tool-size.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.size-decrease) && Data.current-section.board-2d-tabs[tab].tool-size.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-size.decrease = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-increase) {
Data.current-section.board-2d-tabs[tab].tool-line-width.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.line-width-decrease) && Data.current-section.board-2d-tabs[tab].tool-line-width.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-line-width.decrease = true;
return true;
}
} else if Data.current-section.board-2d-tabs[tab].tool == EditorTool.hole {
if Backend.is-shortcut(event, Cmd.drill-increase) {
Data.current-section.board-2d-tabs[tab].tool-drill.increase = true;
return true;
} else if Backend.is-shortcut(event, Cmd.drill-decrease) && Data.current-section.board-2d-tabs[tab].tool-drill.can-decrease {
Data.current-section.board-2d-tabs[tab].tool-drill.decrease = true;
return true;
}
}
// Common shortcuts
if Backend.is-shortcut(event, Cmd.plane-hide-all) {
Backend.trigger-tab(section, tab, TabAction.planes-hide);
return true;
} else if Backend.is-shortcut(event, Cmd.plane-show-all) {
Backend.trigger-tab(section, tab, TabAction.planes-show);
return true;
} else if Backend.is-shortcut(event, Cmd.plane-rebuild-all) {
Backend.trigger-tab(section, tab, TabAction.planes-rebuild);
return true;
} else if Backend.is-shortcut(event, Cmd.generate-fabrication-data) {
Backend.trigger-tab(section, tab, TabAction.export-fabrication-data);
return true;
} else if Backend.is-shortcut(event, Cmd.generate-pick-place) {
Backend.trigger-tab(section, tab, TabAction.export-pick-place);
return true;
} else if Backend.is-shortcut(event, Cmd.generate-d356-netlist) {
Backend.trigger-tab(section, tab, TabAction.export-d356-netlist);
return true;
} else if Backend.is-shortcut(event, Cmd.export-specctra-dsn) {
Backend.trigger-tab(section, tab, TabAction.export-specctra);
return true;
} else if Backend.is-shortcut(event, Cmd.import-specctra-ses) {
Backend.trigger-tab(section, tab, TabAction.import-specctra);
return true;
} else if Backend.is-shortcut(event, Cmd.import-dxf) {
Backend.trigger-tab(section, tab, TabAction.import-dxf);
return true;
} else if Backend.is-shortcut(event, Cmd.ignore-locks) {
Data.current-section.board-2d-tabs[tab].ignore-placement-locks = !Data.current-section.board-2d-tabs[tab].ignore-placement-locks;
return true;
} else if Backend.is-shortcut(event, Cmd.flip-view) {
Data.current-section.board-2d-tabs[tab].flip-view = !Data.current-section.board-2d-tabs[tab].flip-view;
return true;
} else if Backend.is-shortcut(event, Cmd.toggle-3d) {
Backend.trigger-board(Data.current-section.board-2d-tabs[tab].project-index, Data.current-section.board-2d-tabs[tab].board-index, BoardAction.open-3d);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-select) {
Backend.trigger-tab(section, tab, TabAction.tool-select);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-wire) {
Backend.trigger-tab(section, tab, TabAction.tool-wire);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-via) {
Backend.trigger-tab(section, tab, TabAction.tool-via);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-polygon) {
Backend.trigger-tab(section, tab, TabAction.tool-polygon);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-text) {
Backend.trigger-tab(section, tab, TabAction.tool-text);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-plane) {
Backend.trigger-tab(section, tab, TabAction.tool-plane);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-tht) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-tht);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-smt) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-smt);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-thermal) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-thermal);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-bga) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-bga);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-edge-connector) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-edge-connector);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-test-point) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-test-point);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-local-fiducial) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-local-fiducial);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-pad-global-fiducial) {
Backend.trigger-tab(section, tab, TabAction.tool-pad-global-fiducial);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-zone) {
Backend.trigger-tab(section, tab, TabAction.tool-zone);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-hole) {
Backend.trigger-tab(section, tab, TabAction.tool-hole);
return true;
} else if Backend.is-shortcut(event, Cmd.tool-measure) {
Backend.trigger-tab(section, tab, TabAction.tool-measure);
return true;
} else if Backend.is-shortcut(event, Cmd.abort) {
Backend.trigger-tab(section, tab, TabAction.abort);
return true;
} else if process-tab-shortcuts(event) {
return true;
} else if Backend.scene-key-pressed(section, event) {
return true;
} else if process-board-shortcuts(Data.current-board-2d-tab.project-index, Data.current-board-2d-tab.board-index, event) {
return true;
} else if process-project-shortcuts(Data.current-board-2d-tab.project-index, event) {
return true;
}
false
}
public function process-board-3d-tab-shortcuts(event: KeyEvent) -> bool {
if Backend.is-shortcut(event, Cmd.zoom-fit-content) {
Backend.trigger-tab(section, tab, TabAction.zoom-fit);
return true;
} else if Backend.is-shortcut(event, Cmd.zoom-in) {
Backend.trigger-tab(section, tab, TabAction.zoom-in);
return true;
} else if Backend.is-shortcut(event, Cmd.zoom-out) {
Backend.trigger-tab(section, tab, TabAction.zoom-out);
return true;
} else if Backend.is-shortcut(event, Cmd.toggle-3d) {
Backend.trigger-board(Data.current-board-3d-tab.project-index, Data.current-board-3d-tab.board-index, BoardAction.open-2d);
return true;
} else if process-tab-shortcuts(event) {
return true;
} else if Backend.scene-key-pressed(section, event) {
return true;
} else if process-board-shortcuts(Data.current-board-3d-tab.project-index, Data.current-board-3d-tab.board-index, event) {
return true;
} else if process-project-shortcuts(Data.current-board-3d-tab.project-index, event) {
return true;
}
false
}
public function process(event: KeyEvent) -> bool {
// Tab shortcuts
if Data.current-tab.type == TabType.symbol {
if process-symbol-tab-shortcuts(event) {
return true;
}
} else if Data.current-tab.type == TabType.package {
if process-package-tab-shortcuts(event) {
return true;
}
} else if Data.current-tab.type == TabType.device {
if process-device-tab-shortcuts(event) {
return true;
}
} else if Data.current-tab.type == TabType.schematic {
if process-schematic-tab-shortcuts(event) {
return true;
}
} else if Data.current-tab.type == TabType.board-2d {
if process-board-2d-tab-shortcuts(event) {
return true;
}
} else if Data.current-tab.type == TabType.board-3d {
if process-board-3d-tab-shortcuts(event) {
return true;
}
} else if process-tab-shortcuts(event) {
return true;
}
// Global shortcuts
if Backend.is-shortcut(event, Cmd.file-manager) {
Backend.trigger(Action.workspace-open-folder);
return true;
} else if Backend.is-shortcut(event, Cmd.workspace-switch) {
Backend.trigger(Action.workspace-switch);
return true;
} else if Backend.is-shortcut(event, Cmd.workspace-settings) {
Backend.trigger(Action.workspace-settings);
return true;
} else if Backend.is-shortcut(event, Cmd.workspace-libraries-rescan) {
Backend.trigger(Action.workspace-libraries-rescan);
return true;
} else if Backend.is-shortcut(event, Cmd.library-manager) {
Data.set-panel-page(PanelPage.libraries);
return true;
} else if Backend.is-shortcut(event, Cmd.project-new) {
Backend.trigger(Action.project-new);
return true;
} else if Backend.is-shortcut(event, Cmd.project-open) {
Backend.trigger(Action.project-open);
return true;
} else if Backend.is-shortcut(event, Cmd.add-example-projects) {
Backend.trigger(Action.project-import-examples);
return true;
} else if Backend.is-shortcut(event, Cmd.import-eagle-project) {
Backend.trigger(Action.project-import-eagle);
return true;
} else if Backend.is-shortcut(event, Cmd.dock-erc) && Data.current-project.valid {
Data.current-rule-check-board-index = -1;
Data.set-panel-page(PanelPage.rule-check);
return true;
} else if Backend.is-shortcut(event, Cmd.dock-drc) && Data.current-tab.type == TabType.board-2d {
Data.current-rule-check-board-index = Data.current-board-2d-tab.board-index;
Data.set-panel-page(PanelPage.rule-check);
return true;
} else if Backend.is-shortcut(event, Cmd.dock-layers) && (Data.current-tab.layers.length > 0) {
Data.set-panel-page(PanelPage.layers);
return true;
} else if Backend.is-shortcut(event, Cmd.dock-place-devices) && (Data.current-tab.type == TabType.board-2d) {
Data.set-panel-page(PanelPage.place-devices);
} else if Backend.is-shortcut(event, Cmd.order-pcb) && Data.current-project.valid {
Data.set-panel-page(PanelPage.order);
} else if Backend.is-shortcut(event, Cmd.window-new) {
Backend.trigger(Action.window-new);
return true;
} else if Backend.is-shortcut(event, Cmd.window-close) {
Backend.trigger(Action.window-close);
return true;
} else if Backend.is-shortcut(event, Cmd.application-quit) {
Backend.trigger(Action.quit);
return true;
} else if Backend.is-shortcut(event, Cmd.about-librepcb) {
Data.set-panel-page(PanelPage.about);
return true;
} else if Backend.is-shortcut(event, Cmd.website) {
Backend.open-url(Constants.website-url);
return true;
} else if Backend.is-shortcut(event, Cmd.documentation-online) {
Backend.open-url(Constants.user-manual-url);
return true;
} else if Backend.is-shortcut(event, Cmd.support) {
Backend.open-url(Constants.support-url);
return true;
} else if Backend.is-shortcut(event, Cmd.donate) {
Backend.open-url(Constants.donate-url);
return true;
} else if Backend.is-shortcut(event, Cmd.keyboard-shortcuts-reference) {
Backend.trigger(Action.keyboard-shortcuts-reference);
return true;
} else if Data.current-project.valid && process-project-shortcuts(Data.current-project-index, event) {
return true;
}
false
}
}