diff options
author | Therzok <teromario@yahoo.com> | 2013-08-20 22:05:37 +0400 |
---|---|---|
committer | Therzok <teromario@yahoo.com> | 2013-08-20 22:05:37 +0400 |
commit | c52fac2206cac4151761e8001ffe73ed9142bcf8 (patch) | |
tree | 1611aaa8a39aee9e03c6e6f35c32d754b6f07daf /main/src/addins | |
parent | ad904d042602231a6d34b4a23294cfa1c18f7d81 (diff) |
[Version Control] Removed unused files AnnotateView and AnnotateCommand.
They have been replaced by BlameView and BlameCommand apparently.
Diffstat (limited to 'main/src/addins')
3 files changed, 0 insertions, 520 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/AnnotateView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/AnnotateView.cs deleted file mode 100644 index 64b4fe2414..0000000000 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/AnnotateView.cs +++ /dev/null @@ -1,429 +0,0 @@ -// -// AnnotateView.cs -// -// Author: -// Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> -// -// Copyright (C) 2009 Levi Bard -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// 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. -// -/* -using System; -using System.Threading; -using System.Collections.Generic; - -using Gtk; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui; -using MonoDevelop.SourceEditor; -using Mono.TextEditor; -using MonoDevelop.Ide; - -namespace MonoDevelop.VersionControl.Views -{ - /// <summary> - /// A view for displaying annotated source code. - /// </summary> - internal class AnnotateView - { - /// <summary> - /// Retrieve and display annotations for a given VersionControlItem - /// </summary> - /// <param name="repo"> - /// A <see cref="Repository"/> to which file belongs - /// </param> - /// <param name="file"> - /// A <see cref="FilePath"/>: The file to annotate - /// </param> - /// <param name="test"> - /// A <see cref="System.Boolean"/>: Whether this is a test run - /// </param> - /// <returns> - /// A <see cref="System.Boolean"/>: Whether annotations are supported - /// </returns> - public static bool Show (Repository repo, FilePath file, bool test) - { - if (test){ - if (null != repo && repo.CanGetAnnotations (file)) { - foreach (Ide.Gui.Document guidoc in IdeApp.Workbench.Documents) { - if (guidoc.FileName.Equals (file)) { - SourceEditorView seview = guidoc.ActiveView as SourceEditorView; - if (null != seview && - seview.TextEditor.HasMargin (typeof (AnnotationMargin)) && - seview.TextEditor.GetMargin (typeof (AnnotationMargin)).IsVisible) { - return false; - } - } - } - return true; - } - return false; - } - - MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.OpenDocument (file, true); - SourceEditorView view = doc.ActiveView as SourceEditorView; - if (view != null) { - if (view.TextEditor.HasMargin (typeof (AnnotationMargin))) { - AnnotationMargin margin = (AnnotationMargin) view.TextEditor.GetMargin (typeof (AnnotationMargin)); - margin.IsVisible = true; - margin.UpdateAnnotations (null, null); - } else { - view.TextEditor.InsertMargin (0, new AnnotationMargin (repo, view.TextEditor, doc)); - } - view.TextEditor.QueueDraw (); - } - - return true; - } - - /// <summary> - /// Hide annotations for a given VersionControlItem - /// </summary> - /// <param name="repo"> - /// A <see cref="Repository"/> to which file belongs - /// </param> - /// <param name="file"> - /// A <see cref="FilePath"/>: The file to annotate - /// </param> - /// <param name="test"> - /// A <see cref="System.Boolean"/>: Whether this is a test run - /// </param> - /// <returns> - /// A <see cref="System.Boolean"/>: Whether annotations are supported - /// </returns> - public static bool Hide (Repository repo, FilePath file, bool test) - { - if (test){ return (null != repo && repo.CanGetAnnotations (file) && !Show (repo, file, test)); } - - MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.OpenDocument (file, true); - SourceEditorView view = doc.ActiveView as SourceEditorView; - if (view != null && view.TextEditor.HasMargin (typeof (AnnotationMargin))) { - view.TextEditor.GetMargin (typeof (AnnotationMargin)).IsVisible = false; - view.TextEditor.QueueDraw (); - } - - return true; - } - } - - /// <summary> - /// Margin for displaying annotations - /// </summary> - internal class AnnotationMargin: Margin - { - Repository repo; - List<Annotation> annotations; - Revision[] history; - Pango.Layout layout; - Gdk.GC lineNumberBgGC, lineNumberGC, lineNumberHighlightGC, locallyModifiedGC; - Mono.TextEditor.TextEditor editor; - AnnotationTooltipProvider tooltipProvider; - Ide.Gui.Document document; - - private static readonly Annotation locallyModified = new Annotation ("***", "***", "***"); - - public override int Width { - get { return width; } - } - int width; - - /// <summary> - /// Creates a new AnnotationMargin - /// </summary> - /// <param name="repo"> - /// A <see cref="Repository"/>: The repo to use for annotation - /// </param> - /// <param name="editor"> - /// A <see cref="Mono.TextEditor.TextEditor"/>: The editor to which the margin belongs - /// </param> - /// <param name="doc"> - /// A <see cref="Ide.Gui.Document"/>: The document to be annotated - /// </param> - public AnnotationMargin (Repository repo, Mono.TextEditor.TextEditor editor, Ide.Gui.Document doc) - { - this.repo = repo; - this.width = 0; - this.editor = editor; - this.document = doc; - annotations = new List<Annotation> (); - UpdateAnnotations (null, null); - - tooltipProvider = new AnnotationTooltipProvider (this); - - editor.Document.TextReplacing += EditorDocumentTextReplacing; - editor.Document.LineChanged += EditorDocumentLineChanged; - editor.Caret.PositionChanged += EditorCarethandlePositionChanged; - editor.TooltipProviders.Add (tooltipProvider); - - doc.Saved += UpdateAnnotations; - - layout = new Pango.Layout (editor.PangoContext); - layout.FontDescription = editor.Options.Font; - - lineNumberBgGC = new Gdk.GC (editor.GdkWindow); - lineNumberBgGC.RgbFgColor = editor.ColorStyle.LineNumber.BackgroundColor; - - lineNumberGC = new Gdk.GC (editor.GdkWindow); - lineNumberGC.RgbFgColor = editor.ColorStyle.LineNumber.Color; - - lineNumberHighlightGC = new Gdk.GC (editor.GdkWindow); - lineNumberHighlightGC.RgbFgColor = editor.ColorStyle.LineNumberFgHighlighted; - - locallyModifiedGC = new Gdk.GC (editor.GdkWindow); - locallyModifiedGC.RgbFgColor = editor.ColorStyle.LineDirtyBg; - } - - /// <summary> - /// Reloads annotations for the current document - /// </summary> - internal void UpdateAnnotations (object sender, EventArgs e) - { - if (!IsVisible) - return; - StatusBarContext ctx = IdeApp.Workbench.StatusBar.CreateContext (); - ctx.AutoPulse = true; - ctx.ShowMessage (ImageService.GetImage ("md-version-control", IconSize.Menu), GettextCatalog.GetString ("Retrieving history")); - - ThreadPool.QueueUserWorkItem (delegate { - try { - annotations = new List<Annotation> (repo.GetAnnotations (editor.Document.FileName)); - if (null == history) - history = repo.GetHistory (editor.Document.FileName, null); - } catch (Exception ex) { - LoggingService.LogError ("Error retrieving history", ex); - } - - bool redrawAll = (0 == width); - DispatchService.GuiDispatch (delegate { - ctx.Dispose (); - UpdateWidth (); - editor.QueueDraw (); - }); - }); - } - - /// <summary> - /// Marks a line as locally modified - /// </summary> - private void EditorDocumentLineChanged (object sender, LineEventArgs e) - { - int startLine = editor.Document.OffsetToLineNumber (e.Line.Offset), - endLine = editor.Document.OffsetToLineNumber (e.Line.EndOffset); - - if (startLine == endLine) { - SetAnnotation (startLine, locallyModified); - } - for (int i=startLine; i<endLine; ++i) { - SetAnnotation (i, locallyModified); - } - } - - /// <summary> - /// Marks necessary lines modified when text is replaced - /// </summary> - private void EditorDocumentTextReplacing (object sender, ReplaceEventArgs e) - { - int startLine = editor.Document.OffsetToLineNumber (e.Offset), - endLine = editor.Document.OffsetToLineNumber (e.Offset+e.Count), - lineCount = 0; - string[] tokens = null; - - if (startLine < endLine) { - // change crosses line boundary - - lineCount = endLine - startLine; - - if (string.IsNullOrEmpty (e.Value)) { - // delete - annotations.RemoveRange (startLine, lineCount); - } else { - // replace - annotations.RemoveRange (startLine, lineCount); - for (int i=0; i<lineCount; ++i) { - annotations.Insert (startLine, locallyModified); - } - } - return; - } else if (0 == e.Count) { - // insert - tokens = e.Value.Split (new string[]{Environment.NewLine}, StringSplitOptions.None); - lineCount = tokens.Length - 1; - - for (int i=0; i<lineCount; ++i) { - annotations.Insert (startLine+1, locallyModified); - } - } else if (startLine > endLine) { - // revert - UpdateAnnotations (null, null); - return; - } - - SetAnnotation (startLine, locallyModified); - } - - /// <summary> - /// Force line repaint on line change - /// </summary> - private void EditorCarethandlePositionChanged (object sender, DocumentLocationEventArgs e) - { - if (e.Location.Line == editor.Caret.Line) - return; - editor.RedrawMarginLine (this, e.Location.Line); - editor.RedrawMarginLine (this, editor.Caret.Line); - } - - /// <summary> - /// Calculate the maximum width required to render annotations - /// </summary> - private void UpdateWidth () - { - int tmpwidth = 0, - height = 0; - - foreach (Annotation note in annotations) { - if (!string.IsNullOrEmpty (note.Author)) { - layout.SetText (note.Author + note.Date + note.Revision + "_"); - layout.GetPixelSize (out tmpwidth, out height); - width = Math.Max (width, tmpwidth); - } - } - } - - public override void Dispose () - { - document.Saved -= UpdateAnnotations; - editor.Document.TextReplacing -= EditorDocumentTextReplacing; - editor.Document.LineChanged -= EditorDocumentLineChanged; - editor.TooltipProviders.Remove (tooltipProvider); - layout.Dispose (); - lineNumberBgGC.Dispose (); - lineNumberGC.Dispose (); - lineNumberHighlightGC.Dispose (); - locallyModifiedGC.Dispose (); - base.Dispose (); - } - - /// <summary> - /// Render an annotation on each line - /// </summary> - protected override void Draw (Gdk.Drawable drawable, Gdk.Rectangle area, int line, int x, int y, int lineHeight) - { - Annotation ann = (line < annotations.Count)? annotations[line]: new Annotation ("", "", ""); - Gdk.Rectangle drawArea = new Gdk.Rectangle (x, y, Width, lineHeight); - drawable.DrawRectangle (ann? locallyModifiedGC: lineNumberBgGC, true, drawArea); - - if (!locallyModified.Equals (ann, StringComparison.Ordinal) && - (line < annotations.Count)) { - layout.SetText (annotations[line]); - drawable.DrawLayout ((editor.Caret.Line == line)? lineNumberHighlightGC: lineNumberGC, x + 1, y, layout); - } - } - - /// <summary> - /// Sets a given annotation line, - /// accounting for end-of-buffer overrun. - /// </summary> - /// <param name="index"> - /// A <see cref="System.Int32"/>: The index of the item to be set. - /// </param> - /// <param name="text"> - /// A <see cref="System.String"/>: The annotation to be used. - /// </param> - void SetAnnotation (int index, Annotation text) - { - int difference = index - annotations.Count; - - if (0 > difference) { - annotations[index] = text; - } else { - for (int i=0; i<difference; ++i) { - annotations.Add (locallyModified); - } - annotations.Add (text); - } - } - - /// <summary> - /// Gets the commit message matching a given annotation index. - /// </summary> - internal string GetCommitMessage (int index) - { - string annotation = (index < annotations.Count)? annotations[index]: null; - - if (null != history && !string.IsNullOrEmpty (annotation)) - { - string[] tokens = annotation.Split (new char[]{' '}, StringSplitOptions.RemoveEmptyEntries); - if (1 < tokens.Length) { - foreach (Revision rev in history) { - if (rev.ToString ().Equals (tokens[0], StringComparison.Ordinal)) { - return rev.Message; - } - } - } - } - - return null; - } - } - - /// <summary> - /// Tooltip provider for annotation margins - /// </summary> - class AnnotationTooltipProvider: ITooltipProvider - { - AnnotationMargin margin; - - public AnnotationTooltipProvider (AnnotationMargin margin) - { - this.margin = margin; - } - - #region ITooltipProvider implementation - - public TooltipItem GetItem (Mono.TextEditor.TextEditor editor, int offset) - { - DocumentLocation location = editor.Document.OffsetToLocation (offset); - return (0 >= location.Column)? new TooltipItem (margin.GetCommitMessage (location.Line), editor.Document.GetLine (location.Line)) : null; - } - - - public Window CreateTooltipWindow (Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) - { - return new LanguageItemWindow (editor as ExtensibleTextEditor, modifierState, null, item.Item as string, null); - } - - - public void GetRequiredPosition (Mono.TextEditor.TextEditor editor, Window tipWindow, out int requiredWidth, out double xalign) - { - LanguageItemWindow win = (LanguageItemWindow) tipWindow; - requiredWidth = win.SetMaxWidth (win.Screen.Width); - xalign = 0.5; - } - - - public bool IsInteractive (Mono.TextEditor.TextEditor editor, Window tipWindow) - { - return false; - } - - #endregion - } -}*/ diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj index a7925ca97d..5919e2a283 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj @@ -160,12 +160,10 @@ <Compile Include="MonoDevelop.VersionControl.Views\CellRendererDiff.cs" /> <Compile Include="MonoDevelop.VersionControl.Views\LogView.cs" /> <Compile Include="MonoDevelop.VersionControl.Views\StatusView.cs" /> - <Compile Include="MonoDevelop.VersionControl.Views\AnnotateView.cs" /> <Compile Include="MonoDevelop.VersionControl.Dialogs\CommitDialog.cs" /> <Compile Include="MonoDevelop.VersionControl.Dialogs\EditRepositoryDialog.cs" /> <Compile Include="MonoDevelop.VersionControl.Dialogs\SelectRepositoryDialog.cs" /> <Compile Include="MonoDevelop.VersionControl\AddRemoveMoveCommand.cs" /> - <Compile Include="MonoDevelop.VersionControl\AnnotateCommand.cs" /> <Compile Include="MonoDevelop.VersionControl\BaseView.cs" /> <Compile Include="MonoDevelop.VersionControl\ChangeSet.cs" /> <Compile Include="MonoDevelop.VersionControl\CheckoutCommand.cs" /> diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AnnotateCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AnnotateCommand.cs deleted file mode 100644 index aeac2dbb81..0000000000 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AnnotateCommand.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// AnnotateCommand.cs -// -// Author: -// Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> -// -// Copyright (C) 2009 Levi Bard -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// 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. -// - -using System.IO; -using MonoDevelop.Core; -using MonoDevelop.Components.Commands; -using MonoDevelop.VersionControl.Views; -using MonoDevelop.Ide; - -namespace MonoDevelop.VersionControl -{/* - /// <summary> - /// Command handler for showing annotations - /// </summary> - internal class ShowAnnotationsCommand: CommandHandler - { - /// <summary> - /// Shows annotations for the active document - /// </summary> - protected override void Run () - { - FilePath file = IdeApp.Workbench.ActiveDocument.FileName; - Repository repo = VersionControlService.GetRepositoryReference (Path.GetDirectoryName (file.FullPath), file.FileName); - AnnotateView.Show (repo, file, false); - } - - /// <summary> - /// Determines whether the command is valid for the active document - /// </summary> - protected override void Update (CommandInfo item) - { - FilePath file = IdeApp.Workbench.ActiveDocument.FileName; - Repository repo = VersionControlService.GetRepositoryReference (Path.GetDirectoryName (file.FullPath), file.FileName); - item.Visible = AnnotateView.Show (repo, file, true); - } - }*/ - - /* - /// <summary> - /// Command handler for hiding annotations - /// </summary> - internal class HideAnnotationsCommand: CommandHandler - { - /// <summary> - /// Hides annotations for the active document - /// </summary> - protected override void Run () - { - FilePath file = IdeApp.Workbench.ActiveDocument.FileName; - Repository repo = VersionControlService.GetRepositoryReference (Path.GetDirectoryName (file.FullPath), file.FileName); - AnnotateView.Hide (repo, file, false); - } - - /// <summary> - /// Determines whether the command is valid for the active document - /// </summary> - protected override void Update (CommandInfo item) - { - FilePath file = IdeApp.Workbench.ActiveDocument.FileName; - Repository repo = VersionControlService.GetRepositoryReference (Path.GetDirectoryName (file.FullPath), file.FileName); - item.Visible = AnnotateView.Hide (repo, file, true); - } - }*/ -} |