Esempio n. 1
0
        void addElementItem(ToolStripMenuItem menu, string title, ELEMENTS item)
        {
            var elm = ConstructElement(item);

            if (elm == null)
            {
                return;
            }
            else
            {
                elm.Delete();
            }
            ToolStripMenuItem mi;
            var sc = shortcut(elm.Shortcut);

            if (sc.Key == Keys.None)
            {
                mi = new ToolStripMenuItem();
            }
            else
            {
                mi = new ToolStripMenuItem()
                {
                    ShowShortcutKeys         = true,
                    ShortcutKeys             = sc.Key,
                    ShortcutKeyDisplayString = sc.Name
                };
            }
            mi.Font   = menuFont;
            mi.Text   = title;
            mi.Click += new EventHandler((sender, e) => {
                mSim.Performed(item);
                if (null != mi.OwnerItem)
                {
                    for (int i = 0; i < mMainMenuItems.Count; i++)
                    {
                        if (mMainMenuItems[i].Checked)
                        {
                            mMainMenuItems[i].Checked             = false;
                            mMainMenuItems[i].OwnerItem.BackColor = Color.Transparent;
                        }
                    }
                    mi.Checked             = true;
                    mi.OwnerItem.BackColor = Color.LightGray;
                }
            });
            mMainMenuItems.Add(mi);
            menu.DropDownItems.Add(mi);
        }
Esempio n. 2
0
 public ScopePopupMenu(CirSim sim)
 {
     mMenuItems = new List <ToolStripMenuItem>();
     /* */
     mMenuItems.Add(mRemoveScope = new ToolStripMenuItem()
     {
         Text = "Remove Scope"
     });
     mRemoveScope.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.REMOVE_SCOPE);
     });
     mMenuItems.Add(mDock = new ToolStripMenuItem()
     {
         Text = "Dock Scope"
     });
     mDock.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.DOCK);
     });
     mMenuItems.Add(mUndock = new ToolStripMenuItem()
     {
         Text = "Undock Scope"
     });
     mUndock.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.UNDOCK);
     });
     mMenuItems.Add(mMaxScale = new ToolStripMenuItem()
     {
         Text = "Max Scale"
     });
     mMaxScale.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.MAX_SCALE);
     });
     mMenuItems.Add(mStack = new ToolStripMenuItem()
     {
         Text = "Stack"
     });
     mStack.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.STACK);
     });
     mMenuItems.Add(mUnstack = new ToolStripMenuItem()
     {
         Text = "Unstack"
     });
     mUnstack.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.UNSTACK);
     });
     mMenuItems.Add(mCombine = new ToolStripMenuItem()
     {
         Text = "Combine"
     });
     mCombine.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.COMBINE);
     });
     mMenuItems.Add(mRemovePlot = new ToolStripMenuItem()
     {
         Text = "Remove Plot"
     });
     mRemovePlot.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.REMOVE_PLOT);
     });
     mMenuItems.Add(mReset = new ToolStripMenuItem()
     {
         Text = "Reset"
     });
     mReset.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.RESET);
     });
     mMenuItems.Add(mProperties = new ToolStripMenuItem()
     {
         Text = "Properties..."
     });
     mProperties.Click += new EventHandler((s, e) => {
         sim.Performed(SCOPE_MENU_ITEM.PROPERTIES);
     });
 }
Esempio n. 3
0
        public ElementPopupMenu(CirSim sim)
        {
            mMenuItems           = new List <ToolStripMenuItem>();
            mMenuItems.Add(mEdit = new ToolStripMenuItem()
            {
                Text = "Edit..."
            });
            mEdit.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.EDIT);
            });
            var cut = new ToolStripMenuItem()
            {
                Text = "Cut"
            };

            mMenuItems.Add(cut);
            cut.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.CUT);
            });
            var copy = new ToolStripMenuItem()
            {
                Text = "Copy"
            };

            mMenuItems.Add(copy);
            copy.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.COPY);
            });
            var delete = new ToolStripMenuItem()
            {
                Text = "Delete"
            };

            mMenuItems.Add(delete);
            delete.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.DELETE);
            });
            var dup = new ToolStripMenuItem()
            {
                Text = "Duplicate"
            };

            mMenuItems.Add(dup);
            dup.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.DUPLICATE);
            });
            mMenuItems.Add(mScope = new ToolStripMenuItem()
            {
                Text = "View in Scope"
            });
            mScope.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.VIEW_IN_SCOPE);
            });
            mMenuItems.Add(mFloatScope = new ToolStripMenuItem()
            {
                Text = "View in Undocked Scope"
            });
            mFloatScope.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.VIEW_IN_FLOAT_SCOPE);
            });
            mMenuItems.Add(mFlip = new ToolStripMenuItem()
            {
                Text = "Swap Terminals"
            });
            mFlip.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.FLIP);
            });
            mMenuItems.Add(mSplit = new ToolStripMenuItem()
            {
                Text = "Split Wire"
            });
            mSplit.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.SPLIT);
            });
            mMenuItems.Add(mSlider = new ToolStripMenuItem()
            {
                Text = "Sliders..."
            });
            mSlider.Click += new EventHandler((s, e) => {
                sim.Performed(ELEMENT_MENU_ITEM.SLIDERS);
            });
        }