public MenuEditor(EIBMenuBar menuBar) { InitializeComponent(); if (menuBar != null) { currentMenuBar = menuBar; } ResetMenuEditor(menuBar); }
public static object CreateControl(string ctrlName, string partialName) { try { Control ctrl = null; //ToolStripMenuItem menu; //ToolStripButton menuItem; switch (ctrlName) { case "EIBButton": ctrl = new EIBButton(); break; case "EIBApplet": ctrl = new EIBApplet(); break; case "EIBLattice": ctrl = new EIBLattice(); break; case "EIBSchedular": ctrl = new EIBSchedular(); break; case "EIBDatePicker": ctrl = new EIBDatePicker(); break; case "EIBTime": ctrl = new EIBTime(); break; case "EIBCheckbox": ctrl = new EIBCheckbox(); break; case "EIBCombobox": ctrl = new EIBCombobox(); break; case "EIBLabel": ctrl = new EIBLabel(); break; case "EIBLine": ctrl = new EIBLine(); break; case "EIBPanel": ctrl = new EIBPanel(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBJasper": ctrl = new EIBJasper(); break; case "EIBRadioGroup": ctrl = new EIBRadioGroup(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBPicture": ctrl = new EIBPicture(); break; case "EIBRadioButton": ctrl = new EIBRadioButton(); break; case "EIBTabControl": ctrl = new EIBTabControl(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBTabPage": ctrl = new EIBTabPage(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBSearch": ctrl = new EIBSearch(); break; case "EIBListbox": ctrl = new EIBListbox(); break; case "EIBGrid": ctrl = new EIBGrid(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBTable": ctrl = new EIBTable(); break; case "EIBRelation": ctrl = new EIBRelation(); break; case "EIBTextBox": ctrl = new EIBTextBox(); break; case "EIBTreeView": ctrl = new EIBTreeView(); break; case "EIBMenuBar": ctrl = new EIBMenuBar(false); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBNode": ctrl = new EIBNode(); break; case "EIBNodeRelation": ctrl = new EIBNodeRelation(); break; case "EIBColumn": ctrl = new EIBColumn(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBScrollableRow": ctrl = new EIBScrollableRow(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBBrowse": ctrl = new EIBBrowse(); break; case "EIBVMenuBar": ctrl = new EIBVMenuBar(false); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBMenu": return new EIBMenu(); case "EIBMenuItem": return new EIBMenuItem(); /* case "EIBTreeNode": ctrl = new EIBTreeNode(); break; */ default: Assembly controlAsm = Assembly.LoadWithPartialName(partialName); Type controlType = controlAsm.GetType(partialName + "." + ctrlName); ctrl = (Control)Activator.CreateInstance(controlType); break; } return ctrl; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("create control failed:" + ex.Message); return new Control(); } }
public void handleDrag(object sender, EventArgs e, object panel, Point NewLocation) { EIBFormDesigner.Controls.EIBPanel panelNew = null; Button buttonObject = (Button)sender; string text = buttonObject.Text; Control ctrl = null; EIBMenu menu = null; EIBMenuItem menuItem = null; EIBTreeNode treeNode = null; bool isusercontrol = true; if (form.currentBaseWindow.TypeOfWindow == FormDesignerConstants.FormPattern) { #region Handling New Control Adding if (text.Trim().Equals(FormDesignerConstants.PlaceHolderControl)) { ctrl = (EIBPlaceHolder)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.LabelControl)) { ctrl = (EIBLabel)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.FrameControl)) { ctrl = (EIBPanel)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.JasperControl)) { ctrl = (EIBJasper)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.RadioGroupControl)) { ctrl = (EIBRadioGroup)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.TextBoxControl)) { ctrl = (EIBTextBox)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.ButtonControl)) { ctrl = (EIBButton)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.DatePickerControl)) { ctrl = (EIBDatePicker)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.TimeControl)) { ctrl = (EIBTime)toolBox.getControlType(text.Trim()); ((EIBTime)ctrl).setTime("0:0:0"); ((EIBTime)ctrl).ShowTimeSplit(); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.BrowseControl)) { ctrl = (EIBBrowse)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.ImageBrowseControl)) { ctrl = (EIBImageBrowse)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.TreeControl)) { ctrl = (EIBTreeView)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.GridControl)) { ctrl = (EIBGrid)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.MultiTabControl)) { ctrl = (EIBTabControl)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); foreach (EIBTabPage page in ((EIBTabControl)ctrl).TabPages) { addPropertiesControl(page); } isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.TabPage)) { ctrl = (EIBTabPage)toolBox.getControlType(text.Trim()); if (ctrl is EIBTabPage) { ctrl.Text = ctrl.Name; } isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.PictureControl)) { ctrl = (EIBPicture)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.CheckboxControl)) { ctrl = (EIBCheckbox)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.RadioControl)) { ctrl = (EIBRadioButton)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.ComboControl)) { ctrl = (EIBCombobox)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.PagingControl)) { ctrl = (EIBPaging)toolBox.getControlType(text.Trim()); isusercontrol = false; } /*if (text.Trim().Equals(FormDesignerConstants.MenuBarControl)) { ctrl = (EIBMenuBar)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; }*/ if (text.Trim().Equals(FormDesignerConstants.MenuBarControl)) { ctrl = (EIBVMenuBar)toolBox.getControlType(text.Trim()); DragDropHandler.RegisterControl(ctrl, true, true); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.CalenderControl)) { ctrl = (EIBCalender)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.SchedularControl)) { ctrl = (EIBSchedular)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.AppletControl)) { ctrl = (EIBApplet)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.LatticeControl)) { ctrl = (EIBLattice)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.SearchControl)) { //Handle Search ctrl = (EIBSearch)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.ListControl)) { //Handle Menu ctrl = (EIBListbox)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.MenuControl)) { //Handle Menu menu = (EIBMenu)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.MenuItemControl)) { //Handle Menu menuItem = (EIBMenuItem)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.TreeNodeControl)) { treeNode = (EIBTreeNode)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.RowControl)) { ctrl = (EIBRow)toolBox.getControlType(text.Trim()); if (currentControl[0] is EIBGrid) { EIBGrid tablePanel = (EIBGrid)currentControl[0]; //tablePanel.SuspendLayout(); EIBRow rowTable = (EIBRow)ctrl; rowTable.BackColor = Color.Coral; //rowTable.HeightPercent = 0; rowTable.HeightPixel = 30; rowTable.HeightTyp = EIBRow.HeightMeasurement.Pixel; tablePanel.Rows.Add(rowTable); DragDropHandler.RegisterControl(ctrl, true, true); } if (currentControl[0] is EIBLattice) { EIBLattice tablePanel = (EIBLattice)currentControl[0]; //tablePanel.SuspendLayout(); EIBRow rowTable = (EIBRow)ctrl; rowTable.BackColor = Color.Coral; //rowTable.HeightPercent = 0; rowTable.HeightPixel = 30; rowTable.HeightTyp = EIBRow.HeightMeasurement.Pixel; tablePanel.Rows.Add(rowTable); DragDropHandler.RegisterControl(ctrl, true, true); } isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.ColumnControl)) { ctrl = (EIBColumn)toolBox.getControlType(text.Trim()); if (currentControl[0] is EIBRow && ((EIBRow)currentControl[0]).Parent is EIBGrid) { EIBColumn columnTable = (EIBColumn)ctrl; columnTable.BackColor = Color.Aqua; columnTable.WidthPixel = 50; columnTable.WidthType = WidthMeasurement.Pixel; EIBRow rowTable = (EIBRow)currentControl[0]; rowTable.Columns.Add(columnTable); DragDropHandler.RegisterControl(ctrl, true, true); } isusercontrol = false; /* if (currentControl is EIBGrid) { TableLayoutPanel tableLayoutPanel = (TableLayoutPanel)currentControl; tableLayoutPanel.ColumnCount = tableLayoutPanel.ColumnCount + 1; ColumnStyle colStyle = new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100); tableLayoutPanel.ColumnStyles.Add(colStyle); } */ } if (text.Trim().Equals(FormDesignerConstants.LineControl)) { ctrl = (EIBLine)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.ConnectorControl)) { ctrl = (EIBLine)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (isusercontrol && !text.Trim().Equals(FormDesignerConstants.NodeControl) && !text.Trim().Equals(FormDesignerConstants.NodeConnectorControl) && !text.Trim().Equals(FormDesignerConstants.TableControl) && !text.Trim().Equals(FormDesignerConstants.RelationControl)) { if (text != form.currentBaseWindow.UniqueID) { if (panel is EIBPlaceHolder) { if (!((EIBPlaceHolder)panel).CheckifAlreadyHave(text)) { ctrl = (EIBItem)toolBox.getControlType("Item"); ((EIBItem)ctrl).Reference = text; ((EIBItem)ctrl).Text = text; } else { MessageBox.Show("Already contains a usercontrol " + text); } } else { MessageBox.Show("Draw a placeholder to have usercontrol"); } } else { MessageBox.Show("You can not drag same usercontrol on same form pattern."); } } if (form.CurrentBaseWindow != null) { form.CurrentBaseWindow.baseFrame.Focus(); } #endregion } else if (form.currentBaseWindow.TypeOfWindow == FormDesignerConstants.WorkflowPattern) { isusercontrol = false; if (text.Trim().Equals(FormDesignerConstants.NodeControl)) { ctrl = (EIBNode)toolBox.getControlType(text.Trim()); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.NodeConnectorControl)) { //ctrl = (EIBRelation)toolBox.getControlType(text.Trim()); NodeRelationManager relationManager = new NodeRelationManager(); relationManager.currentBaseWindow = form.currentBaseWindow; relationManager.loadWorkflowNodes(form.currentBaseWindow.baseFrame); relationManager.ShowDialog(form); isusercontrol = false; return; } } else if (form.currentBaseWindow.TypeOfWindow == FormDesignerConstants.DataPattern) { if (text.Trim().Equals(FormDesignerConstants.TableControl)) { ctrl = (EIBTable)toolBox.getControlType(text.Trim()); ((EIBTable)ctrl).DatabaseDataSet = form.currentBaseWindow.DatabaseDataSet; ((TableUserControl)ctrl).afterDragDrop(); isusercontrol = false; } if (text.Trim().Equals(FormDesignerConstants.RelationControl)) { //ctrl = (EIBRelation)toolBox.getControlType(text.Trim()); RelationshipManager relationManager = new RelationshipManager(); relationManager.DatabaseDataSet = form.currentBaseWindow.DatabaseDataSet; relationManager.loadDatabaseTable(form.currentBaseWindow.baseFrame); relationManager.ShowDialog(form); isusercontrol = false; return; } } //userpattern code. //isusercontrol = false; #region Associate Other Operation. if (!form.CurrentBaseWindow.baseFrame.isMouseClick) { form.currentBaseWindow.baseFrame.MouseClick += new MouseEventHandler(handleControlClick); form.CurrentBaseWindow.baseFrame.isMouseClick = true; } if (ctrl != null) { pickBox.Add((IEIBControl)ctrl, new PickBox()); foreach (IEIBControl ctl in currentControl) { if (ctl is TreeNode) { if (((TreeNode)ctl).TreeView != null) { if (pickBox.ContainsKey((IEIBControl)((TreeNode)ctl).TreeView)) pickBox[(IEIBControl)((TreeNode)ctl).TreeView].HideHandles(); } } else { if (pickBox.ContainsKey((IEIBControl)ctl)) pickBox[ctl].HideHandles(); } } //if (panel is EIBPlaceHolder) //{ // parentPanel = (EIBPlaceHolder)panel; // if (ctrl is EIBMenuBar) // { // ((EIBMenuBar)ctrl).Location = new Point(0, 0); // ((EIBMenuBar)ctrl).Height = 25; // ((EIBMenuBar)ctrl).Width = parentPanel.Width; // ((EIBMenuBar)ctrl).Dock = DockStyle.Top; // ((EIBMenuBar)ctrl).Locked = true; // } // parentPanel.Controls.Add(ctrl); //} if (panel is EIBPanel) { if (!(panel is EIBTabControl)) { if (ctrl is TabPage) { if (EIBControlCollection.TabPagelist.ContainsKey(ctrl.Text.Trim())) { EIBControlCollection.TabPagelist.Remove(ctrl.Text.Trim()); return; } } } parentPanel = (EIBPanel)panel; if (ctrl is EIBMenuBar) { ((EIBMenuBar)ctrl).Location = new Point(0, 0); ((EIBMenuBar)ctrl).Height = 25; ((EIBMenuBar)ctrl).Width = parentPanel.Width; ((EIBMenuBar)ctrl).Dock = DockStyle.Top; ((EIBMenuBar)ctrl).Locked = true; } parentPanel.Controls.Add(ctrl); } else if (panel is EIBTabControl) { parentPanel = (EIBTabControl)panel; EIBTabControl parentTabPanel = (EIBTabControl)panel; if (ctrl is TabPage) { parentTabPanel.TabPages.Add((EIBTabPage)ctrl); } else { if (parentTabPanel.SelectedTab != null) { parentTabPanel.SelectedTab.Controls.Add(ctrl); } } } else if (panel is EIBColumn) { EIBColumn column = (EIBColumn)panel; try { column.Controls.Add(ctrl); } catch (Exception ex) { MessageBox.Show(ex.Message[0].ToString()); } } else if (panel is EIBRow) { EIBRow row = (EIBRow)panel; if (row.Parent is EIBLattice) { try { row.Controls.Add(ctrl); } catch (Exception ex) { MessageBox.Show(ex.Message[0].ToString()); } } } else if (panel is EIBRadioGroup) { parentPanel = (EIBRadioGroup)panel; if (ctrl is EIBRadioButton) { parentPanel.Controls.Add(ctrl); } } else if (panel is EIBPlaceHolder) { parentPanel = (EIBPlaceHolder)panel; if (ctrl is EIBItem) { parentPanel.Controls.Add(ctrl); } else { MessageBox.Show("You can not drag controls in placeholders"); return; } } ctrl.Cursor = Cursors.HSplit; if (!(ctrl is EIBMenuBar || ctrl is EIBRow || ctrl is EIBColumn)) { ctrl.Left = NewLocation.X + 2; ctrl.Top = NewLocation.Y + 2; } addPropertiesControl(ctrl); //Redo Undo Action form.History.Do(new AddControlMemento()); form.Controlpool.Add((IEIBControl)ctrl,form.CurrentBaseWindow); /*******/ List<IEIBControl> collectionControl = new List<IEIBControl>(); collectionControl.Add((IEIBControl)ctrl); propertiesManager.displayProperties(form.propertyWindow,collectionControl); if (!(ctrl is EIBRow || ctrl is EIBColumn)) { pickBox[(IEIBControl)ctrl].SelectControl(ctrl, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); } } #endregion #region Other Operation if (menu != null) { if (currentControl.Count == 1) { if (currentControl[0] is EIBMenuBar) { currentControl.Clear(); currentControl.Add((IEIBControl)menu); menu.Text = "Menu"; parentMenuBar = (EIBMenuBar)panel; //parentMenuBar.CurrentToolStrip.Items.Add(menu); if (parentMenuBar.CurrentToolStrip == null) { if(parentMenuBar.Controls.Count >0) { parentMenuBar.CurrentToolStrip = (ToolStrip)parentMenuBar.Controls[0]; } } parentMenuBar.CurrentToolStrip.Items.Add(menu); parentMenuBar.CurrentMenu = menu; menu.Click += new EventHandler(handleMenuClick); propertiesManager.displayProperties(form.propertyWindow, currentControl); formulaManager.displayFormulaProperties(form.formulaEditor, currentControl[0]); } else if (currentControl[0] is EIBVMenuBar) { currentControl.Clear(); currentControl.Add((IEIBControl)menu); menu.Text = "Menu"; if (panel is EIBVMenuBar) { ((EIBVMenuBar)panel).Items.Add(menu); ((EIBVMenuBar)panel).CurrentMenu = menu; menu.Click += new EventHandler(handleMenuClick); propertiesManager.displayProperties(form.propertyWindow, currentControl); formulaManager.displayFormulaProperties(form.formulaEditor, currentControl[0]); } } else if (currentControl[0] is EIBMenu) { EIBMenu myselectedmenu = (EIBMenu)currentControl[0]; currentControl.Clear(); currentControl.Add((IEIBControl)menu); menu.Text = myselectedmenu.Text + "submenu"; if (panel is EIBMenuBar) { parentMenuBar = (EIBMenuBar)panel; //parentMenuBar.CurrentToolStrip.Items.Add(menu); parentMenuBar.CurrentMenu.DropDownItems.Add(menu); } else if (panel is EIBVMenuBar) { ((EIBVMenuBar)panel).CurrentMenu.DropDownItems.Add(menu); } menu.Click += new EventHandler(handleMenuClick); propertiesManager.displayProperties(form.propertyWindow, currentControl); formulaManager.displayFormulaProperties(form.formulaEditor, currentControl[0]); } } } if (menuItem != null) { if (currentControl[0] is EIBMenuBar) { /*currentControl.Clear(); currentControl.Add((IEIBControl)menu); menu.Text = "Menu"; parentMenuBar = (EIBMenuBar)panel; //parentMenuBar.CurrentToolStrip.Items.Add(menu); if (parentMenuBar.CurrentToolStrip == null) { if (parentMenuBar.Controls.Count > 0) { parentMenuBar.CurrentToolStrip = (ToolStrip)parentMenuBar.Controls[0]; } } parentMenuBar.CurrentToolStrip.Items.Add(menu); parentMenuBar.CurrentMenu = menu; menu.Click += new EventHandler(handleMenuClick); propertiesManager.displayProperties(form.propertyWindow, currentControl); formulaManager.displayFormulaProperties(form.formulaEditor, currentControl[0]); */ } else if (currentControl[0] is EIBVMenuBar) { currentControl.Clear(); currentControl.Add((IEIBControl)menuItem); menuItem.Text = "MenuItem"; if (panel is EIBVMenuBar) { if (((EIBVMenuBar)panel).CurrentMenu != null) { ((EIBVMenuBar)panel).CurrentMenu.DropDownItems.Add(menuItem); ((EIBVMenuBar)panel).CurrentMenu.CurrentMenuItem = menuItem; menuItem.Click += new EventHandler(handleMenuItemClick); propertiesManager.displayProperties(form.propertyWindow, currentControl); formulaManager.displayFormulaProperties(form.formulaEditor, currentControl[0]); } else { MessageBox.Show("Please select a menu."); } } } else if (currentControl[0] is EIBMenu) { EIBMenu myselectedmenu = (EIBMenu)currentControl[0]; currentControl.Clear(); currentControl.Add((IEIBControl)menuItem); menuItem.Text = myselectedmenu.Text + "submenuitem"; if (panel is EIBVMenuBar) { ((EIBVMenuBar)panel).CurrentMenu.DropDownItems.Add(menuItem); } menuItem.Click += new EventHandler(handleMenuItemClick); propertiesManager.displayProperties(form.propertyWindow, currentControl); formulaManager.displayFormulaProperties(form.formulaEditor, currentControl[0]); } } if (treeNode != null && (currentControl[0] is EIBTreeView)) { EIBTreeView treeView = (EIBTreeView)currentControl[0]; treeView.Nodes.Add(treeNode); IEIBControl currentEIBControl = (IEIBControl)treeNode; form.currentBaseWindow.CurrentControl.Clear(); form.currentBaseWindow.CurrentControl.Add(currentEIBControl); currentControl.Clear(); currentControl.Add(treeNode) ; propertiesManager.displayProperties(form.propertyWindow, treeNode); formulaManager.displayFormulaProperties(form.formulaEditor, currentEIBControl); } if (treeNode != null && (currentControl[0] is EIBTreeNode)) { EIBTreeNode treeNodeParent = (EIBTreeNode)currentControl[0]; if (!treeNodeParent.Equals(treeNode)) { treeNodeParent.Nodes.Add(treeNode); } IEIBControl currentEIBControl = (IEIBControl)treeNode; form.currentBaseWindow.CurrentControl.Clear(); form.currentBaseWindow.CurrentControl.Add(currentEIBControl) ; currentControl.Clear(); currentControl.Add(treeNode); propertiesManager.displayProperties(form.propertyWindow, treeNode); formulaManager.displayFormulaProperties(form.formulaEditor, currentEIBControl); } LoadControls(form.currentBaseWindow.baseFrame); form.Invalidate(); form.ResumeLayout(false); #endregion }
public void handleMenuClick(object sender, EventArgs e) { EIBMenu menu = null; if (sender is EIBMenuBar) { EIBMenuBar menuBar = (EIBMenuBar)sender; parentMenuBar = menuBar; menu = menuBar.CurrentMenu; } else if (sender is EIBMenu) { menu = (EIBMenu)sender; } else if (sender is EIBVMenuBar) { if (menu != null && menu.Owner.Parent is EIBVMenuBar) { ((EIBVMenuBar)menu.Owner.Parent).CurrentMenu = menu; } } if (parentMenuBar == null) { if (menu.Owner.Parent is EIBMenuBar) { parentMenuBar = (EIBMenuBar)menu.Owner.Parent; parentMenuBar.CurrentMenu = menu; } if (menu != null) { if (menu.Owner is EIBVMenuBar) { ((EIBVMenuBar)menu.Owner).CurrentMenu = menu; } else { EIBVMenuBar parentHMenuBar = getOwner((EIBMenu)menu.OwnerItem); parentHMenuBar.CurrentMenu = menu; //MessageBox.Show(parentHMenuBar.CurrentMenu.Text); } } } else { //parentMenuBar.CurrentMenu = menu; if (menu != null) { if (menu.Owner is EIBVMenuBar) { ((EIBVMenuBar)menu.Owner).CurrentMenu = menu; } else { EIBVMenuBar parentHMenuBar = getOwner((EIBMenu)menu.OwnerItem); if (parentHMenuBar == null) { parentMenuBar.CurrentMenu = menu; } else { parentHMenuBar.CurrentMenu = menu; } //MessageBox.Show(parentHMenuBar.CurrentMenu.Text); } } } List<IEIBControl> propControl = new List<IEIBControl>(); propControl.Add((IEIBControl)sender); propertiesManager.displayProperties(form.propertyWindow, propControl); formulaManager.displayFormulaProperties(form.formulaEditor, menu); if ((!(sender is EIBMenuBar)) && menu != null) { if (!PickBox.isctrlpressed) { if (currentControl.Count >= 1) { foreach (IEIBControl ctl in currentControl) { if (ctl is TreeNode) { if (pickBox.ContainsKey((IEIBControl)((TreeNode)ctl).TreeView)) pickBox[(IEIBControl)((TreeNode)ctl).TreeView].HideHandles(); } else { if (pickBox.ContainsKey((IEIBControl)ctl)) pickBox[ctl].HideHandles(); } } currentControl.Clear(); form.currentBaseWindow.CurrentControl.Clear(); } } //currentControl.Clear(); currentControl.Add((IEIBControl)menu); //form.currentBaseWindow.CurrentControl.Clear(); form.currentBaseWindow.CurrentControl.Add((IEIBControl)menu); } else if (parentMenuBar != null) { if (!PickBox.isctrlpressed) { if (currentControl.Count >= 1) { foreach (IEIBControl ctl in currentControl) { if (ctl is TreeNode) { if (pickBox.ContainsKey((IEIBControl)((TreeNode)ctl).TreeView)) pickBox[(IEIBControl)((TreeNode)ctl).TreeView].HideHandles(); } else { if (pickBox.ContainsKey((IEIBControl)ctl)) pickBox[ctl].HideHandles(); } } currentControl.Clear(); form.currentBaseWindow.CurrentControl.Clear(); } } //currentControl.Clear(); currentControl.Add((IEIBControl)parentMenuBar); //form.currentBaseWindow.CurrentControl.Clear(); form.currentBaseWindow.CurrentControl.Add((IEIBControl)parentMenuBar); } if (parentMenuBar != null && parentMenuBar.CurrentMenu != null && menuItemSelected) { if (parentMenuBar.CurrentMenu.CurrentMenuItem != null) { propertiesManager.displayProperties(form.propertyWindow, parentMenuBar.CurrentMenu.CurrentMenuItem); formulaManager.displayFormulaProperties(form.formulaEditor, parentMenuBar.CurrentMenu.CurrentMenuItem); } } else if (sender is EIBMenu) { if (menu.Owner is EIBVMenuBar && ((EIBVMenuBar)(menu.Owner)).CurrentMenu.CurrentMenuItem != null) { propertiesManager.displayProperties(form.propertyWindow, ((EIBVMenuBar)menu.Owner).CurrentMenu.CurrentMenuItem); formulaManager.displayFormulaProperties(form.formulaEditor, ((EIBVMenuBar)menu.Owner).CurrentMenu.CurrentMenuItem); } } menuItemSelected = false; }
public void ResetMenuEditor(EIBMenuBar menuBar) { foreach(EIBMenu menuItem in ((ToolStrip)menuBar.Controls[0]).Items) { if (!string.IsNullOrEmpty(menuItem.Text)) { TreeNode tn = new TreeNode(menuItem.Text); tn.Name = menuItem.Name; treeView1.Nodes.Add(tn); parseMenuItem(menuItem, tn); nodeMenus.Add(tn.Name, menuItem); } } }