Browse Source

Fixed SD2-525: Changing the output Window font changes the text editor window font.

Fixed SD2-526: Output Window Word Wrap does nothing.
Improved performance of output window and error list when there are many errors/warnings. (previously 3000 warnings caused the SharpDevelop to freeze for 30 seconds and then crash with an OutOfMemoryException, consuming 2 GB of memory; now the speed is much better and the memory usage is fixed)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@875 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
ea52117d70
  1. 5
      data/options/SharpDevelopProperties.xml
  2. 7
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 25
      src/Main/Base/Project/Src/Commands/BuildCommands.cs
  4. 3
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs
  5. 118
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
  6. 8
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/MessageViewCategory.cs
  7. 10
      src/Main/Base/Project/Src/Gui/Pads/ErrorList/ErrorListPad.cs
  8. 10
      src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskView.cs
  9. 18
      src/Main/Base/Project/Src/Services/Tasks/TaskService.cs

5
data/options/SharpDevelopProperties.xml

@ -1,3 +1,8 @@
<SharpDevelopProperties> <SharpDevelopProperties>
<ShowTipsAtStartup value="True" /> <ShowTipsAtStartup value="True" />
<Properties name="WorkbenchMemento">
<bounds value="10,10,780,560" />
<windowstate value="Maximized" />
<defaultstate value="Maximized" />
</Properties>
</SharpDevelopProperties> </SharpDevelopProperties>

7
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -13,6 +13,13 @@
<SignAssembly>True</SignAssembly> <SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>Resources\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>Resources\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> <AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>False</Optimize> <Optimize>False</Optimize>

25
src/Main/Base/Project/Src/Commands/BuildCommands.cs

@ -20,7 +20,9 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public static void BeforeBuild() public static void BeforeBuild()
{ {
TaskService.BuildMessageViewCategory.ClearText(); TaskService.BuildMessageViewCategory.ClearText();
TaskService.InUpdate = true;
TaskService.ClearExceptCommentTasks(); TaskService.ClearExceptCommentTasks();
TaskService.InUpdate = false;
ICSharpCode.SharpDevelop.Commands.SaveAllFiles.SaveAll(); ICSharpCode.SharpDevelop.Commands.SaveAllFiles.SaveAll();
} }
@ -32,6 +34,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
if (results != null) { if (results != null) {
LastErrorCount = 0; LastErrorCount = 0;
LastWarningCount = 0; LastWarningCount = 0;
TaskService.InUpdate = true;
foreach (CompilerError error in results.Errors) { foreach (CompilerError error in results.Errors) {
TaskService.Add(new Task(error)); TaskService.Add(new Task(error));
if (error.IsWarning) if (error.IsWarning)
@ -39,6 +42,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
else else
LastErrorCount++; LastErrorCount++;
} }
TaskService.InUpdate = false;
if (results.Errors.Count > 0) { if (results.Errors.Count > 0) {
WorkbenchSingleton.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront(); WorkbenchSingleton.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront();
} }
@ -112,26 +116,13 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public class BuildProject : AbstractMenuCommand public class BuildProject : AbstractMenuCommand
{ {
public static void ShowResults(CompilerResults results)
{
if (results != null) {
foreach (CompilerError error in results.Errors) {
TaskService.Add(new Task(error));
}
if (results.Errors.Count > 0) {
WorkbenchSingleton.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront();
}
}
}
public override void Run() public override void Run()
{ {
Build.BeforeBuild(); Build.BeforeBuild();
if (ProjectService.OpenSolution == null) { if (ProjectService.OpenSolution == null) {
Build.AddNoSingleFileCompilationError(); Build.AddNoSingleFileCompilationError();
} else { } else {
BuildProject.ShowResults(ProjectService.CurrentProject.Build()); Build.ShowResults(ProjectService.CurrentProject.Build());
} }
Build.AfterBuild(); Build.AfterBuild();
} }
@ -145,7 +136,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
if (ProjectService.OpenSolution == null) { if (ProjectService.OpenSolution == null) {
Build.AddNoSingleFileCompilationError(); Build.AddNoSingleFileCompilationError();
} else { } else {
BuildProject.ShowResults(ProjectService.CurrentProject.Rebuild()); Build.ShowResults(ProjectService.CurrentProject.Rebuild());
} }
Build.AfterBuild(); Build.AfterBuild();
} }
@ -159,7 +150,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
if (ProjectService.OpenSolution == null) { if (ProjectService.OpenSolution == null) {
Build.AddNoSingleFileCompilationError(); Build.AddNoSingleFileCompilationError();
} else { } else {
BuildProject.ShowResults(ProjectService.CurrentProject.Clean()); Build.ShowResults(ProjectService.CurrentProject.Clean());
} }
} }
} }
@ -172,7 +163,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
if (ProjectService.OpenSolution == null) { if (ProjectService.OpenSolution == null) {
Build.AddNoSingleFileCompilationError(); Build.AddNoSingleFileCompilationError();
} else { } else {
BuildProject.ShowResults(ProjectService.CurrentProject.Publish()); Build.ShowResults(ProjectService.CurrentProject.Publish());
} }
} }
} }

3
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs

@ -51,8 +51,5 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
PropertyService.Set(OutputWindowsProperty, properties); PropertyService.Set(OutputWindowsProperty, properties);
return true; return true;
} }
} }
} }

118
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

@ -37,8 +37,10 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
} }
TextEditorControl textEditorControl = new TextEditorControl(); //TextEditorControl textEditorControl = new TextEditorControl();
RichTextBox textEditorControl = new RichTextBox();
Panel myPanel = new Panel(); Panel myPanel = new Panel();
ToolStrip toolStrip;
List<MessageViewCategory> messageCategories = new List<MessageViewCategory>(); List<MessageViewCategory> messageCategories = new List<MessageViewCategory>();
@ -51,7 +53,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (selectedCategory != value) { if (selectedCategory != value) {
selectedCategory = value; selectedCategory = value;
textEditorControl.Text = (value < 0) ? "" : messageCategories[value].Text; textEditorControl.Text = (value < 0) ? "" : messageCategories[value].Text;
textEditorControl.Refresh(); //textEditorControl.Refresh();
OnSelectedCategoryIndexChanged(EventArgs.Empty); OnSelectedCategoryIndexChanged(EventArgs.Empty);
} }
} }
@ -98,7 +100,9 @@ namespace ICSharpCode.SharpDevelop.Gui
myPanel.SuspendLayout(); myPanel.SuspendLayout();
textEditorControl.Dock = DockStyle.Fill; textEditorControl.Dock = DockStyle.Fill;
textEditorControl.ShowLineNumbers = false; textEditorControl.BorderStyle = BorderStyle.FixedSingle;
textEditorControl.BackColor = SystemColors.Window;
/*textEditorControl.ShowLineNumbers = false;
textEditorControl.ShowInvalidLines = false; textEditorControl.ShowInvalidLines = false;
textEditorControl.EnableFolding = false; textEditorControl.EnableFolding = false;
textEditorControl.IsIconBarVisible = false; textEditorControl.IsIconBarVisible = false;
@ -107,7 +111,8 @@ namespace ICSharpCode.SharpDevelop.Gui
textEditorControl.ShowVRuler = false; textEditorControl.ShowVRuler = false;
textEditorControl.ShowSpaces = false; textEditorControl.ShowSpaces = false;
textEditorControl.ShowTabs = false; textEditorControl.ShowTabs = false;
textEditorControl.ShowEOLMarkers = false; textEditorControl.ShowEOLMarkers = false;*/
textEditorControl.ReadOnly = true;
textEditorControl.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/CompilerMessageView/ContextMenu"); textEditorControl.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/CompilerMessageView/ContextMenu");
@ -116,9 +121,10 @@ namespace ICSharpCode.SharpDevelop.Gui
textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString()); textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString());
properties.PropertyChanged += new PropertyChangedEventHandler(PropertyChanged); properties.PropertyChanged += new PropertyChangedEventHandler(PropertyChanged);
textEditorControl.ActiveTextAreaControl.TextArea.DoubleClick += TextEditorControlDoubleClick; //textEditorControl.ActiveTextAreaControl.TextArea.DoubleClick += TextEditorControlDoubleClick;
textEditorControl.DoubleClick += TextEditorControlDoubleClick;
ToolStrip toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/CompilerMessageView/Toolbar"); toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/CompilerMessageView/Toolbar");
toolStrip.Stretch = true; toolStrip.Stretch = true;
toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
@ -131,13 +137,13 @@ namespace ICSharpCode.SharpDevelop.Gui
void SetWordWrap() void SetWordWrap()
{ {
// bool wordWrap = properties.Get("WordWrap", true); bool wordWrap = this.WordWrap;
// textEditorControl.WordWrap = wordWrap; textEditorControl.WordWrap = wordWrap;
// if (wordWrap) { if (wordWrap) {
// textEditorControl.ScrollBars = RichTextBoxScrollBars.ForcedBoth; textEditorControl.ScrollBars = RichTextBoxScrollBars.ForcedBoth;
// } else { } else {
// textEditorControl.ScrollBars = RichTextBoxScrollBars.ForcedVertical; textEditorControl.ScrollBars = RichTextBoxScrollBars.ForcedVertical;
// } }
} }
public override void RedrawContent() public override void RedrawContent()
@ -167,7 +173,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
if (messageCategories[SelectedCategoryIndex] == category) { if (messageCategories[SelectedCategoryIndex] == category) {
textEditorControl.Text = String.Empty; textEditorControl.Text = String.Empty;
textEditorControl.Refresh(); //textEditorControl.Refresh();
} }
} }
@ -176,25 +182,67 @@ namespace ICSharpCode.SharpDevelop.Gui
WorkbenchSingleton.SafeThreadAsyncCall(this, "SetText", (MessageViewCategory)sender, e.Text); WorkbenchSingleton.SafeThreadAsyncCall(this, "SetText", (MessageViewCategory)sender, e.Text);
} }
object appendCallLock = new object();
volatile int pendingAppendCalls = 0;
void CategoryTextAppended(object sender, TextEventArgs e) void CategoryTextAppended(object sender, TextEventArgs e)
{ {
WorkbenchSingleton.SafeThreadAsyncCall(this, "AppendText", (MessageViewCategory)sender, ((MessageViewCategory)sender).Text, e.Text); lock (appendCallLock) {
pendingAppendCalls += 1;
if (pendingAppendCalls < 5) {
WorkbenchSingleton.SafeThreadAsyncCall(this, "AppendText", sender, ((MessageViewCategory)sender).Text, e.Text);
} else if (pendingAppendCalls == 5) {
WorkbenchSingleton.SafeThreadAsyncCall(this, "AppendTextCombined", sender);
}
}
}
const int WM_SETREDRAW = 0x00B;
[System.Security.SuppressUnmanagedCodeSecurityAttribute]
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
void SetUpdate(bool update)
{
SendMessage(textEditorControl.Handle, WM_SETREDRAW, update ? 1 : 0, IntPtr.Zero);
}
void AppendTextCombined(MessageViewCategory category)
{
Application.DoEvents();
Thread.Sleep(50);
Application.DoEvents();
lock (appendCallLock) {
SetUpdate(false);
SetText(category, category.Text);
SetUpdate(true);
textEditorControl.SelectionStart = textEditorControl.TextLength;
LoggingService.Debug("Replaced " + pendingAppendCalls + " appends with one set call");
pendingAppendCalls = 0;
}
} }
void AppendText(MessageViewCategory category, string fullText, string text) void AppendText(MessageViewCategory category, string fullText, string text)
{ {
lock (appendCallLock) {
if (pendingAppendCalls >= 5) {
return;
}
}
if (messageCategories[SelectedCategoryIndex] != category) { if (messageCategories[SelectedCategoryIndex] != category) {
SelectCategory(category.Category, fullText); SelectCategory(category.Category, fullText);
return; return;
} }
if (text != null) { if (text != null) {
text = StringParser.Parse(text); text = StringParser.Parse(text);
textEditorControl.Document.ReadOnly = false; textEditorControl.AppendText(text);
textEditorControl.SelectionStart = textEditorControl.TextLength;
/*textEditorControl.Document.ReadOnly = false;
textEditorControl.Document.Insert(textEditorControl.Document.TextLength, text); textEditorControl.Document.Insert(textEditorControl.Document.TextLength, text);
textEditorControl.Document.ReadOnly = true; textEditorControl.Document.ReadOnly = true;
textEditorControl.ActiveTextAreaControl.Caret.Position = new Point(0, textEditorControl.Document.TotalNumberOfLines); textEditorControl.ActiveTextAreaControl.Caret.Position = new Point(0, textEditorControl.Document.TotalNumberOfLines);
textEditorControl.ActiveTextAreaControl.ScrollTo(textEditorControl.Document.TotalNumberOfLines); textEditorControl.ActiveTextAreaControl.ScrollTo(textEditorControl.Document.TotalNumberOfLines);*/
} }
} }
@ -210,7 +258,7 @@ namespace ICSharpCode.SharpDevelop.Gui
text = StringParser.Parse(text); text = StringParser.Parse(text);
} }
textEditorControl.Text = text; textEditorControl.Text = text;
textEditorControl.Refresh(); //textEditorControl.Refresh();
} }
public void SelectCategory(string categoryName) public void SelectCategory(string categoryName)
@ -234,7 +282,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (category.Category == categoryName) { if (category.Category == categoryName) {
selectedCategory = i; selectedCategory = i;
textEditorControl.Text = text; textEditorControl.Text = text;
textEditorControl.Refresh(); //textEditorControl.Refresh();
OnSelectedCategoryIndexChanged(EventArgs.Empty); OnSelectedCategoryIndexChanged(EventArgs.Empty);
break; break;
} }
@ -268,10 +316,20 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary> /// </summary>
void TextEditorControlDoubleClick(object sender, EventArgs e) void TextEditorControlDoubleClick(object sender, EventArgs e)
{ {
string fullText = textEditorControl.Text;
// Any text? // Any text?
if (textEditorControl.Text.Length > 0) { if (fullText.Length > 0) {
int line = textEditorControl.ActiveTextAreaControl.Caret.Line; //int line = textEditorControl.ActiveTextAreaControl.Caret.Line;
string textLine = TextUtilities.GetLineAsString(textEditorControl.Document, line); //string textLine = TextUtilities.GetLineAsString(textEditorControl.Document, line);
Point clickPos = textEditorControl.PointToClient(Control.MousePosition);
int index = textEditorControl.GetCharIndexFromPosition(clickPos);
int start = index;
// find start of current line
while (--start > 0 && fullText[start - 1] != '\n');
// find end of current line
while (++index < fullText.Length && fullText[index] != '\r');
string textLine = fullText.Substring(start, index - start);
FileLineReference lineReference = OutputTextLineParser.GetFileLineReference(textLine); FileLineReference lineReference = OutputTextLineParser.GetFileLineReference(textLine);
if (lineReference != null) { if (lineReference != null) {
@ -288,6 +346,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
if (e.Key == "WordWrap") { if (e.Key == "WordWrap") {
SetWordWrap(); SetWordWrap();
ToolbarService.UpdateToolbar(toolStrip);
} }
if (e.Key == "DefaultFont") { if (e.Key == "DefaultFont") {
textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString()); textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString());
@ -320,7 +379,8 @@ namespace ICSharpCode.SharpDevelop.Gui
public bool EnableCopy { public bool EnableCopy {
get { get {
return textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCopy; //return textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCopy;
return textEditorControl.SelectionLength > 0;
} }
} }
@ -338,7 +398,8 @@ namespace ICSharpCode.SharpDevelop.Gui
public bool EnableSelectAll { public bool EnableSelectAll {
get { get {
return textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableSelectAll; //return textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableSelectAll;
return textEditorControl.TextLength > 0;
} }
} }
@ -348,7 +409,8 @@ namespace ICSharpCode.SharpDevelop.Gui
public void Copy() public void Copy()
{ {
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Copy(null, null); //textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Copy(null, null);
textEditorControl.Copy();
} }
public void Paste() public void Paste()
@ -361,9 +423,9 @@ namespace ICSharpCode.SharpDevelop.Gui
public void SelectAll() public void SelectAll()
{ {
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(null, null); //textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(null, null);
textEditorControl.SelectAll();
} }
#endregion #endregion
} }
} }

8
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/MessageViewCategory.cs

@ -43,9 +43,11 @@ namespace ICSharpCode.SharpDevelop.Gui
public string Text { public string Text {
get { get {
lock (textBuilder) {
return textBuilder.ToString(); return textBuilder.ToString();
} }
} }
}
public MessageViewCategory(string category) : this(category, category) public MessageViewCategory(string category) : this(category, category)
{ {
@ -59,20 +61,26 @@ namespace ICSharpCode.SharpDevelop.Gui
public void AppendText(string text) public void AppendText(string text)
{ {
lock (textBuilder) {
textBuilder.Append(text); textBuilder.Append(text);
}
OnTextAppended(new TextEventArgs(text)); OnTextAppended(new TextEventArgs(text));
} }
public void SetText(string text) public void SetText(string text)
{ {
lock (textBuilder) {
textBuilder.Length = 0; textBuilder.Length = 0;
textBuilder.Append(text); textBuilder.Append(text);
}
OnTextSet(new TextEventArgs(text)); OnTextSet(new TextEventArgs(text));
} }
public void ClearText() public void ClearText()
{ {
lock (textBuilder) {
textBuilder.Length = 0; textBuilder.Length = 0;
}
OnCleared(EventArgs.Empty); OnCleared(EventArgs.Empty);
} }

10
src/Main/Base/Project/Src/Gui/Pads/ErrorList/ErrorListPad.cs

@ -80,6 +80,10 @@ namespace ICSharpCode.SharpDevelop.Gui
TaskService.Cleared += new EventHandler(TaskServiceCleared); TaskService.Cleared += new EventHandler(TaskServiceCleared);
TaskService.Added += new TaskEventHandler(TaskServiceAdded); TaskService.Added += new TaskEventHandler(TaskServiceAdded);
TaskService.Removed += new TaskEventHandler(TaskServiceRemoved); TaskService.Removed += new TaskEventHandler(TaskServiceRemoved);
TaskService.InUpdateChanged += delegate {
if (!TaskService.InUpdate)
InternalShowResults();
};
ProjectService.EndBuild += ProjectServiceEndBuild; ProjectService.EndBuild += ProjectServiceEndBuild;
ProjectService.SolutionLoaded += OnCombineOpen; ProjectService.SolutionLoaded += OnCombineOpen;
@ -156,18 +160,24 @@ namespace ICSharpCode.SharpDevelop.Gui
void TaskServiceCleared(object sender, EventArgs e) void TaskServiceCleared(object sender, EventArgs e)
{ {
if (TaskService.InUpdate)
return;
taskView.ClearTasks(); taskView.ClearTasks();
UpdateToolstripStatus(); UpdateToolstripStatus();
} }
void TaskServiceAdded(object sender, TaskEventArgs e) void TaskServiceAdded(object sender, TaskEventArgs e)
{ {
if (TaskService.InUpdate)
return;
AddTask(e.Task); AddTask(e.Task);
UpdateToolstripStatus(); UpdateToolstripStatus();
} }
void TaskServiceRemoved(object sender, TaskEventArgs e) void TaskServiceRemoved(object sender, TaskEventArgs e)
{ {
if (TaskService.InUpdate)
return;
taskView.RemoveTask(e.Task); taskView.RemoveTask(e.Task);
UpdateToolstripStatus(); UpdateToolstripStatus();
} }

10
src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskView.cs

@ -199,7 +199,7 @@ namespace ICSharpCode.Core
int right = this.Items.Count - 1; int right = this.Items.Count - 1;
while (left <= right) { while (left <= right) {
int m = left + (right - left) / 2; int m = left + (right - left) / 2;
if (this.ListViewItemSorter.Compare(item, this.Items[m]) > 0) { if (this.mySorter.Compare(item, this.Items[m]) > 0) {
left = m + 1; left = m + 1;
} else { } else {
right = m - 1; right = m - 1;
@ -242,7 +242,6 @@ namespace ICSharpCode.Core
this.EndUpdate(); this.EndUpdate();
} }
#endregion #endregion
#region Custom IComparer for sorting TaskView. #region Custom IComparer for sorting TaskView.
@ -273,10 +272,13 @@ namespace ICSharpCode.Core
currentSortOrder = SortOrder.Ascending; currentSortOrder = SortOrder.Ascending;
} }
this.ListViewItemSorter = this.mySorter = new TaskViewSorter(currentSortColumn, currentSortOrder);
new TaskViewSorter(currentSortColumn, currentSortOrder); this.ListViewItemSorter = mySorter;
this.ListViewItemSorter = null;
} }
TaskViewSorter mySorter;
/// <summary> /// <summary>
/// Custom <see cref="IComparer"/> for TaskView. /// Custom <see cref="IComparer"/> for TaskView.
/// </summary> /// </summary>

18
src/Main/Base/Project/Src/Services/Tasks/TaskService.cs

@ -228,6 +228,24 @@ namespace ICSharpCode.Core
public static event TaskEventHandler Added; public static event TaskEventHandler Added;
public static event TaskEventHandler Removed; public static event TaskEventHandler Removed;
public static event EventHandler Cleared; public static event EventHandler Cleared;
static bool inUpdate;
public static bool InUpdate {
get {
return inUpdate;
} }
set {
if (inUpdate != value) {
inUpdate = value;
if (InUpdateChanged != null) {
InUpdateChanged(null, EventArgs.Empty);
}
}
}
}
public static event EventHandler InUpdateChanged;
}
} }

Loading…
Cancel
Save