Compare commits

...
2 Commits
Author SHA1 Message Date
shufeng2012 cf27e1e827 🏗️ 不用XML进行渲染了 2026-08-20 21:53:11 +08:00
shufeng2012 191a793a85 🍱 更新图标和名称 2026-08-18 21:10:34 +08:00
7 changed files with 899 additions and 1071 deletions

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
"string": [
{
"name": "app_name",
"value": "ohos_xournalpp"
"value": "Xournal++"
}
]
}
+896 -74
View File
@@ -1,7 +1,891 @@
import { UIComponent, analysisXML } from "../utils/XMLHandler";
import { common } from '@kit.AbilityKit';
import { util } from '@kit.ArkTS';
import { BusinessError } from '@kit.BasicServicesKit';
import { SymbolGlyphModifier } from "@kit.ArkUI";
@ComponentV2
struct FileMenu {
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "新建", labelInfo: "Ctrl+N" });
MenuItem({ content: "打开", labelInfo: "Ctrl+O" });
MenuItem({ content: "最近文档", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')) });
MenuItem({ content: "标注PDF" });
MenuItem({ content: "保存", labelInfo: "Ctrl+S" });
MenuItem({ content: "另存为", labelInfo: "Shift+Ctrl+S" });
}
MenuItemGroup() {
MenuItem({ content: "导出为PDF" });
MenuItem({ content: "导出为...", labelInfo: "Ctrl+E" });
}
MenuItemGroup() {
MenuItem({ content: "打印", labelInfo: "Ctrl+P" });
MenuItem({ content: "退出", labelInfo: "Ctrl+Q" });
}
}
}
build() {
Text("文件")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@ComponentV2
struct EditMenu {
@Local condition: boolean[] = [true, true];
@Builder
buildArrangeMenu() {
Menu() {
MenuItem({ content: "移到最前" });
MenuItem({ content: "上移一层" });
MenuItem({ content: "下移一层" });
MenuItem({ content: "移到最后" });
}
}
@Builder
buildToolMenu() {
Menu() {
MenuItemGroup() {}
MenuItemGroup() {
MenuItem({ content: "管理" });
MenuItem({ content: "设置" });
}
}
}
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "撤销", labelInfo: "Ctrl+Z" });
MenuItem({ content: "重复", labelInfo: "Shift+Ctrl+Z" });
}
MenuItemGroup() {
MenuItem({ content: "剪切", labelInfo: "Ctrl+X" });
MenuItem({ content: "拷贝", labelInfo: "Ctrl+C" });
MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" });
}
MenuItemGroup() {
MenuItem({ content: "全选", labelInfo: "Ctrl+A" });
}
MenuItemGroup() {
MenuItem({ content: "查找", labelInfo: "Ctrl+F" });
}
MenuItemGroup() {
MenuItem({ content: "删除", labelInfo: "Delete" });
}
MenuItemGroup() {
MenuItem({ content: "排列选择", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildArrangeMenu.bind(this) });
}
MenuItemGroup() {
MenuItem({ content: "上移选区图层" });
MenuItem({ content: "下移选区图层" });
}
MenuItemGroup() {
MenuItem({ content: "旋转吸附" })
.selected(this.condition[0])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.condition[0] = isSelected;
});
MenuItem({ content: "网格吸附" })
.selected(this.condition[1])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.condition[1] = isSelected;
});
}
MenuItemGroup() {
MenuItem({ content: "首选项" });
MenuItem({ content: "工具栏", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildToolMenu.bind(this) });
}
}
}
build() {
Text("编辑")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@ComponentV2
struct ViewMenu {
@Local menu1: boolean[] = [false, false, false];
@Local menu2: boolean[] = [true, true, false];
@Local condition: boolean = true;
@Local layout1: number = 1;
@Local layout2: number = 1;
@Local layout3: number = 1;
@Local row_col: number = 1;
@Builder
buildLayoutMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "水平" })
.selected(this.layout1 === 1)
.selectIcon(true)
.onChange(() => {
this.layout1 = 1;
})
MenuItem({ content: "垂直" })
.selected(this.layout1 === 2)
.selectIcon(true)
.onChange(() => {
this.layout1 = 2;
});
}
MenuItemGroup() {
MenuItem({ content: "水平" })
.selected(this.layout1 === 1)
.selectIcon(true)
.onChange(() => {
this.layout1 = 1;
})
MenuItem({ content: "垂直" })
.selected(this.layout1 === 2)
.selectIcon(true)
.onChange(() => {
this.layout1 = 2;
});
}
MenuItemGroup() {
MenuItem({ content: "从左到右" })
.selected(this.layout2 === 1)
.selectIcon(true)
.onChange(() => {
this.layout2 = 1;
})
MenuItem({ content: "从右到左" })
.selected(this.layout2 === 2)
.selectIcon(true)
.onChange(() => {
this.layout2 = 2;
});
}
MenuItemGroup() {
MenuItem({ content: "从上到下" })
.selected(this.layout3 === 1)
.selectIcon(true)
.onChange(() => {
this.layout3 = 1;
})
MenuItem({ content: "从下到上" })
.selected(this.layout3 === 2)
.selectIcon(true)
.onChange(() => {
this.layout3 = 2;
});
}
}
}
@Builder
buildColMenu() {
Menu() {
MenuItem({ content: "1列" })
.selected(this.row_col === 1)
.selectIcon(true)
.onChange(() => {
this.row_col = 1;
});
MenuItem({ content: "2列" })
.selected(this.row_col === 2)
.selectIcon(true)
.onChange(() => {
this.row_col = 2;
});
MenuItem({ content: "3列" })
.selected(this.row_col === 3)
.selectIcon(true)
.onChange(() => {
this.row_col = 3;
});
MenuItem({ content: "4列" })
.selected(this.row_col === 4)
.selectIcon(true)
.onChange(() => {
this.row_col = 4;
});
MenuItem({ content: "5列" })
.selected(this.row_col === 5)
.selectIcon(true)
.onChange(() => {
this.row_col = 5;
});
MenuItem({ content: "6列" })
.selected(this.row_col === 6)
.selectIcon(true)
.onChange(() => {
this.row_col = 6;
});
MenuItem({ content: "7列" })
.selected(this.row_col === 7)
.selectIcon(true)
.onChange(() => {
this.row_col = 7;
});
MenuItem({ content: "8列" })
.selected(this.row_col === 8)
.selectIcon(true)
.onChange(() => {
this.row_col = 8;
});
}
}
@Builder
buildRowMenu() {
Menu() {
MenuItem({ content: "1行" })
.selected(this.row_col === 9)
.selectIcon(true)
.onChange(() => {
this.row_col = 9;
});
MenuItem({ content: "2行" })
.selected(this.row_col === 10)
.selectIcon(true)
.onChange(() => {
this.row_col = 10;
});
MenuItem({ content: "3行" })
.selected(this.row_col === 11)
.selectIcon(true)
.onChange(() => {
this.row_col = 11;
});
MenuItem({ content: "4行" })
.selected(this.row_col === 12)
.selectIcon(true)
.onChange(() => {
this.row_col = 12;
});
MenuItem({ content: "5行" })
.selected(this.row_col === 13)
.selectIcon(true)
.onChange(() => {
this.row_col = 13;
});
MenuItem({ content: "6行" })
.selected(this.row_col === 14)
.selectIcon(true)
.onChange(() => {
this.row_col = 14;
});
MenuItem({ content: "7行" })
.selected(this.row_col === 15)
.selectIcon(true)
.onChange(() => {
this.row_col = 15;
});
MenuItem({ content: "8行" })
.selected(this.row_col === 16)
.selectIcon(true)
.onChange(() => {
this.row_col = 16;
});
}
}
@Builder
buildColRowMenu() {
Menu() {
MenuItem({ content: "设置列", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildColMenu.bind(this) });
MenuItem({ content: "设置行", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildRowMenu.bind(this) });
}
}
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "双页模式" })
.selected(this.menu1[0])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.menu1[0] = isSelected;
});
MenuItem({ content: "演讲模式", labelInfo: "F5" })
.selected(this.menu1[1])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.menu1[1] = isSelected;
});
MenuItem({ content: "全屏", labelInfo: "F11" })
.selected(this.menu1[2])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.menu1[2] = isSelected;
});
}
MenuItemGroup() {
MenuItem({ content: "显示工具栏", labelInfo: "F9" })
.selected(this.menu2[0])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.menu2[0] = isSelected;
});
MenuItem({ content: "显示菜单", labelInfo: "F10" })
.selected(this.menu2[1])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.menu2[1] = isSelected;
});
MenuItem({ content: "显示侧边栏", labelInfo: "F12" })
.selected(this.menu2[2])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.menu2[2] = isSelected;
});
}
MenuItemGroup() {
MenuItem({ content: "布局", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildLayoutMenu.bind(this) });
MenuItem({ content: "列/行", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildColRowMenu.bind(this) });
}
MenuItemGroup() {
MenuItem({ content: "放大", labelInfo: "Ctrl++" });
MenuItem({ content: "缩小", labelInfo: "Ctrl+-" });
MenuItem({ content: "正常大小" });
MenuItem({ content: "缩放至适合大小" })
.selected(this.condition)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.condition = isSelected;
});
}
}
}
build() {
Text("视图")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@ComponentV2
struct NavigationMenu {
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "首页", labelInfo: "Ctrl+Home" });
MenuItem({ content: "前一页", labelInfo: "Ctrl+Page Up" });
MenuItem({ content: "转到页面", labelInfo: "Ctrl+G" });
MenuItem({ content: "下一页", labelInfo: "Ctrl+Page Down" });
MenuItem({ content: "末页", labelInfo: "Ctrl+End" });
}
MenuItemGroup() {
MenuItem({ content: "上一个图层", labelInfo: "Shift+Page Down" });
MenuItem({ content: "下一个图层", labelInfo: "Shift+Page Up" });
MenuItem({ content: "顶层" });
}
MenuItemGroup() {
MenuItem({ content: "下一个标注页面", labelInfo: "Shift+Ctrl+Page Down" });
MenuItem({ content: "上一个标注页面", labelInfo: "Shift+Ctrl+Page Up" });
}
}
}
build() {
Text("导航")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@ComponentV2
struct PageMenu {
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "新建前页" });
MenuItem({ content: "新建后页", labelInfo: "Ctrl+D" });
MenuItem({ content: "新建尾页" });
MenuItem({ content: "复制页面" });
MenuItem({ content: "添加新的PDF页面" });
MenuItem({ content: "配置页模板" });
MenuItem({ content: "删除页面", labelInfo: "Shift+Ctrl+Delete" });
}
MenuItemGroup() {
MenuItem({ content: "在活动图层上方添加一个图层", labelInfo: "Ctrl+L" });
MenuItem({ content: "在活动图层下方添加一个图层" });
MenuItem({ content: "删除图层", labelInfo: "Shift+Ctrl+L" });
MenuItem({ content: "向下合并图层", labelInfo: "Ctrl+M" });
MenuItem({ content: "重命名图层", labelInfo: "Ctrl+R" });
}
MenuItemGroup() {
MenuItem({ content: "纸张样式" });
MenuItem({ content: "纸张颜色" });
MenuItem({ content: "纸张背景", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')) });
}
}
}
build() {
Text("页面")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@ComponentV2
struct ToolMenu {
@Local menu1: number = 1;
@Local draw_type: boolean[] = [false, false, false, false, false, false, false, false];
@Local set_square: boolean = false;
@Local compass: boolean = false;
@Local is_record: boolean = false;
@Local is_pause: boolean = false;
@Local pen_weight: number = 2;
@Local eraser_weight: number = 3;
@Local highlight_weight: number = 3;
@Local pen_style: number = 1;
@Local pen_fill: boolean = false;
@Local highlight_fill: boolean = false;
@Builder
buildDrawTypeMenu() {
Menu() {
MenuItem({ content: "形状识别", labelInfo: "Ctrl+1" })
.selected(this.draw_type[0])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[0] = isSelected;
});
MenuItem({ content: "绘制矩形", labelInfo: "Ctrl+2" })
.selected(this.draw_type[1])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[1] = isSelected;
});
MenuItem({ content: "绘制椭圆", labelInfo: "Ctrl+3" })
.selected(this.draw_type[2])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[2] = isSelected;
});
MenuItem({ content: "绘制箭头", labelInfo: "Ctrl+4" })
.selected(this.draw_type[3])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[3] = isSelected;
});
MenuItem({ content: "绘制双箭头", labelInfo: "Ctrl+5" })
.selected(this.draw_type[4])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[4] = isSelected;
});
MenuItem({ content: "绘制坐标系统", labelInfo: "Ctrl+6" })
.selected(this.draw_type[5])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[5] = isSelected;
});
MenuItem({ content: "绘制直线", labelInfo: "Ctrl+7" })
.selected(this.draw_type[6])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[6] = isSelected;
});
MenuItem({ content: "绘制样条曲线", labelInfo: "Ctrl+8" })
.selected(this.draw_type[7])
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.draw_type[7] = isSelected;
});
}
}
@Builder
buildPenMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "极细" })
.selected(this.pen_weight == 1)
.selectIcon(true)
.onChange(() => {
this.pen_weight = 1;
});
MenuItem({ content: "细" })
.selected(this.pen_weight == 2)
.selectIcon(true)
.onChange(() => {
this.pen_weight = 2;
});
MenuItem({ content: "中" })
.selected(this.pen_weight == 3)
.selectIcon(true)
.onChange(() => {
this.pen_weight = 3;
});
MenuItem({ content: "粗" })
.selected(this.pen_weight == 4)
.selectIcon(true)
.onChange(() => {
this.pen_weight = 4;
});
MenuItem({ content: "极粗" })
.selected(this.pen_weight == 5)
.selectIcon(true)
.onChange(() => {
this.pen_weight = 5;
});
}
MenuItemGroup() {
MenuItem({ content: "标准" })
.selected(this.pen_style == 1)
.selectIcon(true)
.onChange(() => {
this.pen_style = 1;
});
MenuItem({ content: "横虚线" })
.selected(this.pen_style == 2)
.selectIcon(true)
.onChange(() => {
this.pen_style = 2;
});
MenuItem({ content: "点划线" })
.selected(this.pen_style == 3)
.selectIcon(true)
.onChange(() => {
this.pen_style = 3;
});
MenuItem({ content: "点虚线" })
.selected(this.pen_style == 4)
.selectIcon(true)
.onChange(() => {
this.pen_style = 4;
});
}
MenuItemGroup() {
MenuItem({ content: "填充" })
.selected(this.pen_fill)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.pen_fill = isSelected;
});
MenuItem({ content: "填充不透明度" });
}
}
}
@Builder
buildEraserMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "极细" })
.selected(this.eraser_weight == 1)
.selectIcon(true)
.onChange(() => {
this.eraser_weight = 1;
});
MenuItem({ content: "细" })
.selected(this.eraser_weight == 2)
.selectIcon(true)
.onChange(() => {
this.eraser_weight = 2;
});
MenuItem({ content: "中" })
.selected(this.eraser_weight == 3)
.selectIcon(true)
.onChange(() => {
this.eraser_weight = 3;
});
MenuItem({ content: "粗" })
.selected(this.eraser_weight == 4)
.selectIcon(true)
.onChange(() => {
this.eraser_weight = 4;
});
MenuItem({ content: "极粗" })
.selected(this.eraser_weight == 5)
.selectIcon(true)
.onChange(() => {
this.eraser_weight = 5;
});
}
MenuItemGroup() {
MenuItem({ content: "标准" });
MenuItem({ content: "涂白" });
MenuItem({ content: "删除笔划" });
}
}
}
@Builder
buildHighLightMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "极细" })
.selected(this.highlight_weight == 1)
.selectIcon(true)
.onChange(() => {
this.highlight_weight = 1;
});
MenuItem({ content: "细" })
.selected(this.highlight_weight == 2)
.selectIcon(true)
.onChange(() => {
this.highlight_weight = 2;
});
MenuItem({ content: "中" })
.selected(this.highlight_weight == 3)
.selectIcon(true)
.onChange(() => {
this.highlight_weight = 3;
});
MenuItem({ content: "粗" })
.selected(this.highlight_weight == 4)
.selectIcon(true)
.onChange(() => {
this.highlight_weight = 4;
});
MenuItem({ content: "极粗" })
.selected(this.highlight_weight == 5)
.selectIcon(true)
.onChange(() => {
this.highlight_weight = 5;
});
}
MenuItemGroup() {
MenuItem({ content: "填充" })
.selected(this.highlight_fill)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.highlight_fill = isSelected;
});
MenuItem({ content: "填充不透明度" });
}
}
}
@Builder
buildPDFMenu() {
Menu() {
MenuItem({ content: "标记不透明度" });
}
}
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "画笔", labelInfo: "Shift+Ctrl+P" })
.selected(this.menu1 == 1)
.selectIcon(true)
.onChange(() => {
this.menu1 = 1;
});
MenuItem({ content: "橡皮", labelInfo: "Shift+Ctrl+E" })
.selected(this.menu1 == 2)
.selectIcon(true)
.onChange(() => {
this.menu1 = 2;
});
MenuItem({ content: "选择连续文本", labelInfo: "Shift+Ctrl+W" })
.selected(this.menu1 == 3)
.selectIcon(true)
.onChange(() => {
this.menu1 = 3;
});
MenuItem({ content: "在矩形中选择文本", labelInfo: "Shift+Ctrl+Y" })
.selected(this.menu1 == 4)
.selectIcon(true)
.onChange(() => {
this.menu1 = 4;
});
MenuItem({ content: "荧光笔", labelInfo: "Shift+Ctrl+H" })
.selected(this.menu1 == 5)
.selectIcon(true)
.onChange(() => {
this.menu1 = 5;
});
MenuItem({ content: "文本", labelInfo: "Shift+Ctrl+T" })
.selected(this.menu1 == 6)
.selectIcon(true)
.onChange(() => {
this.menu1 = 6;
});
MenuItem({ content: "图像", labelInfo: "Shift+Ctrl+I" })
.selected(this.menu1 == 7)
.selectIcon(true)
.onChange(() => {
this.menu1 = 7;
});
MenuItem({ content: "默认工具", labelInfo: "Shift+Ctrl+D" });
}
MenuItemGroup() {
MenuItem({ content: "绘制类型", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildDrawTypeMenu.bind(this) });
}
MenuItemGroup() {
MenuItem({ content: "选择矩形", labelInfo: "Shift+Ctrl+R" })
.selected(this.menu1 == 8)
.selectIcon(true)
.onChange(() => {
this.menu1 = 8;
});
MenuItem({ content: "选择区域", labelInfo: "Shift+Ctrl+G" })
.selected(this.menu1 == 9)
.selectIcon(true)
.onChange(() => {
this.menu1 = 9;
});
MenuItem({ content: "选择多层矩形" })
.selected(this.menu1 == 10)
.selectIcon(true)
.onChange(() => {
this.menu1 = 10;
});
MenuItem({ content: "选择多层区域" })
.selected(this.menu1 == 11)
.selectIcon(true)
.onChange(() => {
this.menu1 = 11;
});
MenuItem({ content: "选择对象", labelInfo: "Shift+Ctrl+O" })
.selected(this.menu1 == 12)
.selectIcon(true)
.onChange(() => {
this.menu1 = 12;
});
MenuItem({ content: "垂直间距", labelInfo: "Shift+Ctrl+V" })
.selected(this.menu1 == 13)
.selectIcon(true)
.onChange(() => {
this.menu1 = 13;
});
MenuItem({ content: "播放对象" })
.selected(this.menu1 == 14)
.selectIcon(true)
.onChange(() => {
this.menu1 = 14;
});
MenuItem({ content: "手形工具", labelInfo: "Shift+Ctrl+A" })
.selected(this.menu1 == 15)
.selectIcon(true)
.onChange(() => {
this.menu1 = 15;
});
MenuItem({ content: "三角板" })
.selected(this.set_square)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.set_square = isSelected;
});
MenuItem({ content: "圆规" })
.selected(this.compass)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.compass = isSelected;
});
}
MenuItemGroup() {
MenuItem({ content: "画笔选项", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildPenMenu.bind(this) });
MenuItem({ content: "橡皮选项", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildEraserMenu.bind(this) });
MenuItem({ content: "高亮选项", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildHighLightMenu.bind(this) });
MenuItem({ content: "选择PDF文件选项", symbolEndIcon: new SymbolGlyphModifier($r('sys.symbol.chevron_right')), builder: this.buildPDFMenu.bind(this) });
MenuItem({ content: "文本字体" });
MenuItem({ content: "录制/停止" })
.selected(this.is_record)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.is_record = isSelected;
});
MenuItem({ content: "暂停" })
.selected(this.is_pause)
.selectIcon(true)
.onChange((isSelected: boolean) => {
this.is_pause = isSelected;
});
MenuItem({ content: "停止" });
MenuItem({ content: "下一步" });
MenuItem({ content: "后退" });
MenuItem({ content: "插入/编辑TeX", labelInfo: "Shift+Ctrl+X" });
}
}
}
build() {
Text("工具")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@ComponentV2
struct PluginsMenu {
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "插件管理器" });
}
}
}
build() {
Text("插件")
.margin('12vp')
.bindMenu(this.buildMenu)
}
}
@ComponentV2
struct HelpMenu {
@Builder
buildMenu() {
Menu() {
MenuItemGroup() {
MenuItem({ content: "帮助" });
MenuItem({ content: "关于" });
}
}
}
build() {
Text("帮助")
.margin('12vp')
.bindMenu(this.buildMenu());
}
}
@@ -9,78 +893,16 @@ import { BusinessError } from '@kit.BasicServicesKit';
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())
FileMenu();
EditMenu();
ViewMenu();
NavigationMenu();
PageMenu();
ToolMenu();
PluginsMenu();
HelpMenu();
}
}
}
-120
View File
@@ -1,120 +0,0 @@
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, "");
}
+1 -1
View File
@@ -14,7 +14,7 @@
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:layered_image",
"icon": "$media:startIcon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
@@ -10,7 +10,7 @@
},
{
"name": "EntryAbility_label",
"value": "label"
"value": "Xournal++"
}
]
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 11 KiB

@@ -1,874 +0,0 @@
<?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>