public MenuUpdater(IAppContext context, PluginIdentity identity, List <string> commandKeys) : base(context, identity) { _map = context.MapControl.Map; _activeView = context.MapControl.Map as IActiveView; _commandKeys = commandKeys; }
public static void Init(object menuManager, object dockingManager, IMenuBase menuBase, IDockPanelCollection dockPanels, PluginIdentity pluginIdentity) { _menuManager = menuManager as MainFrameBarManager; _dockingManager = dockingManager as DockingManager; _menu = menuBase; _dockPanels = dockPanels; _pluginIdentity = pluginIdentity; if (_menuManager == null) { throw new ArgumentNullException("menuManager"); } if (_dockingManager == null) { throw new ArgumentNullException("dockingManager"); } if (_menu == null) { throw new ArgumentNullException("menuBase"); } if (_dockPanels == null) { throw new ArgumentNullException("menuBase"); } if (pluginIdentity == null) { throw new ArgumentNullException("pluginIdentity"); } InitToolbars(); InitWindows(); }
public IDockPanel Add(Control control, string key, PluginIdentity identity) { if (control == null) { throw new NullReferenceException(); } if (string.IsNullOrWhiteSpace(key)) { throw new ApplicationException("Dock panel must have a unique key."); } if (_dict.ContainsKey(control)) { throw new ApplicationException("This control has been already added as a docking window."); } control.Name = key; // to save / restore layout each dock panel must have a key _dockingManager.SetEnableDocking(control, true); _dict.Add(control, new DockPanelInfo(identity, key)); _styleService.ApplyStyle(control); return(GetDockPanel(control)); }
public void RemoveItemsForPlugin(PluginIdentity identity) { List <DockPanelInfo> panels = new List <DockPanelInfo>(); foreach (var p in _dict) { if (p.Key.Identity == identity) { panels.Add(p.Key); } } bool locked = _locked; if (!_locked) { Lock(); } foreach (var ctrl in panels) { // _dockingManager.SetEnableDocking(ctrl, false); _dict.Remove(ctrl); _dockingManager.RemovePanel(_dockingManager.Panels[ctrl.Key]); } if (!locked) { Unlock(); } }
internal static IStatusBar CreateStatusBar(object bar, PluginIdentity identity) { var menuIndex = new MenuIndex(MenuIndexType.StatusBar); var statusBar = new StatusBar(bar, menuIndex, identity); return(statusBar); }
public IMenuItem AddProgressBar(string key, PluginIdentity identity) { var item = new ToolStripProgressBar(); var menuItem = AddItem(item, identity, key, true); return(menuItem); }
public void RemoveItemsForPlugin(PluginIdentity identity) { var controls = new List <Control>(); foreach (var p in this) { if (_dict[p.Control].Identity == identity) { controls.Add(p.Control); } } bool locked = _locked; if (!_locked) { Lock(); } foreach (var ctrl in controls) { _dockingManager.SetEnableDocking(ctrl, false); _dict.Remove(ctrl); _mainForm.Controls.Remove(ctrl); } if (!locked) { Unlock(); } }
public PluginEventArgs(PluginIdentity identity) { if (identity == null) { throw new ArgumentNullException("identity"); } _identity = identity; }
public IDropDownMenuItem AddSplitButton(string text, string key, PluginIdentity identity) { if (!_topLevel) { return(null); } return(AddDropDownCore(new StatusStripSplitButton(), text, key, null, identity, false)); }
public IToolbar Add(string name, string key, PluginIdentity identity) { var bar = new Bar(_manager, name); int index = _manager.Bars.Add(bar); var cbr = _manager.GetBarControl(bar); cbr.Tag = new MenuItemMetadata(identity, key); return(this[index]); }
private void FirePluginUnloaded(PluginIdentity identity) { var handler = PluginUnloaded; if (handler != null) { handler.Invoke(this, new PluginEventArgs(identity)); } }
/// <summary> /// Initialize the toolbar. /// </summary> /// <param name="context"> /// The application context. /// </param> /// <param name="identity"> /// The plug-in identity. /// </param> private void InitToolbar(IAppContext context, PluginIdentity identity) { // Create a new toolbar var bar = context.Toolbars.Add("Template Plugin toolbar", identity); bar.DockState = ToolbarDockState.Top; // Add toolbar buttons, use MenuKeys to identify the buttons and add the command in MenuCommands: bar.Items.AddButton(_commands[MenuKeys.ShowDockableWindow]); }
public MenuItemMetadata(PluginIdentity identity, string key, bool dropDown = false) { if (identity == null) { throw new ArgumentNullException("identity"); } _identity = identity; _key = key; DropDown = dropDown; }
public override IMenuItem AddButton(string text, string key, Bitmap icon, PluginIdentity identity) { var item = new ToolStripMenuItem { Text = text }; var menuItem = AddItem(item, identity, key, false); MenuIcon.AssignIcon(menuItem, icon); return(menuItem); }
public override IMenuItem AddLabel(string text, string key, PluginIdentity identity) { var item = new StaticBarItem(text) { Padding = new Point(TOOLBAR_ITEM_PADDING_X, TOOLBAR_ITEM_PADDING_Y) }; var menuItem = AddItem(item, identity, key); return(menuItem); }
public override IMenuItem AddButton(string text, string key, Bitmap icon, PluginIdentity pluginIdentity) { var item = new BarItem(text) { Padding = new Point(TOOLBAR_ITEM_PADDING_X, TOOLBAR_ITEM_PADDING_Y) }; var menuItem = AddItem(item, pluginIdentity, key); MenuIcon.AssignIcon(menuItem, icon); return(menuItem); }
private IMenuItem AddCore(string text, string key, Bitmap icon, PluginIdentity identity, bool dropDown) { var item = new ToolStripMenuItem { Text = text, Image = icon, Tag = new MenuItemMetadata(identity, key, dropDown) }; return(AddItemCore(item, key, false, false)); }
/// <summary> /// The remove items for plugin. /// </summary> public void RemoveItemsForPlugin(PluginIdentity identity) { for (var i = _nodes.Count - 1; i >= 0; i--) { var tool = GetTool(_nodes[i]); if (tool != null && tool.PluginIdentity == identity) { _nodes.RemoveAt(i); } } }
private IDropDownMenuItem AddDropDownCore(ToolStripDropDownItem item, string text, string key, Bitmap icon, PluginIdentity identity, bool label) { item.Text = text; item.Padding = new Padding(ItemPadding); item.ImageScaling = ToolStripItemImageScaling.SizeToFit; var menuItem = AddItem(item, identity, key, label) as IDropDownMenuItem; MenuIcon.AssignIcon(menuItem, icon); return(menuItem); }
/// <summary> /// Initialize the new menu. /// </summary> /// <param name="context">The application context.</param> /// <param name="identity">The plug-in identity.</param> private static void InitMenu(IAppContext context, PluginIdentity identity) { var menu = context.Menu.Items.AddDropDown("Template", "_", identity); menu.Icon = new MenuIcon(Resources.template_icon); // template by LAFS from the Noun Project menu.SubItems.AddButton("Info", MenuKeys.ShowDockableWindow, identity); var submenu = menu.SubItems.AddDropDown("SubMenu", MenuKeys.SubMenu, identity); var btn = submenu.SubItems.AddButton("Foo", MenuKeys.Foo, identity); btn.Icon = new MenuIcon(Resources.hello_icon); // hello by Deemak Daksina from the Noun Project submenu.SubItems.AddButton("Bar", MenuKeys.Bar, identity); }
public DockPanelInfo(PluginIdentity identity, string key) { if (identity == null) { throw new ArgumentNullException("identity"); } if (string.IsNullOrWhiteSpace(key)) { throw new NullReferenceException(""); } Identity = identity; Key = key; }
/// <summary> /// Unloads single plugin and removes associated menus & toolbars /// </summary> /// <param name="identity">Plugin identity.</param> /// <param name="context">Application context.</param> /// <exception cref="System.ApplicationException">Plugin which requested for unloading isn't present in the list.</exception> public void UnloadPlugin(PluginIdentity identity, IAppContext context) { var plugin = _plugins.FirstOrDefault(p => p.Identity == identity); if (plugin == null) { throw new ApplicationException("Plugin which requested for unloading isn't present in the list."); } plugin.Terminate(); _active.Remove(identity); FirePluginUnloaded(identity); }
private void InitToolbar(IAppContext context, PluginIdentity identity) { var items = context.Toolbars.FileToolbar.Items; items.AddButton(_commands[MenuKeys.CreateLayer]).BeginGroup = true; context.Toolbars.FileToolbar.Update(); _toolbar = context.Toolbars.Add(ShapeEditorToolbar, identity); _toolbar.DockState = ToolbarDockState.Top; items = _toolbar.Items; items.AddButton(_commands[MenuKeys.LayerEdit]); items.AddButton(_commands[MenuKeys.GeometryCreate], true); items.AddButton(_commands[MenuKeys.VertexEditor]); items.AddButton(_commands[MenuKeys.SplitShapes], true); items.AddButton(_commands[MenuKeys.MergeShapes]); items.AddButton(_commands[MenuKeys.MoveShapes]); items.AddButton(_commands[MenuKeys.RotateShapes]); items.AddButton(_commands[MenuKeys.Copy], true); items.AddButton(_commands[MenuKeys.Paste]); items.AddButton(_commands[MenuKeys.Cut]); var dropDown = items.AddDropDown("Polygon Overlay", MenuKeys.PolygonOverlayDropDown, identity); dropDown.BeginGroup = true; dropDown.Icon = new MenuIcon(Resources.icon_geometry_erase_by_polygon); dropDown.SubItems.AddButton(_commands[MenuKeys.EraseByPolygon]); dropDown.SubItems.AddButton(_commands[MenuKeys.ClipByPolygon]); dropDown.SubItems.AddButton(_commands[MenuKeys.SplitByPolygon]); items.AddButton(_commands[MenuKeys.SplitByPolyline]); items.AddButton(_commands[MenuKeys.Undo], true); items.AddLabel("0/0", MenuKeys.HistoryLength, identity); items.AddButton(_commands[MenuKeys.Redo]); items.AddButton(_commands[MenuKeys.SnapToActiveLayer], true); items.AddButton(_commands[MenuKeys.SnapToAlLayers]); items.AddButton(_commands[MenuKeys.SnapToVertices], true); items.AddButton(_commands[MenuKeys.SnapToSegments]); _toolbar.Update(); }
public RibbonItem(YutaiCommand command) { IRibbonItem source = (IRibbonItem)command; this._name = source.Name; this._key = source.Key; this._caption = source.Caption; this._image = source.Image; this._tooltip = source.Tooltip; this._category = source.Category; this._checked = source.Checked; this._enabled = source.Enabled; this._itemType = source.ItemType; _pluginIdentity = source.PluginIdentity; }
public override IComboBoxMenuItem AddComboBox(string text, string key, PluginIdentity identity) { var item = new ComboBoxBarItem() { Padding = new Point(TOOLBAR_ITEM_PADDING_X, TOOLBAR_ITEM_PADDING_Y) }; var menuItem = AddItem(item, identity, key) as IComboBoxMenuItem; if (menuItem != null) { menuItem.Text = text; } return(menuItem); }
public void RemoveItemsForPlugin(PluginIdentity pluginIdentity) { //List<IRibbonMenuItem> _removes = new List<IRibbonMenuItem>(); //foreach (var item in _items) //{ // if (item.Item.PluginIdentity == pluginIdentity) // { // _removes.Add(item); // } //} //foreach (var key in _removes) //{ // _items.Remove(key); //} }
public RibbonMenuServiceBase(IAppContext context, PluginIdentity identity) { if (context == null) { throw new ArgumentNullException("context"); } if (identity == null) { throw new ArgumentNullException("identity"); } _context = context; _identity = identity; _ribbonManager = _context.RibbonMenu; }
public RibbonItem(IRibbonItem source, string newName) { this._name = newName; this._key = source.Key; this._caption = source.Caption; this._image = source.Image; this._tooltip = source.Tooltip; this._category = source.Category; //this._checked = source.Checked; //this._enabled = source.Enabled; this._itemType = source.ItemType; _pluginIdentity = source.PluginIdentity; _parentName = source.ParentName; _position = source.Position; }
public MenuServiceBase(IAppContext context, PluginIdentity identity) { if (context == null) { throw new ArgumentNullException("context"); } if (identity == null) { throw new ArgumentNullException("identity"); } _context = context; _identity = identity; _toolbars = context.Toolbars; _menu = context.Menu; }
/// <summary> /// Adds the specified item. /// </summary> public IToolboxGroup Add(string name, string key, PluginIdentity identity) { var metadata = new ToolboxGroupMetadata(key, name, identity); var node = new TreeNodeAdv { Tag = metadata, Text = metadata.Name, LeftImageIndices = new[] { (int)ToolIcon.Folder } }; _nodes.Add(node); node.Expanded = true; return(new ToolboxGroup(node)); }