public DiffToolbar(DiffView diffView) { Verify.Argument.IsNotNull(diffView, "diffView"); _diffView = diffView; Items.Add(new ToolStripButton(Resources.StrRefresh, CachedResources.Bitmaps["ImgRefresh"], (sender, e) => { _diffView.RefreshContent(); }) { DisplayStyle = ToolStripItemDisplayStyle.Image, }); Items.Add(new ToolStripSeparator()); Items.Add(new ToolStripLabel(Resources.StrContext.AddColon(), null)); Items.Add(new ToolStripButton(Resources.StrLessContext, CachedResources.Bitmaps["ImgLessContext"], (sender, e) => DecrementContext()) { DisplayStyle = ToolStripItemDisplayStyle.Image, }); Items.Add(_contextTextBox = new ToolStripTextBox() { Text = _diffView.DiffOptions.Context.ToString(CultureInfo.InvariantCulture), TextBoxTextAlign = HorizontalAlignment.Right, ControlAlign = ContentAlignment.MiddleCenter, AutoSize = false, Size = new Size(40, 20), MaxLength = 4, ShortcutsEnabled = false, }); Items.Add(new ToolStripButton(Resources.StrMoreContext, CachedResources.Bitmaps["ImgMoreContext"], (sender, e) => IncrementContext()) { DisplayStyle = ToolStripItemDisplayStyle.Image, }); Items.Add(new ToolStripSeparator()); Items.Add(_ddbOptions = new ToolStripDropDownButton(Resources.StrOptions, CachedResources.Bitmaps["ImgConfig"]) { }); _ddbOptions.DropDownItems.Add(_mnuIgnoreWhitespace = new ToolStripMenuItem(Resources.StrsIgnoreWhitespace, null, OnIgnoreWhitespaceClick) { Checked = _diffView.DiffOptions.IgnoreWhitespace, }); _ddbOptions.DropDownItems.Add(_mnuUsePatienceAlgorithm = new ToolStripMenuItem(Resources.StrsUsePatienceDiffAlgorithm, null, OnUsePatienceAlgorithmClick) { Checked = _diffView.DiffOptions.UsePatienceAlgorithm, }); _ddbOptions.DropDownItems.Add(_mnuBinaryDiff = new ToolStripMenuItem(Resources.StrBinary, null, OnBinaryClick) { Checked = _diffView.DiffOptions.Binary, }); Items.Add(_btnSplitMode = new ToolStripButton(Resources.StrDiffSplitView, CachedResources.Bitmaps["ImgDiffSplitView"], (s, e) => _diffView.ViewMode = DiffViewMode.Split) { DisplayStyle = ToolStripItemDisplayStyle.Image, Alignment = ToolStripItemAlignment.Right, Checked = _diffView.ViewMode == DiffViewMode.Split, }); Items.Add(_btnSingleMode = new ToolStripButton(Resources.StrDiffSingleView, CachedResources.Bitmaps["ImgDiffSingleView"], (s, e) => _diffView.ViewMode = DiffViewMode.Single) { DisplayStyle = ToolStripItemDisplayStyle.Image, Alignment = ToolStripItemAlignment.Right, Checked = _diffView.ViewMode == DiffViewMode.Single, }); _contextTextBox.TextChanged += OnContextTextChanged; _contextTextBox.KeyPress += (sender, e) => e.Handled = !char.IsNumber(e.KeyChar); _diffView.ViewModeChanged += OnDiffViewViewModeChanged; }
public DiffToolbar(DiffView diffView) { Verify.Argument.IsNotNull(diffView, nameof(diffView)); _diffView = diffView; Items.Add(new ToolStripButton(Resources.StrRefresh, CachedResources.Bitmaps["ImgRefresh"], (sender, e) => { _diffView.RefreshContent(); }) { DisplayStyle = ToolStripItemDisplayStyle.Image, }); Items.Add(new ToolStripSeparator()); Items.Add(new ToolStripLabel(Resources.StrContext.AddColon(), null)); Items.Add(new ToolStripButton(Resources.StrLessContext, CachedResources.Bitmaps["ImgLessContext"], (sender, e) => DecrementContext()) { DisplayStyle = ToolStripItemDisplayStyle.Image, }); Items.Add(_contextTextBox = new ToolStripTextBox() { Text = _diffView.DiffOptions.Context.ToString(CultureInfo.InvariantCulture), TextBoxTextAlign = HorizontalAlignment.Right, ControlAlign = ContentAlignment.MiddleCenter, AutoSize = false, Size = new Size(40, 20), MaxLength = 4, ShortcutsEnabled = false, }); Items.Add(new ToolStripButton(Resources.StrMoreContext, CachedResources.Bitmaps["ImgMoreContext"], (sender, e) => IncrementContext()) { DisplayStyle = ToolStripItemDisplayStyle.Image, }); Items.Add(new ToolStripSeparator()); Items.Add(_ddbOptions = new ToolStripDropDownButton(Resources.StrOptions, CachedResources.Bitmaps["ImgConfig"]) { }); _ddbOptions.DropDownItems.Add(_mnuIgnoreWhitespace = new ToolStripMenuItem(Resources.StrsIgnoreWhitespace, null, OnIgnoreWhitespaceClick) { Checked = _diffView.DiffOptions.IgnoreWhitespace, }); _ddbOptions.DropDownItems.Add(_mnuUsePatienceAlgorithm = new ToolStripMenuItem(Resources.StrsUsePatienceDiffAlgorithm, null, OnUsePatienceAlgorithmClick) { Checked = _diffView.DiffOptions.UsePatienceAlgorithm, }); _ddbOptions.DropDownItems.Add(_mnuBinaryDiff = new ToolStripMenuItem(Resources.StrBinary, null, OnBinaryClick) { Checked = _diffView.DiffOptions.Binary, }); Items.Add(_btnSplitMode = new ToolStripButton(Resources.StrDiffSplitView, CachedResources.Bitmaps["ImgDiffSplitView"], (s, e) => _diffView.ViewMode = DiffViewMode.Split) { DisplayStyle = ToolStripItemDisplayStyle.Image, Alignment = ToolStripItemAlignment.Right, Checked = _diffView.ViewMode == DiffViewMode.Split, }); Items.Add(_btnSingleMode = new ToolStripButton(Resources.StrDiffSingleView, CachedResources.Bitmaps["ImgDiffSingleView"], (s, e) => _diffView.ViewMode = DiffViewMode.Single) { DisplayStyle = ToolStripItemDisplayStyle.Image, Alignment = ToolStripItemAlignment.Right, Checked = _diffView.ViewMode == DiffViewMode.Single, }); _contextTextBox.TextChanged += OnContextTextChanged; _contextTextBox.KeyPress += (sender, e) => e.Handled = !char.IsNumber(e.KeyChar); _diffView.ViewModeChanged += OnDiffViewViewModeChanged; }