private void ProfilerForm_Load(object sender, System.EventArgs e) { this.Icon = new Icon(this.GetType().Assembly.GetManifestResourceStream("NProf.GUI.Resources.app-icon.ico")); _pic = new ProjectInfoCollection(); _pt = new ProjectTree(); _pt.Projects = _pic; _pt.ProjectDoubleClicked += new ProjectTree.ProjectDoubleClickedHandler(_pt_ProjectDoubleClicked); _pt.RunDoubleClicked += new ProjectTree.RunDoubleClickedHandler(_pt_RunDoubleClicked); _pt.ExecutablesDropped += new ProjectTree.ExecutablesDroppedHandler(_pt_ExecutableDropped); _dock = new Crownwood.Magic.Docking.DockingManager(this, Crownwood.Magic.Common.VisualStyle.IDE); _dock.OuterControl = _menuMain; _dock.InnerControl = _tcProfilers; Crownwood.Magic.Docking.Content c = _dock.Contents.Add(_pt, "Projects"); Crownwood.Magic.Docking.WindowContent wc = _dock.AddContentWithState(c, Crownwood.Magic.Docking.State.DockLeft); this.Text = "nprof Profiling Application - v" + Profiler.Version; _tcProfilers.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument; if (_piInitialProject != null) { _pic.Add(_piInitialProject); _pt.SelectProject(_piInitialProject); _cmdProjectRun_Click(null, null); } }
private void ProfilerForm_Load(object sender, System.EventArgs e) { this.Icon = new Icon(this.GetType().Assembly.GetManifestResourceStream("NProf.GUI.Resources.app-icon.ico")); CommandBarItem item; commandBar2 = new CommandBar(); commandBar2.Style = CommandBarStyle.ToolBar; item = new CommandBarButton(Images.New, "New", new EventHandler(_cmdFileNew_Click)); _cmdFileNew.Image = Images.New; commandBar2.Items.Add(item); item = new CommandBarButton(Images.Open, "Open", new EventHandler(_cmdFileOpen_Click)); _cmdFileOpen.Image = Images.Open; commandBar2.Items.Add(item); item = new CommandBarButton(Images.Save, "Save", new EventHandler(_cmdFileSave_Click)); _cmdFileSave.Image = Images.Save; commandBar2.Items.Add(item); commandBar2.Items.AddSeparator(); item = new CommandBarButton(Images.Cut, "Cut", new EventHandler(_cmdFileNew_Click)); item.IsEnabled = false; commandBar2.Items.Add(item); item = new CommandBarButton(Images.Copy, "Copy", new EventHandler(_cmdFileNew_Click)); item.IsEnabled = false; commandBar2.Items.Add(item); item = new CommandBarButton(Images.Paste, "Paste", new EventHandler(_cmdFileNew_Click)); item.IsEnabled = false; commandBar2.Items.Add(item); commandBar2.Items.AddSeparator(); item = new CommandBarButton(Images.Back, "Back", new EventHandler(_cmdViewNavBack_Click)); _cmdViewNavBack.Image = Images.Back; commandBar2.Items.Add(item); item = new CommandBarButton(Images.Forward, "Forward", new EventHandler(_cmdViewNavForward_Click)); _cmdViewNavForward.Image = Images.Forward; commandBar2.Items.Add(item); commandBarManager1.CommandBars.Add(commandBar2); _pic = new ProjectInfoCollection(); _pt = new ProjectTree(); _pic.ProjectRemoved += new NProf.Glue.Profiler.Project.ProjectInfoCollection.ProjectEventHandler(_pic_ProjectRemoved); _pt.Projects = _pic; _pt.ProjectDoubleClicked += new ProjectTree.ProjectDoubleClickedHandler(_pt_ProjectDoubleClicked); _pt.RunDoubleClicked += new ProjectTree.RunDoubleClickedHandler(_pt_RunDoubleClicked); _pt.ExecutablesDropped += new ProjectTree.ExecutablesDroppedHandler(_pt_ExecutableDropped); _dock = new Crownwood.Magic.Docking.DockingManager(this, Crownwood.Magic.Common.VisualStyle.IDE); _dock.OuterControl = commandBarManager1; _dock.InnerControl = _tcProfilers; Crownwood.Magic.Docking.Content c = _dock.Contents.Add(_pt, "Projects"); Crownwood.Magic.Docking.WindowContent wc = _dock.AddContentWithState(c, Crownwood.Magic.Docking.State.DockLeft); this.Text = "nprof Profiling Application - v" + Profiler.Version; _tcProfilers.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument; SerializationHandler.DataStoreDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\NProf\\" + Profiler.Version; _cmdFileRecentProjects.MenuCommands.Clear(); int count = 1; foreach (UsedFile usedFile in SerializationHandler.ProjectsHistory) { if (count > 10) { break; } string label = (count == 10 ? "1&0" : "&" + count.ToString()) + " " + usedFile.ProjectName; Crownwood.Magic.Menus.MenuCommand pInfo = new Crownwood.Magic.Menus.MenuCommand(label); pInfo.Tag = usedFile.FileName; pInfo.Click += new EventHandler(_cmdFileRecentlyUsed_Click); pInfo.Shortcut = Shortcut.CtrlShift1 + (count == 10 ? -1 : count - 1); _cmdFileRecentProjects.MenuCommands.Add(pInfo); ++count; } if (count == 1) { _cmdFileRecentProjects.Enabled = false; } if (_piInitialProject != null) { _pic.Add(_piInitialProject); _pt.SelectProject(_piInitialProject); _cmdProjectRun_Click(null, null); } }
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); }