195 changed files with 7531 additions and 4509 deletions
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.CodeAnalysis.AnalysisIdeOptionsPanel" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"> |
||||
|
||||
<GroupBox Header="{core:Localize ICSharpCode.CodeAnalysis.IdeOptions.FxCopPath}"> |
||||
<StackPanel> |
||||
<TextBlock Margin="3,5,3,20" x:Name="status" |
||||
HorizontalAlignment="Center" TextWrapping="Wrap" |
||||
Text="(showing current FxCop path)"></TextBlock> |
||||
<Button Content="{core:Localize ICSharpCode.CodeAnalysis.IdeOptions.FindFxCopPath}" |
||||
HorizontalAlignment="Center" |
||||
Click="FindFxCopPath_Click" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</gui:OptionPanel> |
||||
|
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.07.2012 |
||||
* Time: 21:27 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
|
||||
namespace ICSharpCode.CodeAnalysis |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for AnalysisIdeOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
public partial class AnalysisIdeOptionsPanel : OptionPanel |
||||
{ |
||||
public AnalysisIdeOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
ShowStatus(); |
||||
} |
||||
|
||||
|
||||
private void ShowStatus() |
||||
{ |
||||
string path = FxCopWrapper.FindFxCopPath(); |
||||
if (path == null) { |
||||
status.Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopNotFound}"); |
||||
} else { |
||||
status.Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopFoundInPath}") |
||||
+ Environment.NewLine + path; |
||||
} |
||||
} |
||||
|
||||
|
||||
private void FindFxCopPath_Click(object sender, System.Windows.RoutedEventArgs e) |
||||
{ |
||||
string fn = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;"); |
||||
if (!String.IsNullOrEmpty(fn)) { |
||||
string path = Path.GetDirectoryName(fn); |
||||
if (FxCopWrapper.IsFxCopPath(path)) { |
||||
FxCopPath = path; |
||||
} else { |
||||
MessageService.ShowError("${res:ICSharpCode.CodeAnalysis.IdeOptions.DirectoryDoesNotContainFxCop}"); |
||||
} |
||||
} |
||||
ShowStatus(); |
||||
} |
||||
|
||||
|
||||
public static string FxCopPath { |
||||
get { |
||||
return PropertyService.Get("CodeAnalysis.FxCopPath"); |
||||
} |
||||
set { |
||||
PropertyService.Set("CodeAnalysis.FxCopPath", value); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,87 @@
@@ -0,0 +1,87 @@
|
||||
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CodeAnalysis.AnalysisProjectOptionsPanelXaml" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview" |
||||
xmlns:local="clr-namespace:ICSharpCode.CodeAnalysis" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"> |
||||
<Grid > |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition></RowDefinition> |
||||
<RowDefinition></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="30"></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<optionpanels:StorageLocationPicker Location="{Binding RunCodeAnalysis.Location}"></optionpanels:StorageLocationPicker> |
||||
|
||||
<CheckBox Grid.Column="1" VerticalAlignment="Center" Grid.ColumnSpan="2" |
||||
IsChecked="{Binding RunCodeAnalysis.Value}" |
||||
Content="{core:Localize ICSharpCode.CodeAnalysis.ProjectOptions.RunOnBuild}"></CheckBox> |
||||
|
||||
<Button Grid.Row="1" VerticalAlignment="Center" Grid.ColumnSpan="2" Margin="0,10,0,10" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Click="ChangeRuleAssembliesButtonClick" |
||||
Content="{core:Localize ICSharpCode.CodeAnalysis.ProjectOptions.AddRemoveRuleAssembly}"></Button> |
||||
|
||||
<tv:SharpTreeView x:Name="ruleTreeView" ShowRoot="False" ShowLines="False" IsSynchronizedWithCurrentItem="True" |
||||
Grid.Row="2" Grid.ColumnSpan="3"> |
||||
|
||||
<ListView.View> |
||||
<tv:SharpGridView > |
||||
<tv:SharpGridView.Columns> |
||||
<GridViewColumn Width="500" Header="ID"> |
||||
<GridViewColumn.CellTemplate> |
||||
<DataTemplate> |
||||
<tv:SharpTreeNodeView /> |
||||
</DataTemplate> |
||||
</GridViewColumn.CellTemplate> |
||||
</GridViewColumn> |
||||
|
||||
<GridViewColumn Header="Action"> |
||||
<GridViewColumn.CellTemplate> |
||||
<DataTemplate> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<ComboBox Background="Transparent" Width="100" |
||||
HorizontalAlignment="Center" VerticalAlignment="Center" |
||||
ItemsSource="{Binding Path=RuleState}" |
||||
IsSynchronizedWithCurrentItem="True" |
||||
IsReadOnly="False" |
||||
SelectedIndex="{Binding Index}"> |
||||
|
||||
<ComboBox.ItemTemplate> |
||||
<DataTemplate> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Image VerticalAlignment="Center" Height="15" Margin="3,0,5,0" |
||||
Source="{Binding Item1}"></Image> |
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding Item2}"></TextBlock> |
||||
|
||||
</StackPanel> |
||||
|
||||
</DataTemplate> |
||||
</ComboBox.ItemTemplate> |
||||
</ComboBox> |
||||
</StackPanel> |
||||
</DataTemplate> |
||||
</GridViewColumn.CellTemplate> |
||||
</GridViewColumn> |
||||
</tv:SharpGridView.Columns> |
||||
|
||||
</tv:SharpGridView> |
||||
</ListView.View> |
||||
</tv:SharpTreeView> |
||||
|
||||
</Grid> |
||||
</ScrollViewer> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,308 @@
@@ -0,0 +1,308 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06/09/2012 |
||||
* Time: 18:27 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Drawing; |
||||
using System.Drawing.Imaging; |
||||
using System.Globalization; |
||||
using System.IO; |
||||
using System.Text; |
||||
using System.Text.RegularExpressions; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using Gui.Dialogs.OptionPanels.ProjectOptions; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.TreeView; |
||||
|
||||
namespace ICSharpCode.CodeAnalysis |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for AnalysisProjectOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
|
||||
|
||||
public partial class AnalysisProjectOptionsPanelXaml : ProjectOptionPanel |
||||
{ |
||||
private bool initSuccess; |
||||
private bool userCheck; |
||||
private Dictionary<string, RuleTreeNode> rules = new Dictionary<string, RuleTreeNode>(); |
||||
|
||||
public AnalysisProjectOptionsPanelXaml() |
||||
{ |
||||
InitializeComponent(); |
||||
DataContext = this; |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<bool> RunCodeAnalysis { |
||||
get { return GetProperty("RunCodeAnalysis", false); } |
||||
} |
||||
|
||||
public ProjectProperty<string> CodeAnalysisRuleAssemblies { |
||||
get { return GetProperty("CodeAnalysisRuleAssemblies","",TextBoxEditMode.EditEvaluatedProperty); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> CodeAnalysisRules { |
||||
get { return GetProperty("CodeAnalysisRules","",TextBoxEditMode.EditEvaluatedProperty); } |
||||
} |
||||
|
||||
#region Rule Assemblies Property
|
||||
|
||||
string ruleAssemblies; |
||||
const string DefaultRuleAssemblies = @"$(FxCopDir)\rules"; |
||||
|
||||
public string RuleAssemblies { |
||||
get { |
||||
return ruleAssemblies; |
||||
} |
||||
set { |
||||
if (string.IsNullOrEmpty(value)) { |
||||
value = DefaultRuleAssemblies; |
||||
} |
||||
if (ruleAssemblies != value) { |
||||
ruleAssemblies = value; |
||||
|
||||
if (initSuccess) { |
||||
ReloadRuleList(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Rule string Property
|
||||
|
||||
string CreateRuleString() |
||||
{ |
||||
StringBuilder b = new StringBuilder(); |
||||
foreach (SharpTreeNode category in ruleTreeView.Items) { |
||||
foreach (RuleTreeNode rule in category.Children) { |
||||
if (!(bool)rule.IsChecked || rule.isError) { |
||||
if (b.Length > 0) |
||||
b.Append(';'); |
||||
if ((bool)rule.IsChecked) |
||||
b.Append('+'); |
||||
else |
||||
b.Append('-'); |
||||
if (rule.isError) |
||||
b.Append('!'); |
||||
b.Append(rule.Identifier); |
||||
} |
||||
} |
||||
} |
||||
return b.ToString(); |
||||
} |
||||
|
||||
|
||||
void ReadRuleString() |
||||
{ |
||||
userCheck = false; |
||||
foreach (SharpTreeNode cat in ruleTreeView.Root.Children) { |
||||
foreach (RuleTreeNode rtn in cat.Children) { |
||||
rtn.IsChecked = true; |
||||
rtn.isError = false; |
||||
} |
||||
} |
||||
foreach (string rule2 in ruleString.Split(';')) { |
||||
string rule = rule2; |
||||
if (rule.Length == 0) continue; |
||||
bool active = true; |
||||
bool error = false; |
||||
if (rule.StartsWith("-")) { |
||||
active = false; |
||||
rule = rule.Substring(1); |
||||
} else if (rule.StartsWith("+")) { |
||||
rule = rule.Substring(1); |
||||
} |
||||
if (rule.StartsWith("!")) { |
||||
error = true; |
||||
rule = rule.Substring(1); |
||||
} |
||||
RuleTreeNode ruleNode; |
||||
if (rules.TryGetValue(rule, out ruleNode)) { |
||||
ruleNode.IsChecked = active; |
||||
//ruleNode.isError = error;
|
||||
ruleNode.Index = 1; |
||||
} |
||||
} |
||||
userCheck = true; |
||||
SetCategoryIcon(); |
||||
} |
||||
|
||||
|
||||
void SetCategoryIcon() { |
||||
|
||||
Console.WriteLine("SetCategoryicon"); |
||||
foreach (CategoryTreeNode categoryNode in ruleTreeView.Root.Children) { |
||||
categoryNode.CheckMode(); |
||||
/* |
||||
if (!categoryNode.NewErrorState.HasValue) { |
||||
Console.WriteLine ("\t{0} is Mixed Mode",categoryNode.Text); |
||||
categoryNode.AddMixedMode(); |
||||
} else{ |
||||
if (categoryNode.NewErrorState == true) { |
||||
Console.WriteLine ("\t{0} is Error",categoryNode.Text); |
||||
// categoryNode.Index = 1;
|
||||
} else { |
||||
Console.WriteLine ("\t{0} is Warning",categoryNode.Text); |
||||
// categoryNode.Index = ;
|
||||
} |
||||
} |
||||
*/ |
||||
} |
||||
Console.WriteLine("--------------"); |
||||
|
||||
} |
||||
|
||||
string ruleString = ""; |
||||
|
||||
public string RuleString { |
||||
get { |
||||
if (initSuccess) |
||||
return CreateRuleString(); |
||||
else |
||||
return ruleString; |
||||
} |
||||
set { |
||||
ruleString = value; |
||||
if (initSuccess) { |
||||
ReadRuleString(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
protected override void Load(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
base.Load(project, configuration, platform); |
||||
RuleString = this.CodeAnalysisRules.Value; |
||||
RuleAssemblies = CodeAnalysisRuleAssemblies.Value; |
||||
ReloadRuleList(); |
||||
} |
||||
|
||||
protected override bool Save(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
this.CodeAnalysisRules.Value = RuleString; |
||||
return base.Save(project, configuration, platform); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region RuleList
|
||||
|
||||
void ReloadRuleList() |
||||
{ |
||||
ruleTreeView.Root = new SharpTreeNode(); |
||||
FxCopWrapper.GetRuleList(GetRuleAssemblyList(true), Callback); |
||||
if (ruleTreeView.Root.Children.Count == 0) { |
||||
ruleTreeView.Root.Children.Add(new MessageNode(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.LoadingRules}"))); |
||||
} |
||||
} |
||||
|
||||
|
||||
void Callback(List<FxCopCategory> ruleList) |
||||
{ |
||||
if (WorkbenchSingleton.InvokeRequired) { |
||||
WorkbenchSingleton.SafeThreadAsyncCall((Action<List<FxCopCategory>>)Callback, ruleList); |
||||
} else { |
||||
ruleTreeView.Root = new SharpTreeNode(); |
||||
|
||||
|
||||
rules.Clear(); |
||||
if (ruleList == null || ruleList.Count == 0) { |
||||
ruleTreeView.Root.Children.Add(new MessageNode(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.CannotFindFxCop}"))); |
||||
ruleTreeView.Root.Children.Add(new MessageNode(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.SpecifyFxCopPath}"))); |
||||
} else { |
||||
foreach (FxCopCategory cat in ruleList) { |
||||
CategoryTreeNode catNode = new CategoryTreeNode(cat); |
||||
catNode.PropertyChanged += OnPropertyChanged; |
||||
ruleTreeView.Root.Children.Add(catNode); |
||||
foreach (RuleTreeNode ruleNode in catNode.Children) { |
||||
ruleNode.PropertyChanged += OnPropertyChanged; |
||||
rules[ruleNode.Identifier] = ruleNode; |
||||
} |
||||
} |
||||
ReadRuleString(); |
||||
initSuccess = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
private void OnPropertyChanged(object sender,System.ComponentModel.PropertyChangedEventArgs e) |
||||
{ |
||||
if (initSuccess) { |
||||
Console.WriteLine("OnPropertyChanged {0}",e.PropertyName); |
||||
if (e.PropertyName == "Index") { |
||||
base.IsDirty = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
private string[] GetRuleAssemblyList(bool replacePath) |
||||
{ |
||||
List<string> list = new List<string>(); |
||||
string fxCopPath = FxCopWrapper.FindFxCopPath(); |
||||
foreach (string dir in ruleAssemblies.Split(';')) { |
||||
if (string.Equals(dir, "$(FxCopDir)\\rules", StringComparison.OrdinalIgnoreCase)) |
||||
continue; |
||||
if (string.Equals(dir, "$(FxCopDir)/rules", StringComparison.OrdinalIgnoreCase)) |
||||
continue; |
||||
if (replacePath && !string.IsNullOrEmpty(fxCopPath)) { |
||||
list.Add(Regex.Replace(dir, @"\$\(FxCopDir\)", fxCopPath, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase)); |
||||
} else { |
||||
list.Add(dir); |
||||
} |
||||
} |
||||
return list.ToArray(); |
||||
} |
||||
|
||||
|
||||
private void ChangeRuleAssembliesButtonClick( object sender, RoutedEventArgs e) |
||||
{ |
||||
var stringListDialog = new StringListEditorDialog(); |
||||
stringListDialog.BrowseForDirectory = true; |
||||
stringListDialog.TitleText = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.ChooseRuleAssemblyDirectory}"); |
||||
stringListDialog.LoadList(GetRuleAssemblyList(false)); |
||||
stringListDialog.ShowDialog(); |
||||
if (stringListDialog.DialogResult ?? false) { |
||||
StringBuilder b = new StringBuilder(DefaultRuleAssemblies); |
||||
foreach (string asm in stringListDialog.GetList()) { |
||||
b.Append(';'); |
||||
b.Append(asm); |
||||
} |
||||
bool oldInitSuccess = initSuccess; |
||||
initSuccess = true; |
||||
try { |
||||
this.RuleAssemblies = b.ToString(); |
||||
} finally { |
||||
initSuccess = oldInitSuccess; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -0,0 +1,289 @@
@@ -0,0 +1,289 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 30.06.2012 |
||||
* Time: 20:55 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Drawing; |
||||
using System.Windows; |
||||
using System.Windows.Interop; |
||||
using System.Windows.Media; |
||||
using System.Windows.Media.Imaging; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Core.Presentation; |
||||
using ICSharpCode.TreeView; |
||||
|
||||
namespace ICSharpCode.CodeAnalysis |
||||
{ |
||||
/// <summary>
|
||||
/// Description of AnalysisProjectOptionsTreeNodes.
|
||||
/// </summary>
|
||||
public class BaseTree:SharpTreeNode |
||||
{ |
||||
private int index; |
||||
|
||||
|
||||
|
||||
public BaseTree() |
||||
{ |
||||
RuleState = new ObservableCollection<Tuple<ImageSource,string>>(); |
||||
|
||||
Icon icon = SystemIcons.Warning; |
||||
ImageSource imageSource = ToImageSource(icon); |
||||
this.RuleState.Add(Tuple.Create<ImageSource,string>(imageSource, |
||||
ResourceService.GetString("Global.WarningText"))); |
||||
|
||||
icon = SystemIcons.Error; |
||||
imageSource = ToImageSource(icon); |
||||
this.RuleState.Add(Tuple.Create<ImageSource,string>(imageSource, |
||||
ResourceService.GetString("Global.ErrorText"))); |
||||
// bla.Add(Tuple.Create<Icon,string>(null,"None"));
|
||||
} |
||||
|
||||
private static ImageSource ToImageSource( Icon icon) |
||||
{ |
||||
Bitmap bitmap = icon.ToBitmap(); |
||||
IntPtr hBitmap = bitmap.GetHbitmap(); |
||||
|
||||
ImageSource wpfBitmap = Imaging.CreateBitmapSourceFromHBitmap( |
||||
hBitmap, |
||||
IntPtr.Zero, |
||||
Int32Rect.Empty, |
||||
BitmapSizeOptions.FromEmptyOptions()); |
||||
|
||||
return wpfBitmap; |
||||
} |
||||
|
||||
|
||||
|
||||
public ObservableCollection<Tuple<ImageSource,string>> RuleState {get;set;} |
||||
|
||||
private Tuple<Icon,string> selectedItem; |
||||
|
||||
public Tuple<Icon, string> SelectedNode { |
||||
get { return selectedItem; } |
||||
set { selectedItem = value; } |
||||
} |
||||
|
||||
|
||||
public virtual int Index { |
||||
get { return index; } |
||||
set { |
||||
index = value; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
public class CategoryTreeNode : BaseTree |
||||
{ |
||||
internal FxCopCategory category; |
||||
private Tuple<ImageSource,string> mixedModeTuple; |
||||
|
||||
public CategoryTreeNode(FxCopCategory category):base() |
||||
{ |
||||
|
||||
this.category = category; |
||||
foreach (FxCopRule rule in category.Rules) { |
||||
this.Children.Add(new RuleTreeNode(rule)); |
||||
} |
||||
CheckMode(); |
||||
} |
||||
|
||||
|
||||
public override bool IsCheckable { |
||||
get { return true; } |
||||
} |
||||
|
||||
public override object Text { |
||||
get { return category.DisplayName; } |
||||
} |
||||
|
||||
bool ignoreCheckMode; |
||||
public override int Index { |
||||
get { return base.Index; } |
||||
set { |
||||
if (value != base.Index) { |
||||
base.Index = value; |
||||
if (mixedModeTuple == null) { |
||||
Console.WriteLine("Set all to index"); |
||||
ignoreCheckMode = true; |
||||
foreach (RuleTreeNode rule in this.Children) { |
||||
rule.Index = Index; |
||||
} |
||||
ignoreCheckMode = false; |
||||
// CheckMode();
|
||||
// base.RaisePropertyChanged("Index");
|
||||
// foreach (RuleTreeNode rule in this.Children) {
|
||||
// Console.WriteLine(rule.Index.ToString());
|
||||
// }
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
private void AddMixedMode() |
||||
{ |
||||
Console.WriteLine("AddMixedMode"); |
||||
if (!RuleState.Contains(mixedModeTuple)) { |
||||
var image = PresentationResourceService.GetBitmapSource("Icons.16x16.ClosedFolderBitmap"); |
||||
mixedModeTuple = Tuple.Create<ImageSource,string>(image, |
||||
StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.WarningErrorMixed}")); |
||||
RuleState.Add(mixedModeTuple); |
||||
Index = RuleState.Count -1; |
||||
base.RaisePropertyChanged("Index"); |
||||
CheckMode(); |
||||
} |
||||
} |
||||
|
||||
private void RemoveMixedMode() |
||||
{ |
||||
Console.WriteLine("RemoveMixedMode("); |
||||
if (mixedModeTuple != null) { |
||||
if (RuleState.Contains(mixedModeTuple)) { |
||||
RuleState.Remove(mixedModeTuple); |
||||
mixedModeTuple = null; |
||||
base.RaisePropertyChanged("Index"); |
||||
CheckMode(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void CheckMode () |
||||
{ |
||||
if (! ignoreCheckMode) { |
||||
Console.WriteLine("CheckMode"); |
||||
if (!NewErrorState.HasValue) { |
||||
Console.WriteLine ("\t{0} is Mixed Mode",Text); |
||||
AddMixedMode(); |
||||
} |
||||
else{ |
||||
RemoveMixedMode(); |
||||
/* |
||||
if (NewErrorState == true) { |
||||
Console.WriteLine ("\t{0} is Error",Text); |
||||
// Index = 1;
|
||||
} else { |
||||
Console.WriteLine ("\t{0} is Warning",Text); |
||||
// categoryNode.Index = ;
|
||||
} |
||||
*/ |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public Nullable<bool> NewErrorState { |
||||
get { |
||||
bool allWarn = true; |
||||
bool allErr = true; |
||||
foreach (RuleTreeNode tn in Children) { |
||||
if (tn.isError) |
||||
allWarn = false; |
||||
else |
||||
allErr = false; |
||||
} |
||||
if (allErr) |
||||
return true; |
||||
else if (allWarn) |
||||
return false; |
||||
else |
||||
return null; |
||||
|
||||
} |
||||
} |
||||
|
||||
/* |
||||
internal int ErrorState { |
||||
get { |
||||
bool allWarn = true; |
||||
bool allErr = true; |
||||
foreach (RuleTreeNode tn in Children) { |
||||
if (tn.isError) |
||||
allWarn = false; |
||||
else |
||||
allErr = false; |
||||
} |
||||
if (allErr) |
||||
return 1; |
||||
else if (allWarn) |
||||
return 0; |
||||
else |
||||
return -1; |
||||
} |
||||
} |
||||
*/ |
||||
} |
||||
|
||||
|
||||
public class RuleTreeNode :BaseTree |
||||
{ |
||||
internal FxCopRule rule; |
||||
bool error; |
||||
|
||||
internal bool isError { |
||||
get { return error; } |
||||
set { |
||||
error = value; |
||||
// Index = 1;
|
||||
} |
||||
} |
||||
|
||||
|
||||
public RuleTreeNode(FxCopRule rule):base() |
||||
{ |
||||
this.rule = rule; |
||||
} |
||||
|
||||
public override bool IsCheckable { |
||||
get { return true; } |
||||
} |
||||
|
||||
public override object Text { |
||||
get { return rule.CheckId + " : " + rule.DisplayName; } |
||||
} |
||||
|
||||
public string Identifier { |
||||
get { |
||||
return rule.CategoryName + "#" + rule.CheckId; |
||||
} |
||||
} |
||||
|
||||
|
||||
public override int Index { |
||||
get { return base.Index; } |
||||
set { |
||||
if (base.Index != value) { |
||||
isError = value == 1; |
||||
base.Index = value; |
||||
RaisePropertyChanged("Index"); |
||||
var p = Parent as CategoryTreeNode; |
||||
p.CheckMode(); |
||||
Console.WriteLine ("RuleNode {0} - index {1} - error {2}",rule.DisplayName,Index, isError); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public class MessageNode : SharpTreeNode |
||||
{ |
||||
private string message; |
||||
|
||||
public MessageNode (string message) |
||||
{ |
||||
this.message = message; |
||||
} |
||||
|
||||
public override object Text { |
||||
get { return message; } |
||||
} |
||||
} |
||||
} |
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="CodeCoverageProjectOptionsPanel" /> |
||||
<ClientSize value="{Width=342, Height=396}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="excludeListTextBox" /> |
||||
<TabIndex value="3" /> |
||||
<Location value="12, 229" /> |
||||
<WordWrap value="False" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<ScrollBars value="Vertical" /> |
||||
<AcceptsReturn value="True" /> |
||||
<Size value="317, 154" /> |
||||
<Multiline value="True" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="excludeListLabel" /> |
||||
<Location value="12, 206" /> |
||||
<Text value="${res:ICSharpCode.CodeCoverage.ProjectOptionsPanel.ExcludeListLabel}:" /> |
||||
<Size value="317, 20" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="includeListTextBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="12, 36" /> |
||||
<WordWrap value="False" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<ScrollBars value="Vertical" /> |
||||
<AcceptsReturn value="True" /> |
||||
<Size value="317, 154" /> |
||||
<Multiline value="True" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="includeListLabel" /> |
||||
<Location value="12, 12" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:ICSharpCode.CodeCoverage.ProjectOptionsPanel.IncludeListLabel}:" /> |
||||
<Size value="317, 21" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Xml.Linq; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public class CodeCoverageMethodElement |
||||
{ |
||||
XElement element; |
||||
|
||||
public CodeCoverageMethodElement(XElement element) |
||||
{ |
||||
this.element = element; |
||||
Init(); |
||||
} |
||||
|
||||
public bool IsGetter { get; private set; } |
||||
public bool IsSetter { get; private set; } |
||||
public string MethodName { get; private set; } |
||||
|
||||
public bool IsProperty { |
||||
get { return IsGetter || IsSetter; } |
||||
} |
||||
|
||||
void Init() |
||||
{ |
||||
IsGetter = GetBooleanAttributeValue("isGetter"); |
||||
IsSetter = GetBooleanAttributeValue("isSetter"); |
||||
MethodName = GetMethodName(); |
||||
} |
||||
|
||||
bool GetBooleanAttributeValue(string name) |
||||
{ |
||||
return GetBooleanAttributeValue(element.Attribute(name)); |
||||
} |
||||
|
||||
bool GetBooleanAttributeValue(XAttribute attribute) |
||||
{ |
||||
if (attribute != null) { |
||||
bool value = false; |
||||
if (Boolean.TryParse(attribute.Value, out value)) { |
||||
return value; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
string GetMethodName() |
||||
{ |
||||
XElement nameElement = element.Element("Name"); |
||||
if (nameElement != null) { |
||||
return GetMethodName(nameElement.Value); |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
string GetMethodName(string methodSignature) |
||||
{ |
||||
int startIndex = methodSignature.IndexOf("::"); |
||||
int endIndex = methodSignature.IndexOf('(', startIndex); |
||||
return methodSignature |
||||
.Substring(startIndex, endIndex - startIndex) |
||||
.Substring(2); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<gui:OptionPanel |
||||
x:Class="ICSharpCode.CodeCoverage.CodeCoverageOptionsPanel" |
||||
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;assembly=ICSharpCode.SharpDevelop" |
||||
|
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"> |
||||
|
||||
<GroupBox |
||||
Header="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.CodeCoverageColoursGroupBoxText}"> |
||||
<Grid > |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="40"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition Width="30"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Label |
||||
Content="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.DisplayItemsLabel}"></Label> |
||||
|
||||
<Label |
||||
Grid.Column="2" |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Center" |
||||
Content="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.ItemForegroundLabel}"></Label> |
||||
|
||||
<gui:ColorPickerButton |
||||
Grid.Row="1" Grid.Column="3" VerticalAlignment="Center" |
||||
Value="{Binding ForeGroundColor}" |
||||
Text="..."> |
||||
</gui:ColorPickerButton> |
||||
|
||||
<Label |
||||
Grid.Row="2" |
||||
Grid.Column="2" |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Center" |
||||
Content="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.ItemBackgroundLabel}"></Label> |
||||
|
||||
<gui:ColorPickerButton |
||||
Grid.Row="3" Grid.Column="3" VerticalAlignment="Center" |
||||
Value="{Binding BackGroundColor}" |
||||
Text="..."> |
||||
</gui:ColorPickerButton> |
||||
|
||||
<ListView x:Name="displayItemsListBox" |
||||
Grid.Row="1" Grid.ColumnSpan="2" Grid.RowSpan="3" |
||||
ItemsSource="{Binding DisplayItems}" |
||||
SelectedIndex="0" |
||||
SelectedItem="{Binding DisplayItem}" |
||||
IsSynchronizedWithCurrentItem="True"></ListView> |
||||
|
||||
<TextBlock |
||||
Grid.Row="6" |
||||
Grid.ColumnSpan="3" |
||||
Text="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.SampleText}" |
||||
TextAlignment="Center" |
||||
FontSize="15" |
||||
VerticalAlignment="Center"> |
||||
<TextBlock.Foreground> |
||||
<SolidColorBrush Color="{Binding ForeGroundColor}"></SolidColorBrush> |
||||
</TextBlock.Foreground> |
||||
<TextBlock.Background> |
||||
<SolidColorBrush Color="{Binding BackGroundColor}"></SolidColorBrush> |
||||
</TextBlock.Background> |
||||
</TextBlock> |
||||
</Grid> |
||||
</GroupBox> |
||||
</gui:OptionPanel> |
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 09.06.2012 |
||||
* Time: 17:03 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Globalization; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Controls.Primitives; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Widgets; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for CodeCoverageOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
public partial class CodeCoverageOptionsPanel : OptionPanel |
||||
{ |
||||
|
||||
public CodeCoverageOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
DataContext = this; |
||||
DisplayItems = new ObservableCollection<CodeCoverageDisplayItem>(); |
||||
DisplayItems.Add(new CodeCoverageDisplayItem(StringParser.Parse("${res:ICSharpCode.CodeCoverage.CodeCovered}"), CodeCoverageOptions.VisitedColorProperty, CodeCoverageOptions.VisitedColor, CodeCoverageOptions.VisitedForeColorProperty, CodeCoverageOptions.VisitedForeColor)); |
||||
DisplayItems.Add(new CodeCoverageDisplayItem(StringParser.Parse("${res:ICSharpCode.CodeCoverage.CodeNotCovered}"), CodeCoverageOptions.NotVisitedColorProperty, CodeCoverageOptions.NotVisitedColor, CodeCoverageOptions.NotVisitedForeColorProperty, CodeCoverageOptions.NotVisitedForeColor)); |
||||
DisplayItem = DisplayItems[0]; |
||||
} |
||||
|
||||
CodeCoverageDisplayItem displayItem; |
||||
|
||||
public CodeCoverageDisplayItem DisplayItem { |
||||
get { return displayItem; } |
||||
set { displayItem = value; |
||||
base.RaisePropertyChanged(() => DisplayItem); |
||||
ShowColors(); |
||||
} |
||||
} |
||||
|
||||
|
||||
private System.Windows.Media.Color foreGroundColor; |
||||
|
||||
public Color ForeGroundColor { |
||||
get { return foreGroundColor; } |
||||
set { |
||||
foreGroundColor = value; |
||||
RaisePropertyChanged(() => ForeGroundColor); |
||||
DisplayItem.ForeColor = SetColor(ForeGroundColor); |
||||
} |
||||
} |
||||
|
||||
|
||||
private System.Windows.Media.Color backGroundColor; |
||||
|
||||
public Color BackGroundColor { |
||||
get { return backGroundColor; } |
||||
set { backGroundColor = value; |
||||
RaisePropertyChanged(() => BackGroundColor); |
||||
DisplayItem.BackColor = SetColor(BackGroundColor); |
||||
} |
||||
} |
||||
|
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
bool codeCoverageColorsChanged = false; |
||||
|
||||
foreach (CodeCoverageDisplayItem item in displayItemsListBox.Items) { |
||||
if (item.HasChanged) { |
||||
CodeCoverageOptions.Properties.Set<System.Drawing.Color>(item.ForeColorPropertyName, item.ForeColor); |
||||
CodeCoverageOptions.Properties.Set<System.Drawing.Color>(item.BackColorPropertyName, item.BackColor); |
||||
codeCoverageColorsChanged = true; |
||||
} |
||||
} |
||||
|
||||
if (codeCoverageColorsChanged) { |
||||
CodeCoverageService.RefreshCodeCoverageHighlights(); |
||||
} |
||||
return base.SaveOptions(); |
||||
} |
||||
|
||||
private void ShowColors() |
||||
{ |
||||
System.Drawing.Color clr = DisplayItem.ForeColor; |
||||
ForeGroundColor = System.Windows.Media.Color.FromArgb(clr.A, clr.R, clr.G, clr.B); |
||||
clr = DisplayItem.BackColor; |
||||
BackGroundColor = System.Windows.Media.Color.FromArgb(clr.A, clr.R, clr.G, clr.B); |
||||
} |
||||
|
||||
|
||||
private System.Drawing.Color SetColor (System.Windows.Media.Color color) |
||||
{ |
||||
return System.Drawing.Color.FromArgb(color.A,color.R,color.G,color.B); |
||||
} |
||||
|
||||
public ObservableCollection<CodeCoverageDisplayItem> DisplayItems {get; private set;} |
||||
} |
||||
} |
@ -1,101 +0,0 @@
@@ -1,101 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.Specialized; |
||||
using System.IO; |
||||
using System.Text; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public class CodeCoverageProjectOptionsPanel : AbstractXmlFormsProjectOptionPanel |
||||
{ |
||||
static readonly string IncludeListTextBoxName = "includeListTextBox"; |
||||
static readonly string ExcludeListTextBoxName = "excludeListTextBox"; |
||||
|
||||
TextBox includeListTextBox; |
||||
TextBox excludeListTextBox; |
||||
|
||||
public CodeCoverageProjectOptionsPanel() |
||||
{ |
||||
} |
||||
|
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.CodeCoverage.Resources.CodeCoverageProjectOptionsPanel.xfrm")); |
||||
InitializeHelper(); |
||||
|
||||
includeListTextBox = (TextBox)ControlDictionary[IncludeListTextBoxName]; |
||||
excludeListTextBox = (TextBox)ControlDictionary[ExcludeListTextBoxName]; |
||||
|
||||
ReadPartCoverSettings(); |
||||
|
||||
includeListTextBox.TextChanged += TextBoxTextChanged; |
||||
excludeListTextBox.TextChanged += TextBoxTextChanged; |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
SavePartCoverSettings(); |
||||
IsDirty = false; |
||||
return true; |
||||
} |
||||
|
||||
void TextBoxTextChanged(object sender, EventArgs e) |
||||
{ |
||||
IsDirty = true; |
||||
} |
||||
|
||||
void SavePartCoverSettings() |
||||
{ |
||||
PartCoverSettings settings = new PartCoverSettings(); |
||||
settings.Include.AddRange(RemoveEmptyStrings(includeListTextBox.Lines)); |
||||
settings.Exclude.AddRange(RemoveEmptyStrings(excludeListTextBox.Lines)); |
||||
settings.Save(PartCoverSettings.GetFileName(project)); |
||||
} |
||||
|
||||
void ReadPartCoverSettings() |
||||
{ |
||||
string settingsFileName = PartCoverSettings.GetFileName(project); |
||||
if (File.Exists(settingsFileName)) { |
||||
PartCoverSettings settings = new PartCoverSettings(settingsFileName); |
||||
includeListTextBox.Text = ConvertToMultLineString(settings.Include); |
||||
excludeListTextBox.Text = ConvertToMultLineString(settings.Exclude); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Each item in the string collection is added as a separate line
|
||||
/// followed by a carriage return and line feed except the last
|
||||
/// item.
|
||||
/// </summary>
|
||||
static string ConvertToMultLineString(StringCollection items) |
||||
{ |
||||
StringBuilder text = new StringBuilder(); |
||||
foreach (String item in items) { |
||||
text.Append(item); |
||||
text.Append("\r\n"); |
||||
} |
||||
return text.ToString().Trim(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a new string array but with any lines that are empty
|
||||
/// in the original lines array removed from it.
|
||||
/// </summary>
|
||||
static string[] RemoveEmptyStrings(string[] lines) |
||||
{ |
||||
List<string> convertedLines = new List<string>(); |
||||
foreach (string line in lines) { |
||||
if (line.Trim().Length > 0) { |
||||
convertedLines.Add(line); |
||||
} |
||||
} |
||||
return convertedLines.ToArray(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CodeCoverage.CodeCoverageProjectOptionsPanel" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="100"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="100"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Label Content="{core:Localize ICSharpCode.CodeCoverage.ProjectOptionsPanel.IncludeListLabel}"></Label> |
||||
|
||||
<TextBox x:Name="includeListTextBox" Grid.Row="1" Margin="5,0,5,0" |
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" |
||||
TextChanged="TextBox_TextChanged" |
||||
TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"> |
||||
</TextBox> |
||||
|
||||
<Label Grid.Row="2" Content="{core:Localize ICSharpCode.CodeCoverage.ProjectOptionsPanel.ExcludeListLabel}"></Label> |
||||
|
||||
<TextBox x:Name="excludeListTextBox" Grid.Row="3" Margin="5,0,5,0" |
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" |
||||
TextChanged="TextBox_TextChanged" |
||||
TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" > |
||||
</TextBox> |
||||
</Grid> |
||||
|
||||
</ScrollViewer> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 09.06.2012 |
||||
* Time: 15:01 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Specialized; |
||||
using System.IO; |
||||
using System.Text; |
||||
using System.Windows.Controls; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for CodeCoverageOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
public partial class CodeCoverageProjectOptionsPanel : ProjectOptionPanel |
||||
{ |
||||
public CodeCoverageProjectOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
protected override void Load(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
ReadPartCoverSettings(); |
||||
base.Load(project, configuration, platform); |
||||
} |
||||
|
||||
|
||||
protected override bool Save(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
SavePartCoverSettings(); |
||||
return base.Save(project, configuration, platform); |
||||
} |
||||
|
||||
|
||||
void ReadPartCoverSettings() |
||||
{ |
||||
string settingsFileName = OpenCoverSettings.GetFileName(base.Project); |
||||
if (File.Exists(settingsFileName)) { |
||||
OpenCoverSettings settings = new OpenCoverSettings(settingsFileName); |
||||
includeListTextBox.Text = ConvertToMultLineString(settings.Include); |
||||
excludeListTextBox.Text = ConvertToMultLineString(settings.Exclude); |
||||
} |
||||
} |
||||
|
||||
|
||||
private void SavePartCoverSettings() |
||||
{ |
||||
OpenCoverSettings settings = new OpenCoverSettings(); |
||||
settings.Include.AddRange(MakeStringArray(includeListTextBox.Text)); |
||||
settings.Exclude.AddRange(MakeStringArray(excludeListTextBox.Text)); |
||||
settings.Save(OpenCoverSettings.GetFileName(base.Project)); |
||||
} |
||||
|
||||
|
||||
private string[] MakeStringArray(string str) |
||||
{ |
||||
return str.Split(new char[]{'\r','\n'}, StringSplitOptions.RemoveEmptyEntries); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Each item in the string collection is added as a separate line
|
||||
/// followed by a carriage return and line feed except the last
|
||||
/// item.
|
||||
/// </summary>
|
||||
private static string ConvertToMultLineString(StringCollection items) |
||||
{ |
||||
StringBuilder text = new StringBuilder(); |
||||
foreach (String item in items) { |
||||
text.Append(item); |
||||
text.Append("\r\n"); |
||||
} |
||||
return text.ToString().Trim(); |
||||
} |
||||
|
||||
|
||||
void TextBox_TextChanged(object sender, TextChangedEventArgs e) |
||||
{ |
||||
IsDirty = true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,176 @@
@@ -0,0 +1,176 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Xml.Linq; |
||||
using ICSharpCode.CodeCoverage.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Coverage |
||||
{ |
||||
[TestFixture] |
||||
public class CodeCoverageMethodElementTests |
||||
{ |
||||
CodeCoverageMethodElement methodElement; |
||||
|
||||
void CreateMethod(string name) |
||||
{ |
||||
XElement element = CodeCoverageMethodXElementBuilder.CreateMethod("MyClass", name); |
||||
CreateMethod(element); |
||||
} |
||||
|
||||
void CreateMethod(XElement element) |
||||
{ |
||||
methodElement = new CodeCoverageMethodElement(element); |
||||
} |
||||
|
||||
void CreatePropertyGetterMethod(string propertyName) |
||||
{ |
||||
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertyGetter("MyClass", propertyName); |
||||
CreateMethod(element); |
||||
} |
||||
|
||||
void CreatePropertySetterMethod(string propertyName) |
||||
{ |
||||
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertySetter("MyClass", propertyName); |
||||
CreateMethod(element); |
||||
} |
||||
|
||||
void CreatePropertyGetterWithInvalidAttributeValue(string propertyName) |
||||
{ |
||||
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertyGetter("MyClass", propertyName); |
||||
element.SetIsGetterAttributeValue("INVALID"); |
||||
CreateMethod(element); |
||||
} |
||||
|
||||
void CreatePropertySetterWithInvalidAttributeValue(string propertyName) |
||||
{ |
||||
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertySetter("MyClass", propertyName); |
||||
element.SetIsSetterAttributeValue("INVALID"); |
||||
CreateMethod(element); |
||||
} |
||||
|
||||
void CreateMethodWithSignature(string methodSignature) |
||||
{ |
||||
var builder = new CodeCoverageMethodXElementBuilder(methodSignature); |
||||
CreateMethod(builder.MethodElement); |
||||
} |
||||
|
||||
void CreateMethodElementThatHasNoNameElement() |
||||
{ |
||||
var builder = new CodeCoverageMethodXElementBuilder(String.Empty); |
||||
builder.MethodElement.RemoveNodes(); |
||||
CreateMethod(builder.MethodElement); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsGetter_MethodIsNotProperty_ReturnsFalse() |
||||
{ |
||||
CreateMethod("MyMethod"); |
||||
|
||||
bool result = methodElement.IsGetter; |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsProperty_MethodIsNotProperty_ReturnsFalse() |
||||
{ |
||||
CreateMethod("MyMethod"); |
||||
|
||||
bool result = methodElement.IsProperty; |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsGetter_MethodIsPropertyGetter_ReturnsTrue() |
||||
{ |
||||
CreatePropertyGetterMethod("Count"); |
||||
|
||||
bool result = methodElement.IsGetter; |
||||
|
||||
Assert.IsTrue(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsGetter_MethodIsPropertyGetterButAttributeValueIsNotValidBooleanValue_ReturnsFalse() |
||||
{ |
||||
CreatePropertyGetterWithInvalidAttributeValue("Count"); |
||||
|
||||
bool result = methodElement.IsGetter; |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsProperty_MethodIsPropertyGetter_ReturnsTrue() |
||||
{ |
||||
CreatePropertyGetterMethod("Count"); |
||||
|
||||
bool result = methodElement.IsProperty; |
||||
|
||||
Assert.IsTrue(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsSetter_MethodIsNotProperty_ReturnsFalse() |
||||
{ |
||||
CreateMethod("MyMethod"); |
||||
|
||||
bool result = methodElement.IsSetter; |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsSetter_MethodIsPropertySetter_ReturnsTrue() |
||||
{ |
||||
CreatePropertySetterMethod("Count"); |
||||
|
||||
bool result = methodElement.IsSetter; |
||||
|
||||
Assert.IsTrue(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsProperty_MethodIsPropertySetter_ReturnsTrue() |
||||
{ |
||||
CreatePropertySetterMethod("Count"); |
||||
|
||||
bool result = methodElement.IsProperty; |
||||
|
||||
Assert.IsTrue(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsSetter_MethodIsPropertySetterButAttributeValueIsNotValidBooleanValue_ReturnsFalse() |
||||
{ |
||||
CreatePropertySetterWithInvalidAttributeValue("Count"); |
||||
|
||||
bool result = methodElement.IsSetter; |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void MethodName_ElementHasFullMethodSignature_ReturnsMethodName() |
||||
{ |
||||
CreateMethodWithSignature("System.Void MyClass::MyMethod(System.Int32)"); |
||||
|
||||
string methodName = methodElement.MethodName; |
||||
|
||||
Assert.AreEqual("MyMethod", methodName); |
||||
} |
||||
|
||||
[Test] |
||||
public void MethodName_ElementHasNoNameElement_ReturnsEmptyString() |
||||
{ |
||||
CreateMethodElementThatHasNoNameElement(); |
||||
|
||||
string methodName = methodElement.MethodName; |
||||
|
||||
Assert.AreEqual(String.Empty, methodName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Xml.Linq; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Utils |
||||
{ |
||||
public class CodeCoverageMethodXElementBuilder |
||||
{ |
||||
public XElement MethodElement { get; private set; } |
||||
|
||||
public CodeCoverageMethodXElementBuilder(string methodSignature) |
||||
{ |
||||
MethodElement = new XElement("Method"); |
||||
|
||||
var nameElement = new XElement("Name"); |
||||
nameElement.Value = methodSignature; |
||||
MethodElement.Add(nameElement); |
||||
} |
||||
|
||||
public void MakePropertyGetter() |
||||
{ |
||||
SetGetterAttribute(true); |
||||
} |
||||
|
||||
void SetGetterAttribute(bool value) |
||||
{ |
||||
SetBooleanAttribute("isGetter", value); |
||||
} |
||||
|
||||
void SetBooleanAttribute(string name, bool value) |
||||
{ |
||||
SetAttributeValue(name, value.ToString().ToLowerInvariant()); |
||||
} |
||||
|
||||
void SetAttributeValue(string name, object value) |
||||
{ |
||||
MethodElement.SetAttributeValue(name, value); |
||||
} |
||||
|
||||
public void MakePropertySetter() |
||||
{ |
||||
SetSetterAttribute(true); |
||||
} |
||||
|
||||
void SetSetterAttribute(bool value) |
||||
{ |
||||
SetBooleanAttribute("isSetter", value); |
||||
} |
||||
|
||||
public static XElement CreatePropertySetterWithMethodSignature(string methodSignature) |
||||
{ |
||||
var builder = new CodeCoverageMethodXElementBuilder(methodSignature); |
||||
builder.SetSetterAttribute(true); |
||||
builder.SetGetterAttribute(false); |
||||
return builder.MethodElement; |
||||
} |
||||
|
||||
public static XElement CreatePropertyGetterWithMethodSignature(string methodSignature) |
||||
{ |
||||
var builder = new CodeCoverageMethodXElementBuilder(methodSignature); |
||||
builder.SetSetterAttribute(false); |
||||
builder.SetGetterAttribute(true); |
||||
return builder.MethodElement; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Generates a setter method signature from the property name and type
|
||||
/// (e.g. "System.Void set_PROPERTYNAME(PROPERTYTYPE)"
|
||||
/// </summary>
|
||||
public static XElement CreatePropertySetter(string className, string propertyName, string propertyType) |
||||
{ |
||||
string methodSignature = String.Format("System.Void {0}::set_{1}({2})", className, propertyName, propertyType); |
||||
return CreatePropertySetterWithMethodSignature(methodSignature); |
||||
} |
||||
|
||||
public static XElement CreateIntegerPropertySetter(string className, string propertyName) |
||||
{ |
||||
return CreatePropertySetter(className, propertyName, "System.Int32"); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Generates a getter method signature from the property name and type
|
||||
/// (e.g. "PROPERTYTYPE get_PROPERTYNAME()"
|
||||
/// </summary>
|
||||
public static XElement CreatePropertyGetter(string className, string propertyName, string propertyType) |
||||
{ |
||||
string methodSignature = String.Format("{0} {1}::get_{2}()", propertyType, className, propertyName); |
||||
return CreatePropertyGetterWithMethodSignature(methodSignature); |
||||
} |
||||
|
||||
public static XElement CreateIntegerPropertyGetter(string className, string propertyName) |
||||
{ |
||||
return CreatePropertyGetter(className, propertyName, "System.Int32"); |
||||
} |
||||
|
||||
public static XElement CreateMethod(string className, string methodName) |
||||
{ |
||||
return CreateMethod(className, methodName, "System.Void"); |
||||
} |
||||
|
||||
public static XElement CreateMethod(string className, string methodName, string returnType) |
||||
{ |
||||
string methodSignature = String.Format("{0} {1}::{2}()", returnType, className, methodName); |
||||
var builder = new CodeCoverageMethodXElementBuilder(methodSignature); |
||||
return builder.MethodElement; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Xml.Linq; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Utils |
||||
{ |
||||
public static class XElementExtensions |
||||
{ |
||||
public static void SetIsGetterAttributeValue(this XElement element, object value) |
||||
{ |
||||
element.SetAttributeValue("isGetter", value); |
||||
} |
||||
|
||||
public static void SetIsSetterAttributeValue(this XElement element, object value) |
||||
{ |
||||
element.SetAttributeValue("isSetter", value); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.SourceAnalysis.AnalysisIdeOptionsPanel" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
||||
<GroupBox Header="StyleCop"> |
||||
<StackPanel> |
||||
<TextBlock Margin="3,5,3,20" x:Name="status" |
||||
HorizontalAlignment="Center" TextWrapping="Wrap" |
||||
Text="(showing current StyleCop path)"></TextBlock> |
||||
<Button Content="Find StyleCop path" |
||||
HorizontalAlignment="Center" |
||||
Click="FindStyleCopPath_Click" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button> |
||||
|
||||
<Button Margin="0,15,0,0" IsEnabled="{Binding EnableModifyStyleCopSettings}" |
||||
Content="Modify Master StyleCop Settings" |
||||
HorizontalAlignment="Center" |
||||
Click="ModifyStyleCopSettings_Click" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
|
||||
</gui:OptionPanel> |
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 23.07.2012 |
||||
* Time: 20:13 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
|
||||
namespace ICSharpCode.SourceAnalysis |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for AnalysisIdeOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
public partial class AnalysisIdeOptionsPanel : OptionPanel |
||||
{ |
||||
private bool enableModifyStyleCopSettings; |
||||
|
||||
public AnalysisIdeOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
DataContext = this; |
||||
ShowStatus(); |
||||
} |
||||
|
||||
|
||||
private void ShowStatus() |
||||
{ |
||||
string path = StyleCopWrapper.FindStyleCopPath(); |
||||
if (path == null) { |
||||
status.Text = StringParser.Parse("StyleCop not found in the given path."); |
||||
EnableModifyStyleCopSettings = false; |
||||
} else { |
||||
status.Text = StringParser.Parse("StyleCop was found in: ") + Environment.NewLine + path; |
||||
EnableModifyStyleCopSettings = true; |
||||
} |
||||
} |
||||
|
||||
|
||||
public bool EnableModifyStyleCopSettings { |
||||
get { return enableModifyStyleCopSettings; } |
||||
set { enableModifyStyleCopSettings = value; |
||||
base.RaisePropertyChanged("EnableModifyStyleCopSettings"); |
||||
} |
||||
} |
||||
|
||||
|
||||
private void FindStyleCopPath_Click(object sender, System.Windows.RoutedEventArgs e) |
||||
{ |
||||
string filter = StringParser.Parse("StyleCop|*" + StyleCopWrapper.STYLE_COP_FILE + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||
string path = OptionsHelper.OpenFile(filter); |
||||
if (!String.IsNullOrEmpty(path)) { |
||||
if (StyleCopWrapper.IsStyleCopPath(path)) { |
||||
StyleCopPath = path; |
||||
} else { |
||||
MessageService.ShowError(string.Format("Directory does not contain StyleCop (*{0}).", StyleCopWrapper.STYLE_COP_FILE)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
void ModifyStyleCopSettings_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
var executable = Path.Combine(Path.GetDirectoryName(StyleCopWrapper.FindStyleCopPath()), "StyleCopSettingsEditor.exe"); |
||||
var parameters = "\"" + StyleCopWrapper.GetMasterSettingsFile() + "\""; |
||||
|
||||
if (!File.Exists(executable)) { |
||||
LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable); |
||||
MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options."); |
||||
return; |
||||
} |
||||
|
||||
using(Process p = Process.Start("\"" + executable + "\"", parameters)) |
||||
{ |
||||
// No need to wait for the settings dialog to close - we can leave it open.
|
||||
} |
||||
} |
||||
|
||||
|
||||
public static string StyleCopPath { |
||||
get { |
||||
return PropertyService.Get("SourceAnalysis.StyleCopPath"); |
||||
} |
||||
set { |
||||
PropertyService.Set("SourceAnalysis.StyleCopPath", value); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
<optionpanels:ProjectOptionPanel |
||||
x:Class="ICSharpCode.SourceAnalysis.AnalysisProjectOptionsPanel" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
|
||||
<Grid Margin="0,10,0,0"> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="10"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="200"></ColumnDefinition> |
||||
<ColumnDefinition Width="200"></ColumnDefinition> |
||||
<ColumnDefinition Width="30"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<optionpanels:StorageLocationPicker Location="{Binding SourceAnalysisOverrideSettingsFile.Location}" VerticalAlignment="Center" /> |
||||
|
||||
<TextBox Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="3,0,3,0" |
||||
x:Name="settingsFileTextBox" |
||||
Text="{Binding SourceAnalysisOverrideSettingsFile.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<Button Grid.Column="3" Content="..." VerticalAlignment="Center" |
||||
Click="BrowseButton_Click" ></Button> |
||||
|
||||
|
||||
<Button Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Center" |
||||
Content="Modify StyleCop Settings" Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Click="ModifyStyleCopSettings_Click"></Button> |
||||
</Grid> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.07.2012 |
||||
* Time: 18:51 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Media; |
||||
using System.Windows.Media.Imaging; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SourceAnalysis |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for AnalysisIdeOptionsPanelXaml.xaml
|
||||
/// </summary>
|
||||
public partial class AnalysisProjectOptionsPanel : ProjectOptionPanel |
||||
{ |
||||
public AnalysisProjectOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> SourceAnalysisOverrideSettingsFile { |
||||
get { return GetProperty("SourceAnalysisOverrideSettingsFile", "", TextBoxEditMode.EditRawProperty); } |
||||
} |
||||
|
||||
|
||||
protected override void Load(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
base.Load(project, configuration, platform); |
||||
if (String.IsNullOrEmpty(SourceAnalysisOverrideSettingsFile.Value)) { |
||||
SourceAnalysisOverrideSettingsFile.Value = StyleCopWrapper.GetMasterSettingsFile(); |
||||
SourceAnalysisOverrideSettingsFile.Location = PropertyStorageLocations.Base; |
||||
} |
||||
} |
||||
|
||||
|
||||
void BrowseButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
var fn = OptionsHelper.OpenFile(String.Empty); |
||||
if (!String.IsNullOrEmpty(fn)) { |
||||
settingsFileTextBox.Text = fn; |
||||
} |
||||
} |
||||
|
||||
|
||||
void ModifyStyleCopSettings_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
|
||||
var settingsFile = SourceAnalysisOverrideSettingsFile.Value; |
||||
|
||||
if (settingsFile == StyleCopWrapper.GetMasterSettingsFile()) { |
||||
if (ConfirmSwitchFromMaster()) { |
||||
settingsFile = CopyFromMaster(); |
||||
} |
||||
} |
||||
|
||||
if (!System.IO.File.Exists(settingsFile)) { |
||||
if (ConfirmReplaceMissingFile()) { |
||||
settingsFile = CopyFromMaster(); |
||||
} |
||||
else { |
||||
MessageService.ShowWarning("No settings file found to modify."); |
||||
return; |
||||
} |
||||
} |
||||
|
||||
string styleCopPath = StyleCopWrapper.FindStyleCopPath(); |
||||
string executable; |
||||
if (styleCopPath != null) |
||||
executable = Path.Combine(Path.GetDirectoryName(styleCopPath), "StyleCopSettingsEditor.exe"); |
||||
else |
||||
executable = null; |
||||
string parameters = "\"" + settingsFile + "\""; |
||||
if (!File.Exists(executable)) { |
||||
LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable); |
||||
MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options."); |
||||
return; |
||||
} |
||||
|
||||
using(Process p = Process.Start("\"" + executable + "\"", parameters)) { |
||||
// No need to wait for the settings dialog to close - we can leave it open.
|
||||
} |
||||
} |
||||
|
||||
|
||||
private bool ConfirmReplaceMissingFile() |
||||
{ |
||||
return MessageService.AskQuestion("A settings file is not present. Would you like to copy the master into the " + |
||||
"project folder?", |
||||
"Missing Settings File"); |
||||
} |
||||
|
||||
|
||||
private bool ConfirmSwitchFromMaster() |
||||
{ |
||||
return MessageService.AskQuestion("You are currently using the master settings file. Do you want to make a " |
||||
+ "copy in the project folder instead?", |
||||
"Using Master Settings File"); |
||||
} |
||||
|
||||
|
||||
private string CopyFromMaster() |
||||
{ |
||||
var newSettingsFile = Project.Directory + "\\Settings.SourceAnalysis"; |
||||
System.IO.File.Copy( |
||||
StyleCopWrapper.GetMasterSettingsFile(), |
||||
newSettingsFile, |
||||
true |
||||
); |
||||
SourceAnalysisOverrideSettingsFile.Value = newSettingsFile; |
||||
SourceAnalysisOverrideSettingsFile.Location = PropertyStorageLocations.Base; |
||||
return newSettingsFile; |
||||
} |
||||
} |
||||
} |
@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
namespace MattEverson.SourceAnalysis |
||||
namespace ICSharpCode.SourceAnalysis |
||||
{ |
||||
partial class AnalysisProjectOptions : System.Windows.Forms.UserControl |
||||
{ |
@ -1,398 +0,0 @@
@@ -1,398 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="cSharpBuildOptionsPanel" /> |
||||
<ClientSize value="{Width=527, Height=684}" /> |
||||
<AutoScroll value="True" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="generalGroupBox" /> |
||||
<Location value="3, 3" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.BuildOptions.General}" /> |
||||
<Size value="521, 146" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="conditionalSymbolsLabel" /> |
||||
<Location value="6, 16" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.BuildOptions.ConditionalSymbols}" /> |
||||
<Size value="509, 16" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="conditionalSymbolsTextBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="6, 36" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="509, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="optimizeCodeCheckBox" /> |
||||
<Location value="6, 60" /> |
||||
<Text value="${res:Dialog.ProjectOptions.BuildOptions.OptimizeCode}" /> |
||||
<TabIndex value="2" /> |
||||
<Size value="509, 21" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="allowUnsafeCodeCheckBox" /> |
||||
<Location value="6, 80" /> |
||||
<Text value="${res:Dialog.ProjectOptions.BuildOptions.AllowUnsafeCode}" /> |
||||
<TabIndex value="3" /> |
||||
<Size value="509, 21" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="checkForOverflowCheckBox" /> |
||||
<Location value="6, 100" /> |
||||
<Text value="${res:Dialog.ProjectOptions.BuildOptions.CheckForOverflow}" /> |
||||
<TabIndex value="4" /> |
||||
<Size value="509, 21" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="noCorlibCheckBox" /> |
||||
<Location value="6, 120" /> |
||||
<Text value="${res:Dialog.ProjectOptions.BuildOptions.NoCorlib}" /> |
||||
<TabIndex value="5" /> |
||||
<Size value="509, 21" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="outputGroupBox" /> |
||||
<Location value="3, 152" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.Output}" /> |
||||
<Size value="521, 362" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="1" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="projectUpdateButton" /> |
||||
<Location value="337, 106" /> |
||||
<Text value="Change" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Size value="173, 23" /> |
||||
<TabIndex value="12" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="outputPathLabel" /> |
||||
<Location value="12, 17" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.OutputPath}" /> |
||||
<Size value="509, 16" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="outputPathTextBox" /> |
||||
<TabIndex value="4" /> |
||||
<Location value="12, 37" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="465, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="outputPathBrowseButton" /> |
||||
<Location value="481, 37" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="..." /> |
||||
<Size value="40, 21" /> |
||||
<Anchor value="Top, Right" /> |
||||
<TabIndex value="5" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="xmlDocumentationCheckBox" /> |
||||
<Location value="12, 61" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.XmlDocumentationFile}" /> |
||||
<TabIndex value="6" /> |
||||
<Size value="154, 21" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="xmlDocumentationTextBox" /> |
||||
<TabIndex value="7" /> |
||||
<Location value="170, 61" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="350, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="debugInfoLabel" /> |
||||
<Location value="12, 85" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.DebugInfo}" /> |
||||
<Size value="154, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="8" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="debugInfoComboBox" /> |
||||
<TabIndex value="9" /> |
||||
<Location value="170, 85" /> |
||||
<Size value="161, 21" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="targetFrameworkLabel" /> |
||||
<Location value="12, 109" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.TargetFramework}" /> |
||||
<Size value="154, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="10" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="targetFrameworkComboBox" /> |
||||
<TabIndex value="11" /> |
||||
<Location value="170, 109" /> |
||||
<Size value="161, 21" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="advancedOutputGroupBox" /> |
||||
<Location value="6, 136" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.Advanced}" /> |
||||
<Size value="509, 220" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="9" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Panel> |
||||
<Name value="platformSpecificOptionsPanel" /> |
||||
<Location value="6, 14" /> |
||||
<TabIndex value="9" /> |
||||
<Size value="497, 121" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="generateSerializationAssemblyLabel" /> |
||||
<Location value="3, 23" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.GenerateSerializationAssembly}" /> |
||||
<Size value="180, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="1" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="dllBaseAddressTextBox" /> |
||||
<TabIndex value="8" /> |
||||
<Location value="189, 95" /> |
||||
<Size value="140, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="dllBaseAddressLabel" /> |
||||
<Location value="3, 95" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.DLLBaseAddress}" /> |
||||
<Size value="180, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="7" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="registerCOMInteropCheckBox" /> |
||||
<Location value="177, 1" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.RegisterForCOM}" /> |
||||
<TabIndex value="0" /> |
||||
<Size value="317, 21" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="fileAlignmentComboBox" /> |
||||
<TabIndex value="6" /> |
||||
<Location value="189, 71" /> |
||||
<Size value="180, 21" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="fileAlignmentLabel" /> |
||||
<Location value="3, 71" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.FileAlignment}" /> |
||||
<Size value="180, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="5" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="targetCpuComboBox" /> |
||||
<TabIndex value="4" /> |
||||
<Location value="189, 47" /> |
||||
<Size value="180, 21" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="targetCpuLabel" /> |
||||
<Location value="3, 47" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.TargetCPU}" /> |
||||
<Size value="180, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="generateSerializationAssemblyComboBox" /> |
||||
<TabIndex value="2" /> |
||||
<Location value="189, 23" /> |
||||
<Size value="180, 21" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
</Controls> |
||||
</System.Windows.Forms.Panel> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="baseIntermediateOutputPathLabel" /> |
||||
<Location value="6, 134" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.BaseIntermediateOutputPath}" /> |
||||
<Size value="497, 16" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="baseIntermediateOutputPathTextBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="6, 153" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="446, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="baseIntermediateOutputPathBrowseButton" /> |
||||
<Location value="463, 153" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="..." /> |
||||
<Size value="40, 21" /> |
||||
<Anchor value="Top, Right" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="intermediateOutputPathLabel" /> |
||||
<Location value="6, 177" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.IntermediateOutputPath}" /> |
||||
<Size value="497, 16" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="intermediateOutputPathTextBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="6, 193" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="446, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="intermediateOutputPathBrowseButton" /> |
||||
<Location value="463, 192" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="..." /> |
||||
<Size value="40, 21" /> |
||||
<Anchor value="Top, Right" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Button> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="warningsGroupBox" /> |
||||
<Location value="3, 518" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.ErrorsAndWarnings}" /> |
||||
<Size value="521, 66" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="2" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="warningLevelLabel" /> |
||||
<Location value="6, 16" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.WarningLevel}" /> |
||||
<Size value="154, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="warningLevelComboBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="164, 16" /> |
||||
<Size value="60, 21" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="suppressWarningsLabel" /> |
||||
<Location value="6, 40" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.SuppressWarnings}" /> |
||||
<Size value="154, 16" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="suppressWarningsTextBox" /> |
||||
<TabIndex value="3" /> |
||||
<Location value="164, 40" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="350, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="treatWarningsAsErrorsGroupBox" /> |
||||
<Location value="3, 588" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors}" /> |
||||
<Size value="521, 92" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="3" /> |
||||
<Controls> |
||||
<System.Windows.Forms.RadioButton> |
||||
<Name value="noneRadioButton" /> |
||||
<Location value="6, 20" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.None}" /> |
||||
<Size value="154, 21" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.RadioButton> |
||||
<System.Windows.Forms.RadioButton> |
||||
<Name value="specificWarningsRadioButton" /> |
||||
<Location value="6, 42" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.Specific}" /> |
||||
<Size value="154, 21" /> |
||||
<TabIndex value="1" /> |
||||
</System.Windows.Forms.RadioButton> |
||||
<System.Windows.Forms.RadioButton> |
||||
<Name value="allRadioButton" /> |
||||
<Location value="6, 65" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.All}" /> |
||||
<Size value="154, 21" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.RadioButton> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="specificWarningsTextBox" /> |
||||
<TabIndex value="2" /> |
||||
<Location value="164, 42" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="351, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -1,61 +0,0 @@
@@ -1,61 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using StringPair = System.Collections.Generic.KeyValuePair<System.String, System.String>; |
||||
|
||||
namespace CSharpBinding.OptionPanels |
||||
{ |
||||
public class BuildOptions : AbstractBuildOptions |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlResource("CSharpBinding.BuildOptions.xfrm"); |
||||
InitializeHelper(); |
||||
|
||||
InitBaseIntermediateOutputPath(); |
||||
InitIntermediateOutputPath(); |
||||
InitOutputPath(); |
||||
InitXmlDoc(); |
||||
InitTargetFramework(); |
||||
|
||||
ConfigurationGuiBinding b; |
||||
|
||||
b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants", TextBoxEditMode.EditRawProperty); |
||||
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; |
||||
b.CreateLocationButton("conditionalSymbolsTextBox"); |
||||
|
||||
b = helper.BindBoolean("optimizeCodeCheckBox", "Optimize", false); |
||||
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; |
||||
b.CreateLocationButton("optimizeCodeCheckBox"); |
||||
|
||||
b = helper.BindBoolean("allowUnsafeCodeCheckBox", "AllowUnsafeBlocks", false); |
||||
b.CreateLocationButton("allowUnsafeCodeCheckBox"); |
||||
|
||||
b = helper.BindBoolean("checkForOverflowCheckBox", "CheckForOverflowUnderflow", false); |
||||
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; |
||||
b.CreateLocationButton("checkForOverflowCheckBox"); |
||||
|
||||
b = helper.BindBoolean("noCorlibCheckBox", "NoStdLib", false); |
||||
b.CreateLocationButton("noCorlibCheckBox"); |
||||
|
||||
InitDebugInfo(); |
||||
InitAdvanced(); |
||||
b = helper.BindStringEnum("fileAlignmentComboBox", "FileAlignment", |
||||
"4096", |
||||
new StringPair("512", "512"), |
||||
new StringPair("1024", "1024"), |
||||
new StringPair("2048", "2048"), |
||||
new StringPair("4096", "4096"), |
||||
new StringPair("8192", "8192")); |
||||
b.DefaultLocation = PropertyStorageLocations.PlatformSpecific; |
||||
b.RegisterLocationButton(advancedLocationButton); |
||||
|
||||
InitWarnings(); |
||||
|
||||
helper.AddConfigurationSelector(this); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,343 @@
@@ -0,0 +1,343 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<optionpanels:ProjectOptionPanel |
||||
x:Class="CSharpBinding.OptionPanels.BuildOptions" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:local="clr-namespace:CSharpBinding.OptionPanels" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"> |
||||
|
||||
<optionpanels:ProjectOptionPanel.Resources> |
||||
<optionpanels:StorageLocationConverter |
||||
x:Key="converter" /> |
||||
</optionpanels:ProjectOptionPanel.Resources> |
||||
|
||||
<ScrollViewer |
||||
VerticalScrollBarVisibility="Auto"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<GroupBox |
||||
Header="{core:Localize Dialog.ProjectOptions.BuildOptions.General}"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Label Grid.ColumnSpan="2" |
||||
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.ConditionalSymbols}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker |
||||
Grid.Row="1" |
||||
Location="{Binding DefineConstants.Location}" |
||||
DockPanel.Dock="Left" /> |
||||
|
||||
<!--x:Name="conditionalSymbolsTextBox"--> |
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="5,2,5,2" HorizontalAlignment="Stretch" |
||||
Text="{Binding DefineConstants.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="2" DockPanel.Dock="Left" Location="{Binding Optimize.Location}"/> |
||||
|
||||
<!--x:Name="optimizeCodeCheckBox"--> |
||||
<CheckBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" |
||||
IsChecked="{Binding Optimize.Value}" |
||||
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.OptimizeCode}"></CheckBox> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="3" DockPanel.Dock="Left" |
||||
Location="{Binding AllowUnsafeBlocks.Location}"/> |
||||
|
||||
<!--x:Name="allowUnsafeCodeCheckBox"--> |
||||
<CheckBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" |
||||
IsChecked="{Binding AllowUnsafeBlocks.Value}" |
||||
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.AllowUnsafeCode}"></CheckBox> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="4" DockPanel.Dock="Left" Location="{Binding CheckForOverflowUnderflow.Location}"/> |
||||
|
||||
<!--x:Name="checkForOverflowCheckBox"--> |
||||
<CheckBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" |
||||
IsChecked="{Binding CheckForOverflowUnderflow.Value}" |
||||
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.CheckForOverflow}"></CheckBox> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="5" DockPanel.Dock="Left" Location="{Binding NoStdLib.Location}"/> |
||||
|
||||
<!--x:Name="noCorlibCheckBox"--> |
||||
<CheckBox Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" |
||||
IsChecked="{Binding NoStdLib.Value}" |
||||
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.NoCorlib}"></CheckBox> |
||||
</Grid> |
||||
</GroupBox> |
||||
<GroupBox |
||||
Header="{core:Localize Dialog.ProjectOptions.Build.Output}"> |
||||
<Grid > |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="*"></ColumnDefinition> |
||||
<ColumnDefinition Width="50"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Label Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.Build.OutputPath}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="1" DockPanel.Dock="Left" |
||||
Location="{Binding OutputPath.Location}"/> |
||||
|
||||
<TextBox x:Name="outputPathTextBox" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" |
||||
Text="{Binding OutputPath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<Button Grid.Row="1" Grid.Column="3" Margin="3,0,3,0" |
||||
VerticalAlignment="Center" |
||||
Content="..." |
||||
Command="{Binding ChangeOutputPath}"></Button> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="2" DockPanel.Dock="Left" Location="{Binding DocumentationFile.Location}"/> |
||||
|
||||
<CheckBox x:Name="xmlDocumentationCheckBox" Grid.Row="2" Grid.Column="1" |
||||
VerticalAlignment="Center" |
||||
Margin="3,0,3,0" |
||||
IsChecked="{Binding DocumentFileIsChecked}" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.XmlDocumentationFile}"></CheckBox> |
||||
|
||||
<TextBox x:Name="xmlDocumentationTextBox" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" |
||||
IsEnabled="{Binding DocumentFileIsChecked}" |
||||
Text="{Binding DocumentationFile.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="3" DockPanel.Dock="Left" Location="{Binding DebugType.Location}" /> |
||||
|
||||
<Label Grid.Row="3" Grid.Column="1" Margin="3,0,3,0" |
||||
HorizontalAlignment="Right" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.DebugInfo}"></Label> |
||||
|
||||
<ComboBox Grid.Row="3" Grid.Column="2" Width="150" |
||||
VerticalAlignment="Center" |
||||
HorizontalAlignment="Left" |
||||
SelectedValue="{Binding Path=DebugType.Value}" |
||||
gui:EnumBinding.EnumType="{x:Type project:DebugSymbolType}"></ComboBox> |
||||
|
||||
<Label Grid.Row="4" Grid.Column="1" Margin="3,0,3,0" |
||||
HorizontalAlignment="Right" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TargetFramework}"></Label> |
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2"> |
||||
|
||||
<ComboBox x:Name="targetFrameworkComboBox" Width="200" Margin="0,0,3,0" |
||||
VerticalAlignment="Center" |
||||
IsEnabled="False"></ComboBox> |
||||
|
||||
<Button Margin="3,0,3,0" VerticalAlignment="Center" |
||||
Content="Change" |
||||
Command="{Binding UpdateProjectCommand}" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button> |
||||
</StackPanel> |
||||
|
||||
<GroupBox Grid.Row="5" Grid.ColumnSpan="4" Margin="5,10,0,0" |
||||
Header="{core:Localize Dialog.ProjectOptions.Build.Advanced}"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition MinWidth="120"></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition Width="50"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="1" VerticalAlignment="Center"> |
||||
<optionpanels:StorageLocationPicker.Location> |
||||
<MultiBinding Converter="{StaticResource converter}"> |
||||
<Binding Path="RegisterForComInterop.Location" /> |
||||
<Binding Path="GenerateSerializationAssemblies.Location" /> |
||||
<Binding Path="PlatformTarget.Location" /> |
||||
<Binding Path="FileAlignment.Location" /> |
||||
<Binding Path="BaseAddress.Location" /> |
||||
</MultiBinding> |
||||
</optionpanels:StorageLocationPicker.Location> |
||||
|
||||
</optionpanels:StorageLocationPicker> |
||||
|
||||
<!--x:Name="registerCOMInteropCheckBox"--> |
||||
<CheckBox Grid.Column="2" |
||||
IsChecked="{Binding RegisterForComInterop.Value}" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.RegisterForCOM}"></CheckBox> |
||||
|
||||
<Label Grid.Row="1" Grid.Column="1" |
||||
HorizontalAlignment="Right" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.GenerateSerializationAssembly}"></Label> |
||||
|
||||
<!--x:Name="generateSerializationAssemblyComboBox"--> |
||||
<ComboBox Grid.Row="1" Grid.Column="2" |
||||
VerticalAlignment="Center" |
||||
ItemsSource="{Binding Path=DataContext.SerializationInfo}" |
||||
SelectedValue="{Binding Path=GenerateSerializationAssemblies.Value}" |
||||
DisplayMemberPath="DisplayValue" |
||||
SelectedValuePath="Key"></ComboBox> |
||||
|
||||
<Label Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TargetCPU}"></Label> |
||||
|
||||
<!--x:Name="targetCpuComboBox"--> |
||||
<ComboBox Grid.Row="2" Grid.Column="2" VerticalAlignment="Center" |
||||
ItemsSource="{Binding Path=DataContext.TargetCPU}" |
||||
SelectedValue="{Binding Path=PlatformTarget.Value}" |
||||
DisplayMemberPath="DisplayValue" |
||||
SelectedValuePath="Key"></ComboBox> |
||||
|
||||
<Label Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.FileAlignment}"></Label> |
||||
|
||||
<!--x:Name="fileAlignmentComboBox"--> |
||||
<ComboBox Grid.Row="3" Grid.Column="2" VerticalAlignment="Center" |
||||
ItemsSource="{Binding Path=DataContext.FileAlign}" |
||||
SelectedValue="{Binding Path=FileAlignment.Value}" |
||||
DisplayMemberPath="DisplayValue" |
||||
SelectedValuePath="Key"></ComboBox> |
||||
|
||||
<Label Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.DLLBaseAddress}"></Label> |
||||
|
||||
<!-- Hex binding --> |
||||
<!--x:Name="dllBaseAddressTextBox"--> |
||||
<TextBox Grid.Row="4" Grid.Column="2"> |
||||
<TextBox.Text> |
||||
<Binding Path="BaseAddress.Value" UpdateSourceTrigger="PropertyChanged"> |
||||
<Binding.ValidationRules> |
||||
<local:HexValidator /> |
||||
</Binding.ValidationRules> |
||||
</Binding> |
||||
</TextBox.Text> |
||||
</TextBox> |
||||
|
||||
<!-- location multibinding --> |
||||
<Label Grid.Row="6" Grid.ColumnSpan="2" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.BaseIntermediateOutputPath}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="7" |
||||
Location="{Binding BaseIntermediateOutputPath.Location}" |
||||
DockPanel.Dock="Left" /> |
||||
|
||||
<TextBox x:Name="baseIntermediateOutputPathTextBox" Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" |
||||
Text="{Binding BaseIntermediateOutputPath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<Button Grid.Row="7" Grid.Column="4" Margin="3,0,3,0" |
||||
Content="..." |
||||
VerticalAlignment="Center" |
||||
Command="{Binding BaseIntermediateOutputPathCommand}"></Button> |
||||
|
||||
<Label Grid.Row="8" Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.Build.IntermediateOutputPath}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="9" DockPanel.Dock="Left" |
||||
Location="{Binding IntermediateOutputPath.Location}"/> |
||||
|
||||
<TextBox x:Name="intermediateOutputPathTextBox" Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="3" |
||||
Text="{Binding IntermediateOutputPath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<Button Grid.Row="9" Grid.Column="4" Margin="3,0,3,0" |
||||
Content="..." |
||||
VerticalAlignment="Center" |
||||
Command="{Binding IntermediateOutputPathCommand}"></Button> |
||||
</Grid> |
||||
</GroupBox> |
||||
</Grid> |
||||
</GroupBox> |
||||
|
||||
<GroupBox Margin="0,8,0,0" |
||||
Header="{core:Localize Dialog.ProjectOptions.Build.ErrorsAndWarnings}"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="*"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Label Grid.Column="1" Content="{core:Localize Dialog.ProjectOptions.Build.WarningLevel}"></Label> |
||||
|
||||
<!--x:Name="warningLevelComboBox"--> |
||||
<ComboBox Grid.Column="2" Width="40" VerticalAlignment="Center" HorizontalAlignment="Left" |
||||
ItemsSource="{Binding Path=DataContext.WarnLevel}" |
||||
SelectedValue="{Binding Path=WarningLevel.Value}" |
||||
DisplayMemberPath="DisplayValue" |
||||
SelectedValuePath="Key" |
||||
SelectedIndex="4"></ComboBox> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding NoWarn.Location}" DockPanel.Dock="Left" /> |
||||
|
||||
<Label Grid.Row="1" Grid.Column="1" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.SuppressWarnings}"></Label> |
||||
|
||||
<!--x:Name="suppressWarningsTextBox"--> |
||||
<TextBox Grid.Row="1" Grid.Column="2" |
||||
Text="{Binding NoWarn.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
</Grid> |
||||
</GroupBox> |
||||
|
||||
<GroupBox Margin="0,8,0,0" |
||||
Header="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors}"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="*"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding TreatWarningsAsErrors.Location}"> |
||||
</optionpanels:StorageLocationPicker> |
||||
|
||||
<RadioButton x:Name="noneRadioButton" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.None}"></RadioButton> |
||||
|
||||
<RadioButton x:Name="specificWarningsRadioButton" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.Specific}"></RadioButton> |
||||
|
||||
<TextBox x:Name="specificWarningsTextBox" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" |
||||
Margin="3,0,3,0" |
||||
IsEnabled="{Binding ElementName=specificWarningsRadioButton, Path=IsChecked}" |
||||
Text="{Binding WarningsAsErrors.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<RadioButton x:Name="allRadioButton" Grid.Row="2" Grid.Column="1" |
||||
Margin="3,0,3,0" |
||||
VerticalAlignment="Center" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.All}"></RadioButton> |
||||
</Grid> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</ScrollViewer> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,406 @@
@@ -0,0 +1,406 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 05/02/2012 |
||||
* Time: 19:54 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
|
||||
using Gui.Dialogs.OptionPanels.ProjectOptions; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Project.Converter; |
||||
using ICSharpCode.SharpDevelop.Widgets; |
||||
|
||||
namespace CSharpBinding.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for BuildOptionsXaml.xaml
|
||||
/// </summary>
|
||||
/// SYST
|
||||
|
||||
public partial class BuildOptions : ProjectOptionPanel |
||||
{ |
||||
|
||||
private List<KeyItemPair> serializationInfo; |
||||
private List<KeyItemPair> targetCPU; |
||||
private List<KeyItemPair> fileAlignment; |
||||
private List<KeyItemPair> warnLevel; |
||||
|
||||
private System.Windows.Input.ICommand updateProjectCommand; |
||||
private System.Windows.Input.ICommand changeOutputPath; |
||||
private System.Windows.Input.ICommand baseIntermediateOutputPathCommand; |
||||
private System.Windows.Input.ICommand intermediateOutputPathCommand; |
||||
|
||||
private MSBuildBasedProject project; |
||||
|
||||
public BuildOptions() |
||||
{ |
||||
InitializeComponent(); |
||||
this.serializationInfo = new List<KeyItemPair>(); |
||||
|
||||
this.serializationInfo.Add (new KeyItemPair("Off",StringParser.Parse("${res:Dialog.ProjectOptions.Build.Off}"))); |
||||
this.serializationInfo.Add (new KeyItemPair("On",StringParser.Parse("${res:Dialog.ProjectOptions.Build.On}"))); |
||||
this.serializationInfo.Add (new KeyItemPair("Auto",StringParser.Parse( "${res:Dialog.ProjectOptions.Build.Auto}"))); |
||||
this.SerializationInfo = this.serializationInfo; |
||||
|
||||
this.targetCPU = new List<KeyItemPair>(); |
||||
this.targetCPU.Add(new KeyItemPair( "AnyCPU",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any}"))); |
||||
this.targetCPU.Add(new KeyItemPair( "x86",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x86}"))); |
||||
this.targetCPU.Add(new KeyItemPair( "x64",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}"))); |
||||
this.targetCPU.Add(new KeyItemPair( "Itanium",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}"))); |
||||
this.TargetCPU = targetCPU; |
||||
|
||||
|
||||
fileAlignment = new List<KeyItemPair>(); |
||||
fileAlignment.Add( new KeyItemPair("512", "512")); |
||||
fileAlignment.Add( new KeyItemPair("1024", "1024")); |
||||
fileAlignment.Add(new KeyItemPair("2048", "2048")); |
||||
fileAlignment.Add(new KeyItemPair("4096", "4096")); |
||||
fileAlignment.Add(new KeyItemPair("8192", "8192")); |
||||
FileAlign = fileAlignment; |
||||
|
||||
this.warnLevel = new List<KeyItemPair>(); |
||||
this.warnLevel.Add(new KeyItemPair("0","0")); |
||||
this.warnLevel.Add(new KeyItemPair("1","1")); |
||||
this.warnLevel.Add(new KeyItemPair("2","2")); |
||||
this.warnLevel.Add(new KeyItemPair("3","3")); |
||||
this.warnLevel.Add(new KeyItemPair("4","4")); |
||||
this.WarnLevel = warnLevel; |
||||
} |
||||
|
||||
private void Initialize() |
||||
{ |
||||
this.UpdateProjectCommand = new RelayCommand(UpdateProjectExecute); |
||||
this.ChangeOutputPath = new RelayCommand(ChangeOutputPathExecute); |
||||
UpdateTargetFrameworkCombo(); |
||||
if (DocumentationFile.Value.Length > 0) { |
||||
documentFileIsChecked = true; |
||||
} |
||||
XmlDocHelper(); |
||||
this.BaseIntermediateOutputPathCommand = new RelayCommand(BaseIntermediateOutputPathExecute); |
||||
this.IntermediateOutputPathCommand = new RelayCommand(IntermediateOutputPathExecute); |
||||
SetTreatWarningAsErrorRadioButtons(); |
||||
} |
||||
|
||||
#region properties
|
||||
|
||||
public ProjectProperty<string> DefineConstants { |
||||
get {return GetProperty("DefineConstants", "", |
||||
TextBoxEditMode.EditRawProperty,PropertyStorageLocations.ConfigurationSpecific); } |
||||
} |
||||
|
||||
public ProjectProperty<bool> Optimize { |
||||
get { return GetProperty("Optimize", false, PropertyStorageLocations.ConfigurationSpecific); } |
||||
} |
||||
|
||||
public ProjectProperty<bool> AllowUnsafeBlocks { |
||||
get { return GetProperty("AllowUnsafeBlocks", false); } |
||||
} |
||||
|
||||
public ProjectProperty<bool> CheckForOverflowUnderflow { |
||||
get { return GetProperty("CheckForOverflowUnderflow", false, PropertyStorageLocations.ConfigurationSpecific); } |
||||
} |
||||
|
||||
public ProjectProperty<bool> NoStdLib { |
||||
get { return GetProperty("NoStdLib", false); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> OutputPath { |
||||
get {return GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); } |
||||
} |
||||
|
||||
public ProjectProperty<string> DocumentationFile { |
||||
get {return GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);} |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<DebugSymbolType> DebugType { |
||||
get {return GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); } |
||||
} |
||||
|
||||
// used in multibinding
|
||||
public ProjectProperty<bool> RegisterForComInterop { |
||||
get {return GetProperty("RegisterForComInterop", false, PropertyStorageLocations.PlatformSpecific ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> GenerateSerializationAssemblies { |
||||
get {return GetProperty("GenerateSerializationAssemblies","Auto", |
||||
TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } |
||||
} |
||||
|
||||
public ProjectProperty<string> PlatformTarget { |
||||
get {return GetProperty("PlatformTarget","AnyCPU", |
||||
TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } |
||||
} |
||||
|
||||
public ProjectProperty<string> FileAlignment { |
||||
get {return GetProperty("FileAlignment","4096", |
||||
TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } |
||||
} |
||||
|
||||
public ProjectProperty<string> BaseAddress { |
||||
get {return GetProperty("BaseAddress","0x400000", |
||||
TextBoxEditMode.EditEvaluatedProperty,PropertyStorageLocations.PlatformSpecific ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> BaseIntermediateOutputPath { |
||||
get {return GetProperty("BaseIntermediateOutputPath",@"obj\", |
||||
TextBoxEditMode.EditRawProperty,PropertyStorageLocations.ConfigurationSpecific ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> IntermediateOutputPath { |
||||
get {return GetProperty("IntermediateOutputPath",@"obj\$(Configuration)\",TextBoxEditMode.EditRawProperty ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> WarningLevel { |
||||
get {return GetProperty("WarningLevel","4",TextBoxEditMode.EditEvaluatedProperty ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> NoWarn { |
||||
get {return GetProperty("NoWarn","",TextBoxEditMode.EditRawProperty ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<string> WarningsAsErrors { |
||||
get {return GetProperty("WarningsAsErrors","",TextBoxEditMode.EditRawProperty ); } |
||||
} |
||||
|
||||
|
||||
public ProjectProperty<bool> TreatWarningsAsErrors { |
||||
get {return GetProperty("TreatWarningsAsErrors", false); } |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
protected override void Load(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
base.Load(project, configuration, platform); |
||||
this.project = project; |
||||
this.Initialize(); |
||||
} |
||||
|
||||
|
||||
protected override bool Save(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
SaveTreatWarningAsErrorRadioButtons(); |
||||
|
||||
return base.Save(project, configuration, platform); |
||||
} |
||||
#endregion
|
||||
|
||||
#region Documentation File
|
||||
|
||||
private bool documentFileIsChecked; |
||||
|
||||
public bool DocumentFileIsChecked { |
||||
get { return documentFileIsChecked; } |
||||
set { documentFileIsChecked = value; |
||||
XmlDocHelper(); |
||||
base.RaisePropertyChanged(() => DocumentFileIsChecked); |
||||
} |
||||
} |
||||
|
||||
private void XmlDocHelper() |
||||
{ |
||||
if (DocumentFileIsChecked) { |
||||
this.xmlDocumentationTextBox.Text = MSBuildInternals.Escape( |
||||
Path.ChangeExtension(ICSharpCode.Core.FileUtility.GetRelativePath(project.Directory, project.OutputAssemblyFullPath), |
||||
".xml")); |
||||
} else { |
||||
this.xmlDocumentationTextBox.Text = string.Empty; |
||||
} |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Command Update Project
|
||||
|
||||
public System.Windows.Input.ICommand UpdateProjectCommand { |
||||
get { return updateProjectCommand; } |
||||
set { updateProjectCommand = value; |
||||
base.RaisePropertyChanged(() =>this.UpdateProjectCommand); |
||||
} |
||||
} |
||||
|
||||
|
||||
private void UpdateProjectExecute () |
||||
{ |
||||
UpgradeViewContent.Show(project.ParentSolution).Select(project as IUpgradableProject); |
||||
this.UpdateTargetFrameworkCombo(); |
||||
} |
||||
|
||||
private void UpdateTargetFrameworkCombo() |
||||
{ |
||||
TargetFramework fx = ((IUpgradableProject)project).CurrentTargetFramework; |
||||
if (fx != null) { |
||||
targetFrameworkComboBox.Items.Add(fx.DisplayName); |
||||
targetFrameworkComboBox.SelectedIndex = 0; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ChangeOutputPathCommand
|
||||
|
||||
public System.Windows.Input.ICommand ChangeOutputPath |
||||
{ |
||||
get {return this.changeOutputPath;} |
||||
set {this.changeOutputPath = value; |
||||
base.RaisePropertyChanged(() => this.ChangeOutputPath); |
||||
} |
||||
} |
||||
private void ChangeOutputPathExecute() |
||||
{ |
||||
OutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", |
||||
base.BaseDirectory,base.BaseDirectory, |
||||
outputPathTextBox.Text,TextBoxEditMode.EditRawProperty); |
||||
base.RaisePropertyChanged(()=> OutputPath); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region SerializationInfo
|
||||
|
||||
public List<KeyItemPair> SerializationInfo { |
||||
get {return this.serializationInfo;} |
||||
set {this.serializationInfo = value; |
||||
base.RaisePropertyChanged(() => SerializationInfo); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region TargetCPU
|
||||
|
||||
public List<KeyItemPair> TargetCPU { |
||||
get { return targetCPU; } |
||||
set { targetCPU = value; |
||||
base.RaisePropertyChanged(() => TargetCPU); |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
#region FileAlignment
|
||||
|
||||
public List<KeyItemPair> FileAlign { |
||||
get { return fileAlignment; } |
||||
set { fileAlignment = value; |
||||
base.RaisePropertyChanged(() => FileAlign); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region BaseIntermediateOutputPath
|
||||
|
||||
public System.Windows.Input.ICommand BaseIntermediateOutputPathCommand { |
||||
get{return this.baseIntermediateOutputPathCommand;} |
||||
set {this.baseIntermediateOutputPathCommand = value; |
||||
base.RaisePropertyChanged(() => BaseIntermediateOutputPathCommand);} |
||||
} |
||||
|
||||
|
||||
private void BaseIntermediateOutputPathExecute () |
||||
{ |
||||
BaseIntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", |
||||
base.BaseDirectory,base.BaseDirectory, |
||||
this.baseIntermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty); |
||||
base.RaisePropertyChanged(()=> BaseIntermediateOutputPath); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region IntermediateOutputPath
|
||||
|
||||
public System.Windows.Input.ICommand IntermediateOutputPathCommand { |
||||
get{return this.intermediateOutputPathCommand;} |
||||
set {this.intermediateOutputPathCommand = value; |
||||
base.RaisePropertyChanged(() => IntermediateOutputPathCommand);} |
||||
} |
||||
|
||||
|
||||
private void IntermediateOutputPathExecute () |
||||
{ |
||||
IntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", |
||||
base.BaseDirectory,base.BaseDirectory, |
||||
this.intermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty); |
||||
base.RaisePropertyChanged(()=> IntermediateOutputPath); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region WarningLevel
|
||||
|
||||
public List<KeyItemPair> WarnLevel { |
||||
get { return warnLevel; } |
||||
set { warnLevel = value; |
||||
base.RaisePropertyChanged(() => WarnLevel); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region SpecificWarnings TreatWarningsAsErrors
|
||||
|
||||
private void SetTreatWarningAsErrorRadioButtons() |
||||
{ |
||||
if (this.TreatWarningsAsErrors.Value) { |
||||
this.allRadioButton.IsChecked = true; |
||||
} else { |
||||
if (WarningsAsErrors.Value.Length > 0) { |
||||
this.specificWarningsRadioButton.IsChecked = true; |
||||
} else { |
||||
this.noneRadioButton.IsChecked = true; |
||||
} |
||||
} |
||||
this.noneRadioButton.Checked += ErrorButton_Checked; |
||||
this.allRadioButton.Checked += ErrorButton_Checked; |
||||
this.specificWarningsRadioButton.Checked += ErrorButton_Checked; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
private void SaveTreatWarningAsErrorRadioButtons() |
||||
{ |
||||
|
||||
if ((bool)this.noneRadioButton.IsChecked){ |
||||
this.specificWarningsTextBox.Text = string.Empty; |
||||
} |
||||
|
||||
if ((bool)this.allRadioButton.IsChecked) { |
||||
this.TreatWarningsAsErrors.Value = true; |
||||
} else { |
||||
this.TreatWarningsAsErrors.Value = false; |
||||
} |
||||
this.noneRadioButton.Checked -= ErrorButton_Checked; |
||||
this.allRadioButton.Checked -= ErrorButton_Checked; |
||||
this.specificWarningsRadioButton.Checked -= ErrorButton_Checked; |
||||
} |
||||
|
||||
void ErrorButton_Checked(object sender, System.Windows.RoutedEventArgs e) |
||||
{ |
||||
IsDirty = true; |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 22.05.2012 |
||||
* Time: 20:46 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Globalization; |
||||
using System.Windows.Controls; |
||||
|
||||
namespace CSharpBinding.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Description of HexValidator.
|
||||
/// </summary>
|
||||
public class HexValidator :ValidationRule |
||||
{ |
||||
// http://www.codeproject.com/Articles/15239/Validation-in-Windows-Presentation-Foundation
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo) |
||||
{ |
||||
ValidationResult result = new ValidationResult(true, null); |
||||
var str = value.ToString(); |
||||
var y = 0; |
||||
var res = Int32.TryParse(str,NumberStyles.HexNumber,CultureInfo.InvariantCulture,out y); |
||||
if (!res) { |
||||
result = new ValidationResult(false, "No valid Hex Digit"); |
||||
} |
||||
return result; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,134 @@
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<optionpanels:ProjectOptionPanel |
||||
x:Class="ICSharpCode.CppBinding.Project.ApplicationOptions" |
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"> |
||||
<Grid > |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="100"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="150"></ColumnDefinition> |
||||
<ColumnDefinition ></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Label Grid.ColumnSpan="2" |
||||
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.AssemblyName}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding AssemblyName.Location}" DockPanel.Dock="Left" /> |
||||
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,0,5,0" |
||||
x:Name="assemblyNameTextBox" |
||||
TextChanged="RefreshOutputNameTextBox" |
||||
Text="{Binding AssemblyName.Value, UpdateSourceTrigger=PropertyChanged}" |
||||
></TextBox> |
||||
|
||||
|
||||
<Label Grid.Row="2" Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.RootNamespace}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="3" Location="{Binding RootNamespace.Location}" DockPanel.Dock="Left" /> |
||||
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Margin="0,0,5,0" |
||||
x:Name="rootNamespaceTextBox" Text="{Binding RootNamespace.Value,UpdateSourceTrigger=PropertyChanged}" |
||||
></TextBox> |
||||
|
||||
|
||||
<Label Grid.Row="4" Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.OutputType}"></Label> |
||||
|
||||
<Label Grid.Row="4" Grid.Column="2" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.StartupObject}"></Label> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="5" Location="{Binding OutputType.Location}" DockPanel.Dock="Left" /> |
||||
|
||||
<ComboBox x:Name="outputTypeComboBox" Grid.Row="5" Grid.Column="1" Margin="5,0,5,0" |
||||
VerticalAlignment="Center" |
||||
gui:EnumBinding.EnumType="{x:Type project:OutputType}"> |
||||
</ComboBox> |
||||
|
||||
<ComboBox x:Name="startupObjectComboBox" VerticalAlignment="Center" Margin="5,0,5,0" |
||||
Grid.Row="5" Grid.Column="2" IsEnabled="False"></ComboBox> |
||||
|
||||
<Image x:Name="applicationIconImage" Width="32" Height="32" Grid.Row="6" ></Image> |
||||
|
||||
<Label Grid.Row="6" Grid.Column="1" |
||||
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ApplicationIcon}"></Label> |
||||
|
||||
|
||||
<Grid Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="2"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition ></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<optionpanels:StorageLocationPicker Location="{Binding ApplicationIcon.Location}" DockPanel.Dock="Left" /> |
||||
|
||||
<TextBox x:Name="applicationIconTextBox" Grid.Column="1" VerticalAlignment="Center" |
||||
TextChanged="ApplicationIconTextBox_TextChanged" |
||||
Text="{Binding ApplicationIcon.Value,UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<Button Grid.Column="2" VerticalAlignment="Center" Padding="9,1" Margin="0,0,5,0" |
||||
Content="..." Click="ApplicationIconButton_Click"></Button> |
||||
|
||||
</Grid> |
||||
|
||||
<Label Grid.Row="7" Grid.Column="1" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.Manifest}"></Label> |
||||
|
||||
<widgets:StackPanelWithSpacing SpaceBetweenItems="3" Grid.Row="7" Grid.Column="2" Orientation="Horizontal"> |
||||
|
||||
<optionpanels:StorageLocationPicker Location="{Binding PreBuildEvent.Location}" DockPanel.Dock="Left" /> |
||||
|
||||
<ComboBox x:Name="applicationManifestComboBox" VerticalAlignment="Center" Width="200" |
||||
SelectionChanged="ApplicationManifestComboBox_SelectionChanged" ></ComboBox> |
||||
</widgets:StackPanelWithSpacing> |
||||
|
||||
<GroupBox Grid.Row="9" Grid.ColumnSpan="3" Margin="0,5,0,0" |
||||
Header="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ProjectInformation}"> |
||||
<Grid Margin="15,0,0,0" > |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="100"></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Label Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ProjectFolder}"></Label> |
||||
|
||||
<TextBox x:Name="projectFolderTextBox" Grid.Column="1" VerticalAlignment="Center"></TextBox> |
||||
|
||||
<Label Grid.Row="1" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ProjectFile}"></Label> |
||||
|
||||
<TextBox x:Name="projectFileTextBox" VerticalAlignment="Center" |
||||
Grid.Row="1" Grid.Column="1"></TextBox> |
||||
|
||||
<Label Grid.Row="2" VerticalAlignment="Center" |
||||
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.OutputName}"></Label> |
||||
|
||||
<TextBox x:Name="outputNameTextBox" VerticalAlignment="Center" |
||||
Grid.Row="2" Grid.Column="1"></TextBox> |
||||
</Grid> |
||||
</GroupBox> |
||||
</Grid> |
||||
</ScrollViewer> |
||||
</optionpanels:ProjectOptionPanel> |
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
/* |
||||
* Utworzone przez SharpDevelop. |
||||
* Użytkownik: trecio |
||||
* Data: 2009-07-14 |
||||
* Godzina: 14:34 |
||||
* |
||||
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych. |
||||
*/ |
||||
using System; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
/* |
||||
/// <summary>
|
||||
/// Description of BuildEventOptions.
|
||||
/// </summary>
|
||||
public class BuildEventOptions : ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
base.LoadPanelContents(); |
||||
|
||||
TextBox preBuildEventTextBox = Get<TextBox>("preBuildEvent"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(preBuildEventTextBox, "PreBuildEvent", "Command")); |
||||
|
||||
TextBox postBuildEventTextBox = Get<TextBox>("postBuildEvent"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(postBuildEventTextBox, "PostBuildEvent", "Command")); |
||||
|
||||
ComboBox runPostBuildEventComboBox = Get<ComboBox>("runPostBuildEvent"); |
||||
runPostBuildEventComboBox.Enabled = false; |
||||
} |
||||
}*/ |
||||
} |
@ -1,102 +0,0 @@
@@ -1,102 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
/* |
||||
* Utworzone przez SharpDevelop. |
||||
* Użytkownik: trecio |
||||
* Data: 2009-07-09 |
||||
* Godzina: 11:15 |
||||
* |
||||
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
|
||||
/// <summary>
|
||||
/// Configuration gui binding that connects a given control and a specified metadata value in Item Definition Group element.
|
||||
///</summary>
|
||||
public class ItemDefinitionGroupBinding<ControlType> : ConfigurationGuiBinding |
||||
where ControlType : Control |
||||
{ |
||||
public delegate string GetValueDelegate(ControlType c); |
||||
public delegate void SetValueDelegate(ControlType c, string val); |
||||
|
||||
public ItemDefinitionGroupBinding(ControlType c, string elementName, string metadataName) : |
||||
this(c, elementName, metadataName, null, null) |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates the binding.
|
||||
/// </summary>
|
||||
/// <param name="c">control which is being bind</param>
|
||||
/// <param name="elementName">element name in the item definition group</param>
|
||||
/// <param name="metadataName">name of the element metadata which value is bind to control</param>
|
||||
/// <param name="getValue">function used to get string value of configuration attribute from control</param>
|
||||
/// <param name="setValue">function used to set controls' state from string</param>
|
||||
public ItemDefinitionGroupBinding(ControlType c, string elementName, string metadataName, |
||||
GetValueDelegate getValue, SetValueDelegate setValue) { |
||||
if (getValue == null) |
||||
getValue = DefaultGetValue; |
||||
if (setValue == null) |
||||
setValue = DefaultSetValue; |
||||
this.control = c; |
||||
this.elementName = elementName; |
||||
this.metadataName = metadataName; |
||||
this.getControlValue = getValue; |
||||
this.setControlValue = setValue; |
||||
c.TextChanged += SetHelperDirty; |
||||
} |
||||
|
||||
public override void Load() |
||||
{ |
||||
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(Project, |
||||
Helper.Configuration, Helper.Platform); |
||||
setControlValue(control, group.GetElementMetadata(elementName, metadataName)); |
||||
} |
||||
|
||||
public override bool Save() |
||||
{ |
||||
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(Project, |
||||
Helper.Configuration, Helper.Platform); |
||||
string controlValue = getControlValue(control); |
||||
group.SetElementMetadata(elementName, metadataName, controlValue); |
||||
return true; |
||||
} |
||||
|
||||
protected void SetHelperDirty(object o, EventArgs e) |
||||
{ |
||||
Helper.IsDirty = true; |
||||
} |
||||
|
||||
ControlType control; |
||||
string elementName; |
||||
string metadataName; |
||||
GetValueDelegate getControlValue; |
||||
SetValueDelegate setControlValue; |
||||
|
||||
private string DefaultGetValue(ControlType c) { return c.Text; } |
||||
private void DefaultSetValue(ControlType c, string val) { c.Text = val; } |
||||
} |
||||
|
||||
public class CheckBoxItemDefinitionGroupBinding : ItemDefinitionGroupBinding<CheckBox> { |
||||
public CheckBoxItemDefinitionGroupBinding(CheckBox c, string elementName, string metadataName) : |
||||
base(c, elementName, metadataName, |
||||
delegate (CheckBox checkBox) { |
||||
return checkBox.Checked ? "true" : "false"; |
||||
}, |
||||
delegate (CheckBox checkBox, string val) { |
||||
bool check; |
||||
if (bool.TryParse(val, out check)) |
||||
checkBox.Checked = check; |
||||
}) |
||||
{ |
||||
c.TextChanged -= SetHelperDirty; |
||||
c.CheckedChanged += SetHelperDirty; |
||||
} |
||||
} |
||||
} |
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
/* |
||||
* Utworzone przez SharpDevelop. |
||||
* Użytkownik: trecio |
||||
* Data: 2009-07-08 |
||||
* Godzina: 12:07 |
||||
* |
||||
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych. |
||||
*/ |
||||
using ICSharpCode.Core; |
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
using ListEditor = ICSharpCode.CppBinding.Project.OpenStringListEditorEvent<TextBox>; |
||||
|
||||
/// <summary>
|
||||
/// Directory settings for c++ application.
|
||||
/// </summary>
|
||||
public class LinkerOptions : AbstractXmlFormsProjectOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream( |
||||
"ICSharpCode.CppBinding.Resources.LinkerOptions.xfrm")); |
||||
|
||||
InitializeHelper(); |
||||
|
||||
helper.BindString("libraryPathTextBox", "LibraryPath", TextBoxEditMode.EditRawProperty); |
||||
Get<Button>("libraryPath").Click += ListEditor.DirectoriesEditor(this, "libraryPath").Event; |
||||
|
||||
TextBox additionalLibsTextBox = Get<TextBox>("additionalLibs"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(additionalLibsTextBox, "Link", "AdditionalDependencies")); |
||||
Get<Button>("additionalLibs").Click += ListEditor.SymbolsEditor(this, "additionalLibs").Event; |
||||
|
||||
TextBox addModuleTextBox = Get<TextBox>("addModule"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(addModuleTextBox, "Link", "AddModuleNamesToAssembly")); |
||||
Get<Button>("addModule").Click += ListEditor.SymbolsEditor(this, "addModule").Event; |
||||
|
||||
CheckBox debugInfoCheckBox = Get<CheckBox>("debugInfo"); |
||||
helper.AddBinding(null, new CheckBoxItemDefinitionGroupBinding(debugInfoCheckBox, "Link", "GenerateDebugInformation")); |
||||
|
||||
TextBox resourceFileTextBox = Get<TextBox>("resourceFile"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(resourceFileTextBox, "Link", "EmbedManagedResourceFile")); |
||||
Get<Button>("resourceFile").Click += ListEditor.SymbolsEditor(this, "resourceFile").Event; |
||||
|
||||
TextBox additionalOptionsTextBox = Get<TextBox>("additionalOptions"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(additionalOptionsTextBox, "Link", "AdditionalOptions")); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CppBinding.Project.LinkerOptions" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"> |
||||
<GroupBox Header="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker}"> |
||||
<Grid > |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox x:Name="debugInfoCheckBox" VerticalAlignment="Center" |
||||
IsChecked="{Binding CheckBoxChecked}" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.GenerateDebugInfo}"> |
||||
</CheckBox> |
||||
|
||||
<Label Grid.Row="1" VerticalAlignment="Center" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.Library}"></Label> |
||||
|
||||
<TextBox x:Name="libraryPathTextBox" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="2" Margin="0,0,3,0" |
||||
Text="{Binding LibraryPath.Value, UpdateSourceTrigger=PropertyChanged}"> |
||||
</TextBox> |
||||
|
||||
<!--x:Name="libraryPathButton"--> |
||||
<Button VerticalAlignment="Center" Grid.Row="2" Padding="9,1" |
||||
Click="LibraryPathButton_Click" |
||||
Grid.Column="1" Content="..."></Button> |
||||
|
||||
<Label Grid.Row="3" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}"></Label> |
||||
|
||||
<TextBox x:Name="additionalLibsTextBox" VerticalAlignment="Center" Margin="0,0,5,0" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="4"> |
||||
</TextBox> |
||||
|
||||
|
||||
<Button Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Padding="9,1" |
||||
Click="AdditionalLibsButton_Click" Content="..." ></Button> |
||||
|
||||
<Label Grid.Row="5" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"></Label> |
||||
|
||||
<TextBox x:Name="addModuleTextBox" VerticalAlignment="Center" Margin="0,0,5,0" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="6"> |
||||
</TextBox> |
||||
|
||||
<Button Grid.Column="1" Grid.Row="6" VerticalAlignment="Center" Padding="9,1" |
||||
Content="..." |
||||
Click="AddModuleButton_Click" ></Button> |
||||
|
||||
<Label Grid.Row="7" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}" ></Label> |
||||
|
||||
<TextBox x:Name="resourceFileTextBox" VerticalAlignment="Center" Margin="0,0,5,0" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="8"></TextBox> |
||||
|
||||
<!--x:Name="resourceFileButton"--> |
||||
<Button Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" Padding="9,1" |
||||
Click="ResourceFileButton_Click" Content="...."></Button> |
||||
|
||||
<Label Grid.Row="9" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.AdditionalOptions}"></Label> |
||||
|
||||
<TextBox x:Name="additionalOptionsTextBox" VerticalAlignment="Center" Margin="0,0,5,0" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="10" Grid.ColumnSpan="2"> |
||||
</TextBox> |
||||
|
||||
</Grid> |
||||
</GroupBox> |
||||
</ScrollViewer> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,188 @@
@@ -0,0 +1,188 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.04.2012 |
||||
* Time: 20:14 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for LinkerOptionsXaml.xaml
|
||||
/// </summary>
|
||||
public partial class LinkerOptions : ProjectOptionPanel |
||||
{ |
||||
private const string metaElement ="Link"; |
||||
private MSBuildBasedProject project; |
||||
|
||||
public LinkerOptions() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
|
||||
private void Initialize() |
||||
{ |
||||
var msDefGroup = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform); |
||||
|
||||
this.additionalLibsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalDependencies"); |
||||
|
||||
this.addModuleTextBox.Text = GetElementMetaData(msDefGroup,"AddModuleNamesToAssembly"); |
||||
|
||||
this.resourceFileTextBox.Text = GetElementMetaData(msDefGroup,"EmbedManagedResourceFile"); |
||||
|
||||
this.additionalOptionsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalOptions"); |
||||
|
||||
string def = GetElementMetaData(msDefGroup,"GenerateDebugInformation"); |
||||
|
||||
bool check; |
||||
if (bool.TryParse(def, out check)) |
||||
{ |
||||
this.CheckBoxChecked = check; |
||||
this.debugInfoCheckBox.IsChecked = check; |
||||
} |
||||
|
||||
IsDirty = false; |
||||
} |
||||
|
||||
#region Properties
|
||||
|
||||
public ProjectProperty<string> LibraryPath { |
||||
get { return GetProperty("LibraryPath", "", TextBoxEditMode.EditRawProperty); } |
||||
} |
||||
|
||||
|
||||
private bool checkBoxChecked; |
||||
|
||||
public bool CheckBoxChecked { |
||||
get {return checkBoxChecked;} |
||||
set |
||||
{ |
||||
checkBoxChecked = value; |
||||
IsDirty = true; |
||||
base.RaisePropertyChanged(() => CheckBoxChecked); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Save/Load
|
||||
|
||||
public override void OnApplyTemplate() |
||||
{ |
||||
base.OnApplyTemplate(); |
||||
HideHeader(); |
||||
} |
||||
|
||||
protected override void Load(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
base.Load(project, configuration, platform); |
||||
this.project = project; |
||||
Initialize(); |
||||
} |
||||
|
||||
protected override bool Save(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, |
||||
project.ActiveConfiguration, project.ActivePlatform); |
||||
|
||||
SetElementMetaData(group,"AdditionalDependencies",this.additionalLibsTextBox.Text); |
||||
SetElementMetaData(group,"AddModuleNamesToAssembly",this.addModuleTextBox.Text); |
||||
SetElementMetaData(group,"EmbedManagedResourceFile",this.resourceFileTextBox.Text); |
||||
SetElementMetaData(group,"AdditionalOptions",this.additionalOptionsTextBox.Text); |
||||
|
||||
string check = "false"; |
||||
if ((bool)this.debugInfoCheckBox.IsChecked) { |
||||
check = "true"; |
||||
} |
||||
|
||||
SetElementMetaData(group,"GenerateDebugInformation",check); |
||||
|
||||
return base.Save(project, configuration, platform); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region MSBuildItemDefinitionGroup Set-Get
|
||||
|
||||
private static string GetElementMetaData (MSBuildItemDefinitionGroup group,string name) |
||||
{ |
||||
return group.GetElementMetadata(metaElement,name); |
||||
} |
||||
|
||||
|
||||
private static void SetElementMetaData (MSBuildItemDefinitionGroup group,string name,string value) |
||||
{ |
||||
group.SetElementMetadata(metaElement,name,value); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
private void LibraryPathButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
PopulateStringListEditor(StringParser.Parse("${res:Global.Folder}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.Library}:"), |
||||
this.libraryPathTextBox, |
||||
true); |
||||
} |
||||
|
||||
|
||||
private void AdditionalLibsButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}:"), |
||||
this.additionalLibsTextBox, |
||||
false); |
||||
} |
||||
|
||||
|
||||
private void AddModuleButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"), |
||||
this.addModuleTextBox, |
||||
false); |
||||
} |
||||
|
||||
|
||||
private void ResourceFileButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}"), |
||||
this.resourceFileTextBox, |
||||
false); |
||||
} |
||||
|
||||
|
||||
public static void PopulateStringListEditor(string title, string listCaption,TextBox textBox,bool browseForDirectoty) |
||||
{ |
||||
var stringListDialog = new StringListEditorDialog(); |
||||
stringListDialog.TitleText = title; |
||||
stringListDialog.ListCaption = listCaption; |
||||
stringListDialog.BrowseForDirectory = browseForDirectoty; |
||||
string[] strings = textBox.Text.Split(';'); |
||||
stringListDialog.LoadList (strings); |
||||
stringListDialog.ShowDialog(); |
||||
if (stringListDialog.DialogResult ?? false) { |
||||
textBox.Text = String.Join(";",stringListDialog.GetList()); |
||||
} |
||||
} |
||||
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) |
||||
{ |
||||
IsDirty = true; |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,48 +0,0 @@
@@ -1,48 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
public class ObservedBinding<Output, ControlType> : ConfigurationGuiBinding |
||||
where ControlType : Control |
||||
{ |
||||
public delegate Output ObserverDelegate(ControlType c); |
||||
public delegate void LoaderDelegate(ControlType c); |
||||
|
||||
public ObservedBinding(ControlType control, ObserverDelegate saveDelegate) : this(control, saveDelegate, null) |
||||
{ |
||||
} |
||||
|
||||
public ObservedBinding(ControlType control, ObserverDelegate saveDelegate, LoaderDelegate loadDelegate) { |
||||
this.control = control; |
||||
this.onLoad = loadDelegate; |
||||
this.onSave = saveDelegate; |
||||
} |
||||
|
||||
public override void Load() { |
||||
if (onLoad != null) |
||||
onLoad(control); |
||||
} |
||||
|
||||
public override bool Save() |
||||
{ |
||||
if (onSave != null) |
||||
if (Property != null) |
||||
base.Set<Output>(onSave(control)); |
||||
else |
||||
onSave(control); |
||||
return true; |
||||
} |
||||
|
||||
private ControlType control; |
||||
private LoaderDelegate onLoad; |
||||
private ObserverDelegate onSave; |
||||
} |
||||
} |
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
/* |
||||
* Utworzone przez SharpDevelop. |
||||
* Użytkownik: trecio |
||||
* Data: 2009-07-09 |
||||
* Godzina: 10:46 |
||||
* |
||||
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych. |
||||
*/ |
||||
using ICSharpCode.Core; |
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
sealed class OpenStringListEditorEvent<ControlType> where ControlType : Control { |
||||
public OpenStringListEditorEvent(XmlUserControl parent, string controlId) { |
||||
this.sourceControl = parent.Get<ControlType>(controlId); |
||||
this.listCaption = parent.Get<Label>(controlId).Text; |
||||
this.ShowBrowseButton = false; |
||||
} |
||||
|
||||
public bool ShowBrowseButton { get; set; } |
||||
public string TitleText { get; set; } |
||||
|
||||
public void Event(object source, EventArgs evt) { |
||||
using (StringListEditorDialog editor = new StringListEditorDialog()) { |
||||
string[] strings = sourceControl.Text.Split(';'); |
||||
editor.BrowseForDirectory = ShowBrowseButton; |
||||
editor.ListCaption = listCaption; |
||||
if (TitleText != null) |
||||
editor.TitleText = TitleText; |
||||
editor.LoadList(strings); |
||||
|
||||
if (editor.ShowDialog() == DialogResult.OK) { |
||||
strings = editor.GetList(); |
||||
sourceControl.Text = string.Join(";", strings); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static OpenStringListEditorEvent<ControlType> DirectoriesEditor(XmlUserControl parent, string controlId) |
||||
{ |
||||
OpenStringListEditorEvent<ControlType> editor = new OpenStringListEditorEvent<ControlType>(parent, controlId); |
||||
editor.ShowBrowseButton = true; |
||||
editor.TitleText = StringParser.Parse("${res:Global.Folder}:"); |
||||
return editor; |
||||
} |
||||
|
||||
public static OpenStringListEditorEvent<ControlType> SymbolsEditor(XmlUserControl parent, string controlId) |
||||
{ |
||||
OpenStringListEditorEvent<ControlType> editor = new OpenStringListEditorEvent<ControlType>(parent, controlId); |
||||
editor.ShowBrowseButton = false; |
||||
editor.TitleText = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"); |
||||
return editor; |
||||
} |
||||
|
||||
string listCaption; |
||||
ControlType sourceControl; |
||||
} |
||||
} |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
/* |
||||
* Utworzone przez SharpDevelop. |
||||
* Użytkownik: trecio |
||||
* Data: 2009-07-08 |
||||
* Godzina: 12:07 |
||||
* |
||||
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych. |
||||
*/ |
||||
using ICSharpCode.Core; |
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
using ListEditor = ICSharpCode.CppBinding.Project.OpenStringListEditorEvent<TextBox>; |
||||
|
||||
/// <summary>
|
||||
/// Directory settings for c++ application.
|
||||
/// </summary>
|
||||
public class PreprocessorOptions : AbstractXmlFormsProjectOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream( |
||||
"ICSharpCode.CppBinding.Resources.PreprocessorOptions.xfrm")); |
||||
|
||||
InitializeHelper(); |
||||
|
||||
TextBox defineTextBox = Get<TextBox>("define"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(defineTextBox, "ClCompile", "PreprocessorDefinitions")); |
||||
Get<Button>("define").Click += ListEditor.SymbolsEditor(this, "define").Event; |
||||
|
||||
helper.BindString("includePathTextBox", "IncludePath", TextBoxEditMode.EditRawProperty); |
||||
Get<Button>("includePath").Click += ListEditor.DirectoriesEditor(this, "includePath").Event; |
||||
|
||||
TextBox undefineTextBox = Get<TextBox>("undefine"); |
||||
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(undefineTextBox, "ClCompile", "UndefinePreprocessorDefinitions")); |
||||
Get<Button>("undefine").Click += ListEditor.SymbolsEditor(this, "undefine").Event; |
||||
|
||||
CheckBox undefineAllCheckBox = Get<CheckBox>("undefineAll"); |
||||
helper.AddBinding(null, new CheckBoxItemDefinitionGroupBinding(undefineAllCheckBox, "ClCompile", "UndefineAllPreprocessorDefinitions")); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CppBinding.Project.PreprocessorOptions" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"> |
||||
<GroupBox Header="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor}"> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="50"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30" ></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition Width="50"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Label Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Includes}"></Label> |
||||
|
||||
<TextBox x:Name="includePathTextBox" Grid.Row="1" |
||||
Text="{Binding IncludePath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<Button Grid.Row="1" VerticalAlignment="Center" Padding="9,1" |
||||
Click="IncludePathButton_Click" Margin="5" Grid.Column="1" Content="..."></Button> |
||||
|
||||
<Label Grid.Row="2" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}"></Label> |
||||
|
||||
<TextBox x:Name="defineTextBox" VerticalAlignment="Center" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="3"></TextBox> |
||||
|
||||
<Button Grid.Row="3" Grid.Column="1" Padding="9,1" Margin="5" VerticalAlignment="Center" |
||||
Click="DefinePathButton_Click" |
||||
Content="..."></Button> |
||||
|
||||
|
||||
<Label Grid.Row="4" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Undefinitions}"></Label> |
||||
|
||||
<TextBox x:Name="undefineTextBox" Grid.Row="5" VerticalAlignment="Center" |
||||
TextChanged="TextBox_TextChanged" ></TextBox> |
||||
|
||||
<Button Grid.Row="5" Grid.Column="1" Padding="9,1" Margin="5" VerticalAlignment="Center" |
||||
Click="UndefineButton_Click" |
||||
Content="..."></Button> |
||||
|
||||
<CheckBox x:Name="undefineAllCheckBox" Grid.Row="6" Margin="5" |
||||
IsChecked="{Binding CheckBoxChecked, UpdateSourceTrigger=PropertyChanged}" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.UndefineAll}"></CheckBox> |
||||
|
||||
</Grid> |
||||
|
||||
</GroupBox> |
||||
</ScrollViewer> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,156 @@
@@ -0,0 +1,156 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 14.04.2012 |
||||
* Time: 17:53 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.CppBinding.Project |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for PreprocessorOptionsXaml.xaml
|
||||
/// </summary>
|
||||
public partial class PreprocessorOptions : ProjectOptionPanel |
||||
{ |
||||
private const string metaElement ="ClCompile"; |
||||
private MSBuildBasedProject project; |
||||
|
||||
public PreprocessorOptions() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
|
||||
private void Initialize() |
||||
{ |
||||
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, |
||||
project.ActiveConfiguration, project.ActivePlatform); |
||||
|
||||
this.defineTextBox.Text = GetElementMetaData(group,"PreprocessorDefinitions"); |
||||
|
||||
this.undefineTextBox.Text = GetElementMetaData(group,"UndefinePreprocessorDefinitions" ); |
||||
|
||||
string defs = GetElementMetaData(group,"UndefineAllPreprocessorDefinitions"); |
||||
|
||||
bool check; |
||||
if (bool.TryParse(defs, out check)) |
||||
{ |
||||
this.CheckBoxChecked = check; |
||||
this.undefineAllCheckBox.IsChecked = check; |
||||
} |
||||
IsDirty = false; |
||||
} |
||||
|
||||
|
||||
#region Properties
|
||||
|
||||
public ProjectProperty<string> IncludePath { |
||||
get { return GetProperty("IncludePath", "", TextBoxEditMode.EditRawProperty); } |
||||
} |
||||
|
||||
bool checkBoxChecked; |
||||
|
||||
public bool CheckBoxChecked { |
||||
get {return checkBoxChecked;} |
||||
set |
||||
{ |
||||
checkBoxChecked = value; |
||||
IsDirty = true; |
||||
base.RaisePropertyChanged(() => CheckBoxChecked); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region overrides
|
||||
|
||||
public override void OnApplyTemplate() |
||||
{ |
||||
base.OnApplyTemplate(); |
||||
HideHeader(); |
||||
} |
||||
protected override void Load(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
base.Load(project, configuration, platform); |
||||
this.project = project; |
||||
Initialize(); |
||||
} |
||||
|
||||
protected override bool Save(MSBuildBasedProject project, string configuration, string platform) |
||||
{ |
||||
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, |
||||
project.ActiveConfiguration, project.ActivePlatform); |
||||
|
||||
SetElementMetaData(group,"PreprocessorDefinitions",this.defineTextBox.Text); |
||||
|
||||
SetElementMetaData(group,"UndefinePreprocessorDefinitions",this.undefineTextBox.Text); |
||||
|
||||
string check = "false"; |
||||
if ((bool)this.undefineAllCheckBox.IsChecked) { |
||||
check = "true"; |
||||
} |
||||
SetElementMetaData(group,"UndefineAllPreprocessorDefinitions",check); |
||||
|
||||
return base.Save(project, configuration, platform); |
||||
} |
||||
#endregion
|
||||
|
||||
#region MSBuildItemDefinitionGroup Set-Get
|
||||
|
||||
private static string GetElementMetaData (MSBuildItemDefinitionGroup group,string name) |
||||
{ |
||||
return group.GetElementMetadata(metaElement,name); |
||||
} |
||||
|
||||
|
||||
private static void SetElementMetaData (MSBuildItemDefinitionGroup group,string name,string value) |
||||
{ |
||||
group.SetElementMetadata(metaElement,name,value); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void IncludePathButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
LinkerOptions.PopulateStringListEditor(StringParser.Parse("${res:Global.Folder}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Includes}:"), |
||||
this.includePathTextBox, |
||||
true); |
||||
} |
||||
|
||||
|
||||
private void DefinePathButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
LinkerOptions.PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}:"), |
||||
this.defineTextBox, |
||||
false); |
||||
} |
||||
|
||||
|
||||
private void UndefineButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
LinkerOptions.PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), |
||||
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), |
||||
this.undefineTextBox, |
||||
false); |
||||
} |
||||
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) |
||||
{ |
||||
IsDirty = true; |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue