private void SetToolTip(ToolStripItem item, FileListToolTip toolTip, bool staged, FileStatus fileStatus) { item.MouseEnter += (sender, e) => ShowToolTip(toolTip, (ToolStripItem)sender, staged, fileStatus); item.MouseLeave += (sender, e) => toolTip.Hide(((ToolStripItem)sender).Owner); }
private void ShowToolTip(FileListToolTip toolTip, ToolStripItem label, bool staged, FileStatus fileStatus) { if (Repository != null) { toolTip.Update(_repository.Status, staged, fileStatus); toolTip.Show(label.Owner, GetToolTipPosition(toolTip, label)); } }
public Statusbar(GuiProvider guiProvider) { Verify.Argument.IsNotNull(guiProvider, "guiProvider"); _guiProvider = guiProvider; _leftAlignedItems = new ToolStripItem[] { new ToolStripStatusLabel(Resources.StrHead.AddColon()), _headLabel = new ToolStripStatusLabel(Resources.StrNoBranch), new ToolStripSeparator(), _statusLabel = new ToolStripStatusLabel(Resources.StrStatus.AddColon()), _statusClean = new ToolStripStatusLabel(string.Empty, ImgClean) { Available = false }, _statusUnmerged = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnmerged) { Available = false, DoubleClickEnabled = true }, _statusStagedAdded = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgStagedAdded) { Available = false, DoubleClickEnabled = true }, _statusStagedModified = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgStagedModified) { Available = false, DoubleClickEnabled = true }, _statusStagedRemoved = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgStagedRemoved) { Available = false, DoubleClickEnabled = true }, _statusUnstagedUntracked = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnstagedUntracked) { Available = false, DoubleClickEnabled = true }, _statusUnstagedModified = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnstagedModified) { Available = false, DoubleClickEnabled = true }, _statusUnstagedRemoved = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnstagedRemoved) { Available = false, DoubleClickEnabled = true }, _statusRepositoryState = new ToolStripStatusLabel(string.Empty, ImgMergeInProcess) { Available = false, DoubleClickEnabled = true }, _rebaseContinue = new ToolStripButton(Resources.StrContinue, CachedResources.Bitmaps["ImgRebaseContinue"], OnRebaseContinueClick) { Available = false }, _rebaseSkip = new ToolStripButton(Resources.StrSkip, CachedResources.Bitmaps["ImgRebaseSkip"], OnRebaseSkipClick) { Available = false }, _rebaseAbort = new ToolStripButton(Resources.StrAbort, CachedResources.Bitmaps["ImgRebaseAbort"], OnRebaseAbortClick) { Available = false }, _cherryPickContinue = new ToolStripButton(Resources.StrContinue, CachedResources.Bitmaps["ImgCherryPickContinue"], OnCherryPickContinueClick) { Available = false, ToolTipText = Resources.TipCherryPickContinue }, _cherryPickQuit = new ToolStripButton(Resources.StrQuit, CachedResources.Bitmaps["ImgCherryPickQuit"], OnCherryPickQuitClick) { Available = false, ToolTipText = Resources.TipCherryPickQuit }, _cherryPickAbort = new ToolStripButton(Resources.StrAbort, CachedResources.Bitmaps["ImgCherryPickAbort"], OnCherryPickAbortClick) { Available = false, ToolTipText = Resources.TipCherryPickAbort }, _revertContinue = new ToolStripButton(Resources.StrContinue, CachedResources.Bitmaps["ImgRevertContinue"], OnRevertContinueClick) { Available = false, ToolTipText = Resources.TipRevertContinue }, _revertQuit = new ToolStripButton(Resources.StrQuit, CachedResources.Bitmaps["ImgRevertQuit"], OnRevertQuitClick) { Available = false, ToolTipText = Resources.TipRevertQuit }, _revertAbort = new ToolStripButton(Resources.StrAbort, CachedResources.Bitmaps["ImgRevertAbort"], OnRevertAbortClick) { Available = false, ToolTipText = Resources.TipRevertAbort }, }; _statusUnmerged.DoubleClick += OnConflictsDoubleClick; _statusUnstagedModified.DoubleClick += OnUnstagedDoubleClick; _statusUnstagedRemoved.DoubleClick += OnUnstagedDoubleClick; _statusUnstagedUntracked.DoubleClick += OnUnstagedDoubleClick; _rightAlignedItems = new[] { _userLabel = new ToolStripStatusLabel(string.Empty, null), _remoteLabel = new ToolStripStatusLabel(string.Empty, CachedResources.Bitmaps["ImgRemote"]), }; _userLabel.MouseDown += OnUserLabelMouseDown; _remoteLabel.MouseDown += OnRemoteLabelMouseDown; if (guiProvider.Repository != null) { AttachToRepository(guiProvider.Repository); } _statusToolTip = new StatusToolTip(); _statusUnmergedToolTip = new FileListToolTip(); _statusStagedAddedToolTip = new FileListToolTip(); _statusStagedModifiedToolTip = new FileListToolTip(); _statusStagedRemovedToolTip = new FileListToolTip(); _statusUnstagedUntrackedToolTip = new FileListToolTip(); _statusUnstagedModifiedToolTip = new FileListToolTip(); _statusUnstagedRemovedToolTip = new FileListToolTip(); SetToolTips(); _headLabel.DoubleClickEnabled = true; _headLabel.DoubleClick += OnHeadLabelDoubleClick; _headLabel.MouseDown += OnHeadLabelMouseDown; _userLabel.DoubleClickEnabled = true; _userLabel.DoubleClick += OnUserDoubleClick; }
public Statusbar(GuiProvider guiProvider) { Verify.Argument.IsNotNull(guiProvider, "guiProvider"); _guiProvider = guiProvider; _leftAlignedItems = new ToolStripItem[] { new ToolStripStatusLabel(Resources.StrHead.AddColon()), _headLabel = new ToolStripStatusLabel(Resources.StrNoBranch), new ToolStripSeparator(), _statusLabel = new ToolStripStatusLabel(Resources.StrStatus.AddColon()), _statusClean = new ToolStripStatusLabel(string.Empty, ImgClean) { Available = false }, _statusUnmerged = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnmerged) { Available = false, DoubleClickEnabled = true }, _statusStagedAdded = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgStagedAdded) { Available = false, DoubleClickEnabled = true }, _statusStagedModified = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgStagedModified) { Available = false, DoubleClickEnabled = true }, _statusStagedRemoved = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgStagedRemoved) { Available = false, DoubleClickEnabled = true }, _statusUnstagedUntracked = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnstagedUntracked) { Available = false, DoubleClickEnabled = true }, _statusUnstagedModified = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnstagedModified) { Available = false, DoubleClickEnabled = true }, _statusUnstagedRemoved = new ToolStripStatusLabel(string.Empty, FileStatusIcons.ImgUnstagedRemoved) { Available = false, DoubleClickEnabled = true }, _statusRepositoryState = new ToolStripStatusLabel(string.Empty, ImgMergeInProcess) { Available = false, DoubleClickEnabled = true }, _rebaseContinue = new ToolStripButton(Resources.StrContinue, CachedResources.Bitmaps["ImgRebaseContinue"], OnRebaseContinueClick) { Available = false }, _rebaseSkip = new ToolStripButton(Resources.StrSkip, CachedResources.Bitmaps["ImgRebaseSkip"], OnRebaseSkipClick) { Available = false }, _rebaseAbort = new ToolStripButton(Resources.StrAbort, CachedResources.Bitmaps["ImgRebaseAbort"], OnRebaseAbortClick) { Available = false }, _cherryPickContinue = new ToolStripButton(Resources.StrContinue, CachedResources.Bitmaps["ImgCherryPickContinue"], OnCherryPickContinueClick) { Available = false, ToolTipText = Resources.TipCherryPickContinue }, _cherryPickQuit = new ToolStripButton(Resources.StrQuit, CachedResources.Bitmaps["ImgCherryPickQuit"], OnCherryPickQuitClick) { Available = false, ToolTipText = Resources.TipCherryPickQuit }, _cherryPickAbort = new ToolStripButton(Resources.StrAbort, CachedResources.Bitmaps["ImgCherryPickAbort"], OnCherryPickAbortClick) { Available = false, ToolTipText = Resources.TipCherryPickAbort }, _revertContinue = new ToolStripButton(Resources.StrContinue, CachedResources.Bitmaps["ImgRevertContinue"], OnRevertContinueClick) { Available = false, ToolTipText = Resources.TipRevertContinue }, _revertQuit = new ToolStripButton(Resources.StrQuit, CachedResources.Bitmaps["ImgRevertQuit"], OnRevertQuitClick) { Available = false, ToolTipText = Resources.TipRevertQuit }, _revertAbort = new ToolStripButton(Resources.StrAbort, CachedResources.Bitmaps["ImgRevertAbort"], OnRevertAbortClick) { Available = false, ToolTipText = Resources.TipRevertAbort }, }; _statusUnmerged.DoubleClick += OnConflictsDoubleClick; _statusUnstagedModified.DoubleClick += OnUnstagedDoubleClick; _statusUnstagedRemoved.DoubleClick += OnUnstagedDoubleClick; _statusUnstagedUntracked.DoubleClick += OnUnstagedDoubleClick; _rightAlignedItems = new[] { _userLabel = new ToolStripStatusLabel(string.Empty, null), _remoteLabel = new ToolStripStatusLabel(string.Empty, CachedResources.Bitmaps["ImgRemote"]), }; _userLabel.MouseDown += OnUserLabelMouseDown; _remoteLabel.MouseDown += OnRemoteLabelMouseDown; if(guiProvider.Repository != null) { AttachToRepository(guiProvider.Repository); } _statusToolTip = new StatusToolTip(); _statusUnmergedToolTip = new FileListToolTip(); _statusStagedAddedToolTip = new FileListToolTip(); _statusStagedModifiedToolTip = new FileListToolTip(); _statusStagedRemovedToolTip = new FileListToolTip(); _statusUnstagedUntrackedToolTip = new FileListToolTip(); _statusUnstagedModifiedToolTip = new FileListToolTip(); _statusUnstagedRemovedToolTip = new FileListToolTip(); SetToolTips(); _headLabel.DoubleClickEnabled = true; _headLabel.DoubleClick += OnHeadLabelDoubleClick; _headLabel.MouseDown += OnHeadLabelMouseDown; _userLabel.DoubleClickEnabled = true; _userLabel.DoubleClick += OnUserDoubleClick; }
private void ShowToolTip(FileListToolTip toolTip, ToolStripItem label, bool staged, FileStatus fileStatus) { if(Repository != null) { toolTip.Update(_repository.Status, staged, fileStatus); toolTip.Show(label.Owner, GetToolTipPosition(toolTip, label)); } }