Exemple #1
0
        /// <summary>
        /// Traverse tree nodes and assign an icon corresponding to each file status.
        /// Since each file has 2 status codes, X and Y, for index with relation to the
        /// git cache, and for current file with relation to the index, isIndex
        /// specifies which code will be used.
        /// </summary>
        public static void ViewAssignIcon(ClassStatus status, TreeNode rootNode, bool isIndex)
        {
            TreeNodeCollection nodes = rootNode.Nodes;

            foreach (TreeNode tn in nodes)
            {
                if (tn.Tag is ClassCommit)
                {
                    tn.ImageIndex = (int)Img.Changelist;
                }
                else
                {
                    string name = isIndex ? tn.Text : tn.Tag.ToString();
                    if (status.IsMarked(name) || tn.Nodes.Count == 0)
                    {
                        char icon = isIndex ? status.Xcode(name) : status.Ycode(name);
                        if (Staticons.ContainsKey(icon))
                        {
                            tn.ImageIndex = (int)Staticons[icon];
                        }
                        else
                        {
                            tn.ImageIndex = 0;
                        }
                    }
                    else
                    {
                        tn.ImageIndex = status.HasModifiedDescendants(name)
                           ? (int)Img.FolderClosedModified
                           : (int)Img.FolderClosed;
                    }
                }
                ViewAssignIcon(status, tn, isIndex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Selectively refreshes only specified panels
        /// </summary>
        public void SelectiveRefresh(SelectveRefreshFlags flags)
        {
            // Always refresh the class status first
            ClassStatus.Refresh();

            if ((flags & SelectveRefreshFlags.View) == SelectveRefreshFlags.View)
            {
                PanelView.ViewRefresh();
            }

            if ((flags & SelectveRefreshFlags.Repos) == SelectveRefreshFlags.Repos)
            {
                PanelRepos.ReposRefresh();
            }

            if ((flags & SelectveRefreshFlags.Commits) == SelectveRefreshFlags.Commits)
            {
                PanelCommits.CommitsRefresh();
            }

            if ((flags & SelectveRefreshFlags.Revisions) == SelectveRefreshFlags.Revisions)
            {
                PanelRevlist.RevlistRefresh();
            }

            if ((flags & SelectveRefreshFlags.Branches) == SelectveRefreshFlags.Branches)
            {
                PanelBranches.BranchesRefresh();
            }
        }
        /// <summary>
        /// Diff selected file versus one of several options.
        /// The root menu class' Tag contains the name of the file to diff
        /// The individual menu item class Tag contains the diff options
        /// </summary>
        private void MenuItemDiffClick(object sender, EventArgs e)
        {
            string      tag      = (sender as ToolStripMenuItem).Tag.ToString();
            string      diffOpt  = tag;
            string      fileName = contextMenuFile.Tag.ToString();
            ClassStatus status   = App.Repos.Current.Status;

            status.Repo.GitDiff(diffOpt, new List <string> {
                fileName
            });
        }
Exemple #4
0
 /// <summary>
 /// Initializes repo class with user.name and user.email fields.
 /// Returns True if the repo appears valid and these settings are read.
 /// </summary>
 public bool Init()
 {
     // We assume that a valid git repo will always have core.bare entry
     if (ClassConfig.GetLocal(this, "core.bare") == string.Empty)
     {
         return(false);
     }
     UserName  = ClassConfig.GetLocal(this, "user.name");
     UserEmail = ClassConfig.GetLocal(this, "user.email");
     Status    = new ClassStatus(this);
     return(true);
 }
Exemple #5
0
 /// <summary>
 /// Initializes repo class with user.name and user.email fields.
 /// Returns True if the repo appears valid and these settings are read.
 /// </summary>
 public bool Init()
 {
     // We assume that a valid git repo will always have core.bare entry
     if (ClassConfig.GetLocal(this, "core.bare") == string.Empty)
         return false;
     UserName = ClassConfig.GetLocal(this, "user.name");
     UserEmail = ClassConfig.GetLocal(this, "user.email");
     Status = new ClassStatus(this);
     return true;
 }
Exemple #6
0
 /// <summary>
 /// Traverse tree nodes and assign an icon corresponding to each file status.
 /// Since each file has 2 status codes, X and Y, for index with relation to the
 /// git cache, and for current file with relation to the index, isIndex
 /// specifies which code will be used.
 /// </summary>
 public static void ViewAssignIcon(ClassStatus status, TreeNode rootNode, bool isIndex)
 {
     TreeNodeCollection nodes = rootNode.Nodes;
     foreach (TreeNode tn in nodes)
     {
         if (tn.Tag is ClassCommit)
             tn.ImageIndex = (int)Img.Changelist;
         else
         {
             string name = isIndex ? tn.Text : tn.Tag.ToString();
             if (status.IsMarked(name) || tn.Nodes.Count == 0)
             {
                 char icon = isIndex ? status.Xcode(name) : status.Ycode(name);
                 tn.ImageIndex = (int)Staticons[icon];
             }
             else
                 tn.ImageIndex = (int)Img.FolderClosed;
         }
         ViewAssignIcon(status, tn, isIndex);
     }
 }