Browse Source

added option to disable advanced highlighting for XAML

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6272 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 16 years ago
parent
commit
ed54e3423a
  1. 20
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/CodeCompletion.xaml
  2. 5
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/XamlBindingOptions.cs
  3. 12
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlLanguageBinding.cs

20
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/CodeCompletion.xaml

@ -23,20 +23,22 @@
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="3" Text="{sd:Localize AddIns.XamlBinding.Options.HighlightingDescription}" TextWrapping="WrapWithOverflow" /> <CheckBox Grid.ColumnSpan="2" Margin="3" Content="{sd:Localize AddIns.XamlBinding.Options.UseHighlighting}" IsChecked="{sd:OptionBinding addin:XamlBindingOptions.UseAdvancedHighlighting}" />
<Label Grid.Row="1" Content="{sd:Localize AddIns.XamlBinding.Options.PropertyColor}" /> <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Margin="3" Text="{sd:Localize AddIns.XamlBinding.Options.HighlightingDescription}" TextWrapping="WrapWithOverflow" />
<Label Grid.Row="2" Content="{sd:Localize AddIns.XamlBinding.Options.EventColor}" /> <Label Grid.Row="2" Content="{sd:Localize AddIns.XamlBinding.Options.PropertyColor}" />
<Label Grid.Row="3" Content="{sd:Localize AddIns.XamlBinding.Options.NamespaceDeclarationColor}" /> <Label Grid.Row="3" Content="{sd:Localize AddIns.XamlBinding.Options.EventColor}" />
<Label Grid.Row="4" Content="{sd:Localize AddIns.XamlBinding.Options.IgnoredElementColor}" /> <Label Grid.Row="4" Content="{sd:Localize AddIns.XamlBinding.Options.NamespaceDeclarationColor}" />
<gui:ColorPicker Grid.Row="1" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.PropertyForegroundColor}" /> <Label Grid.Row="5" Content="{sd:Localize AddIns.XamlBinding.Options.IgnoredElementColor}" />
<gui:ColorPicker Grid.Row="2" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.EventForegroundColor}" /> <gui:ColorPicker Grid.Row="2" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.PropertyForegroundColor}" />
<gui:ColorPicker Grid.Row="3" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.NamespaceDeclarationForegroundColor}" /> <gui:ColorPicker Grid.Row="3" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.EventForegroundColor}" />
<gui:ColorPicker Grid.Row="4" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.IgnoredForegroundColor}" /> <gui:ColorPicker Grid.Row="4" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.NamespaceDeclarationForegroundColor}" />
<gui:ColorPicker Grid.Row="5" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.IgnoredForegroundColor}" />
</Grid> </Grid>
</GroupBox> </GroupBox>
</StackPanel> </StackPanel>

5
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/XamlBindingOptions.cs

@ -40,6 +40,11 @@ namespace ICSharpCode.XamlBinding
set { Properties.Set("SwitchToCodeViewAfterInsertion", value); } set { Properties.Set("SwitchToCodeViewAfterInsertion", value); }
} }
public static bool UseAdvancedHighlighting {
get { return Properties.Get("UseAdvancedHighlighting", true); }
set { Properties.Set("UseAdvancedHighlighting", value); }
}
public static string EventHandlerNamePattern { public static string EventHandlerNamePattern {
get { return Properties.Get("EventHandlerNamePattern", "%Object%_%Event%"); } get { return Properties.Get("EventHandlerNamePattern", "%Object%_%Event%"); }
set { Properties.Set("EventHandlerNamePattern", value); } set { Properties.Set("EventHandlerNamePattern", value); }

12
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlLanguageBinding.cs

@ -35,9 +35,11 @@ namespace ICSharpCode.XamlBinding
// GetService returns null // GetService returns null
if (textView != null) { if (textView != null) {
if (WorkbenchSingleton.Workbench != null) { if (WorkbenchSingleton.Workbench != null) {
if (XamlBindingOptions.UseAdvancedHighlighting) {
colorizer = new XamlColorizer(editor, textView); colorizer = new XamlColorizer(editor, textView);
// attach the colorizer // attach the colorizer
textView.LineTransformers.Add(colorizer); textView.LineTransformers.Add(colorizer);
}
// add the XamlOutlineContentHost, which manages the tree view // add the XamlOutlineContentHost, which manages the tree view
contentHost = new XamlOutlineContentHost(editor); contentHost = new XamlOutlineContentHost(editor);
textView.Services.AddService(typeof(IOutlineContentHost), contentHost); textView.Services.AddService(typeof(IOutlineContentHost), contentHost);
@ -52,14 +54,18 @@ namespace ICSharpCode.XamlBinding
base.Detach(); base.Detach();
// if we added something before // if we added something before
if (textView != null && colorizer != null && contentHost != null) { if (textView != null) {
// remove and dispose everything we added // remove and dispose everything we added
if (colorizer != null) {
textView.LineTransformers.Remove(colorizer); textView.LineTransformers.Remove(colorizer);
textView.Services.RemoveService(typeof(IOutlineContentHost));
textView.Services.RemoveService(typeof(XamlLanguageBinding));
colorizer.Dispose(); colorizer.Dispose();
}
if (contentHost != null) {
textView.Services.RemoveService(typeof(IOutlineContentHost));
contentHost.Dispose(); contentHost.Dispose();
} }
textView.Services.RemoveService(typeof(XamlLanguageBinding));
}
} }
} }
} }

Loading…
Cancel
Save