#region Using Directives
using System;
#endregion Using Directives
namespace ScintillaNET
{
// Used by TextModifiedEventArgs, StyeChangedEventArgs and FoldChangedEventArgs
// this provides a friendly wrapper around the SCNotification's modificationType
// flags having to do with Undo and Redo
///
/// Contains Undo/Redo information, used by many of the events
///
public struct UndoRedoFlags
{
#region Constants
private const string STRING_FORMAT = "IsUndo\t\t\t\t:{0}\r\nIsRedo\t\t\t\t:{1}\r\nIsMultiStep\t\t\t:{2}\r\nIsLastStep\t\t\t:{3}\r\nIsMultiLine\t\t\t:{4}";
#endregion Constants
#region Fields
///
/// Was this action the result of an undo action
///
public bool IsUndo;
///
/// Was this action the result of a redo action
///
public bool IsRedo;
///
/// Is this part of a multiple undo or redo
///
public bool IsMultiStep;
///
/// Is this the last step in an undi or redo
///
public bool IsLastStep;
///
/// Does this affect multiple lines
///
public bool IsMultiLine;
#endregion Fields
#region Methods
///
/// Overridden
///
public override string ToString()
{
return string.Format(STRING_FORMAT, IsUndo, IsRedo, IsMultiStep, IsLastStep, IsMultiLine);
}
#endregion Methods
#region Constructors
///
/// Initializes a new instance of the UndoRedoFlags structure.
///
/// Was this action the result of an undo action
/// Was this action the result of a redo action
/// Is this part of a multiple undo or redo
/// Is this the last step in an undi or redo
/// Does this affect multiple lines
public UndoRedoFlags(int modificationType)
{
IsLastStep = (modificationType & Constants.SC_LASTSTEPINUNDOREDO) > 0;
IsMultiLine = (modificationType & Constants.SC_MULTILINEUNDOREDO) > 0;
IsMultiStep = (modificationType & Constants.SC_MULTISTEPUNDOREDO) > 0;
IsRedo = (modificationType & Constants.SC_PERFORMED_REDO) > 0;
IsUndo = (modificationType & Constants.SC_PERFORMED_UNDO) > 0;
}
#endregion Constructors
}
}