Browse Source

Show "loading..." while font list is loading.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1948 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
c0b803d954
  1. 30
      src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs
  2. 18
      src/Main/Base/Project/Src/Util/DebugTimer.cs

30
src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs

@ -115,6 +115,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels @@ -115,6 +115,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels
void DetectMonospacedThread()
{
Thread.Sleep(0); // first allow UI thread to do some work
DebugTimer.Start();
InstalledFontCollection installedFontCollection = new InstalledFontCollection();
Font currentFont = ParseFont(((Properties)CustomizationObject).Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString());
@ -168,18 +169,25 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels @@ -168,18 +169,25 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels
{
ComboBox comboBox = (ComboBox)sender;
e.DrawBackground();
if (e.Index >= 0) {
Rectangle drawingRect = new Rectangle(e.Bounds.X,
e.Bounds.Y,
e.Bounds.Width,
e.Bounds.Height);
Brush drawItemBrush = SystemBrushes.WindowText;
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
drawItemBrush = SystemBrushes.HighlightText;
}
if (comboBox.Enabled == false) {
e.Graphics.DrawString(ResourceService.GetString("ICSharpCode.SharpDevelop.Gui.Pads.ClassScout.LoadingNode"),
comboBox.Font,
drawItemBrush,
drawingRect,
drawStringFormat);
} else if (e.Index >= 0) {
FontDescriptor fontDescriptor = (FontDescriptor)comboBox.Items[e.Index];
Rectangle drawingRect = new Rectangle(e.Bounds.X,
e.Bounds.Y,
e.Bounds.Width,
e.Bounds.Height);
Brush drawItemBrush = SystemBrushes.WindowText;
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
drawItemBrush = SystemBrushes.HighlightText;
}
e.Graphics.DrawString(fontDescriptor.Name,
fontDescriptor.IsMonospaced ? boldComboBoxFont : comboBox.Font,
drawItemBrush,

18
src/Main/Base/Project/Src/Util/DebugTimer.cs

@ -13,21 +13,31 @@ using ICSharpCode.Core; @@ -13,21 +13,31 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop
{
/// <summary>
/// Provides static helpers methods that measure time from
/// Start() to Stop() and output the timespan to the logging service.
/// Calls to DebugTimer are only compiled in debug builds.
/// [Conditional("DEBUG")]
/// </summary>
public static class DebugTimer
{
static int startTime;
[ThreadStatic]
static Stopwatch stopWatch;
[Conditional("DEBUG")]
public static void Start()
{
startTime = Environment.TickCount;
if (stopWatch == null) {
stopWatch = new Stopwatch();
}
stopWatch.Start();
}
[Conditional("DEBUG")]
public static void Stop(string desc)
{
int stopTime = Environment.TickCount;
LoggingService.Debug('"' + desc + "\" took " + (stopTime - startTime) + " ms");
stopWatch.Stop();
LoggingService.Debug("\"" + desc + "\" took " + (stopWatch.ElapsedMilliseconds) + " ms");
}
}
}

Loading…
Cancel
Save