Ejemplo n.º 1
0
 public HistoricalFileView(string name, string file, string text)
     : base(name)
 {
     // How do I get it to recognize the language of the file?
     widget = new SourceEditor(null);
     widget.Text = text;
     widget.View.Editable = false;
     widget.ShowAll();
 }
 public SourceEditorView(SourceEditorBuffer buf, SourceEditor parent)
 {
     this.ParentEditor = parent;
     this.TabsWidth = 4;
     Buffer = this.buf = buf;
     AutoIndent = true;
     SmartHomeEnd = true;
     ShowLineNumbers = true;
     ShowLineMarkers = true;
     buf.PlaceCursor (buf.StartIter);
     GrabFocus ();
     buf.MarkSet += new MarkSetHandler (BufferMarkSet);
     buf.Changed += new EventHandler (BufferChanged);
 }
Ejemplo n.º 3
0
        public SourceEditorView(SourceEditorBuffer buf, SourceEditor parent)
        {
            this.ParentEditor = parent;
            this.TabWidth     = 4;
            Buffer            = this.buf = buf;
            AutoIndent        = false;
            SmartHomeEnd      = SourceSmartHomeEndType.Always;
            ShowLineNumbers   = true;
            //FIXME GTKSV2
            //ShowLineMarkers = true;
            controlsDrawer = new DrawControlCharacterImp(this);
            buf.PlaceCursor(buf.StartIter);
            GrabFocus();
            buf.MarkSet += new MarkSetHandler(BufferMarkSet);
            buf.Changed += new EventHandler(BufferChanged);
            LoadEditActions();
            this.Events = this.Events | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ExposureMask;

            InitAutoCorrectionValues();
        }
        public override void Dispose()
        {
            if (Runtime.DebuggingService != null) {
                Runtime.DebuggingService.BreakpointAdded -= breakpointAddedHandler;
                Runtime.DebuggingService.BreakpointRemoved -= breakpointRemovedHandler;
                Runtime.DebuggingService.ExecutionLocationChanged -= executionChangedHandler;
            }

            mainBox.Remove (se);
            properties.PropertyChanged -= propertyHanlder;
            se.Buffer.ModifiedChanged -= new EventHandler (OnModifiedChanged);
            se.Buffer.MarkSet -= new MarkSetHandler (OnMarkSet);
            se.Buffer.Changed -= new EventHandler (OnChanged);
            se.View.ToggleOverwrite -= new EventHandler (CaretModeChanged);
            ContentNameChanged -= new EventHandler (UpdateFSW);
            se.Dispose ();
            fsw.Dispose ();
            se = null;
        }
        public SourceEditorDisplayBindingWrapper()
        {
            mainBox = new VBox ();
            editorBar = new HBox ();
            mainBox.PackStart (editorBar, false, false, 0);
            se = new SourceEditor (this);
            se.Buffer.ModifiedChanged += new EventHandler (OnModifiedChanged);
            se.Buffer.MarkSet += new MarkSetHandler (OnMarkSet);
            se.Buffer.Changed += new EventHandler (OnChanged);
            se.View.ToggleOverwrite += new EventHandler (CaretModeChanged);
            ContentNameChanged += new EventHandler (UpdateFSW);

            CaretModeChanged (null, null);
            SetInitialValues ();

            propertyHanlder = (PropertyEventHandler) Runtime.DispatchService.GuiDispatch (new PropertyEventHandler (PropertiesChanged));
            PropertyService propertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
            properties = ((IProperties) propertyService.GetProperty("MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties()));
            properties.PropertyChanged += propertyHanlder;
            fsw = new FileSystemWatcher ();
            fsw.Changed += (FileSystemEventHandler) Runtime.DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged));
            UpdateFSW (null, null);
            mainBox.PackStart (se, true, true, 0);

            if (Runtime.DebuggingService != null) {
                breakpointAddedHandler = (BreakpointEventHandler) Runtime.DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointAdded));
                breakpointRemovedHandler = (BreakpointEventHandler) Runtime.DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointRemoved));
                executionChangedHandler = (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (OnExecutionLocationChanged));

                Runtime.DebuggingService.BreakpointAdded += breakpointAddedHandler;
                Runtime.DebuggingService.BreakpointRemoved += breakpointRemovedHandler;
                Runtime.DebuggingService.ExecutionLocationChanged += executionChangedHandler;
            }
            mainBox.ShowAll ();
        }
		public SourceEditorView (SourceEditorBuffer buf, SourceEditor parent)
		{
			this.ParentEditor = parent;
			this.TabWidth = 4;
			Buffer = this.buf = buf;
			AutoIndent = false;
			SmartHomeEnd = SourceSmartHomeEndType.Always;
			ShowLineNumbers = true;
			//FIXME GTKSV2
			//ShowLineMarkers = true;
			controlsDrawer = new DrawControlCharacterImp (this);
			buf.PlaceCursor (buf.StartIter);
			GrabFocus ();
			buf.MarkSet += new MarkSetHandler (BufferMarkSet);
			buf.Changed += new EventHandler (BufferChanged);
			LoadEditActions ();
			this.Events = this.Events | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ExposureMask;
			
			InitAutoCorrectionValues();
		}
		public override void Dispose()
		{
			disposed = true;
			/*FIXME gtksv2
			if (Services.DebuggingService != null) {
				Services.DebuggingService.BreakpointAdded -= breakpointAddedHandler;
				Services.DebuggingService.BreakpointRemoved -= breakpointRemovedHandler;
				Services.DebuggingService.ExecutionLocationChanged -= executionChangedHandler;
			}*/
			TextFileService.FireResetCountChanges (this);

			properties.PropertyChanged -= propertyHandler;
			se.Buffer.ModifiedChanged -= new EventHandler (OnModifiedChanged);
			se.Buffer.MarkSet -= new MarkSetHandler (OnMarkSet);
			se.Buffer.Changed -= new EventHandler (OnChanged);
			se.View.ToggleOverwrite -= new EventHandler (CaretModeChanged);
			ContentNameChanged -= new EventHandler (UpdateFSW);
   			membersCombo.Changed -= new EventHandler (MemberChanged);
			classCombo.Changed -= new EventHandler (ClassChanged);
				
			classStore.Dispose ();
			memberStore.Dispose ();
			
			membersCombo.Model = null;
			classCombo.Model = null;
			
			IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= new ParseInformationEventHandler(UpdateClassBrowser);
			mainBox.Destroy ();
			fsw.Dispose ();
			se = null;
			base.Dispose ();
		}
		public SourceEditorDisplayBindingWrapper ()
		{
			mainBox = new VBox ();
			mainBox.Spacing = 3;
			editorBar = new VBox ();
			mainBox.PackStart (editorBar, false, true, 0);
			
			classBrowser = new HBox(true, 2);
			classCombo = new Gtk.ComboBox();
			classCombo.WidthRequest = 1;
			
			membersCombo = new Gtk.ComboBox();
			membersCombo.WidthRequest = 1;
			
			// Setup the columns and column renders for the comboboxes
			CellRendererPixbuf pixr = new CellRendererPixbuf();
			pixr.Ypad = 0;
			classCombo.PackStart(pixr, false);
			classCombo.AddAttribute(pixr, "pixbuf", 0);
			CellRendererText colr = new CellRendererText();
			colr.Ypad = 0;
			colr.Ellipsize = Pango.EllipsizeMode.End;
			classCombo.PackStart(colr, true);
			classCombo.AddAttribute(colr, "text", 1);
			
			pixr = new CellRendererPixbuf();
			pixr.Ypad = 0;
			membersCombo.PackStart(pixr, false);
			membersCombo.AddAttribute(pixr, "pixbuf", 0);
			colr = new CellRendererText();
			colr.Ypad = 0;
			colr.Ellipsize = Pango.EllipsizeMode.End;
			membersCombo.PackStart(colr, true);
			membersCombo.AddAttribute(colr, "text", 1);
			
			// Pack the controls into the editorbar just below the file name tabs.
			EventBox tbox = new EventBox ();
			tbox.Add (classCombo);
			classBrowser.PackStart(tbox, true, true, 0);
			tbox = new EventBox ();
			tbox.Add (membersCombo);
			classBrowser.PackStart (tbox, true, true, 0);
			
			editorBar.PackEnd (classBrowser, false, true, 0);
			
			
			// Set up the data stores for the comboboxes
			classStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(IClass));
			classCombo.Model = classStore;	
			memberStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(IMember));
			memberStore.SetSortColumnId (1, Gtk.SortType.Ascending);
			membersCombo.Model = memberStore;
   			membersCombo.Changed += new EventHandler (MemberChanged);
			classCombo.Changed += new EventHandler (ClassChanged);
			
			se = new SourceEditor (this);
			se.Buffer.ModifiedChanged += new EventHandler (OnModifiedChanged);
			se.Buffer.MarkSet += new MarkSetHandler (OnMarkSet);
			se.Buffer.Changed += new EventHandler (OnChanged);
			se.View.ToggleOverwrite += new EventHandler (CaretModeChanged);
			se.Buffer.LineCountChanged += delegate (int line, int count, int column) {
				TextFileService.FireLineCountChanged (this, line, count, column);
			};
			ContentNameChanged += new EventHandler (UpdateFSW);
			
			// setup a focus chain so that the editor widget gets focus when
			// switching tabs rather than the classCombo, by default
			Widget [] chain = new Widget [3];
			chain[0] = se;
			chain[1] = classCombo;
			chain[2] = membersCombo;
			((Container) mainBox).FocusChain = chain;
			
			CaretModeChanged (null, null);
			
			propertyHandler = (EventHandler<PropertyChangedEventArgs>) DispatchService.GuiDispatch (new EventHandler<PropertyChangedEventArgs> (PropertiesChanged));
			properties = TextEditorProperties.Properties;
			properties.PropertyChanged += propertyHandler;
			fsw = new FileSystemWatcher ();
			fsw.Created += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged));	
			fsw.Changed += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged));
			UpdateFSW (null, null);
			mainBox.PackStart (se, true, true, 0);
			/* FIXME GTKSV 2
			if (Services.DebuggingService != null) {
				breakpointAddedHandler = (BreakpointEventHandler) DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointAdded));
				breakpointRemovedHandler = (BreakpointEventHandler) DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointRemoved));
				executionChangedHandler = (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnExecutionLocationChanged));
				
				Services.DebuggingService.BreakpointAdded += breakpointAddedHandler;
				Services.DebuggingService.BreakpointRemoved += breakpointRemovedHandler;
				Services.DebuggingService.ExecutionLocationChanged += executionChangedHandler;
			}
			*/
			IdeApp.Workspace.ParserDatabase.ParseInformationChanged += new ParseInformationEventHandler(UpdateClassBrowser);
			
			mainBox.ShowAll ();
			
			SetInitialValues ();
		}