Ejemplo n.º 1
0
        public BranchDragDropMenu(Branch branch)
        {
            Verify.Argument.IsValidGitObject(branch, nameof(branch));

            _branch = branch;

            Items.Add(new ToolStripMenuItem("TEST"));
        }
Ejemplo n.º 2
0
 public SessionDataPackage()
 {
     Researches      = new Researches();
     ResourceStorage = new ResourceStorage();
     BranchBase      = new BranchBase(new Vector2Int(24, 39));
     Warehouse       = new Warehouse();
     Bureau          = new Bureau();
 }
Ejemplo n.º 3
0
        public BranchDragDropMenu(Branch branch)
        {
            Verify.Argument.IsValidGitObject(branch, "branch");

            _branch = branch;

            Items.Add(new ToolStripMenuItem("TEST"));
        }
Ejemplo n.º 4
0
        public BranchMenu(BranchBase branch)
        {
            Verify.Argument.IsValidGitObject(branch, "branch");

            _branch = branch;

            Items.Add(GuiItemFactory.GetViewReflogItem<ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetViewTreeItem<ToolStripMenuItem>(_branch));

            Items.Add(new ToolStripSeparator()); // interactive section

            Items.Add(GuiItemFactory.GetCheckoutRevisionItem<ToolStripMenuItem>(_branch, "{0} '{1}'"));
            Items.Add(GuiItemFactory.GetResetHeadHereItem<ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetRebaseHeadHereItem<ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetMergeItem<ToolStripMenuItem>(_branch));
            if(!branch.IsRemote)
            {
                Items.Add(GuiItemFactory.GetRenameBranchItem<ToolStripMenuItem>((Branch)_branch, "{0}"));
            }
            Items.Add(GuiItemFactory.GetRemoveBranchItem<ToolStripMenuItem>(_branch));
            if(!branch.IsRemote)
            {
                lock(branch.Repository.Remotes.SyncRoot)
                {
                    if(branch.Repository.Remotes.Count != 0)
                    {
                        Items.Add(new ToolStripSeparator());
                        var pushTo = new ToolStripMenuItem(Resources.StrPushTo, CachedResources.Bitmaps["ImgPush"]);
                        foreach(var remote in branch.Repository.Remotes)
                        {
                            pushTo.DropDownItems.Add(GuiItemFactory.GetPushBranchToRemoteItem<ToolStripMenuItem>((Branch)branch, remote));
                        }
                        Items.Add(pushTo);
                    }
                }
            }
            else
            {

            }
            Items.Add(new ToolStripSeparator()); // copy to clipboard section

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem<ToolStripMenuItem>(Resources.StrName, _branch.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem<ToolStripMenuItem>(Resources.StrFullName, _branch.FullName));
            item.DropDownItems.Add(GuiItemFactory.GetCopyHashToClipboardItem<ToolStripMenuItem>(Resources.StrPosition, _branch.Revision.HashString));

            Items.Add(item);

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetCreateBranchItem<ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetCreateTagItem<ToolStripMenuItem>(_branch));
        }
Ejemplo n.º 5
0
        public BranchMenu(BranchBase branch)
        {
            Verify.Argument.IsValidGitObject(branch, "branch");

            _branch = branch;

            Items.Add(GuiItemFactory.GetViewReflogItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetViewTreeItem <ToolStripMenuItem>(_branch));

            Items.Add(new ToolStripSeparator());             // interactive section

            Items.Add(GuiItemFactory.GetCheckoutRevisionItem <ToolStripMenuItem>(_branch, "{0} '{1}'"));
            Items.Add(GuiItemFactory.GetResetHeadHereItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetRebaseHeadHereItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetMergeItem <ToolStripMenuItem>(_branch));
            if (!branch.IsRemote)
            {
                Items.Add(GuiItemFactory.GetRenameBranchItem <ToolStripMenuItem>((Branch)_branch, "{0}"));
            }
            Items.Add(GuiItemFactory.GetRemoveBranchItem <ToolStripMenuItem>(_branch));
            if (!branch.IsRemote)
            {
                lock (branch.Repository.Remotes.SyncRoot)
                {
                    if (branch.Repository.Remotes.Count != 0)
                    {
                        Items.Add(new ToolStripSeparator());
                        var pushTo = new ToolStripMenuItem(Resources.StrPushTo, CachedResources.Bitmaps["ImgPush"]);
                        foreach (var remote in branch.Repository.Remotes)
                        {
                            pushTo.DropDownItems.Add(GuiItemFactory.GetPushBranchToRemoteItem <ToolStripMenuItem>((Branch)branch, remote));
                        }
                        Items.Add(pushTo);
                    }
                }
            }
            else
            {
            }
            Items.Add(new ToolStripSeparator());             // copy to clipboard section

            var item = new ToolStripMenuItem(Resources.StrCopyToClipboard);

            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrName, _branch.Name));
            item.DropDownItems.Add(GuiItemFactory.GetCopyToClipboardItem <ToolStripMenuItem>(Resources.StrFullName, _branch.FullName));
            item.DropDownItems.Add(GuiItemFactory.GetCopyHashToClipboardItem <ToolStripMenuItem>(Resources.StrPosition, _branch.Revision.HashString));

            Items.Add(item);

            Items.Add(new ToolStripSeparator());

            Items.Add(GuiItemFactory.GetCreateBranchItem <ToolStripMenuItem>(_branch));
            Items.Add(GuiItemFactory.GetCreateTagItem <ToolStripMenuItem>(_branch));
        }
Ejemplo n.º 6
0
 public int DrawBranch(Graphics graphics, Font font, StringFormat format, int x, int y, int right, int h, bool hovered, BranchBase branch)
 {
     if(branch.IsRemote)
     {
         int w = DrawInlineTag(graphics, font, hovered?RemoteBranchBrushHovered:RemoteBranchBrush, format, branch.Name, x, y, right, h);
         return w;
     }
     else
     {
         int w = DrawInlineTag(graphics, font, hovered?LocalBranchBrushHovered:LocalBranchBrush, format, branch.Name, x, y, right, h);
         if(branch.IsCurrent)
         {
             CurrentIndicator[0].X = x + 1.5f;
             CurrentIndicator[0].Y = y + h / 2;
             CurrentIndicator[1].X = x + 1.5f + 4;
             CurrentIndicator[1].Y = y + h / 2 - 4.5f;
             CurrentIndicator[2].X = x + 1.5f + 4;
             CurrentIndicator[2].Y = y + h / 2 + 4.5f;
             graphics.FillPolygon(SystemBrushes.InfoText, CurrentIndicator);
         }
         return w;
     }
 }
Ejemplo n.º 7
0
 public int DrawBranch(Graphics graphics, Font font, StringFormat format, int x, int y, int right, int h, bool hovered, BranchBase branch)
 {
     if (branch.IsRemote)
     {
         int w = DrawInlineTag(graphics, font, hovered?RemoteBranchBrushHovered:RemoteBranchBrush, format, branch.Name, x, y, right, h);
         return(w);
     }
     else
     {
         int w = DrawInlineTag(graphics, font, hovered?LocalBranchBrushHovered:LocalBranchBrush, format, branch.Name, x, y, right, h);
         if (branch.IsCurrent)
         {
             CurrentIndicator[0].X = x + 1.5f;
             CurrentIndicator[0].Y = y + h / 2;
             CurrentIndicator[1].X = x + 1.5f + 4;
             CurrentIndicator[1].Y = y + h / 2 - 4.5f;
             CurrentIndicator[2].X = x + 1.5f + 4;
             CurrentIndicator[2].Y = y + h / 2 + 4.5f;
             graphics.FillPolygon(SystemBrushes.InfoText, CurrentIndicator);
         }
         return(w);
     }
 }