private void AddButtons() { switch (App.ShowExtensionsDialogMode) { case ShowExtensionsDialogMode.Default: var simpleAction = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "Extension Manager...", ExtensionManager_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SmallImage = Resources.plugin_16x16, LargeImage = Resources.plugin_32x32, SortOrder = 100 }; App.HeaderControl.Add(simpleAction); //sample projects menu var simpleActionItem = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "Open sample project..", OpenSampleProjects_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SmallImage = Resources.plugin_16x16, LargeImage = Resources.plugin_32x32 }; App.HeaderControl.Add(simpleActionItem); break; case ShowExtensionsDialogMode.MapGlyph: var fun = new AppFunction { Manager = App, Map = App.Map }; App.Map.MapFunctions.Insert(0, fun); fun.Activate(); break; } }
private void AddButtons() { switch (App.ShowExtensionsDialog) { case ShowExtensionsDialog.Default: var simpleAction = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "Extension Manager...", ExtensionManager_Click); simpleAction.SmallImage = Resources.plugin_16x16; simpleAction.LargeImage = Resources.plugin_32x32; simpleAction.GroupCaption = HeaderControl.ApplicationMenuKey; simpleAction.SortOrder = 100; App.HeaderControl.Add(simpleAction); break; case ShowExtensionsDialog.MapGlyph: AppFunction fun = new AppFunction { Manager = App, Map = App.Map }; App.Map.MapFunctions.Insert(0, fun); fun.Activate(); break; case ShowExtensionsDialog.None: default: break; } }
public override void Add(SimpleActionItem item) { MenuItem menu = new MenuItem(item.Caption); menu.Name = item.Key; menu.Enabled = item.Enabled; menu.Visible = item.Visible; menu.Click += (sender, e) => item.OnClick(e); item.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SimpleActionItem_PropertyChanged); MenuItem root = null; if (!mainmenu.MenuItems.ContainsKey(item.RootKey)) { root = new MenuItem(item.RootKey); } else { root = mainmenu.MenuItems.Find(item.RootKey, true).ElementAt(0); } try { root.MenuItems.Add(menu); } catch (Exception e) { Debug.Print(e.StackTrace); } }
protected void AddHeaderRootItems() { App.HeaderControl.Add(new RootItem(MenuHeading, "Interpolation Tool")); IHeaderControl header = App.HeaderControl; SimpleActionItem auto = new SimpleActionItem(MenuHeading, "Kriging", Auto_Click); SimpleActionItem geo = new SimpleActionItem(MenuHeading, "Geostatistical Methods", Kriging_Click); SimpleActionItem det = new SimpleActionItem(MenuHeading, "Deterministic Methods", Deterministical_Click); geo.LargeImage = GeostatisticalTool.Properties.Resources.grid32G; det.LargeImage = GeostatisticalTool.Properties.Resources.grid32; header.Add(auto); header.Add(geo); header.Add(det); }
public override void Activate() { IHeaderControl header = App.HeaderControl; header.Add(new SimpleActionItem(rootKey, "补货烟道", StockChannelQuery_Click) { ToolTipText = "仓库补货烟道查询", GroupCaption = "作业查询", LargeImage = Resources.SconQuery_32 }); header.Add(new SimpleActionItem(rootKey, "分拣烟道", SortChannelQuery_Click) { ToolTipText = "分拣烟道查询", GroupCaption = "作业查询", LargeImage = Resources.SconQuery_32 }); header.Add(new SimpleActionItem(rootKey, "扫码状态", ScanQuery_Click) { ToolTipText = "扫码状态查询", GroupCaption = "状态查询", LargeImage = Resources.SconQuery_32 }); header.Add(new SimpleActionItem(rootKey, "订单状态", OrderQuery_Click) { ToolTipText = "订单状态查询", GroupCaption = "状态查询", LargeImage = Resources.SconQuery_32 }); actionItem[0]= new SimpleActionItem(rootKey, "刷新", StockChannelRefresh_Click) { ToolTipText = "刷新补货烟道",GroupCaption="补货烟道操作", LargeImage = Resources.refresh_32x32 }; actionItem[1] = new SimpleActionItem(rootKey, "刷新", SortChannelRefresh_Click) { ToolTipText = "刷新分拣烟道", GroupCaption = "分拣烟道操作", LargeImage = Resources.refresh_32x32 }; actionItem[2] = new SimpleActionItem(rootKey, "交换烟道", SortChannelSwap_Click) { GroupCaption = "交换分拣烟道", LargeImage = Resources.SortChannelSwap_32 }; actionItem[3] = new DropDownActionItem() { RootKey = rootKey, Caption = "选择扫码器:", Width = 200, NullValuePrompt = "请选择", GroupCaption = "订单操作" }; actionItem[4] = new SimpleActionItem(rootKey, "刷新", OrderStateRefresh_Click) { ToolTipText = "刷新订单状态", GroupCaption = "订单操作", LargeImage = Resources.refresh_32x32 }; actionItem[5] = new DropDownActionItem() { RootKey = rootKey, Caption = "选择扫码器:", Width = 170, NullValuePrompt = "请选择", GroupCaption = "扫码操作" }; actionItem[6] = new SimpleActionItem(rootKey, "刷新", ScanRefresh_Click) { ToolTipText = "刷新扫码状态", LargeImage = Resources.refresh_32x32, GroupCaption = "扫码操作" }; App.DockManager.PanelClosed += new EventHandler<DockablePanelEventArgs>(DockManager_PanelClosed); App.DockManager.ActivePanelChanged += new EventHandler<DockablePanelEventArgs>(DockManager_ActivePanelChanged); }
/// <summary> /// Initialize the DotSpatial plugin /// </summary> public override void Activate() { // Add Menu or Ribbon buttons. AddServiceDropDown(App.HeaderControl); _optionsAction = new SimpleActionItem("Configure", delegate { var p = CurrentProvider; if (p == null) return; var cf = p.Configure; if (cf != null) { if (cf()) { // Update map if configuration changed EnableBasemapFetching(p); } } }) { Key = "kOptions", RootKey = HeaderControl.HomeRootItemKey, GroupCaption = Properties.Resources.Panel_Name, Enabled = false, }; App.HeaderControl.Add(_optionsAction); AddOpaticyDropDown(App.HeaderControl); _serviceDropDown.SelectedValueChanged += ServiceSelected; _serviceDropDown.SelectedItem = _emptyProvider; //Add handlers for saving/restoring settings App.SerializationManager.Serializing += SerializationManagerSerializing; App.SerializationManager.Deserializing += SerializationManagerDeserializing; App.SerializationManager.NewProjectCreated += SerializationManagerNewProject; //Setup the background worker _bw = new BackgroundWorker { WorkerSupportsCancellation = true, WorkerReportsProgress = true }; _bw.DoWork += BwDoWork; _bw.RunWorkerCompleted += BwRunWorkerCompleted; _bw.ProgressChanged += BwProgressChanged; base.Activate(); }
private void AddMenuItems(IHeaderControl header) { // add sample menu items... if (header == null) return; const string SampleMenuKey = "kSample"; header.Add(new RootItem(SampleMenuKey, "MyPlugin")); SimpleActionItem alphaItem = new SimpleActionItem(SampleMenuKey, "Alpha", null) { Key = "kA" }; header.Add(alphaItem); header.Add(new SimpleActionItem(SampleMenuKey, "Bravo", null)); header.Add(new SimpleActionItem(SampleMenuKey, "Charlie", null)); header.Add(new MenuContainerItem(SampleMenuKey, "submenu", "B")); header.Add(new SimpleActionItem(SampleMenuKey, "submenu", "1", null)); SimpleActionItem item = new SimpleActionItem(SampleMenuKey, "submenu", "2", null); header.Add(item); header.Add(new SimpleActionItem(SampleMenuKey, "submenu", "3", null)); alphaItem.Enabled = false; header.Remove(item.Key); }
public override void Activate() { IHeaderControl header = App.HeaderControl; //header.Add(new SimpleActionItem(rootKey, "初始化", SRM_Click) { GroupCaption = "一号堆垛机", SmallImage = Resources.init_16x16, LargeImage = Resources.init_32x32 }); _btnAuto[0] = new SimpleActionItem(rootKey, "全自动", SRM_Click) { GroupCaption = "一号堆垛机", SmallImage = Resources.auto_full_16x16, LargeImage = Resources.auto_full_32x32 }; header.Add(_btnAuto[0]); _btnHand[0] = new SimpleActionItem(rootKey, "半自动", SRM_Click) { GroupCaption = "一号堆垛机", SmallImage = Resources.auto_semi_16x16, LargeImage = Resources.auto_semi_32x32 }; header.Add(_btnHand[0]); header.Add(new SimpleActionItem(rootKey, "故障复位", SRM_Click) { GroupCaption = "一号堆垛机", SmallImage = Resources.error_reset_16x16, LargeImage = Resources.error_reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "重发任务", SRM_Click) { GroupCaption = "一号堆垛机", SmallImage = Resources.reset_16x16, LargeImage = Resources.reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "取消任务", SRM_Click) { GroupCaption = "一号堆垛机", SmallImage = Resources.cancel_16x16, LargeImage = Resources.cancel_32x32 }); //header.Add(new SimpleActionItem(rootKey, "初始化", SRM_Click) { GroupCaption = "二号堆垛机", SmallImage = Resources.init_16x16, LargeImage = Resources.init_32x32 }); _btnAuto[1] = new SimpleActionItem(rootKey, "全自动", SRM_Click) { GroupCaption = "二号堆垛机", SmallImage = Resources.auto_full_16x16, LargeImage = Resources.auto_full_32x32 }; header.Add(_btnAuto[1]); _btnHand[1] = new SimpleActionItem(rootKey, "半自动", SRM_Click) { GroupCaption = "二号堆垛机", SmallImage = Resources.auto_semi_16x16, LargeImage = Resources.auto_semi_32x32 }; header.Add(_btnHand[1]); header.Add(new SimpleActionItem(rootKey, "故障复位", SRM_Click) { GroupCaption = "二号堆垛机", SmallImage = Resources.error_reset_16x16, LargeImage = Resources.error_reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "重发任务", SRM_Click) { GroupCaption = "二号堆垛机", SmallImage = Resources.reset_16x16, LargeImage = Resources.reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "取消任务", SRM_Click) { GroupCaption = "二号堆垛机", SmallImage = Resources.cancel_16x16, LargeImage = Resources.cancel_32x32 }); //header.Add(new SimpleActionItem(rootKey, "初始化", SRM_Click) { GroupCaption = "三号堆垛机", SmallImage = Resources.init_16x16, LargeImage = Resources.init_32x32 }); _btnAuto[2] = new SimpleActionItem(rootKey, "全自动", SRM_Click) { GroupCaption = "三号堆垛机", SmallImage = Resources.auto_full_16x16, LargeImage = Resources.auto_full_32x32 }; header.Add(_btnAuto[2]); _btnHand[2] = new SimpleActionItem(rootKey, "半自动", SRM_Click) { GroupCaption = "三号堆垛机", SmallImage = Resources.auto_semi_16x16, LargeImage = Resources.auto_semi_32x32 }; header.Add(_btnHand[2]); header.Add(new SimpleActionItem(rootKey, "故障复位", SRM_Click) { GroupCaption = "三号堆垛机", SmallImage = Resources.error_reset_16x16, LargeImage = Resources.error_reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "重发任务", SRM_Click) { GroupCaption = "三号堆垛机", SmallImage = Resources.reset_16x16, LargeImage = Resources.reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "取消任务", SRM_Click) { GroupCaption = "三号堆垛机", SmallImage = Resources.cancel_16x16, LargeImage = Resources.cancel_32x32 }); //header.Add(new SimpleActionItem(rootKey, "初始化", SRM_Click) { GroupCaption = "四号堆垛机", SmallImage = Resources.init_16x16, LargeImage = Resources.init_32x32 }); _btnAuto[3] = new SimpleActionItem(rootKey, "全自动", SRM_Click) { GroupCaption = "四号堆垛机", SmallImage = Resources.auto_full_16x16, LargeImage = Resources.auto_full_32x32 }; header.Add(_btnAuto[3]); _btnHand[3] = new SimpleActionItem(rootKey, "半自动", SRM_Click) { GroupCaption = "四号堆垛机", SmallImage = Resources.auto_semi_16x16, LargeImage = Resources.auto_semi_32x32 }; header.Add(_btnHand[3]); header.Add(new SimpleActionItem(rootKey, "故障复位", SRM_Click) { GroupCaption = "四号堆垛机", SmallImage = Resources.error_reset_16x16, LargeImage = Resources.error_reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "重发任务", SRM_Click) { GroupCaption = "四号堆垛机", SmallImage = Resources.reset_16x16, LargeImage = Resources.reset_32x32 }); header.Add(new SimpleActionItem(rootKey, "取消任务", SRM_Click) { GroupCaption = "四号堆垛机", SmallImage = Resources.cancel_16x16, LargeImage = Resources.cancel_32x32 }); }
public override void Add(SimpleActionItem item) { var menu = new IconMenuItem(item.Caption, item.SmallImage, (sender, e) => item.OnClick(e)) {Name = item.Key, Enabled = item.Enabled, Visible = item.Visible,}; item.PropertyChanged += SimpleActionItem_PropertyChanged; EnsureNonNullRoot(item); MenuItem root; if (item.MenuContainerKey == null) { root = !mainmenu.MenuItems.ContainsKey(item.RootKey) ? mainmenu.MenuItems[mainmenu.MenuItems.Add(new MenuItem(item.RootKey) {Name = item.RootKey})] : mainmenu.MenuItems.Find(item.RootKey, true)[0]; } else { root = mainmenu.MenuItems.Find(item.MenuContainerKey, true)[0]; } root.MenuItems.Add(menu); }
public override void Activate() { btnAuto = this.Add(new SimpleActionItem(rootKey, "全自动", btnAuto_Click) { SmallImage = Resources.auto_full_16x16, LargeImage = Resources.auto_full_32x32 }); btnHand = this.Add(new SimpleActionItem(rootKey, "半自动", btnHand_Click) { SmallImage = Resources.auto_semi_16x16, LargeImage = Resources.auto_semi_32x32 }); this.Add(new SimpleActionItem(rootKey, "故障复位", btReset_Click) { SmallImage = Resources.error_reset_16x16, LargeImage = Resources.error_reset_32x32 }); this.Add(new SimpleActionItem(rootKey, "重发任务", btResent_Click) { SmallImage = Resources.reset_16x16, LargeImage = Resources.reset_32x32 }); this.Add(new SimpleActionItem(rootKey, "取消任务", btCancel_Click) { SmallImage = Resources.cancel_16x16, LargeImage = Resources.cancel_32x32 }); dropItem = new DropDownActionItem() { RootKey = rootKey, GroupCaption = "选择堆垛机", Width = 170 }; foreach (var srm in SRMManager.SRMs) { dropItem.Items.Add(srm.Name); } this.Add(dropItem); dropItem.SelectedValueChanged += new EventHandler<SelectedValueChangedEventArgs>(dropItem_SelectedValueChanged); dropItem.DisplayText = "请选择堆垛机"; SRMManager.ActiveSRM = SRMManager.SRMs.FirstOrDefault(); if (SRMManager.ActiveSRM != null) { dropItem.SelectedItem = SRMManager.ActiveSRM.Name; } }
/// <summary> /// When the plugin is activated /// </summary> public override void Activate() { //try setting environment variables.. SpatiaLiteHelper.SetEnvironmentVars(); string spatiaLiteGroup = "SpatiaLite"; var bOpenLayer = new SimpleActionItem("Open Layer", ButtonClick) { LargeImage = Resources.spatialite_open_32, SmallImage = Resources.spatialite_open_16, ToolTipText = "Add Layer from SpatiaLite", GroupCaption = spatiaLiteGroup }; App.HeaderControl.Add(bOpenLayer); //query var bQuery = new SimpleActionItem("SpatiaLite Query", bQuery_Click) { LargeImage = Resources.spatialite_query_32, SmallImage = Resources.spatialite_query_16, ToolTipText = "Run SpatiaLite Query", GroupCaption = spatiaLiteGroup }; App.HeaderControl.Add(bQuery); //save layer (not implemented yet) var bSaveLayer = new SimpleActionItem("Save Layer", bSaveLayer_Click) { LargeImage = Resources.spatialite_save_32, SmallImage = Resources.spatialite_save_16, ToolTipText = "Save Layer to SpatiaLite Database", GroupCaption = spatiaLiteGroup }; App.HeaderControl.Add(bSaveLayer); base.Activate(); }
/// <summary> /// Determines whether [is for tool strip] being that it has an icon. Otherwise it should go on a menu. /// </summary> /// <param name="item">The item.</param> /// <returns> /// <c>true</c> if [is for tool strip] [the specified item]; otherwise, <c>false</c>. /// </returns> private static bool IsForMenuStrip(SimpleActionItem item) { return(item.SmallImage == null); }
/// <summary> /// This will add a new item that will appear on the standard toolbar or ribbon control. /// </summary> /// <param name="item">The item.</param> /// <returns>The added button.</returns> public override object Add(SimpleActionItem item) { ToolStripItem menu; if (IsForMenuStrip(item) || item.GroupCaption == ApplicationMenuKey) { menu = new ToolStripMenuItem(item.Caption) { Image = item.SmallImage }; } else { menu = new ToolStripButton(item.Caption) { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = item.SmallImage }; // we're grouping all Toggle buttons together into the same group. if (item.ToggleGroupKey != null) { var button = (ToolStripButton)menu; button.CheckOnClick = true; button.CheckedChanged += ButtonCheckedChanged; item.Toggling += (sender, args) => { UncheckButtonsExcept(button); button.Checked = !button.Checked; }; } } menu.Name = item.Key; menu.Enabled = item.Enabled; menu.Visible = item.Visible; menu.Click += (sender, e) => item.OnClick(e); EnsureNonNullRoot(item); var root = _menuStrip.Items[item.RootKey] as ToolStripDropDownButton; if (root == null) { // Temporarily create the root. root = CreateToolStripDropDownButton(new RootItem(item.RootKey, "AddRootItemWithKey " + item.RootKey)); } if (item.MenuContainerKey == null) { if (IsForMenuStrip(item) || item.GroupCaption == ApplicationMenuKey || item.GroupCaption == null) { root.DropDownItems.Add(menu); root.Visible = true; } else { var strip = GetOrCreateStrip(item.GroupCaption); strip?.Items.Add(menu); menu.ToolTipText = string.IsNullOrWhiteSpace(item.ToolTipText) == false ? item.ToolTipText : item.Caption; } } else { var subMenu = root.DropDownItems[item.MenuContainerKey] as ToolStripMenuItem; subMenu?.DropDownItems.Add(menu); } item.PropertyChanged += SimpleActionItemPropertyChanged; return(menu); }
//add a datasheet plugin root item public void AddRibbon(string sender) { locationTab = new RootItem(strPanelKey, strPanelCaption); locationTab.SortOrder = (short)pluginType; App.HeaderControl.Add(locationTab); //tell ProjMngr if this is being Shown if (sender == "Show") { //make this the selected root App.HeaderControl.SelectRoot(strPanelKey); } //section for working with data const string grpManipulate = "Waste time and space"; btnNull = new SimpleActionItem(strPanelKey, "Do nothing!", btnNull_Click); btnNull.LargeImage = Properties.Resources.USGS; btnNull.GroupCaption = grpManipulate; btnNull.Enabled = false; App.HeaderControl.Add(btnNull); //var validateBtn = new SimpleActionItem("Validate", btnValidate_Click) { RootKey = kVBLocation, ToolTipText = "Validate Data", LargeImage = Properties.Resources.validate }; //App.HeaderControl.Add(validateBtn); //var computeBtn = new SimpleActionItem("Compute", btnCompute_Click) { RootKey = kVBLocation, ToolTipText = "Compute" }; //App.HeaderControl.Add(computeBtn); //var manipulateBtn = new SimpleActionItem("Manipulate", btnManipulate_Click) { RootKey = kVBLocation, ToolTipText = "Manipulate", LargeImage = Properties.Resources.manipulate }; //App.HeaderControl.Add(manipulateBtn); //var transformBtn = new SimpleActionItem("Transform", btnTransform_Click) { RootKey = kVBLocation, ToolTipText = "Transform", LargeImage = Properties.Resources.transform }; //App.HeaderControl.Add(transformBtn); }
private void AddItems(IHeaderControl header) { // Root items header.Add(new RootItem(FileMenuKey, MessageStrings.File) { SortOrder = -20 }); header.Add(new RootItem(HomeMenuKey, MessageStrings.Home) { SortOrder = -10 }); // Menu items header.Add(new SimpleActionItem(FileMenuKey, Msg.File_New, NewProject_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 5, SmallImage = Images.document_empty_16x16, LargeImage = Images.document_empty_32x32, ToolTipText = Msg.FileNewToolTip }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Open, OpenProject_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 10, SmallImage = Images.folder_16x16, LargeImage = Images.folder_32x32, ToolTipText = Msg.FileOpenToolTip }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Save, SaveProject_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 15, SmallImage = Images.disk_16x16, LargeImage = Images.disk_32x32, }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_SaveAs, SaveProjectAs_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 20, SmallImage = Images.save_as_16x16, LargeImage = Images.save_as_32x32, ToolTipText = Msg.FileSaveAsToolTip }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Print, PrintLayout_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 40, SmallImage = Images.printer_16x16, LargeImage = Images.printer_32x32 }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Reset_Layout, ResetLayout_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 200, SmallImage = Images.layout_delete_16x16, LargeImage = Images.layout_delete_32x32 }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Exit, Exit_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 5000, }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Add_Layer, AddLayer_Click) { GroupCaption = Msg.Layers_Group, SmallImage = Images.layer_add_16x16, LargeImage = Images.layer_add_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Remove_Layer, RemoveLayer_Click) { GroupCaption = Msg.Layers_Group, SmallImage = Images.layer_remove_16x16, LargeImage = Images.layer_remove_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Pan, PanTool_Click) { Key = Msg.Pan, GroupCaption = Msg.View_Group, SmallImage = Images.hand_16x16, LargeImage = Images.hand_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_In, ZoomIn_Click) { Key = Msg.Zoom_In, GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_In_Tooltip, SmallImage = Images.zoom_in_16x16, LargeImage = Images.zoom_in_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_Out, ZoomOut_Click) { Key = Msg.Zoom_Out, GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_Out_Tooltip, SmallImage = Images.zoom_out_16x16, LargeImage = Images.zoom_out_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_To_Extents, ZoomToMaxExtents_Click) { GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_To_Extents_Tooltip, SmallImage = Images.zoom_extend_16x16, LargeImage = Images.zoom_extend_32x32 }); _ZoomPrevious = new SimpleActionItem(HomeMenuKey, Msg.Zoom_Previous, ZoomPrevious_Click) { GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_Previous_Tooltip, SmallImage = Images.zoom_to_previous_16, LargeImage = Images.zoom_to_previous, Enabled = false }; header.Add(_ZoomPrevious); _ZoomNext = new SimpleActionItem(HomeMenuKey, Msg.Zoom_Next, ZoomNext_Click) { GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_Next_Tooltip, SmallImage = Images.zoom_to_next_16, LargeImage = Images.zoom_to_next, Enabled = false }; header.Add(_ZoomNext); _ZoomToLayer = new SimpleActionItem(HomeMenuKey, Msg.Zoom_To_Layer, ZoomToLayer_Click) { GroupCaption = Msg.Zoom_Group, SmallImage = Images.zoom_layer_16x16, LargeImage = Images.zoom_layer_32x32 }; header.Add(_ZoomToLayer); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_To_Coordinates, Coordinates_Click) { GroupCaption = Msg.Zoom_Group, SmallImage = Images.zoom_coordinate_16x16, LargeImage = Images.zoom_coordinate_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Select, SelectionTool_Click) { Key = Msg.Select, GroupCaption = Msg.Map_Tools_Group, SmallImage = Images.select_16x16, LargeImage = Images.select_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Deselect, DeselectAll_Click) { Key = Msg.Deselect, GroupCaption = Msg.Map_Tools_Group, SmallImage = Images.deselect_16x16, LargeImage = Images.deselect_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Identify, IdentifierTool_Click) { GroupCaption = Msg.Map_Tools_Group, SmallImage = Images.info_rhombus_16x16, LargeImage = Images.info_rhombus_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); }
/// <summary> /// Adds the specified item. /// </summary> /// <param name="item">The item.</param> public abstract void Add(SimpleActionItem item);
//add a datasheet plugin root item public void AddRibbon(string sender) { rootDatasheetTab = new RootItem(strPanelKey, strPanelCaption); rootDatasheetTab.SortOrder = (short)pluginType; App.HeaderControl.Add(rootDatasheetTab); //tell ProjMngr if this is being Shown if (sender == "Show") { //make this the selected root App.HeaderControl.SelectRoot(strPanelKey); } //add sub-ribbons const string tGroupCaption = "Add"; btnImport = new SimpleActionItem(strPanelKey, "Import Data", btnImport_Click); btnImport.LargeImage = Properties.Resources.Import; btnImport.GroupCaption = tGroupCaption; btnImport.Enabled = true; App.HeaderControl.Add(btnImport); //section for validating const string grpValidate = "Validate"; btnValidate = new SimpleActionItem(strPanelKey, "Validate Data", btnValidate_Click); btnValidate.LargeImage = Properties.Resources.Validate; btnValidate.GroupCaption = grpValidate; btnValidate.Enabled = false; App.HeaderControl.Add(btnValidate); //section for working with data const string grpManipulate = "Work with Data"; btnComputeAO = new SimpleActionItem(strPanelKey, "Compute A O", _frmDatasheet.btnComputeAO_Click); btnComputeAO.LargeImage = Properties.Resources.Compute; btnComputeAO.GroupCaption = grpManipulate; btnComputeAO.Enabled = false; App.HeaderControl.Add(btnComputeAO); btnManipulate = new SimpleActionItem(strPanelKey, "Manipulate", _frmDatasheet.btnManipulate_Click); btnManipulate.LargeImage = Properties.Resources.Manipulate; btnManipulate.GroupCaption = grpManipulate; btnManipulate.Enabled = false; App.HeaderControl.Add(btnManipulate); btnTransform = new SimpleActionItem(strPanelKey, "Transform", _frmDatasheet.btnTransform_Click); btnTransform.LargeImage = Properties.Resources.Transform; btnTransform.GroupCaption = grpManipulate; btnTransform.Enabled = false; App.HeaderControl.Add(btnTransform); btnGoToModeling = new SimpleActionItem(strPanelKey, "Go To Model", btnGoToModeling_Click); btnGoToModeling.LargeImage = Properties.Resources.GoToModeling; btnGoToModeling.GroupCaption = grpManipulate; btnGoToModeling.Enabled = false; App.HeaderControl.Add(btnGoToModeling); }
/// <summary> /// Determines whether [is for tool strip] being that it has an icon. Otherwise it should go on a menu. /// </summary> /// <param name="item"> /// The item. /// </param> /// <returns> /// <c>true</c> if [is for tool strip] [the specified item]; otherwise, <c>false</c>. /// </returns> private static bool IsForMenuStrip(SimpleActionItem item) { return item.SmallImage == null; }
/// <summary> /// This will add a new item that will appear on the standard toolbar or ribbon control. /// </summary> /// <param name="item"> /// The item. /// </param> /// <remarks> /// </remarks> public override void Add(SimpleActionItem item) { ToolStripItem menu; if (IsForMenuStrip(item) || item.GroupCaption == ApplicationMenuKey) { menu = new ToolStripMenuItem(item.Caption) { Image = item.SmallImage }; } else { menu = new ToolStripButton(item.Caption) { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = item.SmallImage }; // we're grouping all Toggle buttons together into the same group. if (item.ToggleGroupKey != null) { var button = (ToolStripButton)menu; button.CheckOnClick = true; button.CheckedChanged += button_CheckedChanged; item.Toggling += (sender, args) => { UncheckButtonsExcept(button); button.Checked = !button.Checked; }; } } menu.Name = item.Key; menu.Enabled = item.Enabled; menu.Visible = item.Visible; menu.Click += (sender, e) => item.OnClick(e); EnsureNonNullRoot(item); var root = _menuStrip.Items[item.RootKey] as ToolStripDropDownButton; if (root == null) { // Temporarily create the root. root = CreateToolStripDropDownButton(new RootItem(item.RootKey, "AddRootItemWithKey " + item.RootKey)); } if (item.MenuContainerKey == null) { if (IsForMenuStrip(item) || item.GroupCaption == ApplicationMenuKey || item.GroupCaption == null) { root.DropDownItems.Add(menu); root.Visible = true; } else { var strip = GetOrCreateStrip(item.GroupCaption); if (strip != null) { strip.Items.Add(menu); } menu.ToolTipText = String.IsNullOrWhiteSpace(item.ToolTipText) == false ? item.ToolTipText : item.Caption; } } else { var subMenu = root.DropDownItems[item.MenuContainerKey] as ToolStripMenuItem; if (subMenu != null) { subMenu.DropDownItems.Add(menu); } } item.PropertyChanged += SimpleActionItem_PropertyChanged; }
private void AddMenus(IHeaderControl headerControl) { if (headerControl == null) return; var sai = new SimpleActionItem("Add BruTileLayer ...", OnInvokeBruTileLayerDialog); //sai.LargeImage = Properties.Resources.BruTileLogoBig; //sai.SmallImage = Properties.Resources.BruTileLogoSmall; sai.Caption = "Add BruTileLayer ..."; sai.GroupCaption = "Add Layer"; //sai.ShowInQuickAccessToolbar = true; headerControl.Add(sai); }
//add a datasheet plugin root item public void AddRibbon(string sender) { rootIPyPredictionTab = new RootItem(strPanelKey, strPanelCaption); rootIPyPredictionTab.SortOrder = (short)pluginType; App.HeaderControl.Add(rootIPyPredictionTab); //tell ProjMngr if this is being Shown if (sender == "Show") { //make this the selected root App.HeaderControl.SelectRoot(strPanelKey); } //add sub-ribbons const string rGroupCaption = "Predict"; btnImportIV = new SimpleActionItem(strPanelKey, "Import IVs", btnImportIV_Click); btnImportIV.LargeImage = Properties.Resources.ImportIV; btnImportIV.GroupCaption = rGroupCaption; btnImportIV.Enabled = true; App.HeaderControl.Add(btnImportIV); btnImportOB = new SimpleActionItem(strPanelKey, "Import OBs", btnImportOB_Click); btnImportOB.LargeImage = Properties.Resources.ImportOB; btnImportOB.GroupCaption = rGroupCaption; btnImportOB.Enabled = true; App.HeaderControl.Add(btnImportOB); btnIVDataVal = new SimpleActionItem(strPanelKey, "IV Data Validation", btnIVDataVal_Click); btnIVDataVal.LargeImage = Properties.Resources.IVDataVal; btnIVDataVal.GroupCaption = rGroupCaption; btnIVDataVal.Enabled = false; App.HeaderControl.Add(btnIVDataVal); btnMakePred = new SimpleActionItem(strPanelKey, "Make Predicitons", btnMakePrediction_Click); btnMakePred.LargeImage = Properties.Resources.MakePrediction; btnMakePred.GroupCaption = rGroupCaption; btnMakePred.Enabled = false; App.HeaderControl.Add(btnMakePred); //extra const string sGroupCaption = "Manipulate"; btnPlot = new SimpleActionItem(strPanelKey, "Plot", btnPlot_Ck); btnPlot.LargeImage = Properties.Resources.Plot; btnPlot.GroupCaption = sGroupCaption; btnPlot.Enabled = true; App.HeaderControl.Add(btnPlot); btnClear = new SimpleActionItem(strPanelKey, "Clear", btnClearTable_Ck); btnClear.LargeImage = Properties.Resources.Clear; btnClear.GroupCaption = sGroupCaption; btnClear.Enabled = true; App.HeaderControl.Add(btnClear); btnExportCSV = new SimpleActionItem(strPanelKey, "Export As CSV", btnExportTable_Ck); btnExportCSV.LargeImage = Properties.Resources.ExportAsCSV; btnExportCSV.GroupCaption = sGroupCaption; btnExportCSV.Enabled = true; App.HeaderControl.Add(btnExportCSV); }
/// <summary> /// Adds the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns>The added item.</returns> public abstract object Add(SimpleActionItem item);
/// <summary> /// Sets up the handler to respond to buttons pressed on a ribbon or toolbar. /// </summary> private void AddButtons() { const string ShapeEditorMenuKey = "kShapeEditor"; //_Header.Add(new RootItem(ShapeEditorMenuKey, "Shape Editing")); _Header.Add(new SimpleActionItem(ShapeEditorMenuKey, ShapeEditorResources.New, NewButton_Click) { GroupCaption = "Shape Editor", SmallImage = ShapeEditorResources.NewShapefile.ToBitmap(), RootKey = HeaderControl.HomeRootItemKey }); _addShape = new SimpleActionItem(ShapeEditorMenuKey, ShapeEditorResources.Add_Shape, AddShapeButton_Click) { GroupCaption = "Shape Editor", SmallImage = ShapeEditorResources.NewShape.ToBitmap(), RootKey = HeaderControl.HomeRootItemKey }; _Header.Add(_addShape); _Header.Add(new SimpleActionItem(ShapeEditorMenuKey, ShapeEditorResources.Move_Vertex, MoveVertexButton_Click) { GroupCaption = "Shape Editor", SmallImage = ShapeEditorResources.move, RootKey = HeaderControl.HomeRootItemKey }); _Header.Add(new SimpleActionItem(ShapeEditorMenuKey, ShapeEditorResources.Snapping, SnappingButton_Click) { GroupCaption = "Shape Editor", SmallImage = ShapeEditorResources.SnappingIcon.ToBitmap(), RootKey = HeaderControl.HomeRootItemKey }); }
public override void Activate() { //Add an Open button to the application ("File") menu. var btnOpen = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "Open", Open); btnOpen.GroupCaption = HeaderControl.ApplicationMenuKey; btnOpen.LargeImage = Resources.open_16x16; //btnOpen.SmallImage = Resources.open_16x16; btnOpen.ToolTipText = "Open a saved project."; App.HeaderControl.Add(btnOpen); //Add a Save button to the application ("File") menu. var btnSave = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "Save", Save); btnSave.GroupCaption = HeaderControl.ApplicationMenuKey; btnSave.LargeImage = Resources.Save16x16; //btnSave.SmallImage = Resources.save_16x16; btnSave.ToolTipText = "Save the current project state."; App.HeaderControl.Add(btnSave); //Add a Save As button to the application ("File") menu. var btnSaveAs = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "Save As", SaveAs); btnSaveAs.GroupCaption = HeaderControl.ApplicationMenuKey; btnSaveAs.LargeImage = Resources.SaveAs16x16; //btnSaveAs.SmallImage = Resources.open_16x16; btnSaveAs.ToolTipText = "test hide panel"; App.HeaderControl.Add(btnSaveAs); //Add an item to the application ("File") menu. var btnAbout = new SimpleActionItem(HeaderControl.ApplicationMenuKey, "About", AboutVirtualBeach); btnAbout.GroupCaption = HeaderControl.ApplicationMenuKey; btnAbout.LargeImage = Resources.About_16x16; //btnAbout.SmallImage = Resources.info_16x16; btnAbout.ToolTipText = "Open the 'About VirtualBeach' dialog."; App.HeaderControl.Add(btnAbout); //get plugin type for each plugin List<Globals.PluginType> lstAllPluginTypes = new List<Globals.PluginType>(); Globals.PluginType PType; foreach(DotSpatial.Extensions.IExtension ext in App.Extensions) { if (ext is IPlugin) { IPlugin plugType = (IPlugin)ext; //store pluginType PType = plugType.PluginType; lstAllPluginTypes.Add(PType); } } //if PType is smallest (datasheet/map), set as activated when open int pos = lstAllPluginTypes.IndexOf(lstAllPluginTypes.Min()); DotSpatial.Extensions.IExtension extension = App.Extensions.ElementAt(pos); IPlugin ex = (IPlugin)extension; ex.MakeActive(); //initialize only Datasheet is shown, all others are hidden foreach(DotSpatial.Extensions.IExtension x in App.Extensions) { if (x is IPlugin) { //hide the rest IPlugin pt = (IPlugin)x; if ((Int32)pt.PluginType > (Int32)Globals.PluginType.Datasheet) pt.Hide(); } } base.Activate(); }
//add a datasheet plugin root item public void AddRibbon(string sender) { rootHeaderItem = new RootItem(strPanelKey, strPanelCaption); rootHeaderItem.SortOrder = (short)pluginType; App.HeaderControl.Add(rootHeaderItem); //tell ProjMngr if this is being Shown if (sender == "Show") { //make this the selected root App.HeaderControl.SelectRoot(strPanelKey); } //add sub-ribbon string rGroupCaption = strPanelCaption; btnRun = new SimpleActionItem(strPanelKey, "Run", btnRun_Click); btnRun.LargeImage = Properties.Resources.Run; btnRun.GroupCaption = rGroupCaption; btnRun.Enabled = true; App.HeaderControl.Add(btnRun); btnCancel = new SimpleActionItem(strPanelKey, "Cancel", btnCancel_Click); btnCancel.LargeImage = Properties.Resources.Cancel; btnCancel.GroupCaption = rGroupCaption; btnCancel.Enabled = false; App.HeaderControl.Add(btnCancel); }
private void AddMenuItems() { IHeaderControl header = App.HeaderControl; header.Add(new SimpleActionItem(FileMenuKey, Msg.File_New, NewProject_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 5, SmallImage = Resources.document_empty_16x16, LargeImage = Resources.document_empty_32x32, ToolTipText = DotSpatial.Plugins.MenuBar.MessageStrings.FileNewToolTip }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Open, OpenProject_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 10, SmallImage = Resources.folder_16x16, LargeImage = Resources.folder_32x32, ToolTipText = DotSpatial.Plugins.MenuBar.MessageStrings.FileOpenToolTip }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Save, SaveProject_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 15, SmallImage = Resources.disk_16x16, LargeImage = Resources.disk_32x32, ShowInQuickAccessToolbar = Settings.Default.ShowSaveQuickAccessButton }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_SaveAs, SaveProjectAs_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 20, SmallImage = Resources.save_as_16x16, LargeImage = Resources.save_as_32x32, ToolTipText = DotSpatial.Plugins.MenuBar.MessageStrings.FileSaveAsToolTip }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Print, PrintLayout_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 40, SmallImage = Resources.printer_16x16, LargeImage = Resources.printer_32x32 }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Reset_Layout, ResetLayout_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 200, SmallImage = Resources.layout_delete_16x16, LargeImage = Resources.layout_delete_32x32 }); header.Add(new SimpleActionItem(FileMenuKey, Msg.File_Exit, Exit_Click) { GroupCaption = HeaderControl.ApplicationMenuKey, SortOrder = 5000, }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Add_Layer, AddLayer_Click) { GroupCaption = Msg.Layers_Group, SmallImage = Resources.layer_add_16x16, LargeImage = Resources.layer_add_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Remove_Layer, RemoveLayer_Click) { GroupCaption = Msg.Layers_Group, SmallImage = Resources.layer_remove_16x16, LargeImage = Resources.layer_remove_32x32 }); //header.Add(new SimpleActionItem(HomeMenuKey, Msg.Save_Layer, null) { GroupCaption = Msg.Layers_Group, SmallImage = Resources.layer_save_16x16, LargeImage = Resources.layer_save_32x32, Enabled = false }); //header.Add(new SimpleActionItem(HomeMenuKey, Msg.Pointer, PointerTool_Click) { GroupCaption = Msg.View_Group, SmallImage = Resources.cursor_arrow_16x16, LargeImage = Resources.cursor_arrow_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Pan, PanTool_Click) {Key = Msg.Pan, GroupCaption = Msg.View_Group, SmallImage = Resources.hand_16x16, LargeImage = Resources.hand_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_In, ZoomIn_Click) {Key = Msg.Zoom_In, GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_In_Tooltip, SmallImage = Resources.zoom_in_16x16, LargeImage = Resources.zoom_in_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_Out, ZoomOut_Click) {Key = Msg.Zoom_Out, GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_Out_Tooltip, SmallImage = Resources.zoom_out_16x16, LargeImage = Resources.zoom_out_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_To_Extents, ZoomToMaxExtents_Click) { GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_To_Extents_Tooltip, SmallImage = Resources.zoom_extend_16x16, LargeImage = Resources.zoom_extend_32x32 }); _ZoomPrevious = new SimpleActionItem(HomeMenuKey, Msg.Zoom_Previous, ZoomPrevious_Click) { GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_Previous_Tooltip, SmallImage = Resources.zoom_to_previous_16, LargeImage = Resources.zoom_to_previous, Enabled = false }; header.Add(_ZoomPrevious); _ZoomNext = new SimpleActionItem(HomeMenuKey, Msg.Zoom_Next, ZoomNext_Click) {GroupCaption = Msg.Zoom_Group, ToolTipText = Msg.Zoom_Next_Tooltip, SmallImage = Resources.zoom_to_next_16, LargeImage = Resources.zoom_to_next, Enabled = false }; header.Add(_ZoomNext); _ZoomToLayer = new SimpleActionItem(HomeMenuKey, Msg.Zoom_To_Layer, ZoomToLayer_Click) { GroupCaption = Msg.Zoom_Group, SmallImage = Resources.zoom_layer_16x16, LargeImage = Resources.zoom_layer_32x32}; header.Add(_ZoomToLayer); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Zoom_To_Coordinates, Coordinates_Click) { GroupCaption = Msg.Zoom_Group, SmallImage = Resources.zoom_coordinate_16x16, LargeImage = Resources.zoom_coordinate_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Select, SelectionTool_Click) {Key = Msg.Select, GroupCaption = Msg.Map_Tools_Group, SmallImage = Resources.select_16x16, LargeImage = Resources.select_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Deselect, DeselectAll_Click) { Key = Msg.Deselect, GroupCaption = Msg.Map_Tools_Group, SmallImage = Resources.deselect_16x16, LargeImage = Resources.deselect_32x32 }); header.Add(new SimpleActionItem(HomeMenuKey, Msg.Identify, IdentifierTool_Click) { GroupCaption = Msg.Map_Tools_Group, SmallImage = Resources.info_rhombus_16x16, LargeImage = Resources.info_rhombus_32x32, ToggleGroupKey = Msg.Map_Tools_Group }); }
private void AddMenuItems(IHeaderControl header) { SimpleActionItem contourerItem = new SimpleActionItem("Contour...", new EventHandler(menu_Click)) { Key = "kC" }; header.Add(contourerItem); }