static Pen GetPen(ResourceDictionary props, HexColumnLineKind lineKind)
        {
            Color?          color;
            SolidColorBrush scBrush;

            Pen newPen;

            if ((color = props[VSTC.EditorFormatDefinition.ForegroundColorId] as Color?) != null)
            {
                var brush = new SolidColorBrush(color.Value);
                brush.Freeze();
                newPen = InitializePen(new Pen(brush, PEN_THICKNESS), lineKind);
                newPen.Freeze();
            }
            else if ((scBrush = props[VSTC.EditorFormatDefinition.ForegroundBrushId] as SolidColorBrush) != null)
            {
                if (scBrush.CanFreeze)
                {
                    scBrush.Freeze();
                }
                newPen = InitializePen(new Pen(scBrush, PEN_THICKNESS), lineKind);
                newPen.Freeze();
            }
            else if ((newPen = props[VSTC.MarkerFormatDefinition.BorderId] as Pen) != null)
            {
                if (newPen.CanFreeze)
                {
                    newPen.Freeze();
                }
            }

            return(newPen);
        }
Beispiel #2
0
        static Pen?GetPen(ResourceDictionary props, HexColumnLineKind lineKind)
        {
            Pen?newPen;

            if (props[VSTC.EditorFormatDefinition.ForegroundColorId] is Color color)
            {
                var brush = new SolidColorBrush(color);
                brush.Freeze();
                newPen = InitializePen(new Pen(brush, PEN_THICKNESS), lineKind);
                newPen.Freeze();
            }
            else if (props[VSTC.EditorFormatDefinition.ForegroundBrushId] is SolidColorBrush scBrush)
            {
                if (scBrush.CanFreeze)
                {
                    scBrush.Freeze();
                }
                newPen = InitializePen(new Pen(scBrush, PEN_THICKNESS), lineKind);
                newPen.Freeze();
            }
            else if (!((newPen = props[VSTC.MarkerFormatDefinition.BorderId] as Pen) is null))
            {
                if (newPen.CanFreeze)
                {
                    newPen.Freeze();
                }
            }

            return(newPen);
        }
Beispiel #3
0
        protected AdvancedAppSettingsPageBase(CommonEditorOptions options)
        {
            this.options       = options ?? throw new ArgumentNullException(nameof(options));
            ColumnLine0VM      = new EnumListVM(hexColumnLineKindList);
            ColumnLine1VM      = new EnumListVM(hexColumnLineKindList);
            ColumnGroupLine0VM = new EnumListVM(hexColumnLineKindList);
            ColumnGroupLine1VM = new EnumListVM(hexColumnLineKindList);

            ShowColumnLines = options.ShowColumnLines;
            RemoveExtraTextLineVerticalPixels = options.RemoveExtraTextLineVerticalPixels;
            SelectionMargin      = options.SelectionMargin;
            GlyphMargin          = options.GlyphMargin;
            ZoomControl          = options.ZoomControl;
            EnableMouseWheelZoom = options.EnableMouseWheelZoom;
            ColumnLine0          = options.ColumnLine0;
            ColumnLine1          = options.ColumnLine1;
            ColumnGroupLine0     = options.ColumnGroupLine0;
            ColumnGroupLine1     = options.ColumnGroupLine1;
        }
        static Pen InitializePen(Pen pen, HexColumnLineKind lineKind)
        {
            switch (lineKind)
            {
            case HexColumnLineKind.None:
                Debug.Fail("Shouldn't be here");
                break;

            case HexColumnLineKind.Solid:
                break;

            case HexColumnLineKind.Dashed_1_1:
                pen.DashStyle = new DashStyle(dashed_1_1_DashStyle, 1);
                pen.DashCap   = PenLineCap.Flat;
                break;

            case HexColumnLineKind.Dashed_2_2:
                pen.DashStyle = new DashStyle(dashed_2_2_DashStyle, 1);
                pen.DashCap   = PenLineCap.Flat;
                break;

            case HexColumnLineKind.Dashed_3_3:
                pen.DashStyle = new DashStyle(dashed_3_3_DashStyle, 1);
                pen.DashCap   = PenLineCap.Flat;
                break;

            case HexColumnLineKind.Dashed_4_4:
                pen.DashStyle = new DashStyle(dashed_4_4_DashStyle, 1);
                pen.DashCap   = PenLineCap.Flat;
                break;

            default:
                Debug.Fail($"Unknown line kind: {lineKind}");
                break;
            }
            return(pen);
        }
		static Pen InitializePen(Pen pen, HexColumnLineKind lineKind) {
			switch (lineKind) {
			case HexColumnLineKind.None:
				Debug.Fail("Shouldn't be here");
				break;

			case HexColumnLineKind.Solid:
				break;

			case HexColumnLineKind.Dashed_1_1:
				pen.DashStyle = new DashStyle(dashed_1_1_DashStyle, 1);
				pen.DashCap = PenLineCap.Flat;
				break;

			case HexColumnLineKind.Dashed_2_2:
				pen.DashStyle = new DashStyle(dashed_2_2_DashStyle, 1);
				pen.DashCap = PenLineCap.Flat;
				break;

			case HexColumnLineKind.Dashed_3_3:
				pen.DashStyle = new DashStyle(dashed_3_3_DashStyle, 1);
				pen.DashCap = PenLineCap.Flat;
				break;

			case HexColumnLineKind.Dashed_4_4:
				pen.DashStyle = new DashStyle(dashed_4_4_DashStyle, 1);
				pen.DashCap = PenLineCap.Flat;
				break;

			default:
				Debug.Fail($"Unknown line kind: {lineKind}");
				break;
			}
			return pen;
		}
		static Pen GetPen(ResourceDictionary props, HexColumnLineKind lineKind) {
			Color? color;
			SolidColorBrush scBrush;

			Pen newPen;
			if ((color = props[VSTC.EditorFormatDefinition.ForegroundColorId] as Color?) != null) {
				var brush = new SolidColorBrush(color.Value);
				brush.Freeze();
				newPen = InitializePen(new Pen(brush, PEN_THICKNESS), lineKind);
				newPen.Freeze();
			}
			else if ((scBrush = props[VSTC.EditorFormatDefinition.ForegroundBrushId] as SolidColorBrush) != null) {
				if (scBrush.CanFreeze)
					scBrush.Freeze();
				newPen = InitializePen(new Pen(scBrush, PEN_THICKNESS), lineKind);
				newPen.Freeze();
			}
			else if ((newPen = props[VSTC.MarkerFormatDefinition.BorderId] as Pen) != null) {
				if (newPen.CanFreeze)
					newPen.Freeze();
			}

			return newPen;
		}
		protected AdvancedAppSettingsPageBase(CommonEditorOptions options) {
			if (options == null)
				throw new ArgumentNullException(nameof(options));
			this.options = options;
			ColumnLine0VM = new EnumListVM(hexColumnLineKindList);
			ColumnLine1VM = new EnumListVM(hexColumnLineKindList);
			ColumnGroupLine0VM = new EnumListVM(hexColumnLineKindList);
			ColumnGroupLine1VM = new EnumListVM(hexColumnLineKindList);

			ShowColumnLines = options.ShowColumnLines;
			RemoveExtraTextLineVerticalPixels = options.RemoveExtraTextLineVerticalPixels;
			SelectionMargin = options.SelectionMargin;
			GlyphMargin = options.GlyphMargin;
			ZoomControl = options.ZoomControl;
			EnableMouseWheelZoom = options.EnableMouseWheelZoom;
			ColumnLine0 = options.ColumnLine0;
			ColumnLine1 = options.ColumnLine1;
			ColumnGroupLine0 = options.ColumnGroupLine0;
			ColumnGroupLine1 = options.ColumnGroupLine1;
		}