✨ 完成menubar的显示了!!!

This commit is contained in:
shufeng2012 committed 2026-08-17 16:24:39 +08:00
1 parent ace2ea9a2c
commit 47b7b34472
4 files changed
+1093 -21

No files matched your search

+86
View File
@@ -0,0 +1,86 @@
import { UIComponent, analysisXML } from "../utils/XMLHandler";
import { common } from '@kit.AbilityKit';
import { util } from '@kit.ArkTS';
import { BusinessError } from '@kit.BasicServicesKit';
@ComponentV2
export struct Menubar {
private content: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
@Local ui_components: UIComponent[] = [];
aboutToAppear() {
const xml_string = this.getXML();
this.ui_components = analysisXML(xml_string);
}
getXML(): string {
try {
let data: Uint8Array = this.content.resourceManager.getRawFileContentSync("mainmenubar.xml");
let text_decoder: util.TextDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true });
let xml_string: string = text_decoder.decodeToString(data, { stream: false });
return xml_string;
} catch (err) {
let code: number = (err as BusinessError).code;
let message: string = (err as BusinessError).message;
console.log(`[Error](${code}): ${message}`);
return "";
}
}
@Builder
buildMenu(items: UIComponent[]) {
Menu() {
ForEach(items, (item: UIComponent) => {
if (item.isSection === true) {
MenuItemGroup() {
ForEach(item.children || [], (sub: UIComponent) => {
this.buildMenuItem(sub);
}, (sub: UIComponent, idx) => idx.toString())
}
} else {
this.buildMenuItem(item);
}
}, (item: UIComponent, idx) => idx.toString());
}
}
@Builder
buildMenuItem(item: UIComponent) {
if (item.children && item.children?.length > 0) {
MenuItem({ content: item.label, labelInfo: item.accel }) {
this.buildSubMenu(item.children || []);
}
} else {
MenuItem({ content: item.label, labelInfo: item.accel });
}
}
@Builder
buildSubMenu(items: UIComponent[]) {
Menu() {
ForEach(items, (sub: UIComponent) => {
if (sub.children && sub.children?.length > 0) {
MenuItem({ content: sub.label, labelInfo: sub.accel }) {
this.buildSubMenu(sub.children || []);
}
} else {
MenuItem({ content: sub.label, labelInfo: sub.accel });
}
}, (sub: UIComponent, idx) => idx.toString())
}
}
build() {
Row() {
ForEach(this.ui_components, (menu: UIComponent) => {
Text(menu.label)
.bindMenu(this.buildMenu(menu.children || []))
.padding('10vp')
}, (menu: UIComponent, idx) => idx.toString())
}
}
}
+13 -21
View File
@@ -1,23 +1,15 @@
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
import { Menubar } from "../components/Menubar";
build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize($r('app.float.page_text_font_size'))
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.onClick(() => {
this.message = 'Welcome';
})
@Entry
@ComponentV2
struct Index {
build() {
Column() {
Menubar();
}
}
.height('100%')
.width('100%')
}
}
}
+120
View File
@@ -0,0 +1,120 @@
import { convertxml } from '@kit.ArkTS';
interface XMLNode {
_name: string;
_attributes?: Record<string, string>;
_text?: string;
_cdata?: string;
elements?: XMLNode[];
}
export interface UIComponent {
label: string;
action?: string;
accel?: string;
target?: string | number | boolean;
isSection?: boolean;
children?: UIComponent[];
}
export function analysisXML(xml_string: string): UIComponent[] {
const conv = new convertxml.ConvertXML();
const options: convertxml.ConvertOptions = {
trim: true,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "elements"
};
const result = conv.fastConvertToJSObject(xml_string, options) as XMLNode;
const interface_obj = result.elements?.[0];
const menu = interface_obj?.elements?.find(
(elem: XMLNode) => elem._name === "menu" && elem._attributes?.id === "menubar"
);
if (!menu) {
return [];
}
return getMenuItem(menu.elements || []);
}
function getMenuItem(elements: XMLNode[]): UIComponent[] {
const items: UIComponent[] = [];
for (const elem of elements) {
if (elem._name === "submenu") {
const label = getAttribute(elem, "label") || "";
const children = getMenuItem(elem.elements || []);
items.push({
label: cleanLabel(label),
children: children.length > 0 ? children : undefined
});
} else if (elem._name === "item") {
const label = getAttribute(elem, "label") || "";
const action = getAttribute(elem, "action") || "";
const accel = getAttribute(elem, "accel") || "";
let target: string | number | boolean | undefined;
const target_attr = elem.elements?.find(
(e: XMLNode) => e._name === "attribute" && e._attributes?.name === "target"
);
if (target_attr) {
const text_node = target_attr.elements?.[0];
const raw = text_node?._text || text_node?._cdata || "";
const type = target_attr._attributes?.type || "s";
if (raw !== "") {
switch (type) {
case "i":
target = parseInt(raw, 10);
break;
case "b":
target = raw === "true" || raw === "1";
break;
default:
target = raw;
break;
}
}
}
items.push({
label: cleanLabel(label),
action: action,
accel: accel,
target: target
});
} else if (elem._name === "section") {
const section_items = getMenuItem(elem.elements || []);
if (section_items.length > 0) {
items.push({
label: "",
isSection: true,
children: section_items
});
}
}
}
return items;
}
function getAttribute(element: XMLNode, att_name: string): string | undefined {
const att_elem = element.elements?.find(
(elem: XMLNode) => elem._name === "attribute" && elem._attributes?.name === att_name
);
if (att_elem) {
const text_node = att_elem.elements?.[0];
if (text_node) {
return text_node._text || text_node._cdata;
}
return undefined;
}
return undefined;
}
function cleanLabel(label: string): string {
return label.replace(/_/g, "");
}
@@ -0,0 +1,874 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="menubar">
<submenu>
<attribute name="label" translatable="yes">_File</attribute>
<section id="menu1">
<item>
<attribute name="label" translatable="true">New</attribute>
<attribute name="action">win.new-file</attribute>
<attribute name="accel">&lt;Ctrl&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Open</attribute>
<attribute name="action">win.open</attribute>
<attribute name="accel">&lt;Ctrl&gt;o</attribute>
</item>
<submenu id="menuFileRecent">
<!-- Filled dynamically -->
<attribute name="label" translatable="yes">Recent _Documents</attribute>
</submenu>
<item>
<attribute name="label" translatable="yes">_Annotate PDF</attribute>
<attribute name="action">win.annotate-pdf</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save</attribute>
<attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Ctrl&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save As</attribute>
<attribute name="action">win.save-as</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;s</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Export as PDF</attribute>
<attribute name="action">win.export-as-pdf</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Export as...</attribute>
<attribute name="action">win.export-as</attribute>
<attribute name="accel">&lt;Ctrl&gt;e</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Print</attribute>
<attribute name="action">win.print</attribute>
<attribute name="accel">&lt;Ctrl&gt;p</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="hidden-when">macos-menubar</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Edit</attribute>
<section id="sectionUndoRedo">
<item>
<attribute name="label" translatable="yes">Undo</attribute>
<attribute name="action">win.undo</attribute>
<!-- Undo/Redo accelerators are set in control/actions/ActionDatabase.cpp -->
</item>
<item>
<attribute name="label" translatable="yes">Redo</attribute>
<attribute name="action">win.redo</attribute>
<!-- Undo/Redo accelerators are set in control/actions/ActionDatabase.cpp -->
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Cut</attribute>
<attribute name="action">win.cut</attribute>
<!-- Cut accelerators are defined in control/actions/ActionProperties.h -->
</item>
<item>
<attribute name="label" translatable="yes">Copy</attribute>
<attribute name="action">win.copy</attribute>
<!-- Copy accelerators are defined in control/actions/ActionProperties.h -->
</item>
<item>
<attribute name="label" translatable="yes">Paste</attribute>
<attribute name="action">win.paste</attribute>
<!-- Paste accelerators are defined in control/actions/ActionProperties.h -->
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Select All</attribute>
<attribute name="action">win.select-all</attribute>
<attribute name="accel">&lt;Ctrl&gt;a</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Find</attribute>
<attribute name="action">win.search</attribute>
<attribute name="accel">&lt;Ctrl&gt;f</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Delete</attribute>
<attribute name="action">win.delete</attribute>
<attribute name="accel">Delete</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Arrange Selection</attribute>
<section>
<item>
<attribute name="label" translatable="yes">Bring to Front</attribute>
<attribute name="action">win.arrange-selection-order</attribute>
<attribute name="target" type="t">0</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Bring Forward</attribute>
<attribute name="action">win.arrange-selection-order</attribute>
<attribute name="target" type="t">1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Send Backward</attribute>
<attribute name="action">win.arrange-selection-order</attribute>
<attribute name="target" type="t">2</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Send to Back</attribute>
<attribute name="action">win.arrange-selection-order</attribute>
<attribute name="target" type="t">3</attribute>
</item>
</section>
</submenu>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Move Selection Layer Up</attribute>
<attribute name="action">win.move-selection-layer-up</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Move Selection Layer Down</attribute>
<attribute name="action">win.move-selection-layer-down</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Rotation Snapping</attribute>
<attribute name="action">win.rotation-snapping</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Grid Snapping</attribute>
<attribute name="action">win.grid-snapping</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Preferences</attribute>
<attribute name="action">app.preferences</attribute>
<attribute name="hidden-when">macos-menubar</attribute>
</item>
<submenu id="menuViewToolbar">
<attribute name="label" translatable="yes">T_oolbars</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Manage</attribute>
<attribute name="action">win.manage-toolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Customize</attribute>
<attribute name="action">win.customize-toolbar</attribute>
</item>
</section>
</submenu>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_View</attribute>
<section id="menu4">
<item>
<attribute name="label" translatable="yes">_Pair Pages</attribute>
<attribute name="action">win.paired-pages-mode</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Presentation Mode</attribute>
<attribute name="action">win.presentation-mode</attribute>
<attribute name="accel">F5</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Fullscreen</attribute>
<attribute name="action">win.fullscreen</attribute>
<attribute name="accel">F11</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Show Toolbars</attribute>
<attribute name="action">win.show-toolbar</attribute>
<attribute name="accel">F9</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Show Menubar</attribute>
<attribute name="action">win.show-menubar</attribute>
<attribute name="accel">F10</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Show Sidebar</attribute>
<attribute name="action">win.show-sidebar</attribute>
<attribute name="accel">F12</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Layout</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Horizontal</attribute>
<attribute name="action">win.set-layout-vertical</attribute>
<attribute name="target" type="b">false</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Vertical</attribute>
<attribute name="action">win.set-layout-vertical</attribute>
<attribute name="target" type="b">true</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Left to Right</attribute>
<attribute name="action">win.set-layout-right-to-left</attribute>
<attribute name="target" type="b">false</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Right to Left</attribute>
<attribute name="action">win.set-layout-right-to-left</attribute>
<attribute name="target" type="b">true</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Top to Bottom</attribute>
<attribute name="action">win.set-layout-bottom-to-top</attribute>
<attribute name="target" type="b">false</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Bottom to Top</attribute>
<attribute name="action">win.set-layout-bottom-to-top</attribute>
<attribute name="target" type="b">true</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Cols/Rows</attribute>
<section>
<submenu>
<attribute name="label" translatable="yes">Set Columns</attribute>
<section>
<!-- Positive values for columns, Negative for rows -->
<item>
<attribute name="label" translatable="yes">_1 Column</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_2 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">2</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_3 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">3</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_4 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">4</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_5 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">5</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_6 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">6</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_7 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">7</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_8 Columns</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">8</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">Set Rows</attribute>
<section>
<!-- Positive values for columns, Negative for rows -->
<item>
<attribute name="label" translatable="yes">_1 Row</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_2 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-2</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_3 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-3</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_4 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-4</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_5 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-5</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_6 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-6</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_7 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-7</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_8 Rows</attribute>
<attribute name="action">win.set-columns-or-rows</attribute>
<attribute name="target" type="i">-8</attribute>
</item>
</section>
</submenu>
</section>
</submenu>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Zoom In</attribute>
<attribute name="action">win.zoom-in</attribute>
<!-- Zoom accelerators are defined in control/actions/ActionProperties.h -->
</item>
<item>
<attribute name="label" translatable="yes">Zoom Out</attribute>
<attribute name="action">win.zoom-out</attribute>
<!-- Zoom accelerators are defined in control/actions/ActionProperties.h -->
</item>
<item>
<attribute name="label" translatable="yes">Normal Size</attribute>
<attribute name="action">win.zoom-100</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Zoom to Fit</attribute>
<attribute name="action">win.zoom-fit</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Navigation</attribute>
<section id="menu6">
<item>
<attribute name="label" translatable="yes">_First Page</attribute>
<attribute name="action">win.goto-first</attribute>
<attribute name="accel">&lt;Ctrl&gt;Home</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Previous Page</attribute>
<attribute name="action">win.goto-previous</attribute>
<attribute name="accel">&lt;Ctrl&gt;Page_Up</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Goto Page</attribute>
<attribute name="action">win.goto-page</attribute>
<attribute name="accel">&lt;Ctrl&gt;g</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Next Page</attribute>
<attribute name="action">win.goto-next</attribute>
<attribute name="accel">&lt;Ctrl&gt;Page_Down</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Last Page</attribute>
<attribute name="action">win.goto-last</attribute>
<attribute name="accel">&lt;Ctrl&gt;End</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Previous Layer</attribute>
<attribute name="action">win.layer-goto-previous</attribute>
<attribute name="accel">&lt;Shift&gt;Page_Down</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Next Layer</attribute>
<attribute name="action">win.layer-goto-next</attribute>
<attribute name="accel">&lt;Shift&gt;Page_Up</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Top Layer</attribute>
<attribute name="action">win.layer-goto-top</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">N_ext Annotated Page</attribute>
<attribute name="action">win.goto-next-annotated-page</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;Page_Down</attribute>
</item>
<item>
<attribute name="label" translatable="yes">P_revious Annotated Page</attribute>
<attribute name="action">win.goto-previous-annotated-page</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;Page_Up</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Journal</attribute>
<section id="menu7">
<item>
<attribute name="label" translatable="yes">New Page _Before</attribute>
<attribute name="action">win.new-page-before</attribute>
</item>
<item>
<attribute name="label" translatable="yes">New Page _After</attribute>
<attribute name="action">win.new-page-after</attribute>
<attribute name="accel">&lt;Ctrl&gt;d</attribute>
</item>
<item>
<attribute name="label" translatable="yes">New Page at _End</attribute>
<attribute name="action">win.new-page-at-end</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Duplicate Page</attribute>
<attribute name="action">win.duplicate-page</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Append New PDF Pages</attribute>
<attribute name="action">win.append-new-pdf-pages</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Configure Page Template</attribute>
<attribute name="action">win.configure-page-template</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Delete Page</attribute>
<attribute name="action">win.delete-page</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;Delete</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Add a _Layer above the active layer</attribute>
<attribute name="action">win.layer-new-above-current</attribute>
<attribute name="accel">&lt;Ctrl&gt;l</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Add a layer below the active layer</attribute>
<attribute name="action">win.layer-new-below-current</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Delete Layer</attribute>
<attribute name="action">win.layer-delete</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;l</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Merge Layer Down</attribute>
<attribute name="action">win.layer-merge-down</attribute>
<attribute name="accel">&lt;Ctrl&gt;m</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Rename Layer</attribute>
<attribute name="action">win.layer-rename</attribute>
<attribute name="accel">&lt;Ctrl&gt;r</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Paper _Format</attribute>
<attribute name="action">win.paper-format</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Paper _Color</attribute>
<attribute name="action">win.paper-background-color</attribute>
</item>
<submenu id="menuJournalPaperBackground">
<attribute name="label" translatable="yes">Paper B_ackground</attribute>
</submenu>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Tools</attribute>
<section id="menu10">
<item>
<attribute name="label" translatable="yes">_Pen</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">1</attribute> <!-- TOOL_PEN -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;p</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Eraser</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">2</attribute> <!-- TOOL_ERASER -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;e</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Select Linear Text</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">21</attribute> <!-- TOOL_SELECT_PDF_TEXT_LINEAR -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;w</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Select Text In Rectangle</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">22</attribute> <!-- TOOL_SELECT_PDF_TEXT_RECT -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;y</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Highlighter</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">3</attribute> <!-- TOOL_HIGHLIGHTER -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;h</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Text</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">4</attribute> <!-- TOOL_TEXT -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;t</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Image</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">5</attribute> <!-- TOOL_IMAGE -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;i</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Default Tool</attribute>
<attribute name="action">win.select-default-tool</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;d</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Drawing Type</attribute>
<item>
<attribute name="label" translatable="yes">_Shape Recognizer</attribute>
<attribute name="action">win.tool-draw-shape-recognizer</attribute>
<attribute name="accel">&lt;Ctrl&gt;1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw Rectangle</attribute>
<attribute name="action">win.tool-draw-rectangle</attribute>
<attribute name="accel">&lt;Ctrl&gt;2</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw Ellipse</attribute>
<attribute name="action">win.tool-draw-ellipse</attribute>
<attribute name="accel">&lt;Ctrl&gt;3</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw Arrow</attribute>
<attribute name="action">win.tool-draw-arrow</attribute>
<attribute name="accel">&lt;Ctrl&gt;4</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw Double Arrow</attribute>
<attribute name="action">win.tool-draw-double-arrow</attribute>
<attribute name="accel">&lt;Ctrl&gt;5</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw Coordinate System</attribute>
<attribute name="action">win.tool-draw-coordinate-system</attribute>
<attribute name="accel">&lt;Ctrl&gt;6</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw _Line</attribute>
<attribute name="action">win.tool-draw-line</attribute>
<attribute name="accel">&lt;Ctrl&gt;7</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Draw Spline</attribute>
<attribute name="action">win.tool-draw-spline</attribute>
<attribute name="accel">&lt;Ctrl&gt;8</attribute>
</item>
</submenu>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Select Rectangle</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">6</attribute> <!-- TOOL_SELECT_RECT -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Select Region</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">7</attribute> <!-- TOOL_SELECT_REGION -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;g</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Select Multi-Layer Rectangle</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">8</attribute> <!-- TOOL_SELECT_MULTILAYER_RECT -->
</item>
<item>
<attribute name="label" translatable="yes">Select Multi-Layer Region</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">9</attribute> <!-- TOOL_SELECT_MULTILAYER_REGION -->
</item>
<item>
<attribute name="label" translatable="yes">Select Object</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">10</attribute> <!-- TOOL_SELECT_OBJECT -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;o</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Vertical Space</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">12</attribute> <!-- TOOL_VERTICAL_SPACE -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;v</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Play Object</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">11</attribute> <!-- TOOL_PLAY_OBJECT -->
<attribute name="class">audio</attribute> <!-- Gets removed when audio is disabled -->
</item>
<item>
<attribute name="label" translatable="yes">H_and Tool</attribute>
<attribute name="action">win.select-tool</attribute>
<attribute name="target" type="t">13</attribute> <!-- TOOL_HAND -->
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;a</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Setsquare</attribute>
<attribute name="action">win.setsquare</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Compass</attribute>
<attribute name="action">win.compass</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Pen _Options</attribute>
<section id="menu11">
<item>
<attribute name="label" translatable="yes">_very fine</attribute>
<attribute name="action">win.tool-pen-size</attribute>
<attribute name="target" type="t">0</attribute> <!-- TOOL_SIZE_VERY_FINE -->
</item>
<item>
<attribute name="label" translatable="yes">_fine</attribute>
<attribute name="action">win.tool-pen-size</attribute>
<attribute name="target" type="t">1</attribute> <!-- TOOL_SIZE_FINE -->
</item>
<item>
<attribute name="label" translatable="yes">_medium</attribute>
<attribute name="action">win.tool-pen-size</attribute>
<attribute name="target" type="t">2</attribute> <!-- TOOL_SIZE_MEDIUM -->
</item>
<item>
<attribute name="label" translatable="yes">_thick</attribute>
<attribute name="action">win.tool-pen-size</attribute>
<attribute name="target" type="t">3</attribute> <!-- TOOL_SIZE_THICK -->
</item>
<item>
<attribute name="label" translatable="yes">ver_y thick</attribute>
<attribute name="action">win.tool-pen-size</attribute>
<attribute name="target" type="t">4</attribute> <!-- TOOL_SIZE_VERY_THICK -->
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">standard</attribute>
<attribute name="action">win.tool-pen-line-style</attribute>
<attribute name="target">plain</attribute>
</item>
<item>
<attribute name="label" translatable="yes">dashed</attribute>
<attribute name="action">win.tool-pen-line-style</attribute>
<attribute name="target">dash</attribute>
</item>
<item>
<attribute name="label" translatable="yes">dash-/ dotted</attribute>
<attribute name="action">win.tool-pen-line-style</attribute>
<attribute name="target">dashdot</attribute>
</item>
<item>
<attribute name="label" translatable="yes">dotted</attribute>
<attribute name="action">win.tool-pen-line-style</attribute>
<attribute name="target">dot</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Fi_ll</attribute>
<attribute name="action">win.tool-pen-fill</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Fill opacity</attribute>
<attribute name="action">win.tool-pen-fill-opacity</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">Eraser Optio_ns</attribute>
<section id="menu12">
<item>
<attribute name="label" translatable="yes">_very fine</attribute>
<attribute name="action">win.tool-eraser-size</attribute>
<attribute name="target" type="t">0</attribute> <!-- TOOL_SIZE_VERY_FINE -->
</item>
<item>
<attribute name="label" translatable="yes">_fine</attribute>
<attribute name="action">win.tool-eraser-size</attribute>
<attribute name="target" type="t">1</attribute> <!-- TOOL_SIZE_FINE -->
</item>
<item>
<attribute name="label" translatable="yes">_medium</attribute>
<attribute name="action">win.tool-eraser-size</attribute>
<attribute name="target" type="t">2</attribute> <!-- TOOL_SIZE_MEDIUM -->
</item>
<item>
<attribute name="label" translatable="yes">_thick</attribute>
<attribute name="action">win.tool-eraser-size</attribute>
<attribute name="target" type="t">3</attribute> <!-- TOOL_SIZE_THICK -->
</item>
<item>
<attribute name="label" translatable="yes">ver_y thick</attribute>
<attribute name="action">win.tool-eraser-size</attribute>
<attribute name="target" type="t">4</attribute> <!-- TOOL_SIZE_VERY_THICK -->
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_standard</attribute>
<attribute name="action">win.tool-eraser-type</attribute>
<attribute name="target" type="t">1</attribute> <!-- ERASER_TYPE_DEFAULT -->
</item>
<item>
<attribute name="label" translatable="yes">_whiteout</attribute>
<attribute name="action">win.tool-eraser-type</attribute>
<attribute name="target" type="t">2</attribute> <!-- ERASER_TYPE_WHITEOUT -->
</item>
<item>
<attribute name="label" translatable="yes">_delete strokes</attribute>
<attribute name="action">win.tool-eraser-type</attribute>
<attribute name="target" type="t">3</attribute> <!-- ERASER_TYPE_DELETE_STROKE -->
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">Highlighter Opti_ons</attribute>
<section id="menu13">
<item>
<attribute name="label" translatable="yes">_very fine</attribute>
<attribute name="action">win.tool-highlighter-size</attribute>
<attribute name="target" type="t">0</attribute> <!-- TOOL_SIZE_VERY_FINE -->
</item>
<item>
<attribute name="label" translatable="yes">_fine</attribute>
<attribute name="action">win.tool-highlighter-size</attribute>
<attribute name="target" type="t">1</attribute> <!-- TOOL_SIZE_FINE -->
</item>
<item>
<attribute name="label" translatable="yes">_medium</attribute>
<attribute name="action">win.tool-highlighter-size</attribute>
<attribute name="target" type="t">2</attribute> <!-- TOOL_SIZE_MEDIUM -->
</item>
<item>
<attribute name="label" translatable="yes">_thick</attribute>
<attribute name="action">win.tool-highlighter-size</attribute>
<attribute name="target" type="t">3</attribute> <!-- TOOL_SIZE_THICK -->
</item>
<item>
<attribute name="label" translatable="yes">ver_y thick</attribute>
<attribute name="action">win.tool-highlighter-size</attribute>
<attribute name="target" type="t">4</attribute> <!-- TOOL_SIZE_VERY_THICK -->
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Fi_ll</attribute>
<attribute name="action">win.tool-highlighter-fill</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Fill opacity</attribute>
<attribute name="action">win.tool-highlighter-fill-opacity</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">Select PDF Text Options</attribute>
<section>
<item>
<attribute name="label" translatable="yes">Marker Opacity</attribute>
<attribute name="action">win.tool-select-pdf-text-marker-opacity</attribute>
</item>
</section>
</submenu>
<item>
<attribute name="label" translatable="yes">Text Font...</attribute>
<attribute name="action">win.select-font</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;f</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Record / Stop</attribute>
<attribute name="action">win.audio-record</attribute>
<attribute name="class">audio</attribute> <!-- Gets removed when audio is disabled -->
</item>
<item>
<attribute name="label" translatable="yes">Pause</attribute>
<attribute name="action">win.audio-pause-playback</attribute>
<attribute name="class">audio</attribute> <!-- Gets removed when audio is disabled -->
</item>
<item>
<attribute name="label" translatable="yes">Stop</attribute>
<attribute name="action">win.audio-stop-playback</attribute>
<attribute name="class">audio</attribute> <!-- Gets removed when audio is disabled -->
</item>
<item>
<attribute name="label" translatable="yes">Forward</attribute>
<attribute name="action">win.audio-seek-forwards</attribute>
<attribute name="class">audio</attribute> <!-- Gets removed when audio is disabled -->
</item>
<item>
<attribute name="label" translatable="yes">Back</attribute>
<attribute name="action">win.audio-seek-backwards</attribute>
<attribute name="class">audio</attribute> <!-- Gets removed when audio is disabled -->
</item>
<item>
<attribute name="label" translatable="yes">Add/Edit TeX</attribute>
<attribute name="action">win.tex</attribute>
<attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;x</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="accel">&lt;Ctrl&gt;h</attribute>
<section id="menu3">
<item>
<attribute name="label" translatable="yes">Help</attribute>
<attribute name="action">win.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Run Gtk3 demo</attribute>
<attribute name="action">win.demo</attribute>
</item>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
<attribute name="hidden-when">macos-menubar</attribute>
</item>
</section>
</submenu>
</menu>
</interface>