1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| public static class CUITools { public static CustomizationSection AddCui(this Document doc, string cuiFile, string menuGroupName) { CustomizationSection cs; if (!File.Exists(cuiFile)) { cs = new CustomizationSection { MenuGroupName = menuGroupName }; cs.SaveAs(cuiFile); } else cs = new CustomizationSection(cuiFile); return cs; }
public static MenuMacro AddMacro(this CustomizationSection cs, string name, string command, string tag, string helpString, string imagePath) { MenuGroup menuGroup = cs.MenuGroup; MacroGroup mg = menuGroup.FindMacroGroup(menuGroup.Name); if (mg == null) mg = new MacroGroup(menuGroup.Name, menuGroup); foreach (MenuMacro macro in mg.MenuMacros) { if (macro.ElementID == tag) return null; } MenuMacro menuMacro = new MenuMacro(mg, name, command, tag); menuMacro.macro.HelpString = helpString; if (!string.IsNullOrWhiteSpace(imagePath) && File.Exists(imagePath)) menuMacro.macro.LargeImage = menuMacro.macro.SmallImage = imagePath; return menuMacro; }
public static PopMenu AddPopMenu(this MenuGroup menuGroup, string name, StringCollection aliasList, string tag) { PopMenu pm = null; if (menuGroup.PopMenus.IsNameFree(name)) pm = new PopMenu(name, aliasList, tag, menuGroup); return pm; }
public static PopMenuItem AddMenuItem(this PopMenu parentMenu, int index, string name, string macroId) { PopMenuItem newPmi = null; foreach (PopMenuItem pmi in parentMenu.PopMenuItems) if (pmi.Name == name) return newPmi; newPmi = new PopMenuItem(parentMenu, index); if (name != null) newPmi.Name = name; newPmi.MacroID = macroId; return newPmi; }
public static PopMenu AddSubMenu(this PopMenu parentMenu, int index, string name, string tag) { PopMenu pm = null; if (parentMenu.CustomizationSection.MenuGroup.PopMenus.IsNameFree(name)) { pm = new PopMenu(name, null, tag, parentMenu.CustomizationSection.MenuGroup); PopMenuRef menuRef = new PopMenuRef(pm, parentMenu, index); } return pm; }
public static PopMenuItem AddSeparator(this PopMenu parentMenu, int index) { return new PopMenuItem(parentMenu, index); } }
|