/// <summary> /// Loads the plugin settings /// </summary> public void LoadSettings() { settingObject = new Settings(); if (!File.Exists(this.settingFilename)) SaveSettings(); else { Object obj = ObjectSerializer.Deserialize(this.settingFilename, settingObject); settingObject = (Settings)obj; } #if false if (settingObject.DebugFlashPlayerPath == null || settingObject.DebugFlashPlayerPath.Length == 0) settingObject.DebugFlashPlayerPath = DetectFlashPlayer(); #endif // AddSettingsListeners(); }
/// <summary> /// Creates a menu item for the plugin and adds a ignored key /// </summary> public MenusHelper(Image pluginImage, DebuggerManager debugManager, Settings settingObject) { imageList = new ImageList(); imageList.Images.Add("StartContinue", Resource.StartContinue); imageList.Images.Add("Pause", Resource.Pause); imageList.Images.Add("Stop", Resource.Stop); imageList.Images.Add("Current", Resource.Current); imageList.Images.Add("RunToCursor", Resource.RunToCursor); imageList.Images.Add("Step", Resource.Step); imageList.Images.Add("Next", Resource.Next); imageList.Images.Add("Finish", Resource.Finish); ToolStripMenuItem viewMenu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("ViewMenu"); viewMenu.DropDownItems.Add(new ToolStripMenuItem(TextHelper.GetString("Label.ViewLocalVariablesPanel"), pluginImage, new EventHandler(this.OpenLocalVariablesPanel))); viewMenu.DropDownItems.Add(new ToolStripMenuItem(TextHelper.GetString("Label.ViewBreakpointsPanel"), pluginImage, new EventHandler(this.OpenBreakPointPanel))); viewMenu.DropDownItems.Add(new ToolStripMenuItem(TextHelper.GetString("Label.ViewStackframePanel"), pluginImage, new EventHandler(this.OpenStackframePanel))); //Menu ToolStripMenuItem debugMenu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("DebugMenu"); if (debugMenu == null) { debugMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Debug")); ToolStripMenuItem toolsMenu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("ToolsMenu"); Int32 idx = PluginBase.MainForm.MenuStrip.Items.IndexOf(toolsMenu); if (idx < 0) idx = PluginBase.MainForm.MenuStrip.Items.Count - 1; PluginBase.MainForm.MenuStrip.Items.Insert(idx, debugMenu); } StartContinueMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Start"), imageList.Images["StartContinue"], new EventHandler(StartContinue_Click), settingObject.StartContinue); PauseMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Pause"), imageList.Images["Pause"], new EventHandler(debugManager.Pause_Click), settingObject.Pause); StopMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Stop"), imageList.Images["Stop"], new EventHandler(debugManager.Stop_Click), settingObject.Stop); CurrentMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Current"), imageList.Images["Current"], new EventHandler(debugManager.Current_Click), settingObject.Current); RunToCursorMenu = new ToolStripMenuItem(TextHelper.GetString("Label.RunToCursor"), imageList.Images["RunToCursor"], new EventHandler(ScintillaHelper.RunToCursor_Click), settingObject.RunToCursor); StepMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Step"), imageList.Images["Step"], new EventHandler(debugManager.Step_Click), settingObject.Step); NextMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Next"), imageList.Images["Next"], new EventHandler(debugManager.Next_Click), settingObject.Next); FinishMenu = new ToolStripMenuItem(TextHelper.GetString("Label.Finish"), imageList.Images["Finish"], new EventHandler(debugManager.Finish_Click), settingObject.Finish); ToggleBreakPointMenu = new ToolStripMenuItem(TextHelper.GetString("Info.ToggleBreakpoint"), null, new EventHandler(ScintillaHelper.ToggleBreakPoint_Click), settingObject.ToggleBreakPoint); DeleteAllBreakPointsMenu = new ToolStripMenuItem(TextHelper.GetString("Info.DeleteAllBreakpoints"), null, new EventHandler(ScintillaHelper.DeleteAllBreakPoints_Click), settingObject.Finish); ToggleBreakPointEnableMenu = new ToolStripMenuItem(TextHelper.GetString("Info.ToggleBreakpointEnabled"), null, new EventHandler(ScintillaHelper.ToggleBreakPointEnable_Click), settingObject.ToggleBreakPointEnable); DisableAllBreakPointsMenu = new ToolStripMenuItem(TextHelper.GetString("Info.DisableAllBreakpoints"), null, new EventHandler(ScintillaHelper.DisableAllBreakPoints_Click), settingObject.DisableAllBreakPoints); EnableAllBreakPointsMenu = new ToolStripMenuItem(TextHelper.GetString("Info.EnableAllBreakpoints"), null, new EventHandler(ScintillaHelper.EnableAllBreakPoints_Click), settingObject.EnableAllBreakPoints); List<ToolStripItem> items = new List<ToolStripItem>(new ToolStripItem[] { StartContinueMenu, PauseMenu, StopMenu, new ToolStripSeparator(), CurrentMenu, RunToCursorMenu, StepMenu, NextMenu, FinishMenu, new ToolStripSeparator(), ToggleBreakPointMenu, DeleteAllBreakPointsMenu, ToggleBreakPointEnableMenu ,DisableAllBreakPointsMenu, EnableAllBreakPointsMenu}); foreach (ToolStripItem item in items) { if (item is ToolStripMenuItem) { if ((item as ToolStripMenuItem).ShortcutKeys != Keys.None) PluginBase.MainForm.IgnoredKeys.Add((item as ToolStripMenuItem).ShortcutKeys); } } debugMenu.DropDownItems.AddRange(items.ToArray()); //ToolStrip StartContinueButton = new ToolStripButton(TextHelper.GetString("Label.Start"), imageList.Images["StartContinue"], new EventHandler(StartContinue_Click)); StartContinueButton.DisplayStyle = ToolStripItemDisplayStyle.Image; PauseButton = new ToolStripButton(TextHelper.GetString("Label.Pause"), imageList.Images["Pause"], new EventHandler(debugManager.Pause_Click)); PauseButton.DisplayStyle = ToolStripItemDisplayStyle.Image; StopButton = new ToolStripButton(TextHelper.GetString("Label.Stop"), imageList.Images["Stop"], new EventHandler(debugManager.Stop_Click)); StopButton.DisplayStyle = ToolStripItemDisplayStyle.Image; CurrentButton = new ToolStripButton(TextHelper.GetString("Label.Current"), imageList.Images["Current"], new EventHandler(debugManager.Current_Click)); CurrentButton.DisplayStyle = ToolStripItemDisplayStyle.Image; RunToCursorButton = new ToolStripButton(TextHelper.GetString("Label.RunToCursor"), imageList.Images["RunToCursor"], new EventHandler(ScintillaHelper.RunToCursor_Click)); RunToCursorButton.DisplayStyle = ToolStripItemDisplayStyle.Image; StepButton = new ToolStripButton(TextHelper.GetString("Label.Step"), imageList.Images["Step"], new EventHandler(debugManager.Step_Click)); StepButton.DisplayStyle = ToolStripItemDisplayStyle.Image; NextButton = new ToolStripButton(TextHelper.GetString("Label.Next"), imageList.Images["Next"], new EventHandler(debugManager.Next_Click)); NextButton.DisplayStyle = ToolStripItemDisplayStyle.Image; FinishButton = new ToolStripButton(TextHelper.GetString("Label.Finish"), imageList.Images["Finish"], new EventHandler(debugManager.Finish_Click)); FinishButton.DisplayStyle = ToolStripItemDisplayStyle.Image; m_ToolStripButtons = new ToolStripItem[] { StartContinueButton, PauseButton, StopButton, new ToolStripSeparator(), CurrentButton, RunToCursorButton, StepButton, NextButton, FinishButton }; m_DebuggerToolStrip = new ToolStrip(m_ToolStripButtons); m_DebuggerToolStrip.Renderer = new DockPanelStripRenderer(false); PluginBase.MainForm.ToolStrip.Stretch = false; #if false Point toolStripLocation = PluginMain.settingObject.DebugToolBarLocation; if (toolStripLocation.IsEmpty) { PluginBase.MainForm.ToolStripPanel.Join(m_DebuggerToolStrip, PluginBase.MainForm.ToolStripPanel.Rows.Length); } else { PluginBase.MainForm.ToolStripPanel.Join(m_DebuggerToolStrip, toolStripLocation); } m_DebuggerToolStrip.EndDrag += new EventHandler(DebuggerToolStrip_EndDrag); #else //PluginBase.MainForm.ToolStripPanel.Join(m_DebuggerToolStrip, PluginBase.MainForm.ToolStripPanel.Rows.Length); #endif // update items when debugger state changes PluginMain.debugManager.StateChangedEvent += UpdateMenuState; }