4 changed files with 104 additions and 0 deletions
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.OutputWindowOptionsPanelXaml" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui"> |
||||
|
||||
<StackPanel Orientation="Vertical"> |
||||
<GroupBox Margin="5,5,5,0" Header="{core:Localize Dialog.Options.IDEOptions.OutputPanel.Format}"> |
||||
<CheckBox Margin="0,10,0,0" |
||||
IsChecked="{Binding WordWrap}" |
||||
Content="{core:Localize Dialog.Options.IDEOptions.OutputPanel.WordWrap}"></CheckBox> |
||||
</GroupBox> |
||||
|
||||
<GroupBox Margin="5,5,5,0" Header="{core:Localize Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox}"> |
||||
<gui:FontSelector x:Name="fontSelectionPanel"></gui:FontSelector> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 27.12.2012 |
||||
* Time: 19:36 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for OutputWindowOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
public partial class OutputWindowOptionsPanelXaml : OptionPanel |
||||
{ |
||||
private static readonly string OutputWindowsProperty = "SharpDevelop.UI.OutputWindowOptions"; |
||||
|
||||
public OutputWindowOptionsPanelXaml() |
||||
{ |
||||
InitializeComponent(); |
||||
this.DataContext = this; |
||||
} |
||||
|
||||
|
||||
public override void LoadOptions() |
||||
{ |
||||
base.LoadOptions(); |
||||
var properties = PropertyService.NestedProperties(OutputWindowsProperty); |
||||
WordWrap = properties.Get("WordWrap", true); |
||||
var fontStr = properties.Get("DefaultFont", SD.WinForms.DefaultMonospacedFont.ToString()).ToString(); |
||||
var font = ParseFont(fontStr); |
||||
fontSelectionPanel.SelectedFontFamily = new System.Windows.Media.FontFamily(font.Name); |
||||
fontSelectionPanel.SelectedFontSize = (int)font.Size; |
||||
font.Dispose(); |
||||
} |
||||
|
||||
|
||||
private static Font ParseFont(string font) |
||||
{ |
||||
try { |
||||
string[] descr = font.Split(new char[]{',', '='}); |
||||
return new Font(descr[1], Single.Parse(descr[3])); |
||||
} catch (Exception ex) { |
||||
LoggingService.Warn(ex); |
||||
return SD.WinForms.DefaultMonospacedFont; |
||||
} |
||||
} |
||||
|
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
var properties = PropertyService.NestedProperties(OutputWindowsProperty); |
||||
properties.Set("WordWrap", WordWrap); |
||||
|
||||
var font = new Font(new System.Drawing.FontFamily(fontSelectionPanel.SelectedFontName), |
||||
(float)fontSelectionPanel.SelectedFontSize); |
||||
Console.WriteLine(font.ToString()); |
||||
font.Dispose(); |
||||
return base.SaveOptions(); |
||||
} |
||||
|
||||
|
||||
bool wordWrap; |
||||
|
||||
public bool WordWrap { |
||||
get { return wordWrap; } |
||||
set { wordWrap = value; |
||||
base.RaisePropertyChanged(() => WordWrap);} |
||||
} |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue