Inheritance: System.EventArgs
Beispiel #1
0
        /// <summary>
        /// This method moves all indices from index upward count lines
        /// (useful for deletion/insertion of text)
        /// </summary>
        void MoveIndices(object sender, LineManagerEventArgs e)
        {
            bool changed = false;

            OnBeforeChanged();
            for (int i = 0; i < bookmark.Count; ++i)
            {
                int mark = (int)bookmark[i];
                if (e.LinesMoved < 0 && mark + 1 >= e.LineStart && mark + 1 < e.LineStart - e.LinesMoved)
                {
                    bookmark.RemoveAt(i);
                    --i;
                    changed = true;
                }
                else if (mark >= e.LineStart + 1 || (e.LinesMoved < 0 && mark > e.LineStart))
                {
                    changed     = true;
                    bookmark[i] = mark + e.LinesMoved;
                }
            }

            if (changed)
            {
                OnChanged();
            }
        }
Beispiel #2
0
 protected virtual void OnLineCountChanged(LineManagerEventArgs e)
 {
     if (LineCountChanged != null)
     {
         LineCountChanged(this, e);
     }
 }
Beispiel #3
0
        /// <summary>
        /// This method moves all indices from index upward count lines
        /// (useful for deletion/insertion of text)
        /// </summary>
        void MoveIndices(object sender, LineManagerEventArgs e)
        {
            bool changed = false;

            OnBeforeChanged();
            for (int i = 0; i < lines.Count; ++i)
            {
                int startLineNr = ((CustomLine)lines[i]).StartLineNr;
                int endLineNr   = ((CustomLine)lines[i]).EndLineNr;
                if (e.LineStart >= startLineNr && e.LineStart < endLineNr)
                {
                    changed = true;
                    ((CustomLine)lines[i]).EndLineNr += e.LinesMoved;
                }
                else if (e.LineStart < startLineNr)
                {
                    ((CustomLine)lines[i]).StartLineNr += e.LinesMoved;
                    ((CustomLine)lines[i]).EndLineNr   += e.LinesMoved;
                }
                else
                {
                }

/*
 *                              if (e.LinesMoved < 0 && lineNr == e.LineStart) {
 *                                      lines.RemoveAt(i);
 *                                      --i;
 *                                      changed = true;
 *                              } else if (lineNr > e.LineStart + 1 || (e.LinesMoved < 0 && lineNr > e.LineStart))  {
 *                                      changed = true;
 *                                      ((CustomLine)lines[i]).StartLineNr += e.LinesMoved;
 *                                      ((CustomLine)lines[i]).EndLineNr += e.LinesMoved;
 *                              }
 */
            }

            if (changed)
            {
                OnChanged();
            }
        }
Beispiel #4
0
        /// <summary>
        /// This method moves all indices from index upward count lines
        /// (useful for deletion/insertion of text)
        /// </summary>
        void MoveIndices(object sender, LineManagerEventArgs e)
        {
            bool changed = false;

            for (int i = 0; i < bookmark.Count; ++i)
            {
                Bookmark mark = bookmark[i];
                if (e.LinesMoved < 0 && mark.LineNumber == e.LineStart)
                {
                    bookmark.RemoveAt(i);
                    OnRemoved(new BookmarkEventArgs(mark));
                    --i;
                    changed = true;
                }
                else if (mark.LineNumber > e.LineStart + 1 || (e.LinesMoved < 0 && mark.LineNumber > e.LineStart))
                {
                    changed = true;
                    int newLine = mark.LineNumber + e.LinesMoved;
                    if (newLine >= 0)
                    {
                        bookmark[i].LineNumber = newLine;
                    }
                    else
                    {
                        bookmark.RemoveAt(i);
                        OnRemoved(new BookmarkEventArgs(mark));
                        --i;
                    }
                }
            }

            if (changed)
            {
                OnChanged(EventArgs.Empty);
            }
        }
		/// <summary>
		/// This method moves all indices from index upward count lines
		/// (useful for deletion/insertion of text)
		/// </summary>
		void MoveIndices(object sender,LineManagerEventArgs e)
		{
			bool changed = false;
			OnBeforeChanged();
			for (int i = 0; i < lines.Count; ++i) {
				int startLineNr = ((CustomLine)lines[i]).StartLineNr;
				int endLineNr = ((CustomLine)lines[i]).EndLineNr;
				if (e.LineStart >= startLineNr && e.LineStart < endLineNr) {
					changed = true;
					((CustomLine)lines[i]).EndLineNr += e.LinesMoved;
				} 
				else if (e.LineStart < startLineNr) {
					((CustomLine)lines[i]).StartLineNr += e.LinesMoved;
					((CustomLine)lines[i]).EndLineNr += e.LinesMoved;
				} 
				else {
				}
/*
				if (e.LinesMoved < 0 && lineNr == e.LineStart) {
					lines.RemoveAt(i);
					--i;
					changed = true;
				} else if (lineNr > e.LineStart + 1 || (e.LinesMoved < 0 && lineNr > e.LineStart))  {
					changed = true;
					((CustomLine)lines[i]).StartLineNr += e.LinesMoved;
					((CustomLine)lines[i]).EndLineNr += e.LinesMoved;
				}
*/
			}
			
			if (changed) {
				OnChanged();
			}
		}
        /// <summary>
        /// This method moves all indices from index upward count lines
        /// (useful for deletion/insertion of text)
        /// </summary>
        void MoveIndices(object sender,LineManagerEventArgs e)
        {
            bool changed = false;
            for (int i = 0; i < bookmark.Count; ++i) {
                Bookmark mark = bookmark[i];
                if (e.LinesMoved < 0 && mark.LineNumber == e.LineStart) {
                    bookmark.RemoveAt(i);
                    OnRemoved(new BookmarkEventArgs(mark));
                    --i;
                    changed = true;
                } else if (mark.LineNumber > e.LineStart) {
                    changed = true;
                    int newLine = mark.LineNumber + e.LinesMoved;
                    if (newLine >= 0) {
                        bookmark[i].LineNumber = newLine;
                    } else {
                        bookmark.RemoveAt(i);
                        OnRemoved(new BookmarkEventArgs(mark));
                        --i;
                    }
                }
            }

            if (changed) {
                OnChanged(EventArgs.Empty);
            }
        }
		protected virtual void OnLineCountChanged(LineManagerEventArgs e)
		{
			if (LineCountChanged != null) {
				LineCountChanged(this, e);
			}
		}