2014-07-26 07:12:56 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2014-07-29 16:42:52 +00:00
|
|
|
|
using System.ComponentModel;
|
2014-08-12 13:33:13 +00:00
|
|
|
|
using RainmeterStudio.Core.Model;
|
2014-07-26 07:12:56 +00:00
|
|
|
|
|
2014-08-12 13:33:13 +00:00
|
|
|
|
namespace RainmeterStudio.TextEditorPlugin
|
2014-07-26 07:12:56 +00:00
|
|
|
|
{
|
|
|
|
|
public class TextDocument : IDocument
|
|
|
|
|
{
|
2014-07-29 16:42:52 +00:00
|
|
|
|
private Reference _reference;
|
|
|
|
|
private bool _isDirty;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the text associated with this document
|
|
|
|
|
/// </summary>
|
2014-07-29 20:35:59 +00:00
|
|
|
|
public List<string> Lines
|
2014-07-29 16:42:52 +00:00
|
|
|
|
{
|
2014-07-29 20:35:59 +00:00
|
|
|
|
get; private set;
|
2014-07-29 16:42:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the reference of this document
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Reference Reference
|
2014-07-26 07:12:56 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-07-29 16:42:52 +00:00
|
|
|
|
return _reference;
|
2014-07-26 07:12:56 +00:00
|
|
|
|
}
|
2014-07-29 16:42:52 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_reference = value;
|
2014-07-26 07:12:56 +00:00
|
|
|
|
|
2014-07-29 16:42:52 +00:00
|
|
|
|
if (PropertyChanged != null)
|
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs("Reference"));
|
|
|
|
|
}
|
2014-07-26 07:12:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 16:42:52 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a property indicating if this file was modified and not saved
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsDirty
|
2014-07-26 07:12:56 +00:00
|
|
|
|
{
|
2014-07-29 16:42:52 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _isDirty;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_isDirty = value;
|
|
|
|
|
|
|
|
|
|
if (PropertyChanged != null)
|
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs("IsDirty"));
|
|
|
|
|
}
|
2014-07-26 07:12:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 16:42:52 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Triggered when the value of a property changes
|
|
|
|
|
/// </summary>
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes the text document
|
|
|
|
|
/// </summary>
|
2014-07-26 07:12:56 +00:00
|
|
|
|
public TextDocument()
|
|
|
|
|
{
|
2014-07-29 20:35:59 +00:00
|
|
|
|
Lines = new List<string>();
|
2014-07-26 07:12:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|