Esempio n. 1
0
        /// <summary>Create <see cref="StashSaveDialog"/>.</summary>
        /// <param name="repository">Repository for performing stash save.</param>
        /// <exception cref="ArgumentNullException"><paramref name="repository"/> == <c>null</c>.</exception>
        public StashSaveDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            InitializeComponent();

            Text = Resources.StrStashSave;

            _lblMessage.Text = Resources.StrOptionalMessage.AddColon();
            _chkKeepIndex.Text = Resources.StrKeepIndex;
            _chkIncludeUntrackedFiles.Text = Resources.StrsIncludeUntrackedFiles;
            if(!GitFeatures.StashIncludeUntrackedOption.IsAvailableFor(repository))
            {
                _chkIncludeUntrackedFiles.Enabled = false;
                _chkIncludeUntrackedFiles.Text += " " +
                    Resources.StrfVersionRequired
                             .UseAsFormat(GitFeatures.StashIncludeUntrackedOption.RequiredVersion)
                             .SurroundWithBraces();
            }

            ToolTipService.Register(_chkKeepIndex, Resources.TipStashKeepIndex);

            GitterApplication.FontManager.InputFont.Apply(_txtMessage);

            if(SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }
        }
Esempio n. 2
0
        public CommitDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                _messageInput     = new TextBoxInputSource(_txtMessage),
                _amendInput       = new CheckBoxInputSource(_chkAmend),
                _stagedItemsInput = new ControlInputSource(_lstStaged),
            };
            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            for(int i = 0; i < _lstStaged.Columns.Count; ++i)
            {
                var col = _lstStaged.Columns[i];
                col.IsVisible = col.Id == (int)ColumnId.Name;
            }

            _lstStaged.Columns[0].SizeMode = ColumnSizeMode.Auto;
            _lstStaged.Style = GitterApplication.DefaultStyle;
            _lstStaged.SetTree(repository.Status.StagedRoot, TreeListBoxMode.ShowFullTree);
            _lstStaged.ExpandAll();

            _chkAmend.Enabled = !repository.Head.IsEmpty;

            GitterApplication.FontManager.InputFont.Apply(_txtMessage);
            if(SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }

            _txtMessage.Text = repository.Status.LoadCommitMessage();
            _txtMessage.Height = _chkAmend.Top - _txtMessage.Top - 2;

            _controller = new CommitController(repository) { View = this };
        }
Esempio n. 3
0
        /// <summary>Create <see cref="AddNoteDialog"/>.</summary>
        /// <param name="repository">Repository to create note in.</param>
        public AddNoteDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            InitializeComponent();

            var inputs = new IUserInputSource[]
            {
                _revisionInput = new ControlInputSource(_txtRevision),
                _messageInput  = new TextBoxInputSource(_txtMessage),
            };
            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            Text = Resources.StrAddNote;

            _txtRevision.References.LoadData(
                _repository,
                ReferenceType.Reference,
                GlobalBehavior.GroupReferences,
                GlobalBehavior.GroupRemoteBranches);
            _txtRevision.References.Items[0].IsExpanded = true;

            _txtRevision.Text = GitConstants.HEAD;

            _lblRevision.Text = Resources.StrRevision.AddColon();
            _lblMessage.Text = Resources.StrMessage.AddColon();

            GitterApplication.FontManager.InputFont.Apply(_txtRevision, _txtMessage);
            if(SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }
            _controller = new AddNoteController(repository) { View = this };
        }
Esempio n. 4
0
        /// <summary>Create <see cref="CreateTagDialog"/>.</summary>
        /// <param name="repository"><see cref="Repository"/> to create <see cref="Tag"/> in.</param>
        /// <exception cref="ArgumentNullException"><paramref name="repository"/> == <c>null</c>.</exception>
        public CreateTagDialog(Repository repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            _repository = repository;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                _tagNameInput   = new TextBoxInputSource(_txtName),
                _revisionInput  = new ControlInputSource(_txtRevision),
                _messageInput   = new TextBoxInputSource(_txtMessage),
                _annotatedInput = new RadioButtonInputSource(_radAnnotated),
                _signedInput    = new RadioButtonInputSource(_radSigned),
                _useKeyIdInput  = new RadioButtonInputSource(_radUseKeyId),
                _keyIdInput     = new TextBoxInputSource(_txtKeyId),
            };

            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtName, ReferenceType.Tag);

            _txtRevision.References.LoadData(
                _repository,
                ReferenceType.Reference,
                GlobalBehavior.GroupReferences,
                GlobalBehavior.GroupRemoteBranches);
            _txtRevision.References.Items[0].IsExpanded = true;

            GitterApplication.FontManager.InputFont.Apply(_txtKeyId, _txtMessage, _txtName, _txtRevision);
            GlobalBehavior.SetupAutoCompleteSource(_txtRevision, _repository, ReferenceType.Branch);
            if(SpellingService.Enabled)
            {
                _speller = new TextBoxSpellChecker(_txtMessage, true);
            }

            _controller = new CreateTagController(repository) { View = this };
        }
Esempio n. 5
0
        public CommitView(GuiProvider gui)
            : base(Guids.CommitViewGuid, gui)
        {
            InitializeComponent();

            Text = Resources.StrCommit;

            _treeMode = true;

            _splitContainer.BackColor = GitterApplication.Style.Colors.WorkArea;
            _splitContainer.Panel1.BackColor = GitterApplication.Style.Colors.Window;
            _splitContainer.Panel2.BackColor = GitterApplication.Style.Colors.Window;

            _lblStaged.Text = Resources.StrsStagedChanges.AddColon();
            _lstStaged.Text = Resources.StrsNoStagedChanges;
            _lblUnstaged.Text = Resources.StrsUnstagedChanges.AddColon();
            _lstUnstaged.Text = Resources.StrsNoUnstagedChanges;
            _lblMessage.Text = Resources.StrMessage.AddColon();
            _chkAmend.Text = Resources.StrAmend;
            _btnCommit.Text = Resources.StrCommit;

            _lstStaged.PreviewKeyDown += OnKeyDown;
            _lstUnstaged.PreviewKeyDown += OnKeyDown;
            _txtMessage.PreviewKeyDown += OnKeyDown;
            _chkAmend.Control.PreviewKeyDown += OnKeyDown;
            _btnCommit.Control.PreviewKeyDown += OnKeyDown;

            if(GitterApplication.Style.Type == GitterStyleType.DarkBackground)
            {
                _txtMessage.BorderStyle = BorderStyle.FixedSingle;
            }

            GitterApplication.FontManager.InputFont.Apply(_txtMessage);

            _lstStaged.Columns[0].SizeMode = ColumnSizeMode.Auto;
            _lstUnstaged.Columns[0].SizeMode = ColumnSizeMode.Auto;

            _lstStaged.ItemActivated += OnStagedItemActivated;
            _lstUnstaged.ItemActivated += OnUnstagedItemActivated;

            _lstStaged.GotFocus += OnStagedGotFocus;
            _lstUnstaged.GotFocus += OnUnstagedGotFocus;

            for(int i = 0; i < _lstUnstaged.Columns.Count; ++i)
            {
                var column = _lstUnstaged.Columns[i];
                column.IsVisible = column.Id == (int)ColumnId.Name;
            }

            for(int i = 0; i < _lstStaged.Columns.Count; ++i)
            {
                var column = _lstStaged.Columns[i];
                column.IsVisible = column.Id == (int)ColumnId.Name;
            }

            _txtMessage.BackColor = GitterApplication.Style.Colors.Window;
            _txtMessage.ForeColor = GitterApplication.Style.Colors.WindowText;

            AddTopToolStrip(_toolbar = new CommitToolbar(this));
            _speller = new TextBoxSpellChecker(_txtMessage, true);
        }