private void UpdateOptions() { try { this.editor.Font = new Font(this.editorSpecificOptionsModel.FontFamily, (float)this.editorSpecificOptionsModel.FontSize); } catch { this.editor.Font = new Font(EditorSpecificOptionsModel.GetDefaultFont(), (float)this.editorSpecificOptionsModel.FontSize); } this.editor.Document.AutoConvertTabsToSpaces = this.editorSpecificOptionsModel.ConvertTabsToSpace; this.editor.Document.TabSize = this.editorSpecificOptionsModel.TabSize; this.editor.WordWrap = this.editorSpecificOptionsModel.WordWrap ? WordWrapType.Token : WordWrapType.None; }
internal CodeEditor(IWpfTextView textView, IWpfTextViewHost textViewHost, IEditorOperations editorCommands, ITextBufferUndoManager undoService, IFindLogic findLogic, IClassificationTypeRegistry classificationRegistry, IClassificationFormatMap classificationFormatMap, ISquiggleProvider squiggleProvider, ICompletionBroker completionBroker, CodeOptionsModel codeOptionsModel, IMessageDisplayService messageDisplayService, ICodeAidProvider codeAidProvider, IEnvironment environment) { this.textView = textView; this.textViewHost = textViewHost; this.findLogic = findLogic; this.classificationRegistry = classificationRegistry; this.classificationFormatMap = classificationFormatMap; this.editorCommands = editorCommands; this.undoService = undoService; this.squiggleProvider = squiggleProvider; this.environment = environment; this.messageDisplayService = messageDisplayService; this.codeEditorOperations = new CodeEditorOperations(this, completionBroker, codeAidProvider); FrameworkElement element1 = this.Element; element1.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus); element1.LostFocus += new RoutedEventHandler(this.Editor_LostFocus); element1.GotFocus += new RoutedEventHandler(this.Editor_GotFocus); this.textView.Caret.PositionChanged += new EventHandler <CaretPositionChangedEventArgs>(this.Caret_PositionChanged); this.textView.Background = (Brush)Brushes.White; this.textView.Selection.UnfocusedBrush = (Brush)Brushes.LightGray; this.verticalScollBar = (IWpfTextViewMargin)this.textViewHost.GetTextViewMargin("Wpf Vertical Scrollbar"); UIElement element2 = ((IWpfTextViewMargin)this.textViewHost.GetTextViewMargin("Wpf Horizontal Scrollbar")).VisualElement.Parent as UIElement; if (element2 != null) { Grid.SetColumn(element2, 0); Grid.SetColumnSpan(element2, 2); } this.lineNumberMargin = (IWpfLineNumberMargin)this.textViewHost.GetTextViewMargin("Wpf Line Number Margin"); this.lineNumberMargin.BackgroundBrush = (Brush) new SolidColorBrush(Colors.White); Border border = this.textViewHost.GetTextViewMargin("Spacer Margin") as Border; if (border != null) { border.BorderBrush = (Brush) new SolidColorBrush(Color.FromRgb((byte)204, (byte)204, (byte)204)); border.Margin = new Thickness(2.0, 0.0, 0.0, 0.0); border.BorderThickness = new Thickness(1.0, 0.0, 0.0, 0.0); } this.textViewHost.BottomRightMarginCorner = (UIElement) new CodeEditorCorner(); this.codeOptionsModel = codeOptionsModel; this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged); this.editorSpecificOptionsModel = this.codeOptionsModel.GetEditorModel(this.codeOptionsModel.GetEditorType(this.TextBuffer)); this.editorSpecificOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged); this.UpdateOptions(); }
public ActiproEditor(ActiproSoftware.SyntaxEditor.Document document, CodeOptionsModel codeOptionsModel, IMessageDisplayService messageDisplayService, IViewService viewService, ICodeProject codeProject, Microsoft.Expression.Framework.UserInterface.IWindowService windowService) { this.editor = new SyntaxEditor(); this.InitializeEditor(document, codeProject); this.host = new WindowsFormsHost(); this.host.Background = (System.Windows.Media.Brush)System.Windows.Media.Brushes.White; this.editor.IndicatorMarginVisible = false; this.host.Child = (Control)this.editor; this.codeOptionsModel = codeOptionsModel; this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.Actipro_PropertyChanged); this.editorSpecificOptionsModel = this.codeOptionsModel.GetEditorModel(EditorType.CodeEditor); this.editorSpecificOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.Actipro_PropertyChanged); this.messageDisplayService = messageDisplayService; this.viewService = viewService; this.windowService = windowService; this.windowService.ThemeChanged += new EventHandler(this.WindowService_ThemeChanged); this.UpdateOptions(); }