internal bool LineIsInBlock(int functionNo, int LineNumber) { // Can't be in this block - its in a different function... if (functionNo != this._functionNo) { return(false); } // Is it in this block ? if (LineNumber <= _block_end_lineno && LineNumber >= _block_start_lineno) { return(true); } // It it in any child blocks ? if (this.Nodes != null) { foreach (TreeNode t in this.Nodes) { if (t is MyLocationNode) { MyLocationNode mln = t as MyLocationNode; if (mln.LineIsInBlock(functionNo, LineNumber)) { return(true); } } } } // no.. return(false); }
public override string ToString() { string path; if (t == null) { return(""); } try { if (!lastIsSuggestion) { path = t.FullPath; path = path.Replace("\\", "-->"); } else { if (t is MyLocationNode) { MyLocationNode mln = t as MyLocationNode; if (mln.LineIsInBlock(_functionNo, LineNumber)) { // We in the last command... path = t.FullPath; path = path.Replace("\\", "-->"); } else { // We're after the last command path = t.FullPath; path = path.Replace("\\", "-->"); // We now need to remove the last portion and replace it with our own line.. int l = path.LastIndexOf("-->"); path = path.Substring(0, l + 3); path += _lineText; } } else { path = t.FullPath; path = path.Replace("\\", "-->"); // We now need to remove the last portion and replace it with our own line.. int l = path.LastIndexOf("-->"); path = path.Substring(0, l + 3); path += _lineText; } } return(path); } catch (Exception e) { return(""); } }
public offsetTreeNodeForList(int functionNo, System.Windows.Forms.TreeNode node, int actualLineNumber, string lineText) : base(node) { _lineNumber = actualLineNumber; _lineText = lineText; _functionNo = functionNo; if (t is MyLocationNode) { MyLocationNode mln = t as MyLocationNode; if (mln.LineNumber == actualLineNumber) { // Yeah - its an exact match! } else { lastIsSuggestion = true; } } }
internal bool ensureLines(int functionNo, int line, int lastLine) { bool neededToUpdate = false; if (this._functionNo != functionNo) { return(false); } if (lastLine != -1) { if (line > lastLine) { throw new ApplicationException("Line must be <= lastline"); } } if (_block_start_lineno == -1) { _block_start_lineno = line; neededToUpdate = true; } else { if (line < _block_start_lineno) { _block_start_lineno = line; neededToUpdate = true; } } if (lastLine != -1) { if (_block_end_lineno == -1) { _block_end_lineno = lastLine; neededToUpdate = true; } else { if (_block_end_lineno < lastLine) { _block_end_lineno = lastLine; neededToUpdate = true; } } } if (_block_start_lineno > _block_end_lineno) { throw new ApplicationException("start > last"); } this.Text = _text; // +" (" + _functionNo + ":" + _block_start_lineno + "," + _block_end_lineno + ")"; TreeNode _parent; _parent = this.Parent; while (_parent != null) { if (_parent is MyLocationNode) { MyLocationNode mln = _parent as MyLocationNode; mln.ensureLines(functionNo, _block_start_lineno, _block_end_lineno); // if (!mln.ensureLines(functionNo, _block_start_lineno, _block_end_lineno) && false) break; } _parent = _parent.Parent; } return(neededToUpdate); }