コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 private void ResetCurrentLocation()
 {
     if ((PluginBase.MainForm as Form).InvokeRequired)
     {
         (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker)ResetCurrentLocation);
         return;
     }
     if (CurrentLocation.getFile() != null)
     {
         ScintillaControl sci;
         String           localPath = GetLocalPath(CurrentLocation.getFile());
         if (localPath != null)
         {
             sci = ScintillaHelper.GetScintillaControl(localPath);
             if (sci != null)
             {
                 Int32 i = ScintillaHelper.GetScintillaControlIndex(sci);
                 if (i != -1)
                 {
                     Int32 line = CurrentLocation.getLine() - 1;
                     sci.MarkerDelete(line, ScintillaHelper.markerCurrentLine);
                 }
             }
         }
     }
 }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 private void GotoCurrentLocation(bool bSetMarker)
 {
     if ((PluginBase.MainForm as Form).InvokeRequired)
     {
         (PluginBase.MainForm as Form).BeginInvoke(new Action <bool>(GotoCurrentLocation), bSetMarker);
         return;
     }
     if (CurrentLocation != null && CurrentLocation.getFile() != null)
     {
         String localPath = GetLocalPath(CurrentLocation.getFile());
         if (localPath != null)
         {
             int line             = CurrentLocation.getLine() - 1;
             ScintillaControl sci = ScintillaHelper.ActivateDocument(localPath, line, false);
             if (sci == null)
             {
                 return;
             }
             if (bSetMarker)
             {
                 sci.MarkerAdd(line, ScintillaHelper.markerCurrentLine);
             }
         }
     }
 }
コード例 #3
0
ファイル: BreakPointUI.cs プロジェクト: zvoronz/flashdevelop
 private void TsbRemoveFiltered_Click(object sender, EventArgs e)
 {
     if (dgv.Rows.Count == 0)
     {
         return;
     }
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
     foreach (DataGridViewRow row in dgv.Rows)
     {
         string          filefullpath = (string)row.Cells["FilePath"].Value;
         int             line         = int.Parse((string)row.Cells["Line"].Value) - 1;
         ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
         if (doc != null)
         {
             Boolean m = ScintillaHelper.IsMarkerSet(doc.SciControl, ScintillaHelper.markerBPDisabled, line);
             doc.SciControl.MarkerDelete(line, m ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
         }
         else
         {
             breakPointManager.SetBreakPointInfo(filefullpath, line, true, false);
         }
     }
     dgv.Rows.Clear();
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
     breakPointManager.Save();
 }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        static public void ApplyHighlights(ScintillaControl sender, Int32 line)
        {
            Boolean bCurrentLine = IsMarkerSet(sender, markerCurrentLine, line);
            Boolean bBpActive    = IsMarkerSet(sender, markerBPEnabled, line);
            Boolean bBpDisabled  = IsMarkerSet(sender, markerBPDisabled, line);

            if (bCurrentLine)
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugDisabledBreakpoint);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugEnabledBreakpoint);
                ScintillaHelper.AddHighlight(sender, line, indicatorDebugCurrentLine, 1);
            }
            else if (bBpActive)
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugCurrentLine);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugDisabledBreakpoint);
                ScintillaHelper.AddHighlight(sender, line, indicatorDebugEnabledBreakpoint, 1);
            }
            else if (bBpDisabled)
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugCurrentLine);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugEnabledBreakpoint);
                ScintillaHelper.AddHighlight(sender, line, indicatorDebugDisabledBreakpoint, 1);
            }
            else
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugCurrentLine);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugDisabledBreakpoint);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugEnabledBreakpoint);
            }
            PluginMain.breakPointManager.SetBreakPointInfo(sender.FileName, line, !(bBpActive || bBpDisabled), bBpActive);
        }
コード例 #5
0
ファイル: BreakPointUI.cs プロジェクト: zvoronz/flashdevelop
 private void TsbAlternateFiltered_Click(object sender, EventArgs e)
 {
     if (dgv.Rows.Count == 0)
     {
         return;
     }
     this.breakPointManager.ChangeBreakPointEvent -= breakPointManager_ChangeBreakPointEvent;
     foreach (DataGridViewRow row in dgv.Rows)
     {
         string          filefullpath = (string)row.Cells["FilePath"].Value;
         int             line         = int.Parse((string)row.Cells["Line"].Value) - 1;
         bool            value        = !(bool)row.Cells["Enable"].Value;
         ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
         if (doc != null)
         {
             int     newMarker = value ? ScintillaHelper.markerBPEnabled : ScintillaHelper.markerBPDisabled;
             Boolean m         = ScintillaHelper.IsMarkerSet(doc.SciControl, newMarker, line);
             if (!m)
             {
                 doc.SciControl.MarkerAdd(line, newMarker);
                 doc.SciControl.MarkerDelete(line, value ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
             }
         }
         else
         {
             breakPointManager.SetBreakPointInfo(filefullpath, line, false, value);
         }
         row.Cells["Enable"].Value = value;
     }
     dgv.EndEdit();
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
     breakPointManager.Save();
 }
コード例 #6
0
ファイル: BreakPointUI.cs プロジェクト: zvoronz/flashdevelop
        private void TsbRemoveSelected_Click(object sender, EventArgs e)
        {
            if (dgv.SelectedCells.Count == 0)
            {
                return;
            }
            this.breakPointManager.ChangeBreakPointEvent -= breakPointManager_ChangeBreakPointEvent;
            var processedRows = new HashSet <DataGridViewRow>();

            foreach (DataGridViewCell selectedCell in dgv.SelectedCells)
            {
                var selected = selectedCell.OwningRow;
                if (processedRows.Contains(selected))
                {
                    continue;
                }
                processedRows.Add(selected);
                string          filefullpath = (string)selected.Cells["FilePath"].Value;
                int             line         = int.Parse((string)selected.Cells["Line"].Value) - 1;
                ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
                if (doc != null)
                {
                    Boolean m = ScintillaHelper.IsMarkerSet(doc.SciControl, ScintillaHelper.markerBPDisabled, line);
                    doc.SciControl.MarkerDelete(line, m ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
                }
                else
                {
                    breakPointManager.SetBreakPointInfo(filefullpath, line, true, false);
                }
                dgv.Rows.Remove(selected);
            }
            this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
            breakPointManager.Save();
        }
コード例 #7
0
 void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (dgv.Rows[e.RowIndex].Cells["Line"].ColumnIndex == e.ColumnIndex)
     {
         string filename = (string)dgv.Rows[e.RowIndex].Cells["FilePath"].Value;
         int    line     = int.Parse((string)dgv.Rows[e.RowIndex].Cells["Line"].Value);
         ScintillaHelper.ActivateDocument(filename, line - 1, true);
     }
 }
コード例 #8
0
        private void GotoSourceClick(Object sender, EventArgs e)
        {
            var frame = ((ListItemData)lv.SelectedItems[0].Tag).Frame;

            if (frame == null)
            {
                return;
            }
            string file = PluginMain.debugManager.GetLocalPath(frame.getLocation().getFile());

            if (file == null)
            {
                return;
            }
            ScintillaHelper.ActivateDocument(file, frame.getLocation().getLine() - 1, false);
        }
コード例 #9
0
        void dgv_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dgv.Rows.Count)
            {
                return;
            }
            if (dgv.Rows[e.RowIndex].Cells["Enable"].ColumnIndex == e.ColumnIndex)
            {
                Boolean         enable       = !(Boolean)dgv.Rows[e.RowIndex].Cells["Enable"].Value;
                string          filefullpath = (string)dgv.Rows[e.RowIndex].Cells["FilePath"].Value;
                int             line         = int.Parse((string)dgv.Rows[e.RowIndex].Cells["Line"].Value);
                ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
                if (doc != null)
                {
                    // This logic should be handled by BPMAnager, wo we'll just work arround bad BPs and ignore them
                    if (line < 1 || (doc.SciControl != null && line > doc.SciControl.LineCount))
                    {
                        return;
                    }
                    Boolean m = ScintillaHelper.IsMarkerSet(doc.SciControl, ScintillaHelper.markerBPDisabled, line - 1);
                    if (m)
                    {
                        doc.SciControl.MarkerAdd(line - 1, ScintillaHelper.markerBPEnabled);
                        doc.SciControl.MarkerDelete(line - 1, ScintillaHelper.markerBPDisabled);
                    }
                    else
                    {
                        doc.SciControl.MarkerAdd(line - 1, ScintillaHelper.markerBPDisabled);
                        doc.SciControl.MarkerDelete(line - 1, ScintillaHelper.markerBPEnabled);
                    }

                    if (e.RowIndex >= 0 && e.RowIndex < dgv.Rows.Count) // list can have been updated in the meantime
                    {
                        if ((Boolean)dgv.Rows[e.RowIndex].Cells["Enable"].Value != m)
                        {
                            dgv.Rows[e.RowIndex].Cells["Enable"].Value = m;
                        }
                    }
                    dgv.RefreshEdit();
                }
            }
        }
コード例 #10
0
 /// <summary>
 ///
 /// </summary>
 private void GotoCurrentLocation(bool bSetMarker)
 {
     if ((PluginBase.MainForm as Form).InvokeRequired)
     {
         (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker) delegate()
         {
             GotoCurrentLocation(bSetMarker);
         });
         return;
     }
     if (CurrentLocation != null && CurrentLocation.getFile() != null)
     {
         ScintillaControl sci;
         String           localPath = GetLocalPath(CurrentLocation.getFile());
         if (localPath != null)
         {
             sci = ScintillaHelper.GetScintillaControl(localPath);
             if (sci == null)
             {
                 PluginBase.MainForm.OpenEditableDocument(localPath);
                 sci = ScintillaHelper.GetScintillaControl(localPath);
             }
             if (sci != null)
             {
                 Int32 i = ScintillaHelper.GetScintillaControlIndex(sci);
                 if (i != -1)
                 {
                     PluginBase.MainForm.Documents[i].Activate();
                     Int32 line = CurrentLocation.getLine() - 1;
                     sci.GotoLine(line);
                     if (bSetMarker)
                     {
                         sci.MarkerAdd(line, ScintillaHelper.markerCurrentLine);
                     }
                 }
             }
         }
     }
 }
コード例 #11
0
ファイル: BreakPointUI.cs プロジェクト: zvoronz/flashdevelop
 void dgv_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     this.breakPointManager.ChangeBreakPointEvent -= breakPointManager_ChangeBreakPointEvent;
     if (e.RowIndex < 0 || e.RowIndex >= dgv.Rows.Count)
     {
         return;
     }
     if (dgv.Rows[e.RowIndex].Cells["Enable"].ColumnIndex == e.ColumnIndex)
     {
         var             row          = dgv.Rows[e.RowIndex];
         string          filefullpath = (string)row.Cells["FilePath"].Value;
         int             line         = int.Parse((string)row.Cells["Line"].Value) - 1;
         ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
         bool            value        = (Boolean)row.Cells["Enable"].EditedFormattedValue;
         if (doc != null)
         {
             // This logic should be handled by BPManager, so we'll just work arround bad BPs and ignore them
             if (line < 0 || (doc.SciControl != null && line >= doc.SciControl.LineCount))
             {
                 return;
             }
             int     marker = value ? ScintillaHelper.markerBPEnabled : ScintillaHelper.markerBPDisabled;
             Boolean m      = ScintillaHelper.IsMarkerSet(doc.SciControl, marker, line);
             if (!m)
             {
                 doc.SciControl.MarkerAdd(line, marker);
                 doc.SciControl.MarkerDelete(line, value ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
             }
         }
         else
         {
             breakPointManager.SetBreakPointInfo(filefullpath, line, false, value);
         }
     }
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
 }
コード例 #12
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            if (debugManager == null)
            {
                return;
            }
            switch (e.Type)
            {
            case EventType.FileOpen:
                TextEvent evnt = (TextEvent)e;
                ScintillaHelper.AddSciEvent(evnt.Value);
                breakPointManager.SetBreakPointsToEditor(evnt.Value);
                break;

            case EventType.UIStarted:
                menusHelper.AddToolStripItems();
                menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                debugManager.RestoreOldLayout();
                break;

            case EventType.UIClosing:
                if (debugManager.FlashInterface.isDebuggerStarted)
                {
                    debugManager.FlashInterface.Detach();
                }
                break;

            case EventType.ApplySettings:
                menusHelper.UpdateMenuState(this);
                break;

            case EventType.FileSwitch:
                menusHelper.UpdateMenuState(this);
                break;

            case EventType.Command:
                PluginCore.DataEvent buildevnt = (PluginCore.DataEvent)e;
                if (buildevnt.Action == "AS3Context.StartDebugger")
                {
                    if (settingObject.StartDebuggerOnTestMovie)
                    {
                        if (debugManager.Start(buildevnt.Data != null))
                        {
                            buildevnt.Handled = true;
                        }
                    }
                    return;
                }
                if (!buildevnt.Action.StartsWith("ProjectManager"))
                {
                    return;
                }
                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.Project)
                {
                    IProject project = PluginBase.CurrentProject;
                    if (project != null && project.EnableInteractiveDebugger)
                    {
                        disableDebugger = false;
                        PanelsHelper.breakPointUI.Clear();
                        if (breakPointManager.Project != null && breakPointManager.Project != project)
                        {
                            breakPointManager.Save();
                        }
                        breakPointManager.Project = project;
                        breakPointManager.Load();
                        breakPointManager.SetBreakPointsToEditor(PluginBase.MainForm.Documents);
                    }
                    else
                    {
                        disableDebugger = true;
                        if (breakPointManager.Project != null)
                        {
                            breakPointManager.Save();
                        }
                        PanelsHelper.breakPointUI.Clear();
                    }
                }
                else if (disableDebugger)
                {
                    return;
                }
                if (buildevnt.Action == ProjectManager.ProjectManagerCommands.HotBuild || buildevnt.Action == ProjectManager.ProjectManagerCommands.BuildProject)
                {
                    if (debugManager.FlashInterface.isDebuggerStarted)
                    {
                        if (debugManager.FlashInterface.isDebuggerSuspended)
                        {
                            debugManager.Continue_Click(null, null);
                        }
                        debugManager.Stop_Click(null, null);
                    }
                }
                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject)
                {
                    if (debugManager.FlashInterface.isDebuggerStarted)
                    {
                        if (debugManager.FlashInterface.isDebuggerSuspended)
                        {
                            debugManager.Continue_Click(null, null);
                            e.Handled = true;
                            return;
                        }
                    }
                }
                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject)
                {
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }
                break;
            }
        }
コード例 #13
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            if (debugManager == null)
            {
                return;
            }
            switch (e.Type)
            {
            case EventType.FileOpen:
                TextEvent evnt = (TextEvent)e;
                ScintillaHelper.AddSciEvent(evnt.Value);
                breakPointManager.SetBreakPointsToEditor(evnt.Value);
                break;

            case EventType.UIStarted:
                menusHelper.AddToolStripItems();
                menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                break;

            case EventType.UIClosing:
                if (debugManager.FlashInterface.isDebuggerStarted)
                {
                    debugManager.FlashInterface.Detach();
                }
                break;

            case EventType.ApplySettings:
                menusHelper.UpdateMenuState(this);
                break;

            case EventType.ProcessEnd:
                TextEvent textevnt = (TextEvent)e;
                if (buildCmpFlg && textevnt.Value != "Done(0)")
                {
                    buildCmpFlg = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }
                break;

            case EventType.Command:
                PluginCore.DataEvent buildevnt = (PluginCore.DataEvent)e;
                if (buildevnt.Action == "AS3Context.StartDebugger")
                {
                    if (settingObject.StartDebuggerOnTestMovie)
                    {
                        if (debugManager.Start(false))
                        {
                            buildevnt.Handled = true;
                        }
                    }
                    return;
                }
                if (!buildevnt.Action.StartsWith("ProjectManager"))
                {
                    return;
                }
                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.Project)
                {
                    IProject project = PluginBase.CurrentProject;
                    if (project != null && project is AS3Project)
                    {
                        disableDebugger = false;
                        PanelsHelper.breakPointUI.Clear();
                        if (breakPointManager.Project != null && breakPointManager.Project != project)
                        {
                            breakPointManager.Save();
                        }
                        breakPointManager.Project = project;
                        breakPointManager.Load();
                        breakPointManager.SetBreakPointsToEditor(PluginBase.MainForm.Documents);
                    }
                    else
                    {
                        disableDebugger = true;
                        if (breakPointManager.Project != null)
                        {
                            breakPointManager.Save();
                        }
                        PanelsHelper.breakPointUI.Clear();
                    }
                }
                else if (disableDebugger)
                {
                    return;
                }
                if (debugBuildStart && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildFailed)
                {
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }
                else if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject)
                {
                    if (debugManager.FlashInterface.isDebuggerStarted)
                    {
                        if (debugManager.FlashInterface.isDebuggerSuspended)
                        {
                            debugManager.Continue_Click(null, null);
                        }
                        e.Handled = true;
                        return;
                    }
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }
                else if (debugBuildStart && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildProject && buildevnt.Data.ToString() == "Debug")
                {
                    buildCmpFlg = true;
                }
                else if (buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildFailed)
                {
                    menusHelper.OnBuildFailed();
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                }
                else if (buildCmpFlg && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildComplete)
                {
                    if (buildCmpFlg)
                    {
                        debugManager.Start(debugManager.currentProject.OutputPathAbsolute);
                    }
                    else
                    {
                        menusHelper.OnBuildComplete();
                    }
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Stopped);
                }
                break;
            }
        }