Inheritance: ITextEditorExtension
コード例 #1
0
ファイル: StatusBox.cs プロジェクト: yayanyang/monodevelop
		public StatusBox (SourceEditorWidget editor)
		{
			this.Editor = editor;
			PropertyService.AddPropertyHandler ("CaretStatusBoxShowRealColumns", PropertyHandler);
			
			WidgetFlags |= WidgetFlags.NoWindow;
			
			layout = new Pango.Layout (this.PangoContext);
			measureLayout = new Pango.Layout (this.PangoContext);
		}
コード例 #2
0
		public GotoLineNumberWidget (SourceEditorWidget widget, Widget container)
		{
			this.container = container;
			this.Build ();
			
			this.widget = widget;
			StoreWidgetState ();
			widget.TextEditorContainer.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
			
			//HACK: GTK rendering issue on Mac, images don't repaint unless we put them in visible eventboxes
			if (Platform.IsMac) {
				foreach (var eb in new [] { eventbox1, eventbox2 }) {
					eb.VisibleWindow = true;
					eb.ModifyBg (StateType.Normal, new Gdk.Color (230, 230, 230));
				}
			}
			this.closeButton.Clicked += delegate {
				RestoreWidgetState ();
				widget.RemoveSearchWidget ();
			};
			
			this.buttonGoToLine.Clicked += delegate {
				cleanExit = true;
				GotoLine ();
				widget.RemoveSearchWidget ();
			};
			
			foreach (Gtk.Widget child in this.Children) {
				child.KeyPressEvent += delegate (object sender, Gtk.KeyPressEventArgs args) {
					if (args.Event.Key == Gdk.Key.Escape)  {
						RestoreWidgetState ();
						widget.RemoveSearchWidget ();
					}
				};
			}
			
			Gtk.Widget oldWidget = null;
			this.FocusChildSet += delegate (object sender, Gtk.FocusChildSetArgs args)  {
				// only store state when the focus comes from a non child widget
				if (args.Widget != null && oldWidget == null)
					StoreWidgetState ();
				oldWidget = args.Widget;
			};
			
			this.entryLineNumber.Changed +=  delegate {
				PreviewLine ();
			};
				
			this.entryLineNumber.Activated += delegate {
				cleanExit = true;
				GotoLine ();
				widget.RemoveSearchWidget ();
			};
		}
コード例 #3
0
			public DecoratedScrolledWindow (SourceEditorWidget parent)
			{
				this.parent = parent;
				this.strip = new QuickTaskStrip ();

				scrolledWindow = new CompactScrolledWindow ();
				scrolledWindow.ButtonPressEvent += PrepareEvent;
				PackStart (scrolledWindow, true, true, 0);
				strip.VAdjustment = scrolledWindow.Vadjustment;
				PackEnd (strip, false, true, 0);

				parent.quickTaskProvider.ForEach (AddQuickTaskProvider);

				QuickTaskStrip.EnableFancyFeatures.Changed += FancyFeaturesChanged;
				FancyFeaturesChanged (null, null);
			}
コード例 #4
0
		public SourceEditorView ()
		{
			Counters.LoadedEditors++;
			currentFrameChanged = (EventHandler)DispatchService.GuiDispatch (new EventHandler (OnCurrentFrameChanged));
			breakpointAdded = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointAdded));
			breakpointRemoved = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointRemoved));
			breakpointStatusChanged = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointStatusChanged));
			
			widget = new SourceEditorWidget (this);
			widget.TextEditor.Document.SyntaxModeChanged += delegate(object sender, SyntaxModeChangeEventArgs e) {
				var oldProvider = e.OldMode as IQuickTaskProvider;
				if (oldProvider != null)
					widget.RemoveQuickTaskProvider (oldProvider);
				var newProvider = e.NewMode as IQuickTaskProvider;
				if (newProvider != null)
					widget.AddQuickTaskProvider (newProvider);
			};
			widget.TextEditor.Document.TextReplaced += delegate(object sender, DocumentChangeEventArgs args) {
				if (!inLoad) {
					if (widget.TextEditor.Document.IsInAtomicUndo) {
						wasEdited = true;
					} else {
						InformAutoSave ();
					}
				}
				int startIndex = args.Offset;
				int endIndex = startIndex + Math.Max (args.RemovalLength, args.InsertionLength);
				if (TextChanged != null)
					TextChanged (this, new TextChangedEventArgs (startIndex, endIndex));
			};
			
			widget.TextEditor.Document.LineChanged += delegate(object sender, LineEventArgs e) {
				UpdateBreakpoints ();
				if (messageBubbleCache != null && messageBubbleCache.RemoveLine (e.Line)) {
					MessageBubbleTextMarker marker = currentErrorMarkers.FirstOrDefault (m => m.LineSegment == e.Line);
					if (marker != null) {
						double oldHeight = marker.lastHeight;
						widget.TextEditor.TextViewMargin.RemoveCachedLine (e.Line); 
						// ensure that the line cache is renewed
						double newHeight = marker.GetLineHeight (widget.TextEditor);
					}
				}
			};
			
			widget.TextEditor.Document.BeginUndo += delegate {
				wasEdited = false;
			};
			
			widget.TextEditor.Document.EndUndo += delegate {
				if (wasEdited)
					InformAutoSave ();
			};
			widget.TextEditor.Document.Undone += (o, a) => AutoSave.InformAutoSaveThread (Document);
			widget.TextEditor.Document.Redone += (o, a) => AutoSave.InformAutoSaveThread (Document);
			
			widget.TextEditor.Document.TextReplacing += OnTextReplacing;
			widget.TextEditor.Document.TextReplaced += OnTextReplaced;
			widget.TextEditor.Document.ReadOnlyCheckDelegate = CheckReadOnly;
			
			//			widget.TextEditor.Document.DocumentUpdated += delegate {
			//				this.IsDirty = Document.IsDirty;
			//			};
			
			widget.TextEditor.Caret.PositionChanged += delegate {
				OnCaretPositionSet (EventArgs.Empty);
				FireCompletionContextChanged ();
			};
			widget.TextEditor.IconMargin.ButtonPressed += OnIconButtonPress;
		
			debugStackLineMarker = new DebugStackLineTextMarker (widget.TextEditor);
			currentDebugLineMarker = new CurrentDebugLineTextMarker (widget.TextEditor);
			

			this.WorkbenchWindowChanged += delegate {
				if (WorkbenchWindow != null) {
					widget.TextEditor.ExtensionContext = WorkbenchWindow.ExtensionContext;
					WorkbenchWindow.ActiveViewContentChanged += delegate {
						widget.UpdateLineCol ();
					};
				}
			};
			this.ContentNameChanged += delegate {
				this.Document.FileName = this.ContentName;
				if (String.IsNullOrEmpty (ContentName) || !File.Exists (ContentName))
					return;
				
				lastSaveTimeUtc = File.GetLastWriteTimeUtc (ContentName);
			};
			ClipbardRingUpdated += UpdateClipboardRing;
			
			DebuggingService.DebugSessionStarted += OnDebugSessionStarted;
			DebuggingService.CurrentFrameChanged += currentFrameChanged;
			DebuggingService.StoppedEvent += currentFrameChanged;
			DebuggingService.ResumedEvent += currentFrameChanged;
			DebuggingService.Breakpoints.BreakpointAdded += breakpointAdded;
			DebuggingService.Breakpoints.BreakpointRemoved += breakpointRemoved;
			DebuggingService.Breakpoints.BreakpointStatusChanged += breakpointStatusChanged;
			DebuggingService.Breakpoints.BreakpointModified += breakpointStatusChanged;
			DebuggingService.PinnedWatches.WatchAdded += OnWatchAdded;
			DebuggingService.PinnedWatches.WatchRemoved += OnWatchRemoved;
			DebuggingService.PinnedWatches.WatchChanged += OnWatchChanged;
			
			TaskService.Errors.TasksAdded += UpdateTasks;
			TaskService.Errors.TasksRemoved += UpdateTasks;
			TaskService.JumpedToTask += HandleTaskServiceJumpedToTask;
			IdeApp.Preferences.ShowMessageBubblesChanged += HandleIdeAppPreferencesShowMessageBubblesChanged;
			MonoDevelop.Ide.Gui.Pads.ErrorListPad errorListPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ().Content as MonoDevelop.Ide.Gui.Pads.ErrorListPad;
			errorListPad.TaskToggled += HandleErrorListPadTaskToggled;
			widget.TextEditor.Options.Changed += HandleWidgetTextEditorOptionsChanged;
			IdeApp.Preferences.DefaultHideMessageBubblesChanged += HandleIdeAppPreferencesDefaultHideMessageBubblesChanged;
			Document.AddAnnotation (this);
			FileRegistry.Add (this);
		}
コード例 #5
0
			public DecoratedScrolledWindow (SourceEditorWidget parent)
			{
				this.parent = parent;
				/*
				Border border = new Border ();
				border.HeightRequest = 1;
				PackStart (border, false, true, 0);
								 
				HBox box = new HBox ();
				
				border = new Border ();
				border.WidthRequest = 1;
				box.PackStart (border, false, true, 0);
				
				scrolledWindow = new ScrolledWindow ();
				scrolledWindow.BorderWidth = 0;
				scrolledWindow.ShadowType = ShadowType.None;
				scrolledWindow.ButtonPressEvent += PrepareEvent;
				box.PackStart (scrolledWindow, true, true, 0);
				
				
				border = new Border ();
				border.WidthRequest = 1;
				box.PackStart (border, false, true, 0);
				
				PackStart (box, true, true, 0);
				
				border = new Border ();
				border.HeightRequest = 1;
				PackStart (border, false, true, 0);*/
				
				scrolledWindow = new SmartScrolledWindow ();
//				scrolledWindow.BorderWidth = 0;
//				scrolledWindow.ShadowType = ShadowType.In;
				scrolledWindow.ButtonPressEvent += PrepareEvent;
				PackStart (scrolledWindow, true, true, 0);
			}
コード例 #6
0
		public override void Dispose()
		{
			StoreSettings ();
			
			this.isDisposed= true;
			Counters.LoadedEditors--;
			
			if (messageBubbleHighlightPopupWindow != null)
				messageBubbleHighlightPopupWindow.Destroy ();
			
			IdeApp.Preferences.DefaultHideMessageBubblesChanged -= HandleIdeAppPreferencesDefaultHideMessageBubblesChanged;
			IdeApp.Preferences.ShowMessageBubblesChanged -= HandleIdeAppPreferencesShowMessageBubblesChanged;
			MonoDevelop.Ide.Gui.Pads.ErrorListPad errorListPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ().Content as MonoDevelop.Ide.Gui.Pads.ErrorListPad;
			errorListPad.TaskToggled -= HandleErrorListPadTaskToggled;
			
			DisposeErrorMarkers ();
			
			ClipbardRingUpdated -= UpdateClipboardRing;
			if (fileSystemWatcher != null) {
				fileSystemWatcher.EnableRaisingEvents = false;
				fileSystemWatcher.Dispose ();
				fileSystemWatcher = null;
			}
			
			if (widget != null) {
				widget.TextEditor.Document.TextReplacing -= OnTextReplacing;
				widget.TextEditor.Document.TextReplacing -= OnTextReplaced;
				widget.TextEditor.Document.ReadOnlyCheckDelegate = null;
				widget.TextEditor.Options.Changed -= HandleWidgetTextEditorOptionsChanged;
				// widget is destroyed with it's parent.
				// widget.Destroy ();
				widget = null;
			}
			
			DebuggingService.DebugSessionStarted -= OnDebugSessionStarted;
			DebuggingService.CurrentFrameChanged -= currentFrameChanged;
			DebuggingService.StoppedEvent -= currentFrameChanged;
			DebuggingService.ResumedEvent -= currentFrameChanged;
			DebuggingService.Breakpoints.BreakpointAdded -= breakpointAdded;
			DebuggingService.Breakpoints.BreakpointRemoved -= breakpointRemoved;
			DebuggingService.Breakpoints.BreakpointStatusChanged -= breakpointStatusChanged;
			DebuggingService.Breakpoints.BreakpointModified -= breakpointStatusChanged;
			DebuggingService.PinnedWatches.WatchAdded -= OnWatchAdded;
			DebuggingService.PinnedWatches.WatchRemoved -= OnWatchRemoved;
			DebuggingService.PinnedWatches.WatchChanged -= OnWatchChanged;
			
			TaskService.Errors.TasksAdded   -= UpdateTasks;
			TaskService.Errors.TasksRemoved -= UpdateTasks;
			TaskService.Errors.TasksChanged -= UpdateTasks;
			TaskService.JumpedToTask -= HandleTaskServiceJumpedToTask;
			
			FileService.FileCreated -= fileChanged;
			FileService.FileChanged -= fileChanged;
			
			// This is not necessary but helps when tracking down memory leaks
			
			debugStackLineMarker = null;
			currentDebugLineMarker = null;
			
			currentFrameChanged = null;
			breakpointAdded = null;
			breakpointRemoved = null;
			breakpointStatusChanged = null;

		}
コード例 #7
0
		public SourceEditorView ()
		{
			Counters.LoadedEditors++;
			currentFrameChanged = (EventHandler)DispatchService.GuiDispatch (new EventHandler (OnCurrentFrameChanged));
			breakpointAdded = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointAdded));
			breakpointRemoved = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointRemoved));
			breakpointStatusChanged = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointStatusChanged));
			
			widget = new SourceEditorWidget (this);
			widget.TextEditor.Document.TextReplaced += delegate(object sender, ReplaceEventArgs args) {
				if (!inLoad) {
					if (widget.TextEditor.Document.IsInAtomicUndo) {
						wasEdited = true;
					} else {
						AutoSave.InformAutoSaveThread (Document);
					}
				}
				int startIndex = args.Offset;
				int endIndex = startIndex + Math.Max (args.Count, args.Value != null ? args.Value.Length : 0);
				if (TextChanged != null)
					TextChanged (this, new TextChangedEventArgs (startIndex, endIndex));
			};
			
			widget.TextEditor.Document.LineChanged += delegate(object sender, LineEventArgs e) {
				UpdateBreakpoints ();
				if (MessageBubbleTextMarker.RemoveLine (e.Line)) {
					MessageBubbleTextMarker marker = currentErrorMarkers.FirstOrDefault (m => m.LineSegment == e.Line);
					if (marker != null) {
						double oldHeight = marker.lastHeight;
						widget.TextEditor.TextViewMargin.RemoveCachedLine (e.Line); // ensure that the line cache is renewed
						double newHeight = marker.GetLineHeight (widget.TextEditor);
						if (oldHeight != newHeight)
							widget.Document.CommitLineToEndUpdate (widget.TextEditor.Document.OffsetToLineNumber (e.Line.Offset));
					}
				}
			};
			
			widget.TextEditor.Document.BeginUndo += delegate {
				wasEdited = false;
			};
			
			widget.TextEditor.Document.EndUndo += delegate {
				if (wasEdited)
					AutoSave.InformAutoSaveThread (Document);
			};
			widget.TextEditor.Document.Undone += (o, a) => AutoSave.InformAutoSaveThread (Document);
			widget.TextEditor.Document.Redone += (o, a) => AutoSave.InformAutoSaveThread (Document);
			
			widget.TextEditor.Document.TextReplacing += OnTextReplacing;
			widget.TextEditor.Document.TextReplaced += OnTextReplaced;
			widget.TextEditor.Document.ReadOnlyCheckDelegate = CheckReadOnly;
			
			//			widget.TextEditor.Document.DocumentUpdated += delegate {
			//				this.IsDirty = Document.IsDirty;
			//			};
			
			widget.TextEditor.Caret.PositionChanged += delegate {
				OnCaretPositionSet (EventArgs.Empty);
				FireCompletionContextChanged ();
			};
			widget.TextEditor.IconMargin.ButtonPressed += OnIconButtonPress;
			
			debugStackLineMarker = new DebugStackLineTextMarker (widget.TextEditor);
			currentDebugLineMarker = new CurrentDebugLineTextMarker (widget.TextEditor);
			
			fileSystemWatcher = new FileSystemWatcher ();
			fileSystemWatcher.Created += (FileSystemEventHandler)DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged));
			fileSystemWatcher.Changed += (FileSystemEventHandler)DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged));
			
			fileChanged = DispatchService.GuiDispatch (new EventHandler<FileEventArgs> (GotFileChanged));
			FileService.FileCreated += fileChanged;
			FileService.FileChanged += fileChanged;
			
			this.WorkbenchWindowChanged += delegate {
				if (WorkbenchWindow != null) {
					WorkbenchWindow.ActiveViewContentChanged += delegate {
						widget.UpdateLineCol ();
					};
				}
			};
			this.ContentNameChanged += delegate {
				this.Document.FileName = this.ContentName;
				isInWrite = true;
				if (String.IsNullOrEmpty (ContentName) || !File.Exists (ContentName))
					return;
				
				fileSystemWatcher.EnableRaisingEvents = false;
				lastSaveTime = File.GetLastWriteTime (ContentName);
				fileSystemWatcher.Path = Path.GetDirectoryName (ContentName);
				fileSystemWatcher.Filter = Path.GetFileName (ContentName);
				isInWrite = false;
				fileSystemWatcher.EnableRaisingEvents = true;
			};
			ClipbardRingUpdated += UpdateClipboardRing;
			
			DebuggingService.DebugSessionStarted += OnDebugSessionStarted;
			DebuggingService.CurrentFrameChanged += currentFrameChanged;
			DebuggingService.StoppedEvent += currentFrameChanged;
			DebuggingService.ResumedEvent += currentFrameChanged;
			DebuggingService.Breakpoints.BreakpointAdded += breakpointAdded;
			DebuggingService.Breakpoints.BreakpointRemoved += breakpointRemoved;
			DebuggingService.Breakpoints.BreakpointStatusChanged += breakpointStatusChanged;
			DebuggingService.Breakpoints.BreakpointModified += breakpointStatusChanged;
			DebuggingService.PinnedWatches.WatchAdded += OnWatchAdded;
			DebuggingService.PinnedWatches.WatchRemoved += OnWatchRemoved;
			DebuggingService.PinnedWatches.WatchChanged += OnWatchChanged;
			
			TaskService.Errors.TasksAdded   += UpdateTasks;
			TaskService.Errors.TasksRemoved += UpdateTasks;
			TaskService.JumpedToTask += HandleTaskServiceJumpedToTask;
			IdeApp.Preferences.ShowMessageBubblesChanged += HandleIdeAppPreferencesShowMessageBubblesChanged;
			MonoDevelop.Ide.Gui.Pads.ErrorListPad errorListPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ().Content as MonoDevelop.Ide.Gui.Pads.ErrorListPad;
			errorListPad.TaskToggled += HandleErrorListPadTaskToggled;
			widget.TextEditor.Options.Changed += HandleWidgetTextEditorOptionsChanged;
			IdeApp.Preferences.DefaultHideMessageBubblesChanged += HandleIdeAppPreferencesDefaultHideMessageBubblesChanged;
		}
コード例 #8
0
			public DecoratedScrolledWindow (SourceEditorWidget parent)
			{
				this.parent = parent;
				this.strip = new QuickTaskStrip ();
				/*
				Border border = new Border ();
				border.HeightRequest = 1;
				PackStart (border, false, true, 0);
								 
				HBox box = new HBox ();
				
				border = new Border ();
				border.WidthRequest = 1;
				box.PackStart (border, false, true, 0);
				
				scrolledWindow = new ScrolledWindow ();
				scrolledWindow.BorderWidth = 0;
				scrolledWindow.ShadowType = ShadowType.None;
				scrolledWindow.ButtonPressEvent += PrepareEvent;
				box.PackStart (scrolledWindow, true, true, 0);
				
				
				border = new Border ();
				border.WidthRequest = 1;
				box.PackStart (border, false, true, 0);
				
				PackStart (box, true, true, 0);
				
				border = new Border ();
				border.HeightRequest = 1;
				PackStart (border, false, true, 0);*/
				
				scrolledWindow = new SmartScrolledWindow ();
//				scrolledWindow.BorderWidth = 0;
//				scrolledWindow.ShadowType = ShadowType.In;
				scrolledWindow.ButtonPressEvent += PrepareEvent;
				PackStart (scrolledWindow, true, true, 0);
				if (parent.quickTaskProvider.Count > 0) {
					strip.VAdjustment = scrolledWindow.Vadjustment;
					scrolledWindow.ReplaceVScrollBar (strip);
				} else {
					strip.Visible = false;
				}
				parent.quickTaskProvider.ForEach (p => AddQuickTaskProvider (p));
			}
コード例 #9
0
		public SourceEditorView (IReadonlyTextDocument document = null)
		{
			Counters.LoadedEditors++;

			widget = new SourceEditorWidget (this);
			if (document != null) {
				var textDocument = document as TextDocument;
				if (textDocument != null) {
					widget.TextEditor.Document = textDocument;
				} else {
					widget.TextEditor.Document.Text = document.Text;
				}
			}

			widget.TextEditor.Document.TextReplaced += HandleTextReplaced;
			widget.TextEditor.Document.LineChanged += HandleLineChanged;
			widget.TextEditor.Document.LineInserted += HandleLineChanged;
			widget.TextEditor.Document.LineRemoved += HandleLineChanged;

			widget.TextEditor.Document.BeginUndo += HandleBeginUndo; 
			widget.TextEditor.Document.EndUndo += HandleEndUndo;

			widget.TextEditor.Document.TextReplacing += OnTextReplacing;
			widget.TextEditor.Document.TextReplaced += OnTextReplaced;
			widget.TextEditor.Document.ReadOnlyCheckDelegate = CheckReadOnly;
			widget.TextEditor.TextViewMargin.LineShown += TextViewMargin_LineShown;
			//			widget.TextEditor.Document.DocumentUpdated += delegate {
			//				this.IsDirty = Document.IsDirty;
			//			};
			
			widget.TextEditor.Caret.PositionChanged += HandlePositionChanged; 
			widget.TextEditor.IconMargin.ButtonPressed += OnIconButtonPress;

			ClipbardRingUpdated += UpdateClipboardRing;
			
			TextEditorService.FileExtensionAdded += HandleFileExtensionAdded;
			TextEditorService.FileExtensionRemoved += HandleFileExtensionRemoved;

			breakpoints = DebuggingService.Breakpoints;
			DebuggingService.DebugSessionStarted += OnDebugSessionStarted;
			DebuggingService.StoppedEvent += HandleTargetExited;
			DebuggingService.ExecutionLocationChanged += OnExecutionLocationChanged;
			DebuggingService.CurrentFrameChanged += OnCurrentFrameChanged;
			DebuggingService.StoppedEvent += OnCurrentFrameChanged;
			DebuggingService.ResumedEvent += OnCurrentFrameChanged;
			breakpoints.BreakpointAdded += OnBreakpointAdded;
			breakpoints.BreakpointRemoved += OnBreakpointRemoved;
			breakpoints.BreakpointStatusChanged += OnBreakpointStatusChanged;
			breakpoints.BreakpointModified += OnBreakpointStatusChanged;
			DebuggingService.PinnedWatches.WatchAdded += OnWatchAdded;
			DebuggingService.PinnedWatches.WatchRemoved += OnWatchRemoved;
			DebuggingService.PinnedWatches.WatchChanged += OnWatchChanged;
			
			TaskService.Errors.TasksAdded += UpdateTasks;
			TaskService.Errors.TasksRemoved += UpdateTasks;
			TaskService.JumpedToTask += HandleTaskServiceJumpedToTask;
			IdeApp.Preferences.ShowMessageBubbles.Changed += HandleIdeAppPreferencesShowMessageBubblesChanged;
			TaskService.TaskToggled += HandleErrorListPadTaskToggled;
			widget.TextEditor.Options.Changed += HandleWidgetTextEditorOptionsChanged;
			IdeApp.Preferences.DefaultHideMessageBubbles.Changed += HandleIdeAppPreferencesDefaultHideMessageBubblesChanged;
			Document.AddAnnotation (this);
			if (document != null) {
				Document.MimeType = document.MimeType;
				Document.FileName = document.FileName;
			}
			FileRegistry.Add (this);
		}
コード例 #10
0
		public SourceEditorView ()
		{
			Counters.LoadedEditors++;
			currentFrameChanged = (EventHandler)DispatchService.GuiDispatch (new EventHandler (OnCurrentFrameChanged));
			breakpointAdded = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointAdded));
			breakpointRemoved = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointRemoved));
			breakpointStatusChanged = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointStatusChanged));

			widget = new SourceEditorWidget (this);
			widget.TextEditor.Document.SyntaxModeChanged += HandleSyntaxModeChanged;
			widget.TextEditor.Document.TextReplaced += HandleTextReplaced;
			widget.TextEditor.Document.LineChanged += HandleLineChanged;

			widget.TextEditor.Document.BeginUndo += HandleBeginUndo; 
			widget.TextEditor.Document.EndUndo += HandleEndUndo;
			widget.TextEditor.Document.Undone += HandleUndone;
			widget.TextEditor.Document.Redone += HandleUndone;

			widget.TextEditor.Document.TextReplacing += OnTextReplacing;
			widget.TextEditor.Document.TextReplaced += OnTextReplaced;
			widget.TextEditor.Document.ReadOnlyCheckDelegate = CheckReadOnly;
			
			//			widget.TextEditor.Document.DocumentUpdated += delegate {
			//				this.IsDirty = Document.IsDirty;
			//			};
			
			widget.TextEditor.Caret.PositionChanged += HandlePositionChanged; 
			widget.TextEditor.IconMargin.ButtonPressed += OnIconButtonPress;
		
			debugStackLineMarker = new DebugStackLineTextMarker (widget.TextEditor);
			currentDebugLineMarker = new CurrentDebugLineTextMarker (widget.TextEditor);
			
			this.WorkbenchWindowChanged += HandleWorkbenchWindowChanged;
			this.ContentNameChanged += delegate {
				this.Document.FileName = this.ContentName;
				if (String.IsNullOrEmpty (ContentName) || !File.Exists (ContentName))
					return;
				
				lastSaveTimeUtc = File.GetLastWriteTimeUtc (ContentName);
			};
			ClipbardRingUpdated += UpdateClipboardRing;
			
			TextEditorService.FileExtensionAdded += HandleFileExtensionAdded;
			TextEditorService.FileExtensionRemoved += HandleFileExtensionRemoved;

			breakpoints = DebuggingService.Breakpoints;
			DebuggingService.DebugSessionStarted += OnDebugSessionStarted;
			DebuggingService.CurrentFrameChanged += currentFrameChanged;
			DebuggingService.StoppedEvent += currentFrameChanged;
			DebuggingService.ResumedEvent += currentFrameChanged;
			breakpoints.BreakpointAdded += breakpointAdded;
			breakpoints.BreakpointRemoved += breakpointRemoved;
			breakpoints.BreakpointStatusChanged += breakpointStatusChanged;
			breakpoints.BreakpointModified += breakpointStatusChanged;
			DebuggingService.PinnedWatches.WatchAdded += OnWatchAdded;
			DebuggingService.PinnedWatches.WatchRemoved += OnWatchRemoved;
			DebuggingService.PinnedWatches.WatchChanged += OnWatchChanged;
			
			TaskService.Errors.TasksAdded += UpdateTasks;
			TaskService.Errors.TasksRemoved += UpdateTasks;
			TaskService.JumpedToTask += HandleTaskServiceJumpedToTask;
			IdeApp.Preferences.ShowMessageBubblesChanged += HandleIdeAppPreferencesShowMessageBubblesChanged;
			TaskService.TaskToggled += HandleErrorListPadTaskToggled;
			widget.TextEditor.Options.Changed += HandleWidgetTextEditorOptionsChanged;
			IdeApp.Preferences.DefaultHideMessageBubblesChanged += HandleIdeAppPreferencesDefaultHideMessageBubblesChanged;
			Document.AddAnnotation (this);
			FileRegistry.Add (this);
		}
コード例 #11
0
ファイル: StatusBox.cs プロジェクト: yayanyang/monodevelop
		protected override void OnDestroyed ()
		{
			base.OnDestroyed ();
			if (measureLayout != null) {
				measureLayout.Dispose ();
				measureLayout = null;
			}
			if (layout != null) {
				layout.Dispose ();
				layout = null;
			}
			Editor = null;
			PropertyService.RemovePropertyHandler ("CaretStatusBoxShowRealColumns", PropertyHandler);
		}
コード例 #12
0
			public DecoratedScrolledWindow (SourceEditorWidget parent)
			{
				this.parent = parent;
				this.strip = new QuickTaskStrip ();

				scrolledWindow = new CompactScrolledWindow ();
				scrolledWindow.ButtonPressEvent += PrepareEvent;
				PackStart (scrolledWindow, true, true, 0);
				strip.VAdjustment = scrolledWindow.Vadjustment;
				PackEnd (strip, false, true, 0);

				parent.quickTaskProvider.ForEach (p => AddQuickTaskProvider (p));
			}
コード例 #13
0
		protected override void OnDestroyed ()
		{
			this.widget.TextEditor.TextViewMargin.HideSelection = false;
			widget.TextEditor.Caret.PositionChanged -= HandleWidgetTextEditorCaretPositionChanged;
			widget.TextEditor.TextViewMargin.SearchRegionsUpdated -= HandleWidgetTextEditorTextViewMarginSearchRegionsUpdated;
			widget.TextEditorContainer.SizeAllocated -= HandleViewTextEditorhandleSizeAllocated;
			
			// SearchPatternChanged -= UpdateSearchPattern;
			ReplacePatternChanged -= UpdateReplacePattern;
			
			if (widget != null) {
				widget.TextEditor.QueueDraw ();
				widget = null;
			}
			base.OnDestroyed ();
		}
コード例 #14
0
		public SearchAndReplaceWidget (SourceEditorWidget widget, Widget container)
		{
			this.container = container;
			widget.TextEditorContainer.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
			widget.TextEditor.TextViewMargin.SearchRegionsUpdated += HandleWidgetTextEditorTextViewMarginSearchRegionsUpdated;
			widget.TextEditor.Caret.PositionChanged += HandleWidgetTextEditorCaretPositionChanged;
			this.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
			this.Name = "SearchAndReplaceWidget";
			this.Events = Gdk.EventMask.AllEventsMask;
			widget.DisableAutomaticSearchPatternCaseMatch = false;
			Build();
			this.buttonReplace.TooltipText = GettextCatalog.GetString ("Replace");
			this.buttonSearchForward.TooltipText = GettextCatalog.GetString ("Find next");
			this.buttonSearchBackward.TooltipText = GettextCatalog.GetString ("Find previous");
			this.buttonSearchMode.TooltipText = GettextCatalog.GetString ("Toggle between search and replace mode");
			this.searchEntry.Ready = true;
			this.searchEntry.Visible = true;
			this.searchEntry.WidthRequest = widget.Vbox.Allocation.Width / 3;
			this.searchEntry.ForceFilterButtonVisible = true;
			replaceWidgets = new Widget [] {
		//		labelReplace,
				entryReplace,
				buttonReplace,
				buttonReplaceAll
			};
			
			this.FocusChain = new Widget [] {
				this.searchEntry,
				this.buttonSearchForward,
				this.buttonSearchBackward,
				entryReplace,
				buttonReplace,
				buttonReplaceAll
			};
			
			this.widget = widget;
			FilterHistory (seachHistoryProperty);
			FilterHistory (replaceHistoryProperty);
			//HACK: GTK rendering issue on Mac, images don't repaint unless we put them in visible eventboxes
			if (Platform.IsMac) {
				foreach (var eb in new [] { eventbox2, eventbox3, eventbox4, eventbox5, eventbox6 }) {
					eb.VisibleWindow = true;
					eb.ModifyBg (StateType.Normal, new Gdk.Color (230, 230, 230));
				}
			}

			if (String.IsNullOrEmpty (widget.TextEditor.SearchPattern)) {
				widget.TextEditor.SearchPattern = searchPattern;
			} else if (widget.TextEditor.SearchPattern != searchPattern) {
				searchPattern = widget.TextEditor.SearchPattern;
				//FireSearchPatternChanged ();
			}
			UpdateSearchPattern ();
			
			//searchEntry.Model = searchHistory;
			
			searchEntry.Entry.KeyReleaseEvent += delegate {
				widget.CheckSearchPatternCasing (SearchPattern);
/*				widget.SetSearchPattern (SearchPattern);
				searchPattern = SearchPattern;
				UpdateSearchEntry ();*/
			};
			
			searchEntry.Entry.Changed += delegate {
				widget.SetSearchPattern (SearchPattern);
				string oldPattern = searchPattern;
				searchPattern = SearchPattern;
				if (oldPattern != searchPattern)
					UpdateSearchEntry ();
				var history = GetHistory (seachHistoryProperty);
				if (history.Count > 0 && history[0] == oldPattern) {
					ChangeHistory (seachHistoryProperty, searchPattern);
				} else {
					UpdateSearchHistory (searchPattern);
				}
			};
			
			entryReplace.Text = replacePattern;
//			entryReplace.Model = replaceHistory;
//			RestoreReplaceHistory ();
			
			foreach (Gtk.Widget child in Children) {
				child.KeyPressEvent += delegate (object sender, Gtk.KeyPressEventArgs args) {
					if (args.Event.Key == Gdk.Key.Escape)
						widget.RemoveSearchWidget ();
				};
			}
			
			closeButton.Clicked += delegate {
				widget.RemoveSearchWidget ();
			};
			
			buttonSearchMode.Clicked += delegate {
				IsReplaceMode = !IsReplaceMode;
			};
			
			// comboboxSearchAs.AppendText (GettextCatalog.GetString ("Text"));
			// comboboxSearchAs.AppendText (GettextCatalog.GetString ("Regular Expressions"));
			// comboboxSearchAs.Active = 0;
			// ReplacePatternChanged += UpdateReplacePattern;
			
			//SearchPatternChanged += UpdateSearchPattern;
			FocusChildSet += delegate {
				StoreWidgetState ();
			};
			
			searchEntry.Entry.Activated += delegate {
				UpdateSearchHistory (SearchPattern);
				widget.FindNext (false);
			};
			
			buttonSearchForward.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				widget.FindNext (false);
			};
			
			buttonSearchBackward.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				widget.FindPrevious (false);
			};
			
//			optionsButton.Label = MonoDevelop.Core.GettextCatalog.GetString ("Options");
			
			this.searchEntry.RequestMenu += HandleSearchEntryhandleRequestMenu;
			
			entryReplace.Changed += delegate {
				replacePattern = ReplacePattern;
				if (!inReplaceUpdate) 
					FireReplacePatternChanged ();
			};
			
			entryReplace.Activated += delegate {
				UpdateSearchHistory (SearchPattern);
				UpdateReplaceHistory (ReplacePattern);
				widget.Replace ();
				entryReplace.GrabFocus ();
			};
			
			buttonReplace.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				UpdateReplaceHistory (ReplacePattern);
				widget.Replace ();
			};
			
			buttonReplaceAll.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				UpdateReplaceHistory (ReplacePattern);
				widget.ReplaceAll ();
			};
			
			buttonSearchForward.KeyPressEvent += OnNavigateKeyPressEvent;
			buttonSearchBackward.KeyPressEvent += OnNavigateKeyPressEvent;
			searchEntry.Entry.KeyPressEvent += OnNavigateKeyPressEvent;
			entryReplace.KeyPressEvent += OnNavigateKeyPressEvent;
			buttonReplace.KeyPressEvent += OnNavigateKeyPressEvent;
			buttonReplaceAll.KeyPressEvent += OnNavigateKeyPressEvent;
			
			resultInformLabelEventBox = this.searchEntry.AddLabelWidget (resultInformLabel);
			resultInformLabelEventBox.BorderWidth = 2;
			resultInformLabel.Xpad = 2;
			resultInformLabel.Show ();
			searchEntry.FilterButtonPixbuf = new Gdk.Pixbuf (typeof(SearchAndReplaceWidget).Assembly, "searchoptions.png");
		}
コード例 #15
0
			//ParseInformationEventArgs args;
			
			public ParseInformationUpdaterWorkerThread (SourceEditorWidget widget)
			{
				this.widget = widget;
			}