Beispiel #1
0
        /// <summary>Initializes a new instance of the <see cref="HistoryToolbar"/> class.</summary>
        /// <param name="view">Host history view.</param>
        public HistoryToolbar(HistoryView view)
        {
            Verify.Argument.IsNotNull(view, "view");

            _view = view;

            _view.LogOptionsChanged += OnLogOptionsChanged;
            _view.RepositoryChanged += OnRepositoryChanged;

            Items.AddRange(
                new ToolStripItem[]
            {
                // left-aligned
                _btnRefresh = new ToolStripButton(Resources.StrRefresh, CachedResources.Bitmaps["ImgRefresh"], OnRefreshButtonClick)
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Image,
                },
                new ToolStripSeparator(),
                _btnDateOrder = new ToolStripButton(Resources.StrDateOrder, CachedResources.Bitmaps["ImgDateOrder"], OnDateOrderButtonClick)
                {
                    Checked      = _view.LogOptions.Order == RevisionQueryOrder.DateOrder,
                    DisplayStyle = ToolStripItemDisplayStyle.Image,
                },
                _btnTopoOrder = new ToolStripButton(Resources.StrTopoOrder, CachedResources.Bitmaps["ImgTopoOrder"], OnTopoOrderButtonClick)
                {
                    Checked      = _view.LogOptions.Order == RevisionQueryOrder.TopoOrder,
                    DisplayStyle = ToolStripItemDisplayStyle.Image,
                },
                new ToolStripSeparator(),
                _btnFilter = new ToolStripDropDownButton(GetFilterButtonText(), CachedResources.Bitmaps["ImgFilter"])
                {
                    DropDown            = new Popup(
                        _filterDropDown = new HistoryFilterDropDown()
                    {
                        LogOptions = _view.LogOptions,
                        Repository = _view.Repository,
                    })
                    {
                        Resizable = false,
                    },
                    ToolTipText = Resources.StrFilter,
                },
                _btnLimit = new ToolStripDropDownButton(string.Empty, null,
                                                        new ToolStripItem[]
                {
                    new ToolStripMenuItem(Resources.StrlUnlimited, null, OnLimitOptionClick)
                    {
                        Tag = 0
                    },
                    new ToolStripMenuItem("100 " + Resources.StrlCommits, null, OnLimitOptionClick)
                    {
                        Tag = 100
                    },
                    new ToolStripMenuItem("500 " + Resources.StrlCommits, null, OnLimitOptionClick)
                    {
                        Tag = 500
                    },
                    new ToolStripMenuItem("1000 " + Resources.StrlCommits, null, OnLimitOptionClick)
                    {
                        Tag = 1000
                    },
                    new ToolStripMenuItem("2000 " + Resources.StrlCommits, null, OnLimitOptionClick)
                    {
                        Tag = 2000
                    },
                    new ToolStripMenuItem("5000 " + Resources.StrlCommits, null, OnLimitOptionClick)
                    {
                        Tag = 5000
                    },
                })
                {
                    ToolTipText = Resources.StrsCommitLimit,
                },
                // right-aligned
                _btnShowDetails = new ToolStripButton(Resources.StrAutoShowDiff, CachedResources.Bitmaps["ImgDiff"], OnShowDetailsButtonClick)
                {
                    Checked      = _view.ShowDetails,
                    DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
                    Alignment    = ToolStripItemAlignment.Right,
                }
            });
            UpdateLimitButtonText();
        }
Beispiel #2
0
        /// <summary>Initializes a new instance of the <see cref="HistoryToolbar"/> class.</summary>
        /// <param name="view">Host history view.</param>
        public HistoryToolbar(HistoryView view)
        {
            Verify.Argument.IsNotNull(view, "view");

            _view = view;

            _view.LogOptionsChanged += OnLogOptionsChanged;
            _view.RepositoryChanged += OnRepositoryChanged;

            Items.AddRange(
                new ToolStripItem[]
                {
                    // left-aligned
                    _btnRefresh = new ToolStripButton(Resources.StrRefresh, CachedResources.Bitmaps["ImgRefresh"], OnRefreshButtonClick)
                        {
                            DisplayStyle = ToolStripItemDisplayStyle.Image,
                        },
                    new ToolStripSeparator(),
                    _btnDateOrder = new ToolStripButton(Resources.StrDateOrder, CachedResources.Bitmaps["ImgDateOrder"], OnDateOrderButtonClick)
                        {
                            Checked = _view.LogOptions.Order == RevisionQueryOrder.DateOrder,
                            DisplayStyle = ToolStripItemDisplayStyle.Image,
                        },
                    _btnTopoOrder = new ToolStripButton(Resources.StrTopoOrder, CachedResources.Bitmaps["ImgTopoOrder"], OnTopoOrderButtonClick)
                        {
                            Checked = _view.LogOptions.Order == RevisionQueryOrder.TopoOrder,
                            DisplayStyle = ToolStripItemDisplayStyle.Image,
                        },
                    new ToolStripSeparator(),
                    _btnFilter = new ToolStripDropDownButton(GetFilterButtonText(), CachedResources.Bitmaps["ImgFilter"])
                        {
                            DropDown = new Popup(
                                _filterDropDown = new HistoryFilterDropDown()
                                {
                                    LogOptions = _view.LogOptions,
                                    Repository = _view.Repository,
                                })
                                {
                                    Resizable = false,
                                },
                            ToolTipText = Resources.StrFilter,
                        },
                    _btnLimit = new ToolStripDropDownButton(string.Empty, null,
                        new ToolStripItem[]
                        {
                            new ToolStripMenuItem(Resources.StrlUnlimited, null, OnLimitOptionClick) { Tag = 0 },
                            new ToolStripMenuItem( "100 " + Resources.StrlCommits, null, OnLimitOptionClick) { Tag = 100 },
                            new ToolStripMenuItem( "500 " + Resources.StrlCommits, null, OnLimitOptionClick) { Tag = 500 },
                            new ToolStripMenuItem("1000 " + Resources.StrlCommits, null, OnLimitOptionClick) { Tag = 1000 },
                            new ToolStripMenuItem("2000 " + Resources.StrlCommits, null, OnLimitOptionClick) { Tag = 2000 },
                            new ToolStripMenuItem("5000 " + Resources.StrlCommits, null, OnLimitOptionClick) { Tag = 5000 },
                        })
                        {
                            ToolTipText = Resources.StrsCommitLimit,
                        },
                    // right-aligned
                    _btnShowDetails = new ToolStripButton(Resources.StrAutoShowDiff, CachedResources.Bitmaps["ImgDiff"], OnShowDetailsButtonClick)
                        {
                            Checked = _view.ShowDetails,
                            DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
                            Alignment = ToolStripItemAlignment.Right,
                        }
                });
            UpdateLimitButtonText();
        }