コード例 #1
0
        void HandlePositionChanged(object sender, DocumentLocationEventArgs e)
        {
            int      caretOffset = Editor.Caret.Offset - baseOffset;
            TextLink link        = links.Find(l => l.PrimaryLink != null && l.PrimaryLink.Offset <= caretOffset && caretOffset <= l.PrimaryLink.EndOffset);

            if (link != null && link.Count > 0 && link.IsEditable)
            {
                if (window != null && window.DataProvider != link)
                {
                    DestroyWindow();
                }
                if (closedLink == link)
                {
                    return;
                }
                closedLink = null;
                if (window == null)
                {
                    window = new ListWindow <string> ();
                    window.DataProvider = link;

                    DocumentLocation loc = Editor.Document.OffsetToLocation(BaseOffset + link.PrimaryLink.Offset);
                    Editor.ShowListWindow(window, loc);
                }
            }
            else
            {
                DestroyWindow();
                closedLink = null;
            }
        }
コード例 #2
0
        void HandlePositionChanged(object sender, DocumentLocationEventArgs e)
        {
            int      caretOffset = Editor.Caret.Offset - baseOffset;
            TextLink link        = links.Find(l => !l.PrimaryLink.IsInvalid() && l.PrimaryLink.Offset <= caretOffset && caretOffset <= l.PrimaryLink.EndOffset);

            if (link != null && link.Count > 0 && link.IsEditable)
            {
                if (closedLink == link)
                {
                    return;
                }
                closedLink = null;

                /* Disabled because code completion was enabled in link mode.
                 * if (window == null) {
                 *      window = new ListWindow<string> ();
                 *      window.DoubleClicked += delegate {
                 *              CompleteWindow ();
                 *      };
                 *      window.DataProvider = link;
                 *
                 *      DocumentLocation loc = Editor.Document.OffsetToLocation (BaseOffset + link.PrimaryLink.Offset);
                 *      Editor.ShowListWindow (window, loc);
                 *
                 * } */
            }
            else
            {
                closedLink = null;
            }
        }
コード例 #3
0
		void EditorCarethandlePositionChanged (object sender, DocumentLocationEventArgs e)
		{
			if (!editor.GetTextEditorData ().HighlightCaretLine || e.Location.Line == editor.Caret.Line)
				return;
			editor.RedrawMarginLine (this, e.Location.Line);
			editor.RedrawMarginLine (this, editor.Caret.Line);
		}
コード例 #4
0
ファイル: GutterMargin.cs プロジェクト: IBBoard/monodevelop
		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);
		}
コード例 #5
0
ファイル: ActionMargin.cs プロジェクト: tirx1/monodevelop
		void HandlePositionChanged (object sender, DocumentLocationEventArgs e)
		{
			if (e.Location.Line == editor.Caret.Line)
				return;
			editor.RedrawMarginLine (this, e.Location.Line);
			editor.RedrawMarginLine (this, editor.Caret.Line);
		}
コード例 #6
0
 protected virtual void OnPositionChanged(DocumentLocationEventArgs args)
 {
     TextEditorData.Document.EnsureOffsetIsUnfolded(Offset);
     if (PositionChanged != null)
     {
         PositionChanged(this, args);
     }
 }
コード例 #7
0
 void EditorCarethandlePositionChanged(object sender, DocumentLocationEventArgs e)
 {
     if (!editor.GetTextEditorData().HighlightCaretLine || e.Location.Line == editor.Caret.Line)
     {
         return;
     }
     editor.RedrawMarginLine(this, e.Location.Line);
     editor.RedrawMarginLine(this, editor.Caret.Line);
 }
コード例 #8
0
		void HandleTextEditorDataCaretPositionChanged(object sender, DocumentLocationEventArgs e)
		{
			if (!MonoDevelop.Core.PropertyService.Get<bool>("EnableHighlightUsages"))
				return;
			if (!textEditorData.IsSomethingSelected && markers.Values.Any(m => m.Contains(textEditorData.Caret.Offset)))
				return;
			RemoveMarkers();
			RemoveTimer();
			if (!textEditorData.IsSomethingSelected)
				popupTimer = GLib.Timeout.Add(1000, UpdateMarkers);
		}
コード例 #9
0
        void HandleEditorCaretPositionChanged(object sender, DocumentLocationEventArgs e)
        {
            if (!IsInCodeFocusMode)
            {
                return;
            }
            DocumentLine lineSegment = editor.Document.GetLine(editor.Caret.Line);

            if (lineSegment == null)
            {
                RemoveBackgroundRenderer();
                return;
            }

            IEnumerable <FoldSegment> newFoldings = editor.Document.GetFoldingContaining(lineSegment);

            if (newFoldings == null)
            {
                RemoveBackgroundRenderer();
                return;
            }

            bool areEqual = foldings != null;

            if (areEqual && foldings.Count() != newFoldings.Count())
            {
                areEqual = false;
            }
            if (areEqual)
            {
                List <FoldSegment> list1 = new List <FoldSegment> (foldings);
                List <FoldSegment> list2 = new List <FoldSegment> (newFoldings);
                for (int i = 0; i < list1.Count; i++)
                {
                    if (list1[i] != list2[i])
                    {
                        areEqual = false;
                        break;
                    }
                }
            }

            if (!areEqual)
            {
                foldings = newFoldings;
                StopTimer();
            }
        }
コード例 #10
0
        void CaretPositionChanged(object sender, DocumentLocationEventArgs args)
        {
            if (!caret.PreserveSelection)
            {
                this.ClearSelection();
            }

            if (Options.RemoveTrailingWhitespaces && args.Location.Line != Caret.Line)
            {
                LineSegment line = Document.GetLine(args.Location.Line);
                if (line != null && line.WasChanged)
                {
                    Document.RemoveTrailingWhitespaces(this, line);
                }
            }
        }
コード例 #11
0
 // Yoinked from C# binding
 void UpdatePath(object sender, Mono.TextEditor.DocumentLocationEventArgs e)
 {
     /*		var unit = Document.ParsedDocument;
      *              if (unit == null)
      *                      return;
      *
      *              var loc = Document.Editor.Caret.Location;
      *
      *              var result = new List<PathEntry> ();
      *              var amb = GetAmbience ();
      *              var type = unit.GetInnermostTypeDefinition (loc.Line, loc.Column) ?? unit.TopLevelTypeDefinitions.FirstOrDefault ();
      *              var curType = type;
      *              object lastTag = unit;
      *              while (curType != null) {
      *                      var markup = amb.GetString ((IEntity)curType, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.ReformatDelegates | OutputFlags.IncludeMarkup);
      *                      result.Insert (0, new PathEntry (ImageService.GetPixbuf (type.GetStockIcon (), Gtk.IconSize.Menu), curType.IsObsolete () ? "<s>" + markup + "</s>" : markup) { Tag = lastTag });
      *                      lastTag = curType;
      *                      curType = curType.DeclaringTypeDefinition;
      *              }
      *
      *              var member = type.Members.FirstOrDefault (m => m.Region.IsInside (loc.Line, loc.Column));
      *              if (member != null) {
      *                      var ctx = Document.ParsedDocument.ParsedFile.GetTypeResolveContext (Document.Compilation, member.Region.Begin);;
      *                      var markup = amb.GetString (member.CreateResolved (ctx), OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.ReformatDelegates | OutputFlags.IncludeMarkup);
      *                      result.Add (new PathEntry (ImageService.GetPixbuf (member.GetStockIcon (), Gtk.IconSize.Menu), member.IsObsolete () ? "<s>" + markup + "</s>" : markup) { Tag = lastTag });
      *              }
      *
      *              PathEntry noSelection = null;
      *              if (type == null) {
      *                      noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit };
      *              } else if (member == null && type.Kind != TypeKind.Delegate)
      *                      noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = type };
      *              if (noSelection != null)
      *                      result.Add (noSelection);
      *              var prev = CurrentPath;
      *              CurrentPath = result.ToArray ();
      *              OnPathChanged (new DocumentPathChangedEventArgs (prev));*/
 }
コード例 #12
0
		void HandleEditorCaretPositionChanged (object sender, DocumentLocationEventArgs e)
		{
			if (!IsInCodeFocusMode) 
				return;
			LineSegment lineSegment = editor.Document.GetLine (editor.Caret.Line);
			if (lineSegment == null) {
				RemoveBackgroundRenderer ();
				return;
			}
			
			IEnumerable<FoldSegment> newFoldings = editor.Document.GetFoldingContaining (lineSegment);
			if (newFoldings == null) {
				RemoveBackgroundRenderer ();
				return;
			}
			
			bool areEqual = foldings != null;
			
			if (areEqual && foldings.Count () != newFoldings.Count ())
				areEqual = false;
			if (areEqual) {
				List<FoldSegment> list1 = new List<FoldSegment> (foldings);
				List<FoldSegment> list2 = new List<FoldSegment> (newFoldings);
				for (int i = 0; i < list1.Count; i++) {
					if (list1[i] != list2[i]) {
						areEqual = false;
						break;
					}
				}
			}
			
			if (!areEqual) {
				foldings = newFoldings;
				DelayTimerElapsed (this, null);
			}
		}
コード例 #13
0
ファイル: Caret.cs プロジェクト: nocache/monodevelop
		protected virtual void OnPositionChanged (DocumentLocationEventArgs args)
		{
			TextEditorData.Document.EnsureOffsetIsUnfolded (Offset);
			if (PositionChanged != null) 
				PositionChanged (this, args);
		}
コード例 #14
0
		void CaretPositionChanged (object o, DocumentLocationEventArgs args)
		{
			UpdateLineCol ();
			LineSegment curLine = TextEditor.Document.GetLine (TextEditor.Caret.Line);
			MonoDevelop.SourceEditor.MessageBubbleTextMarker marker = null;
			if (curLine != null && curLine.Markers.Any (m => m is MonoDevelop.SourceEditor.MessageBubbleTextMarker)) {
				marker = (MonoDevelop.SourceEditor.MessageBubbleTextMarker)curLine.Markers.First (m => m is MonoDevelop.SourceEditor.MessageBubbleTextMarker);
				marker.CollapseExtendedErrors = false;
				if (oldExpandedMarker == null)
					Document.CommitLineToEndUpdate (Document.OffsetToLineNumber (curLine.Offset));
			}
			
			if (oldExpandedMarker != null && oldExpandedMarker != marker) {
				oldExpandedMarker.CollapseExtendedErrors = true;
				int markerOffset = marker != null && marker.LineSegment != null ? marker.LineSegment.Offset : Int32.MaxValue;
				int oldMarkerOffset = oldExpandedMarker.LineSegment != null ? oldExpandedMarker.LineSegment.Offset : Int32.MaxValue;
				Document.CommitLineToEndUpdate (Document.OffsetToLineNumber (Math.Min (markerOffset, oldMarkerOffset)));
			}
			oldExpandedMarker = marker;
		}
コード例 #15
0
ファイル: ViStatusArea.cs プロジェクト: csammis/VimAddin
 void HandlePositionChanged(object sender, DocumentLocationEventArgs e)
 {
     QueueDraw ();
 }
コード例 #16
0
		void HandleTextEditorDataCaretPositionChanged (object sender, DocumentLocationEventArgs e)
		{
			if (!textEditorData.IsSomethingSelected && markers.Values.Any (m => m.Contains (textEditorData.Caret.Offset)))
				return;
			RemoveMarkers (textEditorData.IsSomethingSelected);
			RemoveTimer ();
			if (!textEditorData.IsSomethingSelected)
				popupTimer = GLib.Timeout.Add (1000, DelayedTooltipShow);
		}
コード例 #17
0
		void HandleWidgetTextEditorCaretPositionChanged (object sender, DocumentLocationEventArgs e)
		{
			UpdateResultInformLabel ();
		}
コード例 #18
0
		void HandlePositionChanged (object sender, DocumentLocationEventArgs e)
		{
			OnCaretPositionSet (EventArgs.Empty);
			FireCompletionContextChanged ();
			OnCaretPositionChanged (EventArgs.Empty);
		}
コード例 #19
0
        void HandleTextEditorDataCaretPositionChanged(object sender, DocumentLocationEventArgs e)
        {
            if(!SourceEditor.DefaultSourceEditorOptions.Instance.EnableHighlightUsages)
                return;

            if(!text_editor_data.IsSomethingSelected && markers.Values.Any(m => m.Contains(text_editor_data.Caret.Offset)))
                return;

            RemoveMarkers(text_editor_data.IsSomethingSelected);
            RemoveTimer();
            if(!text_editor_data.IsSomethingSelected)
                popup_timer = GLib.Timeout.Add(1000, DelayedTooltipShow);
        }
コード例 #20
0
ファイル: TextEditorData.cs プロジェクト: dodev/monodevelop
		void CaretPositionChanged (object sender, DocumentLocationEventArgs args)
		{
			if (!caret.PreserveSelection)
				this.ClearSelection ();
		}
コード例 #21
0
			public void DataCaretPositionChanged (object sender, DocumentLocationEventArgs e)
			{
				data.ExtendSelectionTo (data.Caret.Location);
			}
コード例 #22
0
        // Yoinked from C# binding
        void UpdatePath(object sender, Mono.TextEditor.DocumentLocationEventArgs e)
        {
            var unit           = Document.CompilationUnit;
            var textEditorData = Document.Editor;

            if (unit == null)
            {
                return;
            }

            var              loc    = textEditorData.Caret.Location;
            IType            type   = unit.GetTypeAt(loc.Line, loc.Column);
            List <PathEntry> result = new List <PathEntry> ();
            Ambience         amb    = GetAmbience();
            IMember          member = null;
            INode            node   = (INode)unit;

            if (type != null && type.ClassType != ClassType.Delegate)
            {
                member = type.GetMemberAt(loc.Line, loc.Column);
            }

            if (null != member)
            {
                node = member;
            }
            else if (null != type)
            {
                node = type;
            }

            while (node != null)
            {
                PathEntry entry;
                if (node is ICompilationUnit)
                {
                    if (!Document.ParsedDocument.UserRegions.Any())
                    {
                        break;
                    }
                    FoldingRegion reg = Document.ParsedDocument.UserRegions.LastOrDefault(r => r.Region.Contains(loc.Line, loc.Column));
                    if (reg == null)
                    {
                        entry = new PathEntry(GettextCatalog.GetString("No region"));
                    }
                    else
                    {
                        entry = new PathEntry(CompilationUnitDataProvider.Pixbuf, reg.Name);
                    }
                    entry.Position = EntryPosition.Right;
                }
                else
                {
                    entry = new PathEntry(ImageService.GetPixbuf(((IMember)node).StockIcon, Gtk.IconSize.Menu), amb.GetString((IMember)node, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.ReformatDelegates));
                }
                entry.Tag = node;
                result.Insert(0, entry);
                node = node.Parent;
            }

            PathEntry noSelection = null;

            if (type == null)
            {
                noSelection = new PathEntry(GettextCatalog.GetString("No selection"))
                {
                    Tag = new CustomNode(Document.CompilationUnit)
                };
            }
            else if (member == null && type.ClassType != ClassType.Delegate)
            {
                noSelection = new PathEntry(GettextCatalog.GetString("No selection"))
                {
                    Tag = new CustomNode(type)
                }
            }
            ;
            if (noSelection != null)
            {
                result.Add(noSelection);
            }

            var prev = CurrentPath;

            CurrentPath = result.ToArray();
            OnPathChanged(this, new DocumentPathChangedEventArgs(prev));
        }
コード例 #23
0
 public void DataCaretPositionChanged(object sender, DocumentLocationEventArgs e)
 {
     data.ExtendSelectionTo(data.Caret.Location);
 }
コード例 #24
0
ファイル: ComparisonWidget.cs プロジェクト: acken/monodevelop
		internal static void CaretPositionChanged (object sender, DocumentLocationEventArgs e)
		{
			Caret caret = (Caret)sender;
			UpdateCaretPosition (caret);
		}
コード例 #25
0
		void CaretPositionChanged (object o, DocumentLocationEventArgs args)
		{
			UpdateLineCol ();
			DocumentLine curLine = TextEditor.Document.GetLine (TextEditor.Caret.Line);
			MonoDevelop.SourceEditor.MessageBubbleTextMarker marker = null;
			if (curLine != null && curLine.Markers.Any (m => m is MonoDevelop.SourceEditor.MessageBubbleTextMarker)) {
				marker = (MonoDevelop.SourceEditor.MessageBubbleTextMarker)curLine.Markers.First (m => m is MonoDevelop.SourceEditor.MessageBubbleTextMarker);
//				marker.CollapseExtendedErrors = false;
			}
			
			if (oldExpandedMarker != null && oldExpandedMarker != marker) {
//				oldExpandedMarker.CollapseExtendedErrors = true;
			}
			oldExpandedMarker = marker;
		}
コード例 #26
0
ファイル: MainWindow.cs プロジェクト: Netring/ILSpy
		void HandlePositionChanged (object sender, DocumentLocationEventArgs e)
		{
			var node = unit.GetNodeAt (editor.Caret.Line, editor.Caret.Column);
			if (node == null)
				return;
			TreeIter iter;
			if (!iterDict.TryGetValue (node, out iter))
				return;
			this.treeviewNodes.Selection.Changed -= SelectionChanged;
			treeviewNodes.Selection.SelectIter (iter);
			
			treeviewNodes.ScrollToCell (store.GetPath (iter), null, true, 0, 0);
			this.treeviewNodes.Selection.Changed += SelectionChanged;
		}
コード例 #27
0
		void CaretPositionChanged (object sender, DocumentLocationEventArgs args)
		{
			if (!caret.PreserveSelection)
				this.ClearSelection ();
			
			if (Options.RemoveTrailingWhitespaces && args.Location.Line != Caret.Line) {
				LineSegment line = Document.GetLine (args.Location.Line);
				if (line != null && line.WasChanged)
					Document.RemoveTrailingWhitespaces (this, line);
			}
		}
コード例 #28
0
ファイル: TextEdit.cs プロジェクト: moscrif/ide
 void HandleCarethandlePositionChanged(object sender, DocumentLocationEventArgs e)
 {
     //Console.WriteLine("HandleCarethandlePositionChanged ->"+DateTime.Now);
     TextEditorData ted = new TextEditorData(this.Document);
     //if (!ted.IsSomethingSelected && markers.Values.Any (m => m.Contains (ted.Caret.Offset)))
     //	return;
     RemoveMarkers (ted.IsSomethingSelected);
     RemoveTimer ();
     if (!ted.IsSomethingSelected)
         popupTimer = GLib.Timeout.Add (1000, DelayedTooltipShow);
 }