Beispiel #1
0
        /// <summary>
        /// Initializes important variables
        /// </summary>
        void InitBasics()
        {
            String dataPath = Path.Combine(PathHelper.DataDir, "FlexDbg");

            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }

            this.settingFilename = Path.Combine(dataPath, "Settings.FlexDbg");
            String bkPath = Path.Combine(dataPath, "Breakpoints");

            if (!Directory.Exists(bkPath))
            {
                Directory.CreateDirectory(bkPath);
            }

            this.pluginImage = PluginBase.MainForm.FindImage("51");

            PluginBase.MainForm.BreakpointsEnabled = true;

            breakPointManager = new BreakPointManager();
            debugManager      = new DebuggerManager();
            liveDataTip       = new LiveDataTip();
        }
Beispiel #2
0
        private void Manager_OnMouseHover(ScintillaControl sci, Int32 position)
        {
            DebuggerManager debugManager   = PluginMain.debugManager;
            FlashInterface  flashInterface = debugManager.FlashInterface;

            if (!PluginBase.MainForm.EditorMenu.Visible && flashInterface != null &&
                flashInterface.isDebuggerStarted && flashInterface.isDebuggerSuspended)
            {
                if (debugManager.CurrentLocation != null &&
                    debugManager.CurrentLocation.File != null)
                {
                    String localPath = debugManager.GetLocalPath(debugManager.CurrentLocation.File);

                    if (localPath == null || localPath != PluginBase.MainForm.CurrentDocument.FileName)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }

                Point     dataTipPoint = Control.MousePosition;
                Rectangle rect         = new Rectangle(m_ToolTip.Location, m_ToolTip.Size);

                if (m_ToolTip.Visible && rect.Contains(dataTipPoint))
                {
                    return;
                }

                position = sci.WordEndPosition(position, true);
                String leftword = GetWordAtPosition(sci, position);
                if (leftword != String.Empty)
                {
                    try
                    {
                        ASTBuilder builder = new ASTBuilder(true);

                        ValueExp          exp     = builder.parse(new System.IO.StringReader(leftword));
                        ExpressionContext context = new ExpressionContext(flashInterface.Session);

                        context.Depth = debugManager.CurrentFrame;

                        Object obj = exp.evaluate(context);

                        Show(dataTipPoint, (Variable)obj);
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes important variables
        /// </summary>
        void InitBasics()
        {
            String dataPath = Path.Combine(PathHelper.DataDir, "FlexDbg");

			if (!Directory.Exists(dataPath))
				Directory.CreateDirectory(dataPath);

			this.settingFilename = Path.Combine(dataPath, "Settings.FlexDbg");
            String bkPath = Path.Combine(dataPath, "Breakpoints");

			if (!Directory.Exists(bkPath))
				Directory.CreateDirectory(bkPath);

            this.pluginImage = PluginBase.MainForm.FindImage("51");

            PluginBase.MainForm.BreakpointsEnabled = true;

			breakPointManager = new BreakPointManager();
            debugManager = new DebuggerManager();
            liveDataTip = new LiveDataTip();
        }
        /// <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;
        }
Beispiel #5
0
        /// <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;
        }