コード例 #1
0
        public IEditValue Create(string text, EditValueFlags flags)
        {
            var buffer    = textBufferFactoryService.CreateTextBuffer(text, contentType);
            var rolesHash = new HashSet <string>(textEditorFactoryService.DefaultRoles, StringComparer.OrdinalIgnoreCase)
            {
                EditValueConstants.EditValueTextViewRole,
            };

            // This also disables: line compressor, current line highlighter
            rolesHash.Remove(PredefinedTextViewRoles.Document);
            rolesHash.Remove(PredefinedTextViewRoles.Zoomable);
            foreach (var s in extraTextViewRoles)
            {
                rolesHash.Add(s);
            }
            var roles    = textEditorFactoryService.CreateTextViewRoleSet(rolesHash);
            var textView = textEditorFactoryService.CreateTextView(buffer, roles);

            try {
                return(new EditValueImpl(textView, flags));
            }
            catch {
                textView.Close();
                throw;
            }
        }
コード例 #2
0
        public static int EditValue(IntPtr parentWin, int fieldIndex, int unitIndex,
                                    int fieldType, IntPtr fieldValue, int maxLen, int flags,
                                    [MarshalAs(UnmanagedType.LPStr)] string langIdentifier)
        {
            SetValueResult   result;
            ContentFieldType fldType = (ContentFieldType)fieldType;
            EditValueFlags   evFlags = (EditValueFlags)flags;

            callSignature = String.Format("ContentEditValue ({0}/{1}/{2})",
                                          fieldIndex, unitIndex, evFlags.ToString());
            try {
                TcWindow     tcWin    = new TcWindow(parentWin);
                ContentValue value    = new ContentValue(fieldValue, fldType);
                string       strValue = value.StrValue;
                result = Plugin.EditValue(tcWin, fieldIndex, unitIndex, fldType,
                                          ref strValue, maxLen, evFlags, langIdentifier);
                if (result == SetValueResult.Success)
                {
                    value.StrValue = strValue;
                    value.CopyTo(fieldValue);
                }

                TraceCall(TraceLevel.Info, String.Format("{0} - {1}", result.ToString(), value.StrValue));
            } catch (Exception ex) {
                ProcessException(ex);
                result = SetValueResult.NoSuchField;
            }
            return((int)result);
        }
コード例 #3
0
 public EditValueImpl(IWpfTextView wpfTextView, EditValueFlags flags)
 {
     this.wpfTextView = wpfTextView;
     uiControl        = new UIControl(wpfTextView);
     this.flags       = flags;
     wpfTextView.VisualElement.Loaded += VisualElement_Loaded;
     wpfTextView.TextBuffer.Properties.AddProperty(typeof(EditValueImpl), this);
     wpfTextView.Options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, true);
     wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.None);
     wpfTextView.Options.SetOptionValue(DefaultWpfViewOptions.EnableHighlightCurrentLineId, false);
     wpfTextView.Options.SetOptionValue(DefaultWpfViewOptions.EnableMouseWheelZoomId, false);
     wpfTextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.UIMisc);
     wpfTextView.Options.SetOptionValue(DefaultDsTextViewOptions.CanChangeWordWrapStyleId, false);
     wpfTextView.Options.SetOptionValue(DefaultDsTextViewOptions.CompressEmptyOrWhitespaceLinesId, false);
     wpfTextView.Options.SetOptionValue(DefaultDsTextViewOptions.CompressNonLetterLinesId, false);
 }
コード例 #4
0
 public abstract IEditValue Create(string text, EditValueFlags flags);
コード例 #5
0
 // methods used in WDX plugins only
 public virtual SetValueResult EditValue(TcWindow parentWin, int fieldIndex, int unitIndex,
                                         ContentFieldType fieldType, ref string fieldValue, int maxLen, EditValueFlags flags,
                                         string langIdentifier)
 {
     return(SetValueResult.NoSuchField);
 }
コード例 #6
0
ファイル: IEditableValue.cs プロジェクト: zhenren92/dnSpy
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="text">Text to edit</param>
 /// <param name="flags">Flags</param>
 public EditableValueTextInfo(string text, EditValueFlags flags = EditValueFlags.SelectText)
 {
     Text  = text ?? throw new ArgumentNullException(nameof(text));
     Flags = flags;
 }