|
|
@ -135,8 +135,12 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
|
|
|
|
|
|
|
|
void UpdateActiveViewContent() |
|
|
|
void UpdateActiveViewContent() |
|
|
|
{ |
|
|
|
{ |
|
|
|
UpdateTitle(); |
|
|
|
UpdateTitleAndInfoTip(); |
|
|
|
|
|
|
|
|
|
|
|
IViewContent newActiveViewContent = this.ActiveViewContent; |
|
|
|
IViewContent newActiveViewContent = this.ActiveViewContent; |
|
|
|
|
|
|
|
if (newActiveViewContent != null) |
|
|
|
|
|
|
|
IsLocked = newActiveViewContent.IsReadOnly; |
|
|
|
|
|
|
|
|
|
|
|
if (oldActiveViewContent != newActiveViewContent && ActiveViewContentChanged != null) { |
|
|
|
if (oldActiveViewContent != newActiveViewContent && ActiveViewContentChanged != null) { |
|
|
|
ActiveViewContentChanged(this, EventArgs.Empty); |
|
|
|
ActiveViewContentChanged(this, EventArgs.Empty); |
|
|
|
} |
|
|
|
} |
|
|
@ -262,7 +266,7 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
|
|
|
|
|
|
|
|
if (this.DragEnabledArea != null) { |
|
|
|
if (this.DragEnabledArea != null) { |
|
|
|
this.DragEnabledArea.ContextMenu = MenuService.CreateContextMenu(this, contextMenuPath); |
|
|
|
this.DragEnabledArea.ContextMenu = MenuService.CreateContextMenu(this, contextMenuPath); |
|
|
|
UpdateTitle(); // set tooltip
|
|
|
|
UpdateInfoTip(); // set tooltip
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -348,33 +352,57 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnInfoTipChanged(object sender, EventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (sender == ActiveViewContent) { |
|
|
|
|
|
|
|
UpdateInfoTip(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void OnIsDirtyChanged(object sender, EventArgs e) |
|
|
|
void OnIsDirtyChanged(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UpdateTitle(); |
|
|
|
UpdateTitle(); |
|
|
|
CommandManager.InvalidateRequerySuggested(); |
|
|
|
CommandManager.InvalidateRequerySuggested(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UpdateTitle() |
|
|
|
void UpdateTitleAndInfoTip() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UpdateInfoTip(); |
|
|
|
|
|
|
|
UpdateTitle(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateInfoTip() |
|
|
|
{ |
|
|
|
{ |
|
|
|
IViewContent content = ActiveViewContent; |
|
|
|
IViewContent content = ActiveViewContent; |
|
|
|
if (content != null) { |
|
|
|
if (content != null) |
|
|
|
this.InfoTip = content.PrimaryFileName; |
|
|
|
{ |
|
|
|
|
|
|
|
string newInfoTip = content.InfoTip; |
|
|
|
|
|
|
|
|
|
|
|
string newTitle = content.TitleName; |
|
|
|
if (newInfoTip != this.InfoTip) { |
|
|
|
|
|
|
|
this.InfoTip = newInfoTip; |
|
|
|
|
|
|
|
if (DragEnabledArea != null) |
|
|
|
|
|
|
|
DragEnabledArea.ToolTip = this.InfoTip; |
|
|
|
|
|
|
|
|
|
|
|
if (this.IsDirty) { |
|
|
|
OnInfoTipChanged(); |
|
|
|
newTitle += "*"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IsLocked = content.IsReadOnly; |
|
|
|
void UpdateTitle() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IViewContent content = ActiveViewContent; |
|
|
|
|
|
|
|
if (content != null) { |
|
|
|
|
|
|
|
string newTitle = content.TitleName; |
|
|
|
|
|
|
|
if (content.IsDirty) |
|
|
|
|
|
|
|
newTitle += "*"; |
|
|
|
if (newTitle != Title) { |
|
|
|
if (newTitle != Title) { |
|
|
|
Title = newTitle; |
|
|
|
Title = newTitle; |
|
|
|
OnTitleChanged(EventArgs.Empty); |
|
|
|
OnTitleChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RegisterNewContent(IViewContent content) |
|
|
|
void RegisterNewContent(IViewContent content) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Debug.Assert(content.WorkbenchWindow == null); |
|
|
|
Debug.Assert(content.WorkbenchWindow == null); |
|
|
@ -382,6 +410,7 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
|
|
|
|
|
|
|
|
content.TabPageTextChanged += OnTabPageTextChanged; |
|
|
|
content.TabPageTextChanged += OnTabPageTextChanged; |
|
|
|
content.TitleNameChanged += OnTitleNameChanged; |
|
|
|
content.TitleNameChanged += OnTitleNameChanged; |
|
|
|
|
|
|
|
content.InfoTipChanged += OnInfoTipChanged; |
|
|
|
content.IsDirtyChanged += OnIsDirtyChanged; |
|
|
|
content.IsDirtyChanged += OnIsDirtyChanged; |
|
|
|
|
|
|
|
|
|
|
|
this.dockLayout.Workbench.OnViewOpened(new ViewContentEventArgs(content)); |
|
|
|
this.dockLayout.Workbench.OnViewOpened(new ViewContentEventArgs(content)); |
|
|
@ -393,6 +422,7 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
|
|
|
|
|
|
|
|
content.TabPageTextChanged -= OnTabPageTextChanged; |
|
|
|
content.TabPageTextChanged -= OnTabPageTextChanged; |
|
|
|
content.TitleNameChanged -= OnTitleNameChanged; |
|
|
|
content.TitleNameChanged -= OnTitleNameChanged; |
|
|
|
|
|
|
|
content.InfoTipChanged -= OnInfoTipChanged; |
|
|
|
content.IsDirtyChanged -= OnIsDirtyChanged; |
|
|
|
content.IsDirtyChanged -= OnIsDirtyChanged; |
|
|
|
|
|
|
|
|
|
|
|
this.dockLayout.Workbench.OnViewClosed(new ViewContentEventArgs(content)); |
|
|
|
this.dockLayout.Workbench.OnViewClosed(new ViewContentEventArgs(content)); |
|
|
@ -467,15 +497,26 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void OnTitleChanged(EventArgs e) |
|
|
|
void OnTitleChanged() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (TitleChanged != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (TitleChanged != null) { |
|
|
|
TitleChanged(this, EventArgs.Empty); |
|
|
|
TitleChanged(this, e); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public event EventHandler TitleChanged; |
|
|
|
public event EventHandler TitleChanged; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnInfoTipChanged() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (InfoTipChanged != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
InfoTipChanged(this, EventArgs.Empty); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public event EventHandler InfoTipChanged; |
|
|
|
|
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return "[AvalonWorkbenchWindow: " + this.Title + "]"; |
|
|
|
return "[AvalonWorkbenchWindow: " + this.Title + "]"; |
|
|
|