Browse Source

Grouped code according to interface implementations and added #region wrappers to identify them.

No change to code or functionality.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1031 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Alpert 20 years ago
parent
commit
e53be414f7
  1. 21
      src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs
  2. 158
      src/Main/Base/Project/Src/Gui/AbstractViewContent.cs

21
src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs

@ -14,6 +14,16 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -14,6 +14,16 @@ namespace ICSharpCode.SharpDevelop.Gui
{
IWorkbenchWindow workbenchWindow = null;
public event EventHandler WorkbenchWindowChanged;
protected virtual void OnWorkbenchWindowChanged(EventArgs e)
{
if (WorkbenchWindowChanged != null) {
WorkbenchWindowChanged(this, e);
}
}
#region IBaseViewContent implementation
public abstract Control Control {
get;
}
@ -50,18 +60,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -50,18 +60,13 @@ namespace ICSharpCode.SharpDevelop.Gui
{
}
#region IDisposable implementation
public virtual void Dispose()
{
workbenchWindow = null;
}
#endregion
protected virtual void OnWorkbenchWindowChanged(EventArgs e)
{
if (WorkbenchWindowChanged != null) {
WorkbenchWindowChanged(this, e);
}
}
public event EventHandler WorkbenchWindowChanged;
#endregion
}
}

158
src/Main/Base/Project/Src/Gui/AbstractViewContent.cs

@ -18,9 +18,46 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -18,9 +18,46 @@ namespace ICSharpCode.SharpDevelop.Gui
string titleName = null;
string fileName = null;
bool isDirty = false;
bool isViewOnly = false;
List<ISecondaryViewContent> secondaryViewContents = new List<ISecondaryViewContent>();
public AbstractViewContent()
{
}
public AbstractViewContent(string titleName)
{
this.titleName = titleName;
}
public AbstractViewContent(string titleName, string fileName)
{
this.titleName = titleName;
this.fileName = fileName;
}
/// <summary>
/// Sets the file name to <paramref name="fileName"/> and the title to the file name without path. Sets dirty == false too.
/// </summary>
/// <param name="fileName">The name of the file currently inside the content.</param>
protected void SetTitleAndFileName(string fileName)
{
TitleName = Path.GetFileName(fileName);
FileName = fileName;
IsDirty = false;
}
public event EventHandler FileNameChanged;
protected virtual void OnFileNameChanged(EventArgs e)
{
if (FileNameChanged != null) {
FileNameChanged(this, e);
}
}
#region IViewContent implementation
public virtual string UntitledName {
get {
return untitledName;
@ -50,56 +87,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -50,56 +87,12 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
List<ISecondaryViewContent> secondaryViewContents = new List<ISecondaryViewContent>();
/// <summary>
/// Gets the list of secondary view contents attached to this view content.
/// </summary>
public List<ISecondaryViewContent> SecondaryViewContents {
get {
return secondaryViewContents;
}
}
public override void Dispose()
{
foreach (ISecondaryViewContent svc in secondaryViewContents) {
svc.Dispose();
}
base.Dispose();
}
public AbstractViewContent()
{
}
public AbstractViewContent(string titleName)
{
this.titleName = titleName;
}
public AbstractViewContent(string titleName, string fileName)
{
this.titleName = titleName;
this.fileName = fileName;
}
public virtual bool IsUntitled {
get {
return titleName == null;
}
}
public virtual bool IsDirty {
get {
return isDirty;
}
set {
isDirty = value;
OnDirtyChanged(EventArgs.Empty);
}
}
public virtual bool IsReadOnly {
get {
return false;
@ -115,6 +108,15 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -115,6 +108,15 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
/// <summary>
/// Gets the list of secondary view contents attached to this view content.
/// </summary>
public List<ISecondaryViewContent> SecondaryViewContents {
get {
return secondaryViewContents;
}
}
public virtual void Save()
{
if (IsDirty) {
@ -132,23 +134,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -132,23 +134,9 @@ namespace ICSharpCode.SharpDevelop.Gui
throw new System.NotImplementedException();
}
/// <summary>
/// Sets the file name to <paramref name="fileName"/> and the title to the file name without path. Sets dirty == false too.
/// </summary>
/// <param name="fileName">The name of the file currently inside the content.</param>
protected void SetTitleAndFileName(string fileName)
{
TitleName = Path.GetFileName(fileName);
FileName = fileName;
IsDirty = false;
}
protected virtual void OnDirtyChanged(EventArgs e)
{
if (DirtyChanged != null) {
DirtyChanged(this, e);
}
}
public event EventHandler TitleNameChanged;
public event EventHandler Saving;
public event SaveEventHandler Saved;
protected virtual void OnTitleNameChanged(EventArgs e)
{
@ -157,13 +145,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -157,13 +145,6 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
protected virtual void OnFileNameChanged(EventArgs e)
{
if (FileNameChanged != null) {
FileNameChanged(this, e);
}
}
protected virtual void OnSaving(EventArgs e)
{
foreach (ISecondaryViewContent svc in SecondaryViewContents) {
@ -184,10 +165,41 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -184,10 +165,41 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
public event EventHandler TitleNameChanged;
public event EventHandler FileNameChanged;
#region IBaseViewContent implementation
// handled in AbstractBaseViewContent
#region IDisposable implementation
public override void Dispose()
{
foreach (ISecondaryViewContent svc in secondaryViewContents) {
svc.Dispose();
}
base.Dispose();
}
#endregion
#endregion
#region ICanBeDirty implementation
public virtual bool IsDirty {
get {
return isDirty;
}
set {
isDirty = value;
OnDirtyChanged(EventArgs.Empty);
}
}
bool isDirty = false;
public event EventHandler DirtyChanged;
public event EventHandler Saving;
public event SaveEventHandler Saved;
protected virtual void OnDirtyChanged(EventArgs e)
{
if (DirtyChanged != null) {
DirtyChanged(this, e);
}
}
#endregion
#endregion
}
}

Loading…
Cancel
Save