Browse Source
Conflicts: src/AddIns/Debugger/Debugger.AddIn/Pads/WatchPadModel.cs src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj src/Main/Base/Project/Src/Bookmarks/BookmarkConverter.cs src/Main/StartUp/Project/Resources/BitmapResources.resourcespull/11/head
63 changed files with 2527 additions and 684 deletions
After Width: | Height: | Size: 924 B |
After Width: | Height: | Size: 706 B |
After Width: | Height: | Size: 791 B |
After Width: | Height: | Size: 801 B |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="True"> |
||||
<Profiles /> |
||||
<Settings /> |
||||
</SettingsFile> |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
<UserControl x:Class="Debugger.AddIn.Pads.Controls.ConditionCell" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:SDGui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:local="clr-namespace:Debugger.AddIn.Pads.Controls"> |
||||
<UserControl.Resources> |
||||
<DataTemplate x:Key="ConditionCellTemplate"> |
||||
<Grid HorizontalAlignment="Stretch"> |
||||
<local:ConditionCell |
||||
CommandText="{Binding Path=Condition, UpdateSourceTrigger=LostFocus}" |
||||
Tag="{Binding Path=Tag, Mode=TwoWay}"/> |
||||
</Grid> |
||||
</DataTemplate> |
||||
</UserControl.Resources> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" MinWidth="200"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ContentPresenter |
||||
Name="ConsolePanel" /> |
||||
</Grid> |
||||
</UserControl> |
@ -0,0 +1,190 @@
@@ -0,0 +1,190 @@
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
|
||||
using ICSharpCode.AvalonEdit; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Core.Presentation; |
||||
using ICSharpCode.NRefactory; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Bookmarks.Pad.Controls; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace Debugger.AddIn.Pads.Controls |
||||
{ |
||||
public partial class ConditionCell : UserControl |
||||
{ |
||||
private string language; |
||||
|
||||
protected ConsoleControl console; |
||||
|
||||
public static readonly DependencyProperty CommandTextProperty = |
||||
DependencyProperty.Register("CommandText", typeof(string), typeof(ConditionCell), |
||||
new UIPropertyMetadata(null, new PropertyChangedCallback(OnCommandTextChanged))); |
||||
|
||||
private NRefactoryResolver resolver; |
||||
|
||||
public ConditionCell() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
console = new ConsoleControl(); |
||||
console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered); |
||||
console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown); |
||||
console.LostFocus += new RoutedEventHandler(console_LostFocus); |
||||
console.HideScrollBar(); |
||||
ConsolePanel.Content = console; |
||||
|
||||
// get language
|
||||
if (ProjectService.CurrentProject == null) |
||||
language = "C#"; |
||||
else |
||||
language = ProjectService.CurrentProject.Language; |
||||
resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language)); |
||||
|
||||
// FIXME set language
|
||||
if (language == "VB" || language == "VBNet") { |
||||
console.SetHighlighting("VBNET"); |
||||
} |
||||
else { |
||||
console.SetHighlighting("C#"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the command text displayed at the command prompt.
|
||||
/// </summary>
|
||||
public string CommandText { |
||||
get { return console.CommandText.Trim(); } |
||||
set { console.CommandText = value; } |
||||
} |
||||
|
||||
private BreakpointBookmark Breakpoint { |
||||
get { |
||||
var model = Model; |
||||
return model.Mark as BreakpointBookmark; |
||||
} |
||||
} |
||||
|
||||
private ListViewPadItemModel Model { |
||||
get { return Tag as ListViewPadItemModel; } |
||||
} |
||||
|
||||
private ITextEditor TextEditor { |
||||
get { |
||||
return console.TextEditor; |
||||
} |
||||
} |
||||
|
||||
private void console_TextAreaPreviewKeyDown(object sender, KeyEventArgs e) |
||||
{ |
||||
if (e.Key == Key.Return || e.Key == Key.Escape) { |
||||
|
||||
if (e.Key == Key.Escape) |
||||
CommandText = string.Empty; |
||||
else { |
||||
if(!CheckSyntax()) |
||||
return; |
||||
} |
||||
|
||||
UpdateBreakpoint(); |
||||
|
||||
e.Handled = true; |
||||
} |
||||
} |
||||
|
||||
private void console_LostFocus(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (string.IsNullOrEmpty(CommandText) || !this.CheckSyntax()) |
||||
return; |
||||
|
||||
UpdateBreakpoint(); |
||||
} |
||||
|
||||
private void UpdateBreakpoint() |
||||
{ |
||||
Breakpoint.Condition = CommandText; |
||||
Model.Condition = CommandText; |
||||
Breakpoint.ScriptLanguage = language; |
||||
Model.Language = language; |
||||
|
||||
if (!string.IsNullOrEmpty(console.CommandText)) { |
||||
Breakpoint.Action = BreakpointAction.Condition; |
||||
Model.Image = PresentationResourceService.GetImage("Bookmarks.BreakpointConditional").Source; |
||||
} |
||||
else { |
||||
Breakpoint.Action = BreakpointAction.Break; |
||||
Model.Image = PresentationResourceService.GetImage("Bookmarks.Breakpoint").Source; |
||||
} |
||||
} |
||||
|
||||
private bool CheckSyntax() |
||||
{ |
||||
string command = CommandText; |
||||
|
||||
// FIXME workaround the NRefactory issue that needs a ; at the end
|
||||
if (language == "C#") { |
||||
if(!command.EndsWith(";")) |
||||
command += ";"; |
||||
// FIXME only one string should be available; highlighting expects C#, supproted language, CSharp
|
||||
language = "CSharp"; |
||||
} |
||||
|
||||
SupportedLanguage supportedLanguage = (SupportedLanguage)Enum.Parse(typeof(SupportedLanguage), language.ToString(), true); |
||||
using (var parser = ParserFactory.CreateParser(supportedLanguage, new StringReader(TextEditor.Document.Text))) { |
||||
parser.ParseExpression(); |
||||
if (parser.Errors.Count > 0) { |
||||
MessageService.ShowError(parser.Errors.ErrorOutput); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
private void consoleControl_TextAreaTextEntered(object sender, TextCompositionEventArgs e) |
||||
{ |
||||
foreach (char ch in e.Text) { |
||||
if (ch == '.') { |
||||
ShowDotCompletion(console.CommandText); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void ShowDotCompletion(string currentText) |
||||
{ |
||||
var seg = Breakpoint; |
||||
|
||||
var expressionFinder = ParserService.GetExpressionFinder(seg.FileName.ToString()); |
||||
var info = ParserService.GetParseInformation(seg.FileName.ToString()); |
||||
|
||||
string text = ParserService.GetParseableFileContent(seg.FileName.ToString()).Text; |
||||
|
||||
int currentOffset = TextEditor.Caret.Offset - console.CommandOffset - 1; |
||||
|
||||
var expr = expressionFinder.FindExpression(currentText, currentOffset); |
||||
|
||||
expr.Region = new DomRegion(seg.LineNumber, seg.ColumnNumber, seg.LineNumber, seg.ColumnNumber); |
||||
|
||||
var rr = resolver.Resolve(expr, info, text); |
||||
|
||||
if (rr != null) { |
||||
TextEditor.ShowCompletionWindow(new DotCodeCompletionItemProvider().GenerateCompletionListForResolveResult(rr, expr.Context)); |
||||
} |
||||
} |
||||
|
||||
private static void OnCommandTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { |
||||
var cell = d as ConditionCell; |
||||
cell.CommandText = e.NewValue.ToString(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
// 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.Globalization; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Media; |
||||
|
||||
namespace Debugger.AddIn.Pads.Controls |
||||
{ |
||||
public class TreeListViewConverter : IValueConverter |
||||
{ |
||||
private const double INDENTATION_SIZE = 10; |
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
||||
{ |
||||
if (value == null) return null; |
||||
if (targetType == typeof(double) && typeof(DependencyObject).IsAssignableFrom(value.GetType())) |
||||
{ |
||||
DependencyObject element = value as DependencyObject; |
||||
int level = -1; |
||||
for (; element != null; element = VisualTreeHelper.GetParent(element)) { |
||||
if (typeof(TreeViewItem).IsAssignableFrom(element.GetType())) { |
||||
level++; |
||||
} |
||||
} |
||||
return INDENTATION_SIZE * level; |
||||
} |
||||
|
||||
throw new NotSupportedException(); |
||||
} |
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
||||
{ |
||||
throw new NotSupportedException("This method is not supported."); |
||||
} |
||||
} |
||||
|
||||
public class BoolToVisibilityConverter : IMultiValueConverter |
||||
{ |
||||
public object Convert(object[] values, Type targetType, |
||||
object parameter, CultureInfo culture) |
||||
{ |
||||
bool val = bool.Parse(parameter.ToString()); |
||||
return val == (bool.Parse(values[0].ToString()) && bool.Parse(values[1].ToString())) ? Visibility.Visible : Visibility.Collapsed; |
||||
} |
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, |
||||
object parameter, CultureInfo culture) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
// 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.Globalization; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Controls.Primitives; |
||||
using System.Windows.Data; |
||||
|
||||
using Debugger.AddIn.TreeModel; |
||||
|
||||
namespace Debugger.AddIn.Pads.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// Represents a control that displays hierarchical data in a tree structure
|
||||
/// that has items that can expand and collapse.
|
||||
/// </summary>
|
||||
public class TreeListView : TreeView |
||||
{ |
||||
static TreeListView() |
||||
{ |
||||
//Override the default style and the default control template
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(TreeListView), new FrameworkPropertyMetadata(typeof(TreeListView))); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Initialize a new instance of TreeListView.
|
||||
/// </summary>
|
||||
public TreeListView() |
||||
{ |
||||
Columns = new GridViewColumnCollection(); |
||||
} |
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of System.Windows.Controls.GridViewColumn
|
||||
/// objects that is defined for this TreeListView.
|
||||
/// </summary>
|
||||
public GridViewColumnCollection Columns |
||||
{ |
||||
get { return (GridViewColumnCollection)GetValue(ColumnsProperty); } |
||||
set { SetValue(ColumnsProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether columns in a TreeListView can be
|
||||
/// reordered by a drag-and-drop operation. This is a dependency property.
|
||||
/// </summary>
|
||||
public bool AllowsColumnReorder |
||||
{ |
||||
get { return (bool)GetValue(AllowsColumnReorderProperty); } |
||||
set { SetValue(AllowsColumnReorderProperty, value); } |
||||
} |
||||
#endregion
|
||||
|
||||
#region Static Dependency Properties
|
||||
// Using a DependencyProperty as the backing store for AllowsColumnReorder. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty AllowsColumnReorderProperty = |
||||
DependencyProperty.Register("AllowsColumnReorder", typeof(bool), typeof(TreeListView), new UIPropertyMetadata(null)); |
||||
|
||||
// Using a DependencyProperty as the backing store for Columns. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty ColumnsProperty = |
||||
DependencyProperty.Register("Columns", typeof(GridViewColumnCollection), |
||||
typeof(TreeListView), |
||||
new UIPropertyMetadata(null)); |
||||
#endregion
|
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Represents a control that can switch states in order to expand a node of a TreeListView.
|
||||
/// </summary>
|
||||
public class TreeListViewExpander : ToggleButton { } |
||||
} |
@ -0,0 +1,330 @@
@@ -0,0 +1,330 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
x:Class="Debugger.AddIn.Pads.Controls.WatchList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localControls="clr-namespace:Debugger.AddIn.Pads.Controls" xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}" |
||||
Background="White"> |
||||
<UserControl.Resources> |
||||
<localControls:BoolToVisibilityConverter |
||||
x:Key="boolToVisibility" /> |
||||
<localControls:TreeListViewConverter |
||||
x:Key="TreeListViewConverter" /> |
||||
<Style |
||||
x:Key="BorderStyle" |
||||
TargetType="Border"> |
||||
<Setter |
||||
Property="BorderBrush" |
||||
Value="LightGray" /> |
||||
<Setter |
||||
Property="BorderThickness" |
||||
Value="1,0,1,1"></Setter> |
||||
<Setter |
||||
Property="VerticalAlignment" |
||||
Value="Center" /> |
||||
<Setter |
||||
Property="HorizontalAlignment" |
||||
Value="Stretch" /> |
||||
</Style> |
||||
<Style |
||||
TargetType="{x:Type TextBox}" |
||||
x:Key="TextBoxStyle"> |
||||
<Setter Property="BorderThickness" Value="0"/> |
||||
<Setter Property="BorderBrush" Value="Transparent"/> |
||||
<Setter Property="Background" Value="White"/> |
||||
<Setter |
||||
Property="VerticalAlignment" |
||||
Value="Center" /> |
||||
<Setter |
||||
Property="Visibility"> |
||||
<Setter.Value> |
||||
<MultiBinding |
||||
Converter="{StaticResource boolToVisibility}" |
||||
ConverterParameter="True"> |
||||
<Binding |
||||
Path="CanSetText" /> |
||||
<Binding |
||||
Path="IsSelected" |
||||
RelativeSource="{RelativeSource AncestorType=TreeViewItem}" /> |
||||
</MultiBinding> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
<Style |
||||
TargetType="{x:Type TextBlock}" |
||||
x:Key="TextBlockStyle"> |
||||
<Setter |
||||
Property="VerticalAlignment" |
||||
Value="Center" /> |
||||
<Setter |
||||
Property="Visibility"> |
||||
<Setter.Value> |
||||
<MultiBinding |
||||
Converter="{StaticResource boolToVisibility}" |
||||
ConverterParameter="False"> |
||||
<Binding |
||||
Path="CanSetText" /> |
||||
<Binding |
||||
Path="IsSelected" |
||||
RelativeSource="{RelativeSource AncestorType=TreeViewItem}" /> |
||||
</MultiBinding> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
<Style |
||||
x:Key="ExpandToggleStyle" |
||||
TargetType="{x:Type ToggleButton}"> |
||||
<Setter |
||||
Property="Focusable" |
||||
Value="False" /> |
||||
<Setter |
||||
Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate |
||||
TargetType="ToggleButton"> |
||||
<Grid |
||||
Width="21" |
||||
Height="16"> |
||||
<Path |
||||
x:Name="ExpandPath" |
||||
HorizontalAlignment="Left" |
||||
VerticalAlignment="Center" |
||||
Margin="5,0,1,1" |
||||
Stroke="Black" |
||||
Fill="Transparent" |
||||
Data="M 4 0 L 8 4 L 4 8 Z" /> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger |
||||
Property="IsChecked" |
||||
Value="True"> |
||||
<Setter |
||||
Property="Data" |
||||
TargetName="ExpandPath" |
||||
Value="M 0 4 L 8 4 L 4 8 Z" /> |
||||
<Setter |
||||
TargetName="ExpandPath" |
||||
Property="Fill" |
||||
Value="Black" /> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
<!-- TreeViewItem--> |
||||
<ControlTemplate |
||||
TargetType="TreeViewItem" |
||||
x:Key="TreeListViewItem"> |
||||
<StackPanel> |
||||
<Border |
||||
Style="{StaticResource BorderStyle}" |
||||
x:Name="Border"> |
||||
<GridViewRowPresenter |
||||
Content="{TemplateBinding Header}" |
||||
Columns="{Binding Columns,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=localControls:TreeListView}}" /> |
||||
</Border> |
||||
<ItemsPresenter |
||||
x:Name="ItemsPresenter" |
||||
Visibility="Collapsed" /> |
||||
</StackPanel> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger |
||||
Property="IsExpanded" |
||||
Value="True"> |
||||
<Setter |
||||
TargetName="ItemsPresenter" |
||||
Property="Visibility" |
||||
Value="Visible" /> |
||||
</Trigger> |
||||
<Trigger |
||||
Property="IsSelected" |
||||
Value="true"> |
||||
<Setter |
||||
TargetName="Border" |
||||
Property="Background" |
||||
Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" /> |
||||
<Setter |
||||
Property="Foreground" |
||||
Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> |
||||
</Trigger> |
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition |
||||
Property="IsSelected" |
||||
Value="true" /> |
||||
<Condition |
||||
Property="IsSelectionActive" |
||||
Value="false" /> |
||||
</MultiTrigger.Conditions> |
||||
<Setter |
||||
TargetName="Border" |
||||
Property="Background" |
||||
Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> |
||||
<Setter |
||||
Property="Foreground" |
||||
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> |
||||
</MultiTrigger> |
||||
<Trigger |
||||
Property="IsEnabled" |
||||
Value="false"> |
||||
<Setter |
||||
Property="Foreground" |
||||
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
<!--TreeListViewExpander--> |
||||
<ControlTemplate |
||||
TargetType="{x:Type localControls:TreeListViewExpander}" |
||||
x:Key="TreeListViewExpander"> |
||||
<StackPanel |
||||
Orientation="Horizontal" |
||||
x:Name="ContainerElement"> |
||||
<FrameworkElement |
||||
Width="{Binding RelativeSource={x:Static RelativeSource.Self},Converter={StaticResource TreeListViewConverter}}" /> |
||||
<ToggleButton |
||||
Style="{StaticResource ExpandToggleStyle}" |
||||
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeViewItem}}" /> |
||||
</StackPanel> |
||||
</ControlTemplate> |
||||
<!--TreeListView--> |
||||
<Style |
||||
TargetType="{x:Type localControls:TreeListView}"> |
||||
<Setter |
||||
Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate |
||||
TargetType="{x:Type localControls:TreeListView}"> |
||||
<ControlTemplate.Resources> |
||||
<Style |
||||
TargetType="TreeViewItem"> |
||||
<Setter |
||||
Property="Template" |
||||
Value="{StaticResource TreeListViewItem}" /> |
||||
</Style> |
||||
<Style |
||||
TargetType="localControls:TreeListViewExpander"> |
||||
<Setter |
||||
Property="Template" |
||||
Value="{StaticResource TreeListViewExpander}" /> |
||||
</Style> |
||||
</ControlTemplate.Resources> |
||||
<Border |
||||
Background="{TemplateBinding Background}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}"> |
||||
<ScrollViewer |
||||
HorizontalScrollBarVisibility="Auto" |
||||
VerticalScrollBarVisibility="Disabled"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition |
||||
Height="Auto" /> |
||||
<RowDefinition |
||||
Height="*" /> |
||||
</Grid.RowDefinitions> |
||||
<GridViewHeaderRowPresenter |
||||
Columns="{TemplateBinding Columns}" |
||||
AllowsColumnReorder="{TemplateBinding AllowsColumnReorder}" /> |
||||
<ScrollViewer |
||||
HorizontalScrollBarVisibility="Disabled" |
||||
VerticalScrollBarVisibility="Auto" |
||||
Grid.Row="1"> |
||||
<ItemsPresenter /> |
||||
</ScrollViewer> |
||||
</Grid> |
||||
</ScrollViewer> |
||||
</Border> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
<!-- Name column --> |
||||
<DataTemplate |
||||
x:Key="CellTemplate_Name"> |
||||
<StackPanel |
||||
Orientation="Horizontal"> |
||||
<localControls:TreeListViewExpander |
||||
x:Name="Expander" /> |
||||
<Image |
||||
MaxHeight="16" |
||||
MaxWidth="16" |
||||
Margin="3,0,0,0" |
||||
Source="{Binding Path=ImageSource}" |
||||
VerticalAlignment="Center" /> |
||||
<TextBlock |
||||
Margin="3,0,0,0" |
||||
MinWidth="400" |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Center" |
||||
Text="{Binding Path=Name}" /> |
||||
</StackPanel> |
||||
<DataTemplate.Triggers> |
||||
<DataTrigger |
||||
Binding="{Binding Path=HasChildNodes}" |
||||
Value="False"> |
||||
<Setter |
||||
TargetName="Expander" |
||||
Property="Visibility" |
||||
Value="Hidden" /> |
||||
</DataTrigger> |
||||
</DataTemplate.Triggers> |
||||
</DataTemplate> |
||||
<!-- Value column --> |
||||
<DataTemplate |
||||
x:Key="CellTemplate_Value"> |
||||
<StackPanel |
||||
Orientation="Horizontal"> |
||||
<TextBlock |
||||
VerticalAlignment="Center" |
||||
MinWidth="200" |
||||
Text="{Binding Path=Text}" |
||||
Style="{StaticResource TextBlockStyle}" /> |
||||
<TextBox |
||||
Text="{Binding Path=Text, Mode=OneWay}" |
||||
Style="{StaticResource TextBoxStyle}" KeyUp="TextBox_KeyUp" /> |
||||
</StackPanel> |
||||
</DataTemplate> |
||||
<!-- Type column --> |
||||
<DataTemplate |
||||
x:Key="CellTemplate_Type"> |
||||
<TextBlock |
||||
VerticalAlignment="Center" |
||||
MinWidth="200" |
||||
Text="{Binding Path=Type}" /> |
||||
</DataTemplate> |
||||
</UserControl.Resources> |
||||
<DockPanel> |
||||
<localControls:TreeListView |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Stretch" |
||||
ItemsSource="{Binding Path=WatchItems}" |
||||
x:Name="MyList"> |
||||
<localControls:TreeListView.ItemTemplate> |
||||
<HierarchicalDataTemplate |
||||
ItemsSource="{Binding ChildNodes}"/> |
||||
</localControls:TreeListView.ItemTemplate> |
||||
<localControls:TreeListView.Resources> |
||||
<Style x:Key="ColumnHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"> |
||||
<Setter Property="HorizontalContentAlignment" Value="Left"></Setter> |
||||
</Style> |
||||
</localControls:TreeListView.Resources> |
||||
<localControls:TreeListView.Columns> |
||||
<GridViewColumn |
||||
Width="400" |
||||
HeaderContainerStyle="{StaticResource ColumnHeaderStyle}" |
||||
Header="{core:Localize Global.Name}" |
||||
CellTemplate="{StaticResource CellTemplate_Name}"></GridViewColumn> |
||||
<GridViewColumn |
||||
Width="200" |
||||
HeaderContainerStyle="{StaticResource ColumnHeaderStyle}" |
||||
Header="{core:Localize Dialog.HighlightingEditor.Properties.Value}" |
||||
CellTemplate="{StaticResource CellTemplate_Value}" /> |
||||
<GridViewColumn |
||||
Width="200" |
||||
HeaderContainerStyle="{StaticResource ColumnHeaderStyle}" |
||||
Header="{core:Localize ResourceEditor.ResourceEdit.TypeColumn}" |
||||
CellTemplate="{StaticResource CellTemplate_Type}" /> |
||||
</localControls:TreeListView.Columns> |
||||
</localControls:TreeListView> |
||||
</DockPanel> |
||||
</UserControl> |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
// 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.ObjectModel; |
||||
using System.Collections.Specialized; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using Debugger.AddIn.TreeModel; |
||||
|
||||
namespace Debugger.AddIn.Pads.Controls |
||||
{ |
||||
public partial class WatchList : UserControl |
||||
{ |
||||
private ObservableCollection<TreeNode> items = new ObservableCollection<TreeNode>(); |
||||
|
||||
public WatchList() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
void TextBox_KeyUp(object sender, KeyEventArgs e) |
||||
{ |
||||
if (e.Key != Key.Enter && e.Key != Key.Escape) |
||||
{ |
||||
e.Handled = true; |
||||
return; |
||||
} |
||||
|
||||
if (e.Key == Key.Enter) { |
||||
if(SelectedNode is ExpressionNode) { |
||||
var node = (ExpressionNode)SelectedNode; |
||||
node.SetText(((TextBox)sender).Text); |
||||
} |
||||
} |
||||
if (e.Key == Key.Enter || e.Key == Key.Escape) { |
||||
for (int i = 0; i < MyList.Items.Count; i++) { |
||||
TreeViewItem child = (TreeViewItem)MyList.ItemContainerGenerator.ContainerFromIndex(i); |
||||
child.IsSelected = false; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public ObservableCollection<TreeNode> WatchItems { get { return items; } } |
||||
|
||||
public TreeNode SelectedNode { |
||||
get { |
||||
return this.MyList.SelectedItem as TreeNode; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?> |
||||
<Template author="Daniel Grunwald" version="1.0"> |
||||
|
||||
<Config |
||||
name = "Settings" |
||||
icon = "Icons.32x32.ResourceFileIcon" |
||||
category = "${res:Templates.File.Categories.Misc}" |
||||
defaultname = "Settings${Number}.settings" |
||||
language = "SettingsFiles"/> |
||||
|
||||
<Description>${res:Templates.File.Resource.EmptyResourceFile.Description}</Description> |
||||
|
||||
<Files> |
||||
<File name="${FullName}" language="ResourceFiles" Generator="SettingsSingleFileGenerator"><![CDATA[<?xml version='1.0' encoding='utf-8'?> |
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="${StandardNamespace}" GeneratedClassName="${ClassName}"> |
||||
<Profiles /> |
||||
<Settings /> |
||||
</SettingsFile> |
||||
]]> </File> |
||||
</Files> |
||||
|
||||
<AdditionalOptions/> |
||||
</Template> |
||||
|
||||
|
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<gui:OptionPanel |
||||
x:Class="ReflectorAddIn.OptionPanels.ChangeReflectorPath" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<GroupBox |
||||
Header="{core:Localize ReflectorAddIn.SetReflectorPathDialogTitle}"> |
||||
<widgets:StackPanelWithSpacing> |
||||
<TextBlock |
||||
TextWrapping="Wrap" |
||||
Height="46" |
||||
Name="StatusLabel" /> |
||||
<Button |
||||
HorizontalAlignment="Center" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Name="OpenSearchPathButton" |
||||
Content="{core:Localize ReflectorAddIn.IdeOptions.FindReflectorPath}" |
||||
Click="FindReflectorPathClick" /> |
||||
</widgets:StackPanelWithSpacing> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ReflectorAddIn.OptionPanels |
||||
{ |
||||
public partial class ChangeReflectorPath : OptionPanel |
||||
{ |
||||
public ChangeReflectorPath() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
Loaded += delegate { ShowStatus(); }; |
||||
} |
||||
|
||||
void ShowStatus() |
||||
{ |
||||
string path = PropertyService.Get(ReflectorSetupHelper.ReflectorExePathPropertyName); |
||||
|
||||
if (string.IsNullOrEmpty(path)) { |
||||
StatusLabel.Text = StringParser.Parse("${res:ReflectorAddIn.ReflectorPathNotSet}"); |
||||
} else { |
||||
StatusLabel.Text = StringParser.Parse("${res:ReflectorAddIn.IdeOptions.ReflectorFoundInPath}") |
||||
+ Environment.NewLine + path; |
||||
} |
||||
} |
||||
|
||||
void FindReflectorPathClick(object sender, EventArgs e) |
||||
{ |
||||
ReflectorSetupHelper.OpenReflectorExeFullPathInteractiver(); |
||||
ShowStatus(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,106 @@
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Window |
||||
x:Class="ReflectorAddIn.Windows.SetReflectorPath" |
||||
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:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
WindowStartupLocation="CenterOwner" |
||||
Style="{x:Static core:GlobalStyles.DialogWindowStyle}" |
||||
ResizeMode="NoResize" |
||||
WindowStyle="ToolWindow" |
||||
ShowInTaskbar="False" |
||||
SizeToContent="Height" |
||||
Width="446"> |
||||
<Window.Resources> |
||||
<Style |
||||
x:Key="LinkButton" |
||||
TargetType="Button" BasedOn="{x:Static core:GlobalStyles.ButtonStyle}"> |
||||
<Setter |
||||
Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate |
||||
TargetType="Button"> |
||||
<ControlTemplate.Resources> |
||||
<Style |
||||
TargetType="{x:Type TextBlock}"> |
||||
<Setter |
||||
Property="TextDecorations" |
||||
Value="Underline" /> |
||||
</Style> |
||||
</ControlTemplate.Resources> |
||||
<ContentPresenter /> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
<Setter |
||||
Property="Foreground" |
||||
Value="Blue" /> |
||||
<Setter |
||||
Property="Cursor" |
||||
Value="Hand" /> |
||||
<Style.Triggers> |
||||
<Trigger |
||||
Property="IsMouseOver" |
||||
Value="true"> |
||||
<Setter |
||||
Property="Foreground" |
||||
Value="Red" /> |
||||
</Trigger> |
||||
</Style.Triggers> |
||||
</Style> |
||||
</Window.Resources> |
||||
<StackPanel> |
||||
<widgets:StackPanelWithSpacing> |
||||
<TextBlock |
||||
Margin="12,12,12,0" |
||||
HorizontalAlignment="Left" |
||||
TextWrapping="Wrap" |
||||
Name="txtReason"/> |
||||
<TextBlock |
||||
Margin="12" |
||||
TextWrapping="Wrap" |
||||
HorizontalAlignment="Left" |
||||
Name="txtReflectorExplanation" |
||||
Text="{core:Localize ReflectorAddIn.SetReflectorPathDialog.ReflectorInfo}"/> |
||||
<Button Margin="20,0,0,15" |
||||
Name="OpenReflectorPageButton" |
||||
Content="http://reflector.red-gate.com/Download.aspx" |
||||
Style="{StaticResource LinkButton}" |
||||
Click="OpenReflectorPageButton_Click" /> |
||||
<GroupBox Margin="12,0,0,15" |
||||
Header="{core:Localize ReflectorAddIn.SetReflectorPathDialog.PathToReflectorExe}"> |
||||
<widgets:StackPanelWithSpacing |
||||
Orientation="Horizontal"> |
||||
<TextBox |
||||
IsReadOnly="True" |
||||
Name="slePath" |
||||
Width="310" |
||||
Height="20" /> |
||||
<Button Margin="15,0,0,0" |
||||
HorizontalAlignment="Right" |
||||
Name="BrowseButton" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Content="{core:Localize Global.BrowseButtonText}" |
||||
Click="BrowseButton_Click" /> |
||||
</widgets:StackPanelWithSpacing> |
||||
</GroupBox> |
||||
<widgets:UniformGridWithSpacing |
||||
Columns="2" |
||||
Margin="0,0,12,12" |
||||
HorizontalAlignment="Right"> |
||||
<Button |
||||
Name="OkButton" |
||||
IsDefault="True" |
||||
Content="{core:Localize Global.OKButtonText}" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Click="OkButton_Click"/> |
||||
<Button |
||||
Name="CancelButton" |
||||
IsCancel="True" |
||||
Content="{core:Localize Global.CancelButtonText}" |
||||
Click="CancelButton_Click" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" /> |
||||
</widgets:UniformGridWithSpacing> |
||||
</widgets:StackPanelWithSpacing> |
||||
</StackPanel> |
||||
</Window> |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
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 Microsoft.Win32; |
||||
|
||||
namespace ReflectorAddIn.Windows |
||||
{ |
||||
public partial class SetReflectorPath : Window |
||||
{ |
||||
public SetReflectorPath(string oldPath, string reason) |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
this.Title = ResourceService.GetString("ReflectorAddIn.SetReflectorPathDialogTitle"); |
||||
|
||||
if (reason != null) |
||||
this.txtReason.Text = reason; |
||||
else |
||||
this.txtReason.Visibility = Visibility.Collapsed; |
||||
if (!String.IsNullOrEmpty(oldPath)) { |
||||
this.slePath.Text = oldPath; |
||||
} |
||||
} |
||||
|
||||
public string SelectedFile { |
||||
get { |
||||
return slePath.Text; |
||||
} |
||||
} |
||||
|
||||
void OpenReflectorPageButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
try { |
||||
using(System.Diagnostics.Process.Start("http://reflector.red-gate.com/Download.aspx")) { |
||||
} |
||||
} catch (Exception ex) { |
||||
MessageService.ShowError(ex.Message); |
||||
} |
||||
} |
||||
|
||||
void OkButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
this.DialogResult = true; |
||||
Close(); |
||||
} |
||||
|
||||
void CancelButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
this.DialogResult = false; |
||||
Close(); |
||||
} |
||||
|
||||
void BrowseButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
OpenFileDialog dialog = new OpenFileDialog(); |
||||
|
||||
dialog.Title = this.Title; |
||||
dialog.DefaultExt = "exe"; |
||||
dialog.RestoreDirectory = true; |
||||
dialog.Filter = "Reflector.exe|Reflector.exe"; |
||||
|
||||
if (!String.IsNullOrEmpty(this.slePath.Text)) { |
||||
dialog.FileName = this.slePath.Text; |
||||
} |
||||
|
||||
bool? result = dialog.ShowDialog(this); |
||||
|
||||
if (result.HasValue && result.Value) { |
||||
this.slePath.Text = dialog.FileName; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
x:Class="ICSharpCode.SharpDevelop.Bookmarks.Pad.Controls.ListViewPad" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Bookmarks.Pad.Controls" xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"> |
||||
<Grid> |
||||
<Grid.Resources> |
||||
<DataTemplate |
||||
x:Key="CheckBoxTemplate"> |
||||
<CheckBox |
||||
IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" /> |
||||
</DataTemplate> |
||||
<DataTemplate |
||||
x:Key="ImageTemplate"> |
||||
<Image |
||||
Source="{Binding Path=Image, UpdateSourceTrigger=PropertyChanged}" /> |
||||
</DataTemplate> |
||||
</Grid.Resources> |
||||
<ListView |
||||
Name="MyListView" |
||||
ItemsSource="{Binding ItemCollection}"> |
||||
<ListView.View> |
||||
<GridView> |
||||
<GridViewColumn |
||||
Header="" |
||||
Width="Auto" |
||||
CellTemplate="{StaticResource CheckBoxTemplate}" /> |
||||
<GridViewColumn |
||||
Header="" |
||||
Width="Auto" |
||||
CellTemplate="{StaticResource ImageTemplate}" /> |
||||
<GridViewColumn |
||||
Header="{core:Localize MainWindow.Windows.BookmarkPad.LocationText}" |
||||
Width="Auto" |
||||
DisplayMemberBinding="{Binding Path=Location}" /> |
||||
<GridViewColumn |
||||
Header="{core:Localize MainWindow.Windows.Debug.CallStack.Language}" |
||||
Width="Auto" |
||||
DisplayMemberBinding="{Binding Path=Language, UpdateSourceTrigger=PropertyChanged}" /> |
||||
</GridView> |
||||
</ListView.View> |
||||
</ListView> |
||||
</Grid> |
||||
</UserControl> |
@ -0,0 +1,243 @@
@@ -0,0 +1,243 @@
|
||||
// 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.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.IO; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Bookmarks.Pad.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// ListViewPad inside WPF pads.
|
||||
/// </summary>
|
||||
public sealed partial class ListViewPad : UserControl |
||||
{ |
||||
ObservableCollection<ListViewPadItemModel> itemCollection = new ObservableCollection<ListViewPadItemModel>(); |
||||
|
||||
public ObservableCollection<ListViewPadItemModel> ItemCollection { |
||||
get { return itemCollection; } |
||||
} |
||||
|
||||
public event EventHandler ItemActivated; |
||||
|
||||
public ListViewPad() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
this.MyListView.PreviewMouseDoubleClick += new MouseButtonEventHandler(ListViewPad_PreviewMouseDoubleClick); |
||||
this.MyListView.KeyDown += new KeyEventHandler(ListViewPad_KeyDown); |
||||
} |
||||
|
||||
public ListViewPadItemModel CurrentItem { |
||||
get { |
||||
if (MyListView.SelectedItem == null && MyListView.Items.Count > 0) |
||||
this.MyListView.SelectedItem = MyListView.Items[0]; |
||||
|
||||
return MyListView.SelectedItem as ListViewPadItemModel; |
||||
} |
||||
set { |
||||
if (value == null) return; |
||||
|
||||
this.MyListView.SelectedItem = value; |
||||
} |
||||
} |
||||
|
||||
public ListViewPadItemModel NextItem { |
||||
get { |
||||
bool found = false; |
||||
foreach (var line in ItemCollection) { |
||||
if (found) |
||||
return line; |
||||
if (line == CurrentItem) |
||||
found = true; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public ListViewPadItemModel PrevItem { |
||||
get { |
||||
bool found = false; |
||||
ListViewPadItemModel prev = null; |
||||
foreach (var line in ItemCollection) { |
||||
if (found) |
||||
return prev; |
||||
if (line == CurrentItem) { |
||||
found = true; |
||||
} |
||||
else { |
||||
prev = line; |
||||
} |
||||
} |
||||
|
||||
return prev; |
||||
} |
||||
} |
||||
|
||||
public void Add(ListViewPadItemModel item) |
||||
{ |
||||
if (item == null) return; |
||||
ItemCollection.Add(item); |
||||
} |
||||
|
||||
public void Remove(ListViewPadItemModel item) |
||||
{ |
||||
SDBookmark bookmark1 = item.Mark as SDBookmark; |
||||
|
||||
if (bookmark1 is CurrentLineBookmark) |
||||
return; |
||||
|
||||
foreach (var line in itemCollection) { |
||||
SDBookmark bookmark2 = line.Mark as SDBookmark; |
||||
|
||||
if (bookmark1.FileName == bookmark2.FileName && |
||||
bookmark1.LineNumber == bookmark2.LineNumber) { |
||||
ItemCollection.Remove(line); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void AddColumn(string header, DataTemplate cellTemplate) |
||||
{ |
||||
GridViewColumn column = new GridViewColumn(); |
||||
column.Header = header; |
||||
column.CellTemplate = cellTemplate; |
||||
((GridView)this.MyListView.View).Columns.Add(column); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Indexes from end to start.
|
||||
/// </summary>
|
||||
/// <param name="columnIndex"></param>
|
||||
public void HideColumns(params int[] columnIndexes) |
||||
{ |
||||
foreach(int i in columnIndexes) |
||||
((GridView)MyListView.View).Columns.RemoveAt(i); |
||||
} |
||||
|
||||
private void ListViewPad_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) |
||||
{ |
||||
var handler = ItemActivated; |
||||
|
||||
if (handler != null) |
||||
ItemActivated(this, EventArgs.Empty); |
||||
} |
||||
|
||||
private void ListViewPad_KeyDown(object sender, KeyEventArgs e) |
||||
{ |
||||
if (e.Key == Key.Escape) { |
||||
this.MyListView.UnselectAll(); |
||||
e.Handled = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public sealed class ListViewPadItemModel : INotifyPropertyChanged |
||||
{ |
||||
bool isChecked; |
||||
object tag; |
||||
string language; |
||||
string condition; |
||||
ImageSource imageSource; |
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
public ListViewPadItemModel(SDBookmark mark) |
||||
{ |
||||
if (mark is BreakpointBookmark) { |
||||
isChecked = ((BreakpointBookmark)mark).IsEnabled; |
||||
condition = ((BreakpointBookmark)mark).Condition; |
||||
language = ((BreakpointBookmark)mark).ScriptLanguage; |
||||
} |
||||
|
||||
imageSource = mark.Image.ImageSource; |
||||
|
||||
Location = GetLocation(mark); |
||||
Mark = mark; |
||||
tag = this; |
||||
} |
||||
|
||||
public bool IsChecked { |
||||
get { |
||||
return isChecked; |
||||
} |
||||
set { |
||||
if (value != isChecked) |
||||
{ |
||||
isChecked = value; |
||||
NotifyPropertyChanged("IsChecked"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public SDBookmark Mark { |
||||
get; set; |
||||
} |
||||
|
||||
public ImageSource Image { |
||||
get { return imageSource; } |
||||
set { |
||||
imageSource = value; |
||||
NotifyPropertyChanged("Image"); |
||||
} |
||||
} |
||||
|
||||
public string Location { |
||||
get; private set; |
||||
} |
||||
|
||||
public string Language { |
||||
get { return language; } |
||||
set { |
||||
language = value; |
||||
NotifyPropertyChanged("Language"); |
||||
} |
||||
} |
||||
|
||||
public string Condition { |
||||
get { return condition; } |
||||
set { |
||||
condition = value; |
||||
NotifyPropertyChanged("Condition"); |
||||
} |
||||
} |
||||
|
||||
public object Tag { |
||||
get { return tag;} |
||||
set { |
||||
tag = value; |
||||
NotifyPropertyChanged("Tag"); |
||||
} |
||||
} |
||||
|
||||
private string GetLocation(SDBookmark bookmark) |
||||
{ |
||||
return string.Format(StringParser.Parse("${res:MainWindow.Windows.BookmarkPad.LineText}"), |
||||
Path.GetFileName(bookmark.FileName), bookmark.LineNumber); |
||||
} |
||||
|
||||
private void NotifyPropertyChanged(string property) |
||||
{ |
||||
if (property == "IsChecked") |
||||
{ |
||||
if (Mark is BreakpointBookmark) |
||||
(Mark as BreakpointBookmark).IsEnabled = isChecked; |
||||
} |
||||
|
||||
if (PropertyChanged != null) |
||||
{ |
||||
PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
} |
||||
} |
Binary file not shown.
Loading…
Reference in new issue