Exemple #1
0
        public FormUnstash()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            PopulateStashList();
        }
Exemple #2
0
        public FormNewBranch()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            branches = App.Repos.Current.Branches;
        }
Exemple #3
0
        public FormDeleteRepo(string root)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            dir = textPath.Text = root;
        }
        public FormNewRepoScan()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            checkBoxDeepScan.Checked = Properties.Settings.Default.RepoDeepScan;
        }
Exemple #5
0
        /// <summary>
        /// Create a commit form or new/update form
        /// </summary>
        public FormCommit(bool forCommit, string description)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            textDescription.Font = Properties.Settings.Default.commitFont;

            // If we are updating the change, the function is slightly different:
            // The default text is different and the checkbox copies a previous
            // description for the amend operation.
            if (forCommit == false)
            {
                btCommit.Text   = "Update";
                checkAmend.Text = "Copy description of a previous change for the amend operation";
            }

            // Fetch the description of a previous commit for the amend option
            ExecResult result = App.Repos.Current.Run("log --pretty=format:%s%n%b -1");

            if (result.Success())
            {
                amendText = result.stdout;
                // BUG: We are losing newlines with App.Repos.Current.Run. At least insert one after the subject line.
                if (amendText.IndexOf(Environment.NewLine) > 0)
                {
                    amendText = amendText.Insert(amendText.IndexOf(Environment.NewLine), Environment.NewLine);
                }
            }
            else
            {
                amendText = "Unknown";
            }
            textDescription.Text = description;
            textDescription.SelectAll();
        }
Exemple #6
0
        /// <summary>
        /// Form constructor. Takes the git file name whose history is to be shown.
        /// </summary>
        public FormRevisionHistory(string targetFile)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // WAR: On Linux, remove status bar resizing grip (since it does not work under X)
            if (ClassUtils.IsMono())
            {
                statusStrip.SizingGrip = false;
            }

            // Apply the same font we use for description of changes
            textDescription.Font = Properties.Settings.Default.commitFont;

            file = targetFile;
            Sha  = String.Empty;

            // Show complete path to the file being examined using the OS specific path separator
            Text = @"Revision History for " + App.Repos.Current.Root.Replace('\\', Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar + targetFile.Replace('\\', Path.DirectorySeparatorChar);
            // If the path specifies a folder (for example, user clicked on the root repo name on the view pane), add "..."
            if (Text[Text.Length - 1] == Path.DirectorySeparatorChar)
            {
                Text = Text + "...";
            }
        }
Exemple #7
0
        public FormRemoteEdit(ClassRepo repo)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            userControlRemotesEdit.SetRepo(repo);
        }
Exemple #8
0
        /// <summary>
        /// Form constructor
        /// </summary>
        public FormHttpsAuth(bool enableUsername)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            textUsername.Enabled = enableUsername;
        }
        public FormMergeBranch()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            ClassBranches branches = App.Repos.Current.Branches;

            labelCurrentBranchName.Text = "Current branch is \"" + branches.Current + "\"";

            // Add all available branches to the list of branches to merge
            foreach (var branch in branches.Local)
            {
                listBranches.Items.Add(branch);
            }

            foreach (var branch in branches.Remote)
            {
                listBranches.Items.Add(branch);
            }

            listBranches.Items.RemoveAt(listBranches.Items.IndexOf(branches.Current));

            if (listBranches.Items.Count > 0)
            {
                listBranches.SelectedIndex = 0;
                btMerge.Enabled            = true;
            }
        }
        public FormCustomizeTools(ClassCustomTools customTools)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            CustomTools = customTools.Copy();
            RefreshList(0);
        }
        public FormChangelistFilter()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            dateTimeBefore.Value = DateTime.Today;
            dateTimeAfter.Value  = DateTime.Today;
        }
        /// <summary>
        /// Constructor that takes:
        ///     form title string (used to display description of the query)
        ///     initial argument string
        ///     flag whether to show or now Browse... button
        /// </summary>
        public FormCustomToolArgs(string desc, string args, bool isBrowse)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            Text             = desc;
            btBrowse.Visible = isBrowse;
            comboArgs.Text   = args;
        }
Exemple #13
0
        private readonly string cr;     // Just a convinient shortcut

        /// <summary>
        /// Constructor, set the same font as for commit text box.
        /// </summary>
        public FormShowChangelist()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);
            cr = Environment.NewLine;

            textChangelist.Font     = Properties.Settings.Default.commitFont;
            comboShow.SelectedIndex = Properties.Settings.Default.ShowFormatIndex;
        }
        public FormSwitchToBranch()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Initialize the list of local branches to switch to
            foreach (var branch in App.Repos.Current.Branches.Local)
            {
                listBranches.Items.Add(branch);
            }
        }
        public FormNewRepoStep1()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            Type  = "empty";
            Local = String.Empty;

            // Set the default remote name
            Remote.Name    = "origin";
            Remote.PushCmd = "";
            remoteDisplay.Set(Remote);
            remoteDisplay.AnyTextChanged += SomeTextChanged;
        }
Exemple #16
0
        public FormCommitMerge(bool forCommit, string description)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            textDescription.Font = Properties.Settings.Default.commitFont;

            // If we are updating the change, the function is slightly different.
            if (forCommit == false)
            {
                btCommit.Text = "Update";
            }

            textDescription.Text = description;
            textDescription.SelectAll();
        }
Exemple #17
0
        /// <summary>
        /// Constructor for the Delete Branch operation.
        /// It is given a name of the branch to select by default.
        /// </summary>
        public FormDeleteBranch(string defaultBranch)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            branches           = App.Repos.Current.Branches;
            this.defaultBranch = defaultBranch;

            // Initialize local branches as the default view.
            // This assignment will call "RadioButton1CheckedChanged" since
            // we initialized this radio button to not-checked in the designer.
            radioLocalBranch.Checked = true;

            // Restore the state of the Force delete option
            checkForce.Checked = Properties.Settings.Default.ForceDeleteBranch;
        }
Exemple #18
0
        /// <summary>
        /// Form constructor
        /// </summary>
        public FormSSH()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Add button click handlers that will expand the list of existing fetch and push URLs
            _menuHosts.ItemClicked += MenuHostsItemClicked;

            string[] keys = Properties.Settings.Default.PuTTYKeys.
                            Split((",").ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            listBoxKeys.Items.AddRange(keys);

            phrases = App.Putty.GetPassPhrases();
            RefreshPf();
            RefreshRemoteHosts();
        }
Exemple #19
0
        /// <summary>
        /// Class constructor that also pre-sets the command and argument to be run
        /// </summary>
        public FormGitRun(string cmd, string args)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);
            checkAutoclose.Checked = Properties.Settings.Default.AutoCloseGitOnSuccess;

            // Detect URL in this text box
            textStdout.DetectUrls = true;

            job = new Exec(cmd, args);

            // Reuse the same font selected as fixed-pitch
            textStdout.Font  = Properties.Settings.Default.commitFont;
            textStdout.Text += cmd + Environment.NewLine;
            textStdout.Text += args + Environment.NewLine;
        }
Exemple #20
0
        public FormLog()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Add our main print function callback delegate
            App.PrintLogMessage += Print;

            if (App.AppLog != null)
            {
                Print("Logging: " + App.AppLog, MessageType.General);
            }

            // Prints only in Debug build...
            Debug("Debug build.");
        }
Exemple #21
0
        public FormRepoEdit(ClassRepo targetRepo)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);
            repo = targetRepo;

            // Add all user panels to the base repo edit panel; call their init
            foreach (KeyValuePair <string, UserControl> key in panels)
            {
                panel.Controls.Add(key.Value);
                (key.Value as IRepoSettings).Init(repo);
                key.Value.Dock = DockStyle.Fill;
            }

            // Expand the tree and select the first node
            treeSections.ExpandAll();
            treeSections.SelectedNode = treeSections.Nodes[0].Nodes[0];
        }
Exemple #22
0
        /// <summary>
        /// Form constructor. Takes the git file name whose history is to be shown.
        /// </summary>
        public FormRevisionHistory(string targetFile)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Apply the same font we use for description of changes
            textDescription.Font = Properties.Settings.Default.commitFont;

            file = targetFile;
            Sha  = String.Empty;

            // Show complete path to the file being examined using the OS specific path separator
            Text = @"Revision History for " + App.Repos.Current.Path.Replace('\\', Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar + targetFile.Replace('\\', Path.DirectorySeparatorChar);
            // If the path specifies a folder (for example, user clicked on the root repo name on the view pane), add "..."
            if (Text[Text.Length - 1] == Path.DirectorySeparatorChar)
            {
                Text = Text + "...";
            }
        }
Exemple #23
0
        public FormSettings()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            Cursor.Current = Cursors.WaitCursor;
            // Add all user panels to the base options panel; call their init
            foreach (KeyValuePair <string, UserControl> key in panels)
            {
                panel.Controls.Add(key.Value);
                (key.Value as IUserSettings).Init(config);
                key.Value.Dock = DockStyle.Fill;
            }

            // Expand the tree and select the first node
            treeSections.ExpandAll();
            treeSections.SelectedNode = treeSections.Nodes[0].Nodes[0];
            Cursor.Current            = Cursors.Default;
        }
Exemple #24
0
        /// <summary>
        /// Form constructor
        /// </summary>
        public FormHttps()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Add button click handlers that will expand the list of existing fetch and push URLs
            _menuHosts.ItemClicked += MenuHostsItemClicked;

            string user = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

            netrcfilename = Path.Combine(user, ClassUtils.IsMono() ? ".netrc" : "_netrc");
            App.PrintStatusMessage("Using file " + netrcfilename, MessageType.Debug);

            // Load the .netrc file if it exists, ignore if it does not (we will create it on save)
            if (File.Exists(netrcfilename))
            {
                LoadNetrc(netrcfilename);
                PopulateNetrcView();
            }
        }
Exemple #25
0
        public FormAbout()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Add the version number and the build date from the assembly info file
            labelVersion.Text = "Version " + ClassVersion.GetVersion();
            labelBuild.Text   = ClassVersion.GetBuild();

            // If there is a new version available, show the label and a button
            labelNewVersionAvailable.Visible = btDownload.Visible = App.Version.NewVersionAvailable;

            textLic.Text =
                "THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR " +
                "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," +
                "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE " +
                "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER " +
                "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, " +
                "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +
                "THE SOFTWARE.";
        }
Exemple #26
0
        public FormEditTools(ClassTool tool)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);
            Tool = (ClassTool)tool.Clone();

            textName.Text = tool.Name;
            textCmd.Text  = tool.Cmd;
            textArgs.Text = tool.Args;
            textDir.Text  = tool.Dir;
            textDesc.Text = tool.Desc;
            checkAddToContextMenu.Checked = tool.IsAddToContextMenu;
            checkConsoleApp.Checked       = tool.IsConsoleApp;
            checkWriteToStatus.Checked    = tool.IsWriteOutput;
            checkCloseUponExit.Checked    = tool.IsCloseWindowOnExit;
            checkRefresh.Checked          = tool.IsRefresh;
            checkPrompt.Checked           = tool.IsPromptForArgs;
            checkBrowse.Checked           = tool.IsAddBrowse;

            // TODO: Running a command line tool largely does not work on Linux at the moment
            if (ClassUtils.IsMono())
            {
                checkWriteToStatus.Enabled = checkCloseUponExit.Enabled = false;
                checkWriteToStatus.Checked = checkCloseUponExit.Checked = false;
                checkConsoleApp.Checked    = true; // FIXME: Some success when this is checked
            }

            // Adjust the enables (in this order)
            CheckCloseUponExitCheckedChanged(null, null);
            CheckConsoleAppCheckedChanged(null, null);

            // Set the width of drop-down portions of help combo box so when it expands (down)
            // it will show horizontally the complete text from all pre-defined lines.
            // Also set their tags to point to the buddy edit boxes into which to insert selected tokens.
            SetComboBoxWidth(comboHelpArg);
            comboHelpArg.Tag = textArgs;
            SetComboBoxWidth(comboHelpDir);
            comboHelpDir.Tag = textDir;
        }
Exemple #27
0
        public FormLog()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Add our main print function callback delegate
            App.PrintLogMessage += Print;

            // WAR: On Linux, remove status bar resizing grip (since it does not work under X)
            if (ClassUtils.IsMono())
            {
                statusStrip.SizingGrip = false;
            }

            if (App.AppLog != null)
            {
                Print("Logging: " + App.AppLog, MessageType.General);
            }

            // Prints only in Debug build...
            Debug("Debug build.");
        }
Exemple #28
0
        /// <summary>
        /// Class constructor that also pre-sets the command and argument to be run
        /// </summary>
        public FormGitRun(string cmd, string args)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);
            checkAutoclose.Checked = Properties.Settings.Default.AutoCloseGitOnSuccess;

            // WAR: On Linux, remove status bar resizing grip (since it does not work under X)
            if (ClassUtils.IsMono())
            {
                statusStrip.SizingGrip = false;
            }

            // Detect URL in this text box
            textStdout.DetectUrls = true;

            job = new Exec(cmd, args);

            // Reuse the same font selected as fixed-pitch
            textStdout.Font  = Properties.Settings.Default.commitFont;
            textStdout.Text += cmd + Environment.NewLine;
            textStdout.Text += args + Environment.NewLine;
        }
Exemple #29
0
        public FormRepoEdit(ClassRepo targetRepo)
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);
            repo = targetRepo;

            // Get all local configuration strings and assign various panel controls.
            // This is placed first, before initializing the user panels, so that the
            // strings are accessible to individual panels should they need to use them.
            // TODO: This is not needed for now
            //string[] config = _repo.Run("config --local --list -z").Split('\0');

            // Add all user panels to the base repo edit panel; call their init
            foreach (KeyValuePair <string, UserControl> key in panels)
            {
                panel.Controls.Add(key.Value);
                (key.Value as IRepoSettings).Init(repo);
                key.Value.Dock = DockStyle.Fill;
            }

            // Expand the tree and select the first node
            treeSections.ExpandAll();
            treeSections.SelectedNode = treeSections.Nodes[0].Nodes[0];
        }
Exemple #30
0
        /// <summary>
        /// This is the main entry point to the application main form.
        /// </summary>
        public FormMain()
        {
            InitializeComponent();
            ClassWinGeometry.Restore(this);

            // Initialize panels
            // Left panel:
            splitContainer2.Panel1.Controls.Add(PanelView);
            PanelView.Dock = DockStyle.Fill;

            // Right set of panels:
            foreach (var panel in PanelsR)
            {
                var tabPage = new TabPage(panel.Key)
                {
                    Name = panel.Key, Tag = panel.Key, ToolTipText = panel.Key + " (" + PanelsRShortcuts[panel.Key] + ")"
                };
                panel.Value.Dock = DockStyle.Fill;
                tabPage.Controls.Add(panel.Value);
                rightTabControl.TabPages.Add(tabPage);
            }

            // Show or hide command line
            menuViewCommandLine.Checked = cmdBox.Visible = Properties.Settings.Default.ShowCommandLine;

            UpdateRightPaneTabsShowState();

            // Enable SSH only if the PuTTY support class has been instantiated
            if (App.Putty != null)
            {
                btSsh.Enabled = true;
                menuMainManageKeys.Enabled = true;
            }

            // We prevent Log window form closing by getting a FormClosing event within which we set "e.Cancel" to True
            App.Log.FormClosing      += LogWindowToolStripMenuItemClick;
            menuViewLogWindow.Checked = Properties.Settings.Default.ShowLogWindow;

            // Add all callback handlers
            App.Refresh            += FormMainRefresh; // Refresh, when any component wants to update the global state
            App.PrintStatusMessage += PrintStatus;     // Print a line of status message
            App.StatusBusy         += SetBusy;         // Busy flag set or reset

            // Register toolbar file buttons with the View panel
            PanelView.RegisterToolstripFileButtons(new Dictionary
                                                   <PanelView.FileOps, ToolStripButton>
            {
                { PanelView.FileOps.Add, btAdd },
                { PanelView.FileOps.Update, btUpdate },
                { PanelView.FileOps.UpdateAll, btUpdateAll },
                { PanelView.FileOps.Revert, btRevert },
                { PanelView.FileOps.Delete, btDelete },
                { PanelView.FileOps.DeleteFs, btDeleteFs },
                { PanelView.FileOps.Edit, btEdit }
            });

            PrintStatus("GitForce version " + ClassVersion.GetVersion(), MessageType.General);

            // Arm the timer that will check for the result of the new version test
            // Since the network access, implemented in ClassVersion, can take some time to
            // provide with the version check result, we will simply repaint our icon after a delay
            Timer versionCheckTimer = new Timer {
                Interval = 10000, Enabled = true
            };

            versionCheckTimer.Tick += VersionCheckTimerTick;
        }