Browse Source

CompilerMessageView.cs reacts on new OnPropertyChange from FontSize and Font family

newNRvisualizers
Peter Forstmeier 13 years ago
parent
commit
e2f66561ab
  1. 4
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml.cs
  2. 10
      src/Main/Base/Project/Src/Gui/Components/FontSelector.xaml.cs
  3. 10
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanelXaml.xaml.cs
  4. 13
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

4
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml.cs

@ -31,14 +31,14 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
base.LoadOptions(); base.LoadOptions();
CodeEditorOptions options = CodeEditorOptions.Instance; CodeEditorOptions options = CodeEditorOptions.Instance;
fontSelectionPanel.SelectedFontName = options.FontFamily; fontSelectionPanel.SelectedFontName = options.FontFamily;
fontSelectionPanel.SelectedFontSize = SDFontSizeConverter.ToWinFormsFontSize(options.FontSize); fontSelectionPanel.SelectedFontSize = SDFontSizeConverter.FromPoints(options.FontSize);
} }
public override bool SaveOptions() public override bool SaveOptions()
{ {
CodeEditorOptions options = CodeEditorOptions.Instance; CodeEditorOptions options = CodeEditorOptions.Instance;
options.FontFamily = fontSelectionPanel.SelectedFontName; options.FontFamily = fontSelectionPanel.SelectedFontName;
options.FontSize = SDFontSizeConverter.ToWpfFontSize(fontSelectionPanel.SelectedFontSize); options.FontSize = SDFontSizeConverter.ToPoints(fontSelectionPanel.SelectedFontSize);
return base.SaveOptions(); return base.SaveOptions();
} }
} }

10
src/Main/Base/Project/Src/Gui/Components/FontSelector.xaml.cs

@ -157,7 +157,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (value == null) if (value == null)
throw new ArgumentNullException("value"); throw new ArgumentNullException("value");
if (value is int) if (value is int)
return ToWpfFontSize((int)value); return ToPoints((int)value);
throw new NotSupportedException("Cannot convert value of type " + value.GetType()); throw new NotSupportedException("Cannot convert value of type " + value.GetType());
} }
@ -166,16 +166,16 @@ namespace ICSharpCode.SharpDevelop.Gui
if (value == null) if (value == null)
throw new ArgumentNullException("value"); throw new ArgumentNullException("value");
if (value is double) if (value is double)
return ToWinFormsFontSize((double)value); return FromPoints((double)value);
throw new NotSupportedException("Cannot convert value of type " + value.GetType()); throw new NotSupportedException("Cannot convert value of type " + value.GetType());
} }
public static int ToWinFormsFontSize(double value) public static int FromPoints(double value)
{ {
return (int)Math.Round(value * 72.0 / 96.0); return (int)Math.Round(value * 72.0 / 96.0);
} }
public static double ToWpfFontSize(int value) public static double ToPoints(int value)
{ {
return Math.Round(value * 96.0 / 72.0); return Math.Round(value * 96.0 / 72.0);
} }

10
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanelXaml.xaml.cs

@ -19,8 +19,10 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{ {
public static readonly string OutputWindowsProperty = "SharpDevelop.UI.OutputWindowOptions"; public static readonly string OutputWindowsProperty = "SharpDevelop.UI.OutputWindowOptions";
private static readonly string FontFamilyName = "FontFamily"; public static readonly string FontFamilyName = "FontFamily";
private static readonly string FontSizeName = "FontSize"; public static readonly string FontSizeName = "FontSize";
public static readonly string WordWrapName = "WordWrap";
public OutputWindowOptionsPanelXaml() public OutputWindowOptionsPanelXaml()
{ {
@ -33,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{ {
base.LoadOptions(); base.LoadOptions();
var properties = PropertyService.NestedProperties(OutputWindowsProperty); var properties = PropertyService.NestedProperties(OutputWindowsProperty);
WordWrap = properties.Get("WordWrap", true); WordWrap = properties.Get(WordWrapName, true);
var fontDescription = OutputWindowOptionsPanelXaml.DefaultFontDescription(); var fontDescription = OutputWindowOptionsPanelXaml.DefaultFontDescription();
fontSelectionPanel.SelectedFontFamily = new FontFamily(fontDescription.Item1); fontSelectionPanel.SelectedFontFamily = new FontFamily(fontDescription.Item1);
@ -44,7 +46,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public override bool SaveOptions() public override bool SaveOptions()
{ {
var properties = PropertyService.NestedProperties(OutputWindowsProperty); var properties = PropertyService.NestedProperties(OutputWindowsProperty);
properties.Set("WordWrap", WordWrap); properties.Set(WordWrapName, WordWrap);
properties.Set(FontFamilyName,fontSelectionPanel.SelectedFontFamily); properties.Set(FontFamilyName,fontSelectionPanel.SelectedFontFamily);
properties.Set(FontSizeName,fontSelectionPanel.SelectedFontSize); properties.Set(FontSizeName,fontSelectionPanel.SelectedFontSize);
return base.SaveOptions(); return base.SaveOptions();

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

@ -236,6 +236,14 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
private bool IsFontChanged (string propName)
{
if ((propName == OutputWindowOptionsPanelXaml.FontSizeName) || (propName == OutputWindowOptionsPanelXaml.FontFamilyName)) {
return true;
}
return false;
}
private void SetWordWrap() private void SetWordWrap()
{ {
bool wordWrap = this.WordWrap; bool wordWrap = this.WordWrap;
@ -405,15 +413,16 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary> /// </summary>
void PropertyChanged(object sender, PropertyChangedEventArgs e) void PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if (e.PropertyName == "WordWrap") { if (e.PropertyName == OutputWindowOptionsPanelXaml.WordWrapName) {
SetWordWrap(); SetWordWrap();
ToolBarService.UpdateStatus(toolStrip.Items); ToolBarService.UpdateStatus(toolStrip.Items);
} }
if (e.PropertyName == "DefaultFont") { if (IsFontChanged(e.PropertyName)) {
SetTextEditorFont(); SetTextEditorFont();
} }
} }
protected virtual void OnMessageCategoryAdded(EventArgs e) protected virtual void OnMessageCategoryAdded(EventArgs e)
{ {
if (MessageCategoryAdded != null) { if (MessageCategoryAdded != null) {

Loading…
Cancel
Save