public FontSizeSelector(VisualizerDialog dialog) { _dialog = dialog; Size = new SizeF( 40 * dialog.WidthFactor, MenuItemHeight * dialog.HeightFactor).ToSize(); DropDownStyle = ComboBoxStyle.DropDownList; Items.AddRange(Enumerable.Range(6, 18).Cast <object>().ToArray()); SelectedItem = dialog.Settings.Font.Size; dialog.RegisterThemeable(this); SelectedIndexChanged += (sender, args) => { var selector = (FontSizeSelector)sender; var fontSize = (int)selector.SelectedItem; selector._dialog.Viewer.SetFontSize(fontSize); selector._dialog.Settings.Font.Size = fontSize; selector._dialog.Settings.Save(); }; }
public IndentLengthSelector(VisualizerDialog dialog) { _dialog = dialog; Size = new SizeF( 40 * dialog.WidthFactor, MenuItemHeight * dialog.HeightFactor).ToSize(); DropDownStyle = ComboBoxStyle.DropDownList; Items.AddRange(Enumerable.Range(1, 8).Cast <object>().ToArray()); SelectedItem = dialog.Settings.Indent.Length; dialog.RegisterThemeable(this); SelectedIndexChanged += (sender, args) => { var selector = (IndentLengthSelector)sender; var settings = selector._dialog.Settings; var indentCharacter = settings.Indent.FirstOrDefault(); var indentLength = (int)selector.SelectedItem; settings.Indent = new string(indentCharacter, indentLength); settings.Save(); selector._dialog.UpdateTranslation(); }; }
public SettingCheckBox( bool @checked, Action <VisualizerDialog, bool> optionSetter, VisualizerDialog dialog) { Checked = @checked; _optionSetter = optionSetter; _dialog = dialog; Size = new SizeF( SettingCheckBoxWidth * dialog.WidthFactor, MenuItemHeight * dialog.HeightFactor).ToSize(); CheckAlign = ContentAlignment.MiddleRight; dialog.RegisterThemeable(this); CheckedChanged += (sender, args) => { var checkbox = (SettingCheckBox)sender; checkbox._optionSetter.Invoke(checkbox._dialog, checkbox.Checked); checkbox._dialog.Settings.Save(); checkbox._dialog.UpdateTranslation(); }; }
public IndentTypeSelector(VisualizerDialog dialog) { _dialog = dialog; Size = new SizeF( 50 * dialog.WidthFactor, MenuItemHeight * dialog.HeightFactor).ToSize(); DropDownStyle = ComboBoxStyle.DropDownList; DisplayMember = "Key"; Items.AddRange(_options.Cast <object>().ToArray()); base.SelectedIndex = dialog.Settings.Indent.FirstOrDefault() == ' ' ? 0 : 1; dialog.RegisterThemeable(this); SelectedIndexChanged += (sender, args) => { var selector = (IndentTypeSelector)sender; var settings = selector._dialog.Settings; var indentCharacter = ((KeyValuePair <string, char>)selector.SelectedItem).Value; var indentLength = settings.Indent.Length; settings.Indent = new string(indentCharacter, indentLength); settings.Save(); selector._dialog.UpdateTranslation(); }; }
private static void UpdateSizeSettings(VisualizerDialog dialog, bool resizeToCode) { var sizeSettings = dialog.Settings.Size; sizeSettings.ResizeToMatchCode = resizeToCode; sizeSettings.UpdateFrom(dialog); }
public ThemeOption( VisualizerDialogTheme theme, VisualizerDialog dialog) { _theme = theme; _dialog = dialog; Size = new SizeF( ThemeOptionWidth * dialog.WidthFactor, MenuItemHeight * dialog.HeightFactor).ToSize(); Checked = theme.Name == dialog.Theme.Name; dialog.RegisterThemeable(this); base.Font = MenuItemFont; base.TextAlign = ContentAlignment.MiddleLeft; base.Text = theme.Name; CheckedChanged += (sender, args) => { var option = (ThemeOption)sender; if (option._dialog.Viewer.Uninitialised) { return; } if (Checked && (option == this)) { option._dialog.HandleThemeChanged(option._theme); } }; }
protected VisualizerDialogOptionBase( string labelText, string labelTooltip, bool isChecked, Action <VisualizerDialog, bool> optionSetter, VisualizerDialog dialog) : base(dialog) { _checkBox = new SettingCheckBox(isChecked, optionSetter, dialog); var label = new MenuItemLabel(labelText, labelTooltip, _checkBox.Width, dialog); label.Click += (sender, args) => { var control = (Control)sender; var option = control as VisualizerDialogOptionBase; while (option == null) { control = control.Parent; option = control as VisualizerDialogOptionBase; } option._checkBox.Checked = !option._checkBox.Checked; }; Controls.Add(label); Controls.Add(_checkBox); }
public FontFamilySelector(VisualizerDialog dialog) { _dialog = dialog; Size = new SizeF( FontSelectorWidth * dialog.WidthFactor, MenuItemHeight * dialog.HeightFactor).ToSize(); DropDownStyle = ComboBoxStyle.DropDownList; DrawMode = DrawMode.OwnerDrawFixed; DrawItem += WriteFontOption; DisplayMember = "Name"; Items.AddRange(_fonts ??= GetFonts()); var settingsName = _dialog.Settings.Font.Name; base.SelectedIndex = Array.FindIndex(_fonts, ff => ff.Name == settingsName); dialog.RegisterThemeable(this); SelectedIndexChanged += (sender, args) => { var selector = (FontFamilySelector)sender; var font = (Font)selector.SelectedItem; selector._dialog.Viewer.SetFontFamily(font); selector._dialog.Settings.Font.Name = font.Name; selector._dialog.Settings.Save(); }; }
public ResizeToMatchCodeSamplesOption(VisualizerDialog dialog) : base( "Resize viewer to match code", "Resize the debugger visualizer window to match the code samples it contains.", dialog.Settings.Size.ResizeToMatchCode, UpdateSizeSettings, dialog) { }
public ImplicitArrayTypeNamesOption(VisualizerDialog dialog) : base( "Show implicit array type names", "Show the names of implicitly-typed array types.", dialog.Settings.ShowImplicitArrayTypes, (dlg, isChecked) => dlg.Settings.ShowImplicitArrayTypes = isChecked, dialog) { }
public FullyQualifiedTypeNamesOption(VisualizerDialog dialog) : base( "Fully-qualify type names", "Fully qualify type names with their namespaces.", dialog.Settings.UseFullyQualifiedTypeNames, (dlg, isChecked) => dlg.Settings.UseFullyQualifiedTypeNames = isChecked, dialog) { }
protected MenuItemPanelBase(VisualizerDialog dialog) { FlowDirection = FlowDirection.LeftToRight; Width = (int)(DialogConstants.MenuWidth * dialog.WidthFactor); Padding = Padding.Empty; Margin = Padding.Empty; dialog.RegisterThemeable(this); }
public LambdaParameterTypeNamesOption(VisualizerDialog dialog) : base( "Show lambda parameter type names", "Show the names of lambda parameter types.", dialog.Settings.ShowLambdaParameterTypeNames, (dlg, isChecked) => dlg.Settings.ShowLambdaParameterTypeNames = isChecked, dialog) { }
public ExplicitGenericParamsOption(VisualizerDialog dialog) : base( "Use explicit generic arguments", "Always specify generic parameter arguments explicitly in <pointy braces>", dialog.Settings.UseExplicitGenericParameters, (dlg, isChecked) => dlg.Settings.UseExplicitGenericParameters = isChecked, dialog) { }
public QuotedLambdaCommentsOption(VisualizerDialog dialog) : base( "Comment Quoted Lambdas", "Annotate Quoted Lambda Expressions with a comment indicating they have been Quoted.", dialog.Settings.ShowQuotedLambdaComments, (dlg, isChecked) => dlg.Settings.ShowQuotedLambdaComments = isChecked, dialog) { }
protected override void Show( IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (var dialog = new VisualizerDialog(objectProvider.GetObject)) { windowService.ShowDialog(dialog); } }
public DeclareOutParamsInlineOption(VisualizerDialog dialog) : base( "Declare out params inline", "Declare output parameter variables inline with the " + "method call where they are first used.", dialog.Settings.DeclareOutputParametersInline, (dlg, isChecked) => dlg.Settings.DeclareOutputParametersInline = isChecked, dialog) { }
public ExplicitTypeNamesOption(VisualizerDialog dialog) : base( "Use explicit type names", "Use full type names instead of 'var' for local and " + "inline-declared output parameter variables.", dialog.Settings.UseExplicitTypeNames, (dlg, isChecked) => dlg.Settings.UseExplicitTypeNames = isChecked, dialog) { }
public VisualizerOptionsMenuItem(VisualizerDialog dialog) : base("Options") { _dialog = dialog; ((ToolStripDropDownMenu)DropDown).ShowImageMargin = false; dialog.RegisterThemeable(DropDown); DropDownOpening += (sender, args) => ((VisualizerOptionsMenuItem)sender).Populate(); }
public VisualizerViewerPanel(VisualizerDialog dialog) { base.Dock = DockStyle.Fill; base.AutoSize = true; dialog.RegisterThemeable(this); Viewer = new VisualizerViewer(this, dialog); Controls.Add(Viewer); }
public FeedbackButton(VisualizerDialog dialog) { base.Text = "Feedback"; base.TextAlign = ContentAlignment.MiddleRight; Margin = new Padding(2); TextImageRelation = TextImageRelation.ImageBeforeText; ImageAlign = ContentAlignment.MiddleLeft; _imageHeight = Height - 4; dialog.RegisterThemeable(this); Click += (sender, args) => Process.Start("https://github.com/agileobjects/ReadableExpressions/issues/new"); }
public IndentSelector(VisualizerDialog dialog) : base(dialog) { var indentLengthSelector = new IndentLengthSelector(dialog); var indentTypeSelector = new IndentTypeSelector(dialog); var label = new MenuItemLabel( "Indent using", "Set the visualizer code indent", indentLengthSelector.Width + indentTypeSelector.Width, dialog); Controls.Add(label); Controls.Add(indentLengthSelector); Controls.Add(indentTypeSelector); }
public FontSelector(VisualizerDialog dialog) : base(dialog) { var fontFamilySelector = new FontFamilySelector(dialog); var fontSizeSelector = new FontSizeSelector(dialog); var label = new MenuItemLabel( "Code sample font", "Set the visualizer code font", fontFamilySelector.Width + fontSizeSelector.Width, dialog); Controls.Add(label); Controls.Add(fontFamilySelector); Controls.Add(fontSizeSelector); }
public ThemeSelector(VisualizerDialog dialog) : base(dialog) { var lightTheme = new ThemeOption(Light, dialog); var darkTheme = new ThemeOption(Dark, dialog); var label = new MenuItemLabel( "Theme", "Set the visualizer theme", lightTheme.Width + darkTheme.Width, dialog); Controls.Add(label); Controls.Add(lightTheme); Controls.Add(darkTheme); }
public CopyButton(VisualizerDialog dialog) { _dialog = dialog; base.Text = "Copy"; Margin = new Padding(2); dialog.RegisterThemeable(this); Click += (sender, args) => { var copyButton = (CopyButton)sender; var unformatted = copyButton._dialog.Viewer.GetContentRaw(); Clipboard.SetText(unformatted); }; }
public VisualizerViewer(Panel parent, VisualizerDialog dialog) { _parent = parent; _dialog = dialog; AllowNavigation = false; var font = _dialog.Settings.Font; base.Font = new Font(font.Name, font.Size, GraphicsUnit.Point); Resize += (sender, args) => { var viewer = (VisualizerViewer)sender; viewer._parent.Size = viewer.Size; }; dialog.RegisterThemeable(this); }
public MenuItemLabel( string text, string tooltip, int controlWidth, VisualizerDialog dialog) { Size = new SizeF( MenuWidth * dialog.WidthFactor - controlWidth, MenuItemHeight * dialog.HeightFactor).ToSize(); dialog.RegisterThemeable(this); base.Font = MenuItemFont; base.TextAlign = ContentAlignment.MiddleLeft; base.Text = text; dialog.ToolTip.SetToolTip(this, tooltip); }
public static bool UpdateFrom(this VisualizerDialogSizeSettings settings, VisualizerDialog dialog) { var currentInitialWidth = settings.InitialWidth; var currentInitialHeight = settings.InitialHeight; if (settings.ResizeToMatchCode) { settings.InitialWidth = null; settings.InitialHeight = null; } else { settings.InitialWidth = dialog.Viewer.Width; settings.InitialHeight = dialog.Viewer.Height; } return(settings.InitialWidth != currentInitialWidth || settings.InitialHeight != currentInitialHeight); }
public VisualizerDialogRenderer(VisualizerDialog dialog) : base(dialog.ColourTable) { _dialog = dialog; }
public VisualizerDialogColourTable(VisualizerDialog dialog) { _dialog = dialog; }