Пример #1
0
        public char[] ControlVector(PetriNetDocument pnd)
        {
            if (this.Evaluate(pnd) == true)
            {
                ArrayList alControlPlaces = pnd.ControlPlaces;

                char[] caControlVector = new char[alControlPlaces.Count];

                // Initialize all to x
                for (int i = 0; i < caControlVector.Length; i++)
                {
                    caControlVector[i] = 'x';
                }

                // Set elements based on rule
                for (int i = 0; i < saResults.GetLength(0); i++)
                {
                    foreach (Place p in alControlPlaces)
                    {
                        if (p.NameID == this.saResults[i, 0] || "P" + p.Index.ToString() == this.saResults[i, 0])
                        {
                            caControlVector[alControlPlaces.IndexOf(p)] = char.Parse(saResults[i, 1]);
                            break;
                        }
                    }
                }

                return(caControlVector);
            }

            return(null);
        }
Пример #2
0
        public void RestoreAfterDeserialization(PetriNetDocument pnd, Subsystem ssOwner)
        {
            // Create GUI
            SubsystemEditor_CreateGUI(pnd, ssOwner);

            // Restore controls
            RestoreControlsAndConnections();
        }
Пример #3
0
        public RuleEditor(PetriNetDocument pndSelectedDocument)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.pndSelectedDocument = pndSelectedDocument;
        }
Пример #4
0
        public ResponsePlacesEditorForm(PetriNetDocument pnd, Place[] pa)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.paPlaces = pa;
            this.pnd      = pnd;
        }
Пример #5
0
        public void RestoreReferences(PetriNetDocument pnd, Hashtable ht)
        {
            this.pnd = pnd;

            this.paPlaces = new Place[this.iaPlaces.Length];

            for (int i = 0; i < this.iaPlaces.Length; i++)
            {
                this.paPlaces[i] = (Place)ht["P" + this.iaPlaces[i].ToString()];
            }
        }
Пример #6
0
        public RuleEditor(PetriNetDocument pndSelectedDocument, string sExpression, string sDescription)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.pndSelectedDocument    = pndSelectedDocument;
            this.tbRuleCondition.Text   = sExpression;
            this.tbRuleDescription.Text = sDescription;
        }
Пример #7
0
        public SubsystemEditor(PetriNetDocument pnd, Subsystem ssOwner)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            Rectangle r = Screen.PrimaryScreen.Bounds;

            this.Size = new Size((int)(r.Width * 0.9), (int)(r.Height * 0.9));

            SubsystemEditor_CreateGUI(pnd, ssOwner);
        }
Пример #8
0
        public bool IsValidResult(PetriNetDocument pnd)
        {
            bool bValid = true;

            for (int i = 0; i < this.saResults.GetLength(0); i++)
            {
                //Calculate LeftSide of Result
                string s = this.saResults[i, 0];

                int iFound = 0;
                foreach (Place p in pnd.Places)
                {
                    if (p.NameID == s || "P" + p.Index.ToString() == s)
                    {
                        iFound = 1;
                        break;
                    }
                }

                if (iFound == 0)
                {
                    bValid = false;
                }

                //Calculate RightSide of Result
                s = this.saResults[i, 1];

                iFound = 0;
                try
                {
                    int.Parse(s);
                    iFound = 1;
                }
                catch (FormatException)
                {
                    iFound = 0;
                }

                if (iFound == 0)
                {
                    bValid = false;
                }
            }

            return(bValid);
        }
Пример #9
0
        public void Fire()
        {
            PetriNetDocument pnd = ((PetriNetEditor)this.Parent).Document;
            IntMatrix        imF = pnd.F;
            IntMatrix        imS = pnd.S;

            // Get all tokens in parents
            foreach (Place p in this.PlaceParents)
            {
                p.Tokens -= imF[pnd.Transitions.IndexOf(this), pnd.GroupedPlaces.IndexOf(p)];
            }

            // And put them in childs
            foreach (Place p in this.PlaceChilds)
            {
                p.Tokens += imS[pnd.GroupedPlaces.IndexOf(p), pnd.Transitions.IndexOf(this)];
            }
        }
Пример #10
0
        public bool CanFire()
        {
            PetriNetDocument pnd = ((PetriNetEditor)this.Parent).Document;
            IntMatrix        imF = pnd.F;

            int iCountMetConditions = 0;

            foreach (Place p in this.PlaceParents)
            {
                if (p.Tokens >= imF[pnd.Transitions.IndexOf(this), pnd.GroupedPlaces.IndexOf(p)])
                {
                    iCountMetConditions++;
                }
            }

            if (iCountMetConditions == this.PlaceParents.Count && this.PlaceParents.Count != 0)
            {
                return(true);
            }

            return(false);
        }
Пример #11
0
        public Oscillogram(PetriNetDocument pnd, IntMatrix im)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
            this.UpdateStyles();

            this.im  = im;
            this.pnd = pnd;

            this.iGraphHeight       = this.pnd.ResponseOptions.GraphHeight;
            this.iGraphDistance     = this.pnd.ResponseOptions.GraphDistance;
            this.iSectionWidth      = this.pnd.ResponseOptions.SectionWidth;
            this.iNumbersPerSection = this.pnd.ResponseOptions.NumbersPerSection;
            this.szSelection        = pnd.ResponseOptions.Selection;
            this.szRange            = new Size(0, pnd.ResponseOptions.EndTime);

            this.Height = iTopMargin + iGraphHeight * this.pnd.ResponseOptions.Places.Length + iGraphDistance * (this.pnd.ResponseOptions.Places.Length - 1) + iBottomMargin;
            this.Width  = iLeftMargin + iSectionWidth * (this.szRange.Height - this.szRange.Width) / (this.iNumbersPerSection) + iRightMargin;

            this.alGroupedPlaces = pnd.GroupedPlaces;
            this.aResponsePlaces = pnd.ResponseOptions.Places;
        }
Пример #12
0
 public BaseScript(PetriNetDocument p)
 {
     pnd = p;
 }
Пример #13
0
 public Simulator(PetriNetDocument pnd)
 {
     this.pnd      = pnd;
     pnd.Simulator = this;
 }
Пример #14
0
 public CSharpScript(PetriNetDocument p)
     : base(p)
 {
 }
Пример #15
0
        public bool IsValidCondition(PetriNetDocument pnd)
        {
            bool bValid = true;

            for (int i = 0; i < this.saConditions.GetLength(0); i++)
            {
                #region Calculate LeftSide of Condition
                // Calculate LeftSide of Condition
                string[] saSeparatedOperands = saConditions[i, 0].Split(new char[] { '+', '-' });

                foreach (string s in saSeparatedOperands)
                {
                    int iFound = 0;

                    foreach (Place p in pnd.Places)
                    {
                        if (p.NameID == s || "P" + p.Index.ToString() == s)
                        {
                            iFound = 1;
                            break;
                        }
                    }

                    if (iFound == 0)
                    {
                        try
                        {
                            int.Parse(s);
                            iFound = 1;
                        }
                        catch (FormatException)
                        {
                            iFound = 0;
                        }
                    }

                    if (iFound == 0)
                    {
                        bValid = false;
                    }
                }
                #endregion

                #region Calculate RightSide of Condition
                // Calculate RightSide of Condition
                saSeparatedOperands = saConditions[i, 2].Split(new char[] { '+', '-' });

                foreach (string s in saSeparatedOperands)
                {
                    int iFound = 0;

                    foreach (Place p in pnd.Places)
                    {
                        if (p.NameID == s || "P" + p.Index.ToString() == s)
                        {
                            iFound = 1;
                            break;
                        }
                    }

                    if (iFound == 0)
                    {
                        try
                        {
                            int.Parse(s);
                            iFound = 1;
                        }
                        catch (FormatException)
                        {
                            iFound = 0;
                        }
                    }

                    if (iFound == 0)
                    {
                        bValid = false;
                    }
                }
                #endregion
            }

            return(bValid);
        }
Пример #16
0
 public PythonScript(PetriNetDocument p) : base(p)
 {
 }
Пример #17
0
        public bool Evaluate(PetriNetDocument pnd)
        {
            bool bCondition = true;

            for (int i = 0; i < saConditions.GetLength(0); i++)
            {
                #region Calculate LeftSide of Condition

                // Calculate LeftSide of Condition
                string[] saSeparatedOperands = saConditions[i, 0].Split(new char[] { '+', '-' });
                string[] saOperations        = new string[saSeparatedOperands.Length - 1];

                string sConditionLeft = saConditions[i, 0];
                for (int j = 0; j < saSeparatedOperands.Length - 1; j++)
                {
                    sConditionLeft  = sConditionLeft.Replace(saSeparatedOperands[j], "");
                    saOperations[j] = sConditionLeft[0].ToString();
                    sConditionLeft  = sConditionLeft.Remove(0, 1);
                }

                int iLeftSum = 0;
                for (int k = 0; k < saSeparatedOperands.Length; k++)
                {
                    // Find if place exists
                    Place pFound = null;
                    foreach (Place p in pnd.Places)
                    {
                        if (p.NameID == saSeparatedOperands[k] || "P" + p.Index.ToString() == saSeparatedOperands[k])
                        {
                            pFound = p;
                            break;
                        }
                    }

                    if (pFound != null)
                    {
                        if (k != 0)
                        {
                            switch (saOperations[k - 1])
                            {
                            case "+":
                            {
                                iLeftSum += pFound.Tokens;
                                break;
                            }

                            case "-":
                            {
                                iLeftSum -= pFound.Tokens;
                                break;
                            }
                            }
                        }
                        else
                        {
                            foreach (Place p in pnd.Places)
                            {
                                if (p.NameID == saSeparatedOperands[k] || "P" + p.Index.ToString() == saSeparatedOperands[k])
                                {
                                    iLeftSum += p.Tokens;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        // If operand is not found in places then it must be either a constant or it
                        // is a place that has been deleted!
                        // In second case, implement code that will disable or delete this rule
                        // TODO : Implement rule consistency check code
                        if (k != 0)
                        {
                            switch (saOperations[k - 1])
                            {
                            case "+":
                            {
                                iLeftSum += int.Parse(saSeparatedOperands[k]);
                                break;
                            }

                            case "-":
                            {
                                iLeftSum -= int.Parse(saSeparatedOperands[k]);
                                break;
                            }
                            }
                        }
                        else
                        {
                            iLeftSum += int.Parse(saSeparatedOperands[k]);
                        }
                    }
                }
                #endregion

                #region Calculate RightSide of Condition

                // Calculate RightSide of Condition
                saSeparatedOperands = saConditions[i, 2].Split(new char[] { '+', '-' });
                saOperations        = new string[saSeparatedOperands.Length - 1];

                string sConditionRight = saConditions[i, 2];
                for (int j = 0; j < saSeparatedOperands.Length - 1; j++)
                {
                    sConditionRight = sConditionRight.Replace(saSeparatedOperands[j], "");
                    saOperations[j] = sConditionRight[0].ToString();
                    sConditionRight = sConditionRight.Remove(0, 1);
                }

                int iRightSum = 0;
                for (int k = 0; k < saSeparatedOperands.Length; k++)
                {
                    // Find if place exists
                    Place pFound = null;
                    foreach (Place p in pnd.Places)
                    {
                        if (p.NameID == saSeparatedOperands[k] || "P" + p.Index.ToString() == saSeparatedOperands[k])
                        {
                            pFound = p;
                            break;
                        }
                    }

                    if (pFound != null)
                    {
                        if (k != 0)
                        {
                            switch (saOperations[k - 1])
                            {
                            case "+":
                            {
                                iRightSum += pFound.Tokens;
                                break;
                            }

                            case "-":
                            {
                                iRightSum -= pFound.Tokens;
                                break;
                            }
                            }
                        }
                        else
                        {
                            foreach (Place p in pnd.Places)
                            {
                                if (p.NameID == saSeparatedOperands[k] || "P" + p.Index.ToString() == saSeparatedOperands[k])
                                {
                                    iRightSum += p.Tokens;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (k != 0)
                        {
                            switch (saOperations[k - 1])
                            {
                            case "+":
                            {
                                iRightSum += int.Parse(saSeparatedOperands[k]);
                                break;
                            }

                            case "-":
                            {
                                iRightSum -= int.Parse(saSeparatedOperands[k]);
                                break;
                            }
                            }
                        }
                        else
                        {
                            iRightSum += int.Parse(saSeparatedOperands[k]);
                        }
                    }
                }
                #endregion

                #region switch(saConditions[i, 1])
                switch (saConditions[i, 1])
                {
                case "==":
                {
                    bool bCompare = (iLeftSum == iRightSum);
                    bCondition &= bCompare;
                    break;
                }

                case "!=":
                {
                    bool bCompare = (iLeftSum != iRightSum);
                    bCondition &= bCompare;
                    break;
                }

                case ">=":
                {
                    bool bCompare = (iLeftSum >= iRightSum);
                    bCondition &= bCompare;
                    break;
                }

                case "<=":
                {
                    bool bCompare = (iLeftSum <= iRightSum);
                    bCondition &= bCompare;
                    break;
                }

                case ">":
                {
                    bool bCompare = (iLeftSum > iRightSum);
                    bCondition &= bCompare;
                    break;
                }

                case "<":
                {
                    bool bCompare = (iLeftSum < iRightSum);
                    bCondition &= bCompare;
                    break;
                }
                }
                #endregion
            }

            return(bCondition);
        }
Пример #18
0
        private void SubsystemEditor_CreateGUI(PetriNetDocument pnd, Subsystem ssOwner)
        {
            this.pnd     = pnd;
            this.ssOwner = ssOwner;

            Panel pnlEditorContainer = new Panel();

            pnlEditorContainer.AutoScroll = true;
            pnlEditorContainer.Dock       = DockStyle.Fill;

            this.pneEditor                         = new PetriNetEditor(pnd, pnd.InstanceCounter);
            this.pneEditor.AutoScroll              = true;
            this.pneEditor.AutoScrollMinSize       = new Size(3000, 3000);
            this.pneEditor.Size                    = new Size(3000, 3000);
            this.pneEditor.Location                = new Point(0, 0);
            this.pneEditor.ContentsChanged        += new EventHandler(pneEditor_ContentsChanged);
            this.pneEditor.SelectedObjectsChanged += new EventHandler(pneEditor_SelectedObjectsChanged);
            this.pneEditor.PropertiesChanged      += new EventHandler(pneEditor_PropertiesChanged);

            if (this.oDeserializedZoomLevel != null)
            {
                this.pneEditor.Zoom = (float)this.oDeserializedZoomLevel;
            }

            pnlEditorContainer.Controls.Add(pneEditor);
            this.Controls.Add(pnlEditorContainer);

            // Create the object that manages the docking state
            this.dmDockingManager = new Crownwood.Magic.Docking.DockingManager(this, Crownwood.Magic.Common.VisualStyle.IDE);
            this.dmDockingManager.InnerControl = pnlEditorContainer;
            this.dmDockingManager.OuterControl = tbToolBar;

            Crownwood.Magic.Docking.Content toolbox = dmDockingManager.Contents.Add(this.tbToolBox, "Toolbox", this.ilContent, 1);
            toolbox.AutoHideSize = new Size(200, 300);
            toolbox.DisplaySize  = new Size(200, 300);
            toolbox.FloatingSize = new Size(200, 300);
            Crownwood.Magic.Docking.Content properties = dmDockingManager.Contents.Add(this.piPropertiesInspector, "Properties", this.ilContent, 0);
            properties.AutoHideSize = new Size(200, 300);
            properties.DisplaySize  = new Size(200, 300);
            properties.FloatingSize = new Size(200, 300);
            Crownwood.Magic.Docking.WindowContent wc = dmDockingManager.AddContentWithState(toolbox, Crownwood.Magic.Docking.State.DockLeft);

            //dmDockingManager.AddContentToWindowContent(notePad2, wc);
            // Add a new WindowContent to the existing Zone already created
            this.dmDockingManager.AddContentToZone(properties, wc.ParentZone, 1);

            this.tbToolBox.EnabledToolbox = true;

            // Load layout
            if (File.Exists(Application.StartupPath + "\\layoutSubsystem.config.xml"))
            {
                this.dmDockingManager.LoadConfigFromFile(Application.StartupPath + "\\layoutSubsystem.config.xml");
            }

            // Initialize piPropertiesInspector
            this.piPropertiesInspector.SelectedObjectChanged += new EventHandler(piPropertiesInspector_SelectedObjectChanged);

            #region Initialize ToolBar control
            this.tbToolBar.Dock         = DockStyle.Top;
            this.tbToolBar.ButtonSize   = new Size(24, 24);
            this.tbToolBar.ImageList    = ilToolBar;
            this.tbToolBar.ButtonClick += new ToolBarButtonClickEventHandler(tbToolBar_ButtonClick);
            this.tbToolBar.Appearance   = ToolBarAppearance.Flat;

            this.tbbReset.Enabled    = false;
            this.tbbReset.ImageIndex = 3;
            this.tbToolBar.Buttons.Add(tbbReset);

            this.tbbStart.Enabled    = false;
            this.tbbStart.ImageIndex = 4;
            this.tbToolBar.Buttons.Add(tbbStart);

            this.tbbPause.Enabled    = false;
            this.tbbPause.ImageIndex = 5;
            this.tbToolBar.Buttons.Add(tbbPause);

            this.tbbStop.Enabled    = false;
            this.tbbStop.ImageIndex = 6;
            this.tbToolBar.Buttons.Add(tbbStop);

            this.tbbStep.Enabled    = false;
            this.tbbStep.ImageIndex = 7;
            this.tbToolBar.Buttons.Add(tbbStep);

            this.tbbSeparator4.Style = ToolBarButtonStyle.Separator;
            this.tbToolBar.Buttons.Add(tbbSeparator4);

            this.tbbUndo.ImageIndex   = 13;
            this.tbbUndo.ToolTipText  = "Undo";
            this.tbbUndo.Style        = ToolBarButtonStyle.DropDownButton;
            this.tbbUndo.DropDownMenu = this.cmUndo;
            this.tbToolBar.Buttons.Add(tbbUndo);

            this.tbbRedo.ImageIndex   = 14;
            this.tbbRedo.ToolTipText  = "Redo";
            this.tbbRedo.Style        = ToolBarButtonStyle.DropDownButton;
            this.tbbRedo.DropDownMenu = this.cmRedo;
            this.tbToolBar.Buttons.Add(tbbRedo);

            this.tbbSeparator2.Style = ToolBarButtonStyle.Separator;
            this.tbToolBar.Buttons.Add(tbbSeparator2);

//			this.tbbConflicts.ImageIndex = 8;
//			this.tbbConflicts.Style = ToolBarButtonStyle.ToggleButton;
//			this.tbToolBar.Buttons.Add(tbbConflicts);
//
//			this.tbbCircularWaits.ImageIndex = 9;
//			this.tbbCircularWaits.Style = ToolBarButtonStyle.ToggleButton;
//			this.tbToolBar.Buttons.Add(tbbCircularWaits);
//
//			this.tbbFireable.ImageIndex = 10;
//			this.tbbFireable.Style = ToolBarButtonStyle.ToggleButton;
//			this.tbbFireable.Pushed = true;
//			this.tbToolBar.Buttons.Add(tbbFireable);
//
//			this.tbbFired.ImageIndex = 11;
//			this.tbbFired.Style = ToolBarButtonStyle.ToggleButton;
//			this.tbbFired.Pushed = true;
//			this.tbToolBar.Buttons.Add(tbbFired);
//
//			this.tbbSeparator3.Style = ToolBarButtonStyle.Separator;
//			this.tbToolBar.Buttons.Add(tbbSeparator3);

            this.tbbZoom.ImageIndex   = 12;
            this.tbbZoom.Style        = ToolBarButtonStyle.DropDownButton;
            this.tbbZoom.DropDownMenu = this.cmZoom;
            this.tbToolBar.Buttons.Add(tbbZoom);
            this.Controls.Add(this.tbToolBar);
            #endregion

            // Initialize MenuControl
            this.mcMenuControl      = new Crownwood.Magic.Menus.MenuControl();
            this.mcMenuControl.Dock = DockStyle.Top;
            this.Controls.Add(mcMenuControl);

            #region Initialize this.mcFile

            mcFile = new Crownwood.Magic.Menus.MenuCommand("&File");

            mcFileExport          = new Crownwood.Magic.Menus.MenuCommand("&Export...");
            mcFileExport.Shortcut = Shortcut.CtrlE;
            mcFileExport.Click   += new EventHandler(mcFileExport_Click);
            mcFile.MenuCommands.Add(mcFileExport);

            mcFileSeparator1 = new Crownwood.Magic.Menus.MenuCommand("-");
            mcFile.MenuCommands.Add(mcFileSeparator1);

            mcFileClose        = new Crownwood.Magic.Menus.MenuCommand("&Close");
            mcFileClose.Click += new EventHandler(mcFileClose_Click);
            mcFile.MenuCommands.Add(mcFileClose);

            this.mcMenuControl.MenuCommands.Add(mcFile);

            #endregion

            #region Initialize this.mcEdit

            mcEdit = new Crownwood.Magic.Menus.MenuCommand("&Edit");

            mcEditUndo            = new Crownwood.Magic.Menus.MenuCommand("&Undo");
            mcEditUndo.Click     += new EventHandler(mcEditUndo_Click);
            mcEditUndo.ImageList  = ilMenu;
            mcEditUndo.ImageIndex = 4;
            mcEditUndo.Shortcut   = Shortcut.CtrlZ;
            mcEditUndo.Enabled    = false;
            mcEdit.MenuCommands.Add(mcEditUndo);

            mcEditRedo            = new Crownwood.Magic.Menus.MenuCommand("&Redo");
            mcEditRedo.Click     += new EventHandler(mcEditRedo_Click);
            mcEditRedo.ImageList  = ilMenu;
            mcEditRedo.ImageIndex = 5;
            mcEditRedo.Shortcut   = Shortcut.CtrlY;
            mcEditRedo.Enabled    = false;
            mcEdit.MenuCommands.Add(mcEditRedo);

            mcEditSeparator1 = new Crownwood.Magic.Menus.MenuCommand("-");
            mcEdit.MenuCommands.Add(mcEditSeparator1);

            mcEditCut            = new Crownwood.Magic.Menus.MenuCommand("Cu&t");
            mcEditCut.Click     += new EventHandler(mcEditCut_Click);
            mcEditCut.ImageList  = ilMenu;
            mcEditCut.ImageIndex = 6;
            mcEditCut.Shortcut   = Shortcut.CtrlX;
            mcEdit.MenuCommands.Add(mcEditCut);

            mcEditCopy            = new Crownwood.Magic.Menus.MenuCommand("&Copy");
            mcEditCopy.Click     += new EventHandler(mcEditCopy_Click);
            mcEditCopy.ImageList  = ilMenu;
            mcEditCopy.ImageIndex = 7;
            mcEditCopy.Shortcut   = Shortcut.CtrlC;
            mcEdit.MenuCommands.Add(mcEditCopy);

            mcEditPaste            = new Crownwood.Magic.Menus.MenuCommand("&Paste");
            mcEditPaste.Click     += new EventHandler(mcEditPaste_Click);
            mcEditPaste.ImageList  = ilMenu;
            mcEditPaste.ImageIndex = 8;
            mcEditPaste.Shortcut   = Shortcut.CtrlV;
            mcEdit.MenuCommands.Add(mcEditPaste);

            mcEditDelete            = new Crownwood.Magic.Menus.MenuCommand("&Delete");
            mcEditDelete.Click     += new EventHandler(mcEditDelete_Click);
            mcEditDelete.ImageList  = ilMenu;
            mcEditDelete.ImageIndex = 9;
            mcEditDelete.Shortcut   = Shortcut.Del;
            mcEdit.MenuCommands.Add(mcEditDelete);

            mcEditSeparator2 = new Crownwood.Magic.Menus.MenuCommand("-");
            mcEdit.MenuCommands.Add(mcEditSeparator2);

            mcEditCopyModel           = new Crownwood.Magic.Menus.MenuCommand("Copy &model");
            mcEditCopyModel.Click    += new EventHandler(mcEditCopyModel_Click);
            mcEditCopyModel.ImageList = ilMenu;
            //mcEditCopyModel.ImageIndex = 9;
            //mcEditCopyModel.Shortcut = Shortcut.Del;
            mcEdit.MenuCommands.Add(mcEditCopyModel);

            mcEditSeparator3 = new Crownwood.Magic.Menus.MenuCommand("-");
            mcEdit.MenuCommands.Add(mcEditSeparator3);

            mcEditGroup           = new Crownwood.Magic.Menus.MenuCommand("&Group");
            mcEditGroup.Click    += new EventHandler(mcEditGroup_Click);
            mcEditGroup.ImageList = ilMenu;
            //mcEditGroup.ImageIndex = 8;
            mcEditGroup.Shortcut = Shortcut.CtrlG;
            mcEdit.MenuCommands.Add(mcEditGroup);

            mcEditSeparator4 = new Crownwood.Magic.Menus.MenuCommand("-");
            mcEdit.MenuCommands.Add(mcEditSeparator4);

            mcEditSelectAll           = new Crownwood.Magic.Menus.MenuCommand("Select &All");
            mcEditSelectAll.Click    += new EventHandler(mcEditSelectAll_Click);
            mcEditSelectAll.ImageList = ilMenu;
            mcEditSelectAll.Shortcut  = Shortcut.CtrlA;
            mcEdit.MenuCommands.Add(mcEditSelectAll);

            this.mcMenuControl.MenuCommands.Add(mcEdit);

            #endregion

            #region Initialize this.mcView

            mcView = new Crownwood.Magic.Menus.MenuCommand("&View");

            foreach (Crownwood.Magic.Docking.Content c in this.dmDockingManager.Contents)
            {
                Crownwood.Magic.Menus.MenuCommand mc = new Crownwood.Magic.Menus.MenuCommand(c.Title);
                mc.Image  = c.ImageList.Images[c.ImageIndex];
                mc.Click += new EventHandler(mcViewContents_Click);
                mcView.MenuCommands.Add(mc);
            }

            this.mcMenuControl.MenuCommands.Add(mcView);

            #endregion


            #region Initialize ActionList
            // Initialize ActionList
            this.alMenuActionList.ImageList = this.ilMenu;

            this.aEditUndo.Checked    = false;
            this.aEditUndo.Enabled    = false;
            this.aEditUndo.Hint       = null;
            this.aEditUndo.Shortcut   = System.Windows.Forms.Shortcut.CtrlZ;
            this.aEditUndo.Tag        = null;
            this.aEditUndo.ImageIndex = 4;
            this.aEditUndo.Text       = mcEditUndo.Text;
            this.aEditUndo.Visible    = true;
            this.aEditUndo.Update    += new System.EventHandler(this.aEditUndo_Update);
            this.alMenuActionList.Actions.Add(this.aEditUndo);
            this.alMenuActionList.SetAction(this.mcEditUndo, this.aEditUndo);

            this.aEditRedo.Checked    = false;
            this.aEditRedo.Enabled    = false;
            this.aEditRedo.Hint       = null;
            this.aEditRedo.Shortcut   = System.Windows.Forms.Shortcut.CtrlY;
            this.aEditRedo.Tag        = null;
            this.aEditRedo.ImageIndex = 5;
            this.aEditRedo.Text       = mcEditRedo.Text;
            this.aEditRedo.Visible    = true;
            this.aEditRedo.Update    += new System.EventHandler(this.aEditRedo_Update);
            this.alMenuActionList.Actions.Add(this.aEditRedo);
            this.alMenuActionList.SetAction(this.mcEditRedo, this.aEditRedo);

            this.aEditDelete.Checked    = false;
            this.aEditDelete.Enabled    = false;
            this.aEditDelete.Hint       = null;
            this.aEditDelete.Shortcut   = System.Windows.Forms.Shortcut.Del;
            this.aEditDelete.Tag        = null;
            this.aEditDelete.ImageIndex = 9;
            this.aEditDelete.Text       = mcEditDelete.Text;
            this.aEditDelete.Visible    = true;
            this.aEditDelete.Update    += new System.EventHandler(this.aEditDelete_Update);
            this.alMenuActionList.Actions.Add(this.aEditDelete);
            this.alMenuActionList.SetAction(this.mcEditDelete, this.aEditDelete);

            this.aEditCut.Checked    = false;
            this.aEditCut.Enabled    = false;
            this.aEditCut.Hint       = null;
            this.aEditCut.Shortcut   = System.Windows.Forms.Shortcut.CtrlX;
            this.aEditCut.ImageIndex = 6;
            this.aEditCut.Tag        = null;
            this.aEditCut.Text       = mcEditCut.Text;
            this.aEditCut.Visible    = true;
            this.aEditCut.Update    += new System.EventHandler(this.aEditCut_Update);
            this.alMenuActionList.Actions.Add(this.aEditCut);
            this.alMenuActionList.SetAction(this.mcEditCut, this.aEditCut);

            this.aEditCopy.Checked    = false;
            this.aEditCopy.Enabled    = false;
            this.aEditCopy.Hint       = null;
            this.aEditCopy.Shortcut   = System.Windows.Forms.Shortcut.CtrlC;
            this.aEditCopy.ImageIndex = 7;
            this.aEditCopy.Tag        = null;
            this.aEditCopy.Text       = mcEditCopy.Text;
            this.aEditCopy.Visible    = true;
            this.aEditCopy.Update    += new System.EventHandler(this.aEditCopy_Update);
            this.alMenuActionList.Actions.Add(this.aEditCopy);
            this.alMenuActionList.SetAction(this.mcEditCopy, this.aEditCopy);

            this.aEditPaste.Checked    = false;
            this.aEditPaste.Enabled    = false;
            this.aEditPaste.Hint       = null;
            this.aEditPaste.Shortcut   = System.Windows.Forms.Shortcut.CtrlV;
            this.aEditPaste.ImageIndex = 8;
            this.aEditPaste.Tag        = null;
            this.aEditPaste.Text       = mcEditPaste.Text;
            this.aEditPaste.Visible    = true;
            this.aEditPaste.Update    += new System.EventHandler(this.aEditPaste_Update);
            this.alMenuActionList.Actions.Add(this.aEditPaste);
            this.alMenuActionList.SetAction(this.mcEditPaste, this.aEditPaste);

            this.aEditGroup.Checked    = false;
            this.aEditGroup.Enabled    = false;
            this.aEditGroup.Hint       = null;
            this.aEditGroup.Shortcut   = System.Windows.Forms.Shortcut.CtrlG;
            this.aEditGroup.ImageIndex = 12;
            this.aEditGroup.Tag        = null;
            this.aEditGroup.Text       = mcEditGroup.Text;
            this.aEditGroup.Visible    = true;
            this.aEditGroup.Update    += new System.EventHandler(this.aEditGroup_Update);
            this.alMenuActionList.Actions.Add(this.aEditGroup);
            this.alMenuActionList.SetAction(this.mcEditGroup, this.aEditGroup);

            #endregion

            // Initialize Undo/Redo context menus
            this.cmUndo.Popup += new EventHandler(cmUndo_Popup);
            this.cmRedo.Popup += new EventHandler(cmRedo_Popup);
        }
Пример #19
0
 public ResponseOptions(PetriNetDocument pnd)
 {
     this.pnd = pnd;
 }