Inheritance: ITextEditorOptions
Example #1
0
        /// <summary>
        /// Default constructor that configures the Completion form.
        /// </summary>
        public EditorView(ViewBase owner) : base(owner)
        {
            scroller   = new ScrolledWindow();
            textEditor = new MonoTextEditor();
            scroller.Add(textEditor);
            _mainWidget = scroller;
            Mono.TextEditor.TextEditorOptions options = new Mono.TextEditor.TextEditorOptions();
            options.EnableSyntaxHighlighting = true;
            options.ColorScheme                = "Visual Studio";
            options.HighlightCaretLine         = true;
            textEditor.Options                 = options;
            textEditor.TextArea.DoPopupMenu    = DoPopup;
            textEditor.Document.LineChanged   += OnTextHasChanged;
            textEditor.TextArea.FocusInEvent  += OnTextBoxEnter;
            textEditor.TextArea.FocusOutEvent += OnTextBoxLeave;
            textEditor.TextArea.KeyPressEvent += OnKeyPress;
            _mainWidget.Destroyed             += _mainWidget_Destroyed;

            AddContextActionWithAccel("Cut", OnCut, "Ctrl+X");
            AddContextActionWithAccel("Copy", OnCopy, "Ctrl+C");
            AddContextActionWithAccel("Paste", OnPaste, "Ctrl+V");
            AddContextActionWithAccel("Delete", OnDelete, "Delete");
            AddContextSeparator();
            AddContextActionWithAccel("Undo", OnUndo, "Ctrl+Z");
            AddContextActionWithAccel("Redo", OnRedo, "Ctrl+Y");
            AddContextActionWithAccel("Find", OnFind, "Ctrl+F");
            AddContextActionWithAccel("Replace", OnReplace, "Ctrl+H");

            IntelliSenseChars = ".";

            intellisense = new IntellisenseView();
            intellisense.ContextItemsNeeded += ContextItemsNeeded;
            intellisense.LoseFocus          += HideCompletionWindow;
        }
		public DisassemblyView ()
		{
			UntitledName = GettextCatalog.GetString ("Disassembly");
			sw = new Gtk.ScrolledWindow ();
			editor = new Mono.TextEditor.TextEditor ();
			editor.Document.ReadOnly = true;
			
			TextEditorOptions options = new TextEditorOptions ();
			options.CopyFrom (TextEditorOptions.DefaultOptions);
			options.ShowEolMarkers = false;
			options.ShowInvalidLines = false;
			options.ShowLineNumberMargin = false;
			editor.Options = options;
			
			sw.Add (editor);
			sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.ShowAll ();
			sw.Vadjustment.ValueChanged += OnScrollEditor;
			sw.VScrollbar.ButtonPressEvent += OnPress;
			sw.VScrollbar.ButtonReleaseEvent += OnRelease;
			sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask;
			sw.ShadowType = Gtk.ShadowType.In;
			
			sw.Sensitive = false;
			
			currentDebugLineMarker = new CurrentDebugLineTextMarker (editor);
			DebuggingService.StoppedEvent += OnStop;
		}
Example #3
0
        /// <summary>
        /// Default constructor that configures the Completion form.
        /// </summary>
        /// <param name="owner">The owner view</param>
        public EditorView(ViewBase owner) : base(owner)
        {
            scroller   = new ScrolledWindow();
            textEditor = new TextEditor();
            scroller.Add(textEditor);
            mainWidget = scroller;
            Mono.TextEditor.CodeSegmentPreviewWindow.CodeSegmentPreviewInformString = "";
            Mono.TextEditor.TextEditorOptions options = new Mono.TextEditor.TextEditorOptions();
            options.EnableSyntaxHighlighting = true;
            options.ColorScheme                = Configuration.Settings.EditorStyleName;
            options.Zoom                       = Configuration.Settings.EditorZoom;
            options.HighlightCaretLine         = true;
            options.EnableSyntaxHighlighting   = true;
            options.HighlightMatchingBracket   = true;
            textEditor.Options                 = options;
            textEditor.Options.Changed        += EditorOptionsChanged;
            textEditor.Options.ColorScheme     = Configuration.Settings.EditorStyleName;
            textEditor.Options.Zoom            = Configuration.Settings.EditorZoom;
            textEditor.TextArea.DoPopupMenu    = DoPopup;
            textEditor.Document.LineChanged   += OnTextHasChanged;
            textEditor.TextArea.FocusInEvent  += OnTextBoxEnter;
            textEditor.TextArea.FocusOutEvent += OnTextBoxLeave;
            textEditor.TextArea.KeyPressEvent += OnKeyPress;
            scroller.Hadjustment.Changed      += Hadjustment_Changed;
            scroller.Vadjustment.Changed      += Vadjustment_Changed;
            mainWidget.Destroyed              += _mainWidget_Destroyed;

            AddContextActionWithAccel("Cut", OnCut, "Ctrl+X");
            AddContextActionWithAccel("Copy", OnCopy, "Ctrl+C");
            AddContextActionWithAccel("Paste", OnPaste, "Ctrl+V");
            AddContextActionWithAccel("Delete", OnDelete, "Delete");
            AddContextSeparator();
            AddContextActionWithAccel("Undo", OnUndo, "Ctrl+Z");
            AddContextActionWithAccel("Redo", OnRedo, "Ctrl+Y");
            AddContextActionWithAccel("Find", OnFind, "Ctrl+F");
            AddContextActionWithAccel("Replace", OnReplace, "Ctrl+H");
            styleSeparator = AddContextSeparator();
            styleMenu      = AddMenuItem("Use style", null);
            Menu styles = new Menu();

            // find all the editor styles and add sub menu items to the popup
            string[] styleNames = Mono.TextEditor.Highlighting.SyntaxModeService.Styles;
            Array.Sort(styleNames, StringComparer.InvariantCulture);
            foreach (string name in styleNames)
            {
                CheckMenuItem subItem = new CheckMenuItem(name);
                if (string.Compare(name, options.ColorScheme, true) == 0)
                {
                    subItem.Toggle();
                }
                subItem.Activated += OnChangeEditorStyle;
                subItem.Visible    = true;
                styles.Append(subItem);
            }
            styleMenu.Submenu = styles;

            IntelliSenseChars = ".";
        }
 private JustEnoughVi.JustEnoughVi InitTest(string source)
 {
     var options = new TextEditorOptions {
         TabsToSpaces = true,
     };
     var editor = Create(source, options);
     var plugin = new JustEnoughVi.JustEnoughVi();
     plugin.Initialize(editor);
     return plugin;
 }
Example #5
0
        public CodeSegmentEditorWindow(TextEditor editor)
        {
            //TODO: Set to top level

            ScrollView scrolledWindow = new ScrollView();

            scrolledWindow.Content = codeSegmentEditor;
            //scrolledWindow.ShadowType = Gtk.ShadowType.In;
            Content = scrolledWindow;
            codeSegmentEditor.Show();
            ((SimpleEditMode)codeSegmentEditor.CurrentMode).AddBinding(Key.Escape, Close);
            TextEditorOptions options = new TextEditorOptions();

            options.FontName             = editor.Options.FontName;
            options.ColorScheme          = editor.Options.ColorScheme;
            options.ShowRuler            = false;
            options.ShowLineNumberMargin = false;
            options.ShowFoldMargin       = false;
            options.ShowIconMargin       = false;
            options.Zoom = 0.8;
            codeSegmentEditor.Document.MimeType = editor.MimeType;
            codeSegmentEditor.Document.ReadOnly = true;
            codeSegmentEditor.Options           = options;

            codeSegmentEditor.KeyPressed += delegate(object o, KeyEventArgs args) {
                if (args.Key == Key.Escape)
                {
                    Dispose();
                }
            };
            var parent = editor.Parent;

            while (parent != null && !(parent is Window))
            {
                parent = parent.Parent;
            }
            if (parent is Window)
            {
                this.TransientFor = (Window)parent;
            }
            //this.SkipTaskbarHint = true;
            ShowInTaskbar  = false;
            this.Decorated = false;

            /*Gdk.Pointer.Grab (this.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask, null, null, Gtk.Global.CurrentEventTime);
             * Gtk.Grab.Add (this);
             * GrabBrokenEvent += delegate {
             *      Destroy ();
             * };*/

            codeSegmentEditor.LostFocus += (object o, EventArgs ea) => { Visible = false; Dispose(); };

            codeSegmentEditor.SetFocus();
        }
        public void Test(string source, string keys, string expected, Type expectedMode)
        {
            var options = new TextEditorOptions();
            options.TabsToSpaces = true;
            var editor = Create(source, options);
            var plugin = new JustEnoughVi.JustEnoughVi();
            plugin.Initialize(editor);

            ProcessKeys(keys, plugin);
            Check(plugin, expected, expectedMode);
        }
Example #7
0
        public CodeSegmentEditorWindow(MonoTextEditor editor) : base(Gtk.WindowType.Toplevel)
        {
            Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow();
            scrolledWindow.Child      = codeSegmentEditor;
            scrolledWindow.ShadowType = Gtk.ShadowType.In;
            Child = scrolledWindow;
            codeSegmentEditor.Realize();
            ((SimpleEditMode)codeSegmentEditor.CurrentMode).AddBinding(Gdk.Key.Escape, Close);
            TextEditorOptions options = new TextEditorOptions();

            options.FontName             = editor.Options.FontName;
            options.ColorScheme          = editor.Options.ColorScheme;
            options.ShowRuler            = false;
            options.ShowLineNumberMargin = false;
            options.ShowFoldMargin       = false;
            options.ShowIconMargin       = false;
            options.Zoom = 0.8;
            codeSegmentEditor.Document.MimeType = editor.MimeType;
            codeSegmentEditor.Document.ReadOnly = true;
            codeSegmentEditor.Options           = options;

            codeSegmentEditor.KeyPressEvent += delegate(object o, Gtk.KeyPressEventArgs args) {
                if (args.Event.Key == Gdk.Key.Escape)
                {
                    Destroy();
                }
            };
            Gtk.Widget parent = editor.Parent;
            while (parent != null && !(parent is Gtk.Window))
            {
                parent = parent.Parent;
            }
            if (parent is Gtk.Window)
            {
                this.TransientFor = (Gtk.Window)parent;
            }
            this.SkipTaskbarHint = true;
            this.Decorated       = false;
            Gdk.Pointer.Grab(this.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask, null, null, Gtk.Global.CurrentEventTime);
            Gtk.Grab.Add(this);
            GrabBrokenEvent += delegate {
                Destroy();
            };
            codeSegmentEditor.GrabFocus();
        }
Example #8
0
        public CodeSegmentEditorWindow(TextEditor editor) : base(PopupType.Menu)
        {
            var scrolledWindow = new ScrollView();

            scrolledWindow.Content = codeSegmentEditor;
            //scrolledWindow.ShadowType = Gtk.ShadowType.In;
            Content = scrolledWindow;

            ((SimpleEditMode)codeSegmentEditor.CurrentMode).AddBinding(Key.Escape, Close);
            TextEditorOptions options = new TextEditorOptions();

            options.FontName             = editor.Options.FontName;
            options.ColorScheme          = editor.Options.ColorScheme;
            options.ShowRuler            = false;
            options.ShowLineNumberMargin = false;
            options.ShowFoldMargin       = false;
            options.ShowIconMargin       = false;
            options.Zoom = 0.8;
            codeSegmentEditor.Document.MimeType = editor.MimeType;
            codeSegmentEditor.Document.ReadOnly = true;
            codeSegmentEditor.Options           = options;

            codeSegmentEditor.KeyPressed += delegate(object o, KeyEventArgs args)
            {
                if (args.Key == Key.Escape)
                {
                    Dispose();
                }
            };
            codeSegmentEditor.LostFocus += delegate(object o, EventArgs args)
            {
                Dispose();
            };
            TransientFor  = editor.ParentWindow;
            ShowInTaskbar = false;
            Decorated     = false;
            //Gdk.Pointer.Grab(this.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask, null, null, Gtk.Global.CurrentEventTime);
            //Gtk.Grab.Add(this);
            //GrabBrokenEvent += delegate
            //{
            //    Dispose();
            //};
            codeSegmentEditor.SetFocus();
        }
		public CodeSegmentEditorWindow (MonoTextEditor editor) : base (Gtk.WindowType.Toplevel)
		{
			Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow ();
			scrolledWindow.Child = codeSegmentEditor;
			scrolledWindow.ShadowType = Gtk.ShadowType.In;
			Child = scrolledWindow;
			codeSegmentEditor.Realize ();
			((SimpleEditMode)codeSegmentEditor.CurrentMode).AddBinding (Gdk.Key.Escape, Close, true);
			TextEditorOptions options = new TextEditorOptions (true);
			options.FontName = editor.Options.FontName;
			options.ColorScheme = editor.Options.ColorScheme;
			options.ShowRuler =  false;
			options.ShowLineNumberMargin = false;
			options.ShowFoldMargin = false;
			options.ShowIconMargin = false;
			options.Zoom = 0.8;
			codeSegmentEditor.Document.MimeType = editor.MimeType;
			codeSegmentEditor.Document.ReadOnly = true;
			codeSegmentEditor.Options = options;
			
			codeSegmentEditor.KeyPressEvent += delegate(object o, Gtk.KeyPressEventArgs args) {
				if (args.Event.Key == Gdk.Key.Escape)
					Destroy ();
				
			};
			Gtk.Widget parent = editor.Parent;
			while (parent != null && !(parent is Gtk.Window))
				parent = parent.Parent;
			if (parent is Gtk.Window)
				this.TransientFor = (Gtk.Window)parent;
			this.SkipTaskbarHint = true;
			this.Decorated = false;
			Gdk.Pointer.Grab (this.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask, null, null, Gtk.Global.CurrentEventTime);
			Gtk.Grab.Add (this);
			GrabBrokenEvent += delegate {
				Destroy ();
			};
			codeSegmentEditor.GrabFocus ();
		}
Example #10
0
		public virtual void CopyFrom (TextEditorOptions other)
		{
			zoom = other.zoom;
			highlightMatchingBracket = other.highlightMatchingBracket;
			tabsToSpaces = other.tabsToSpaces;
			indentationSize = other.indentationSize;
			tabSize = other.tabSize;
			showIconMargin = other.showIconMargin;
			showLineNumberMargin = other.showLineNumberMargin;
			showFoldMargin = other.showFoldMargin;
			highlightCaretLine = other.highlightCaretLine;
			rulerColumn = other.rulerColumn;
			showRuler = other.showRuler;
			indentStyle = other.indentStyle;
			fontName = other.fontName;
			enableSyntaxHighlighting = other.enableSyntaxHighlighting;
			colorStyle = other.colorStyle;
			overrideDocumentEolMarker = other.overrideDocumentEolMarker;
			defaultEolMarker = other.defaultEolMarker;
			enableAnimations = other.enableAnimations;
			useAntiAliasing = other.useAntiAliasing;
			drawIndentationMarkers = other.drawIndentationMarkers;
			showWhitespaces = other.showWhitespaces;
			includeWhitespaces = other.includeWhitespaces;
			DisposeFont ();
			OnChanged (EventArgs.Empty);
		}
Example #11
0
		void UpdateFromCatalog ()
		{
			filter = this.searchEntryFilter.Entry.Text;
			if (!IsCaseSensitive && filter != null)
				filter = filter.ToUpper ();
			if (RegexSearch) {
				try {
					RegexOptions options = RegexOptions.Compiled;
					if (!IsCaseSensitive)
						options |= RegexOptions.IgnoreCase;
					regex = new Regex (filter, options);
				} catch (Exception e) {
					IdeApp.Workbench.StatusBar.ShowError (e.Message);
					this.searchEntryFilter.Entry.ModifyBase (StateType.Normal, errorColor);
					return;
				}
			}
			this.searchEntryFilter.Entry.ModifyBase (StateType.Normal, Style.Base (StateType.Normal));
			
			int found = 0;
			ListStore newStore = new ListStore (typeof(CatalogEntry));
			
			try {
				foreach (CatalogEntry entry in catalog) {
					if (!ShouldFilter (entry, filter)) {
						newStore.AppendValues (entry);
						found++;
					}
				}
			} catch (Exception) {
				
			}
			
			newStore.SetSortFunc (0, delegate (TreeModel model, TreeIter iter1, TreeIter iter2) {
				CatalogEntry entry1 = (CatalogEntry)model.GetValue (iter1, 0);
				CatalogEntry entry2 = (CatalogEntry)model.GetValue (iter2, 0);
				return GetTypeSortIndicator (entry1).CompareTo (GetTypeSortIndicator (entry2));
			});
			newStore.SetSortFunc (1, delegate (TreeModel model, TreeIter iter1, TreeIter iter2) {
				CatalogEntry entry1 = (CatalogEntry)model.GetValue (iter1, 0);
				CatalogEntry entry2 = (CatalogEntry)model.GetValue (iter2, 0);
				return entry1.String.CompareTo (entry2.String);
			});
			newStore.SetSortFunc (2, delegate (TreeModel model, TreeIter iter1, TreeIter iter2) {
				CatalogEntry entry1 = (CatalogEntry)model.GetValue (iter1, 0);
				CatalogEntry entry2 = (CatalogEntry)model.GetValue (iter2, 0);
				return entry1.GetTranslation (0).CompareTo (entry2.GetTranslation (0));
			});
			IdeApp.Workbench.StatusBar.ShowMessage (string.Format (GettextCatalog.GetPluralString ("Found {0} catalog entry.", "Found {0} catalog entries.", found), found));
			store.Dispose ();
			treeviewEntries.Model = store = newStore;
		}
Example #12
0
        /// <summary>
        /// Default constructor that configures the Completion form.
        /// </summary>
        public EditorView(ViewBase owner) : base(owner)
        {
            scroller   = new ScrolledWindow();
            textEditor = new MonoTextEditor();
            scroller.Add(textEditor);
            _mainWidget = scroller;
            Mono.TextEditor.TextEditorOptions options = new Mono.TextEditor.TextEditorOptions();
            options.EnableSyntaxHighlighting = true;
            options.ColorScheme                = "Visual Studio";
            options.HighlightCaretLine         = true;
            textEditor.Options                 = options;
            textEditor.TextArea.DoPopupMenu    = DoPopup;
            textEditor.Document.LineChanged   += OnTextHasChanged;
            textEditor.TextArea.FocusInEvent  += OnTextBoxEnter;
            textEditor.TextArea.FocusOutEvent += OnTextBoxLeave;
            _mainWidget.Destroyed             += _mainWidget_Destroyed;

            AddContextActionWithAccel("Cut", OnCut, "Ctrl+X");
            AddContextActionWithAccel("Copy", OnCopy, "Ctrl+C");
            AddContextActionWithAccel("Paste", OnPaste, "Ctrl+V");
            AddContextActionWithAccel("Delete", OnDelete, "Delete");
            AddContextSeparator();
            AddContextActionWithAccel("Undo", OnUndo, "Ctrl+Z");
            AddContextActionWithAccel("Redo", OnRedo, "Ctrl+Y");
            AddContextActionWithAccel("Find", OnFind, "Ctrl+F");
            AddContextActionWithAccel("Replace", OnReplace, "Ctrl+H");

            CompletionForm                 = new Window(WindowType.Toplevel);
            CompletionForm.Decorated       = false;
            CompletionForm.SkipPagerHint   = true;
            CompletionForm.SkipTaskbarHint = true;
            Frame completionFrame = new Frame();

            CompletionForm.Add(completionFrame);
            ScrolledWindow completionScroller = new ScrolledWindow();

            completionFrame.Add(completionScroller);
            completionModel = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            CompletionView  = new TreeView(completionModel);
            completionScroller.Add(CompletionView);
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            column.PackStart(iconRender, false);
            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;
            column.PackStart(textRender, true);
            column.SetAttributes(iconRender, "pixbuf", 0);
            column.SetAttributes(textRender, "text", 1);
            column.Title     = "Item";
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender       = new CellRendererText();
            column           = new TreeViewColumn("Units", textRender, "text", 2);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender       = new CellRendererText();
            column           = new TreeViewColumn("Type", textRender, "text", 3);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender       = new CellRendererText();
            column           = new TreeViewColumn("Descr", textRender, "text", 4);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            functionPixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.Function.png", 16, 16);
            propertyPixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.Property.png", 16, 16);
            textEditor.TextArea.KeyPressEvent += OnKeyPress;
            CompletionView.HasTooltip          = true;
            CompletionView.TooltipColumn       = 5;
            CompletionForm.FocusOutEvent      += OnLeaveCompletion;
            CompletionView.ButtonPressEvent   += OnContextListMouseDoubleClick;
            CompletionView.KeyPressEvent      += OnContextListKeyDown;
            CompletionView.KeyReleaseEvent    += CompletionView_KeyReleaseEvent;
            IntelliSenseChars = ".";
        }
Example #13
0
        /// <summary>
        /// Default constructor that configures the Completion form.
        /// </summary>
        public EditorView(ViewBase owner)
            : base(owner)
        {
            scroller = new ScrolledWindow();
            textEditor = new MonoTextEditor();
            scroller.Add(textEditor);
            _mainWidget = scroller;
            TextEditorOptions options = new TextEditorOptions();
            options.EnableSyntaxHighlighting = true;
            options.ColorScheme = "Visual Studio";
            options.HighlightCaretLine = true;
            textEditor.Options = options;
            textEditor.Document.LineChanged += OnTextHasChanged;
            textEditor.LeaveNotifyEvent += OnTextBoxLeave;
            _mainWidget.Destroyed += _mainWidget_Destroyed;

            CompletionForm = new Window(WindowType.Toplevel);
            CompletionForm.Decorated = false;
            CompletionForm.SkipPagerHint = true;
            CompletionForm.SkipTaskbarHint = true;
            Frame completionFrame = new Frame();
            CompletionForm.Add(completionFrame);
            ScrolledWindow completionScroller = new ScrolledWindow();
            completionFrame.Add(completionScroller);
            completionModel = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            CompletionView = new TreeView(completionModel);
            completionScroller.Add(CompletionView);
            TreeViewColumn column = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();
            column.PackStart(iconRender, false);
            CellRendererText textRender = new Gtk.CellRendererText();
            textRender.Editable = false;
            column.PackStart(textRender, true);
            column.SetAttributes(iconRender, "pixbuf", 0);
            column.SetAttributes(textRender, "text", 1);
            column.Title = "Item";
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender = new CellRendererText();
            column = new TreeViewColumn("Units", textRender, "text", 2);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender = new CellRendererText();
            column = new TreeViewColumn("Type", textRender, "text", 3);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender = new CellRendererText();
            column = new TreeViewColumn("Descr", textRender, "text", 4);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            functionPixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.Function.png", 16, 16);
            propertyPixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.Property.png", 16, 16);
            textEditor.TextArea.KeyPressEvent += OnKeyPress;
            CompletionView.HasTooltip = true;
            CompletionView.TooltipColumn = 5;
            CompletionForm.FocusOutEvent += OnLeaveCompletion;
            CompletionView.ButtonPressEvent += OnContextListMouseDoubleClick;
            CompletionView.KeyPressEvent += OnContextListKeyDown;
            CompletionView.KeyReleaseEvent += CompletionView_KeyReleaseEvent;
            IntelliSenseChars = ".";
        }
		public AssemblyBrowserWidget ()
		{
			this.Build( );
			TreeView = new ExtensibleTreeView (new NodeBuilder[] { 
				new ErrorNodeBuilder (),
				new AssemblyNodeBuilder (this),
				new ModuleReferenceNodeBuilder (),
				new ModuleDefinitionNodeBuilder (this),
				new ReferenceFolderNodeBuilder (this),
				new ResourceFolderNodeBuilder (),
				new ResourceNodeBuilder (),
				new NamespaceBuilder (this),
				new DomTypeNodeBuilder (this),
				new DomMethodNodeBuilder (this),
				new DomFieldNodeBuilder (this),
				new DomEventNodeBuilder (this),
				new DomPropertyNodeBuilder (this),
				new BaseTypeFolderNodeBuilder (this),
				new DomReturnTypeNodeBuilder (this),
				new ReferenceNodeBuilder (this),
				}, new TreePadOption [] {
				new TreePadOption ("PublicApiOnly", GettextCatalog.GetString ("Show public members only"), true)
			});
			TreeView.Tree.Selection.Mode = Gtk.SelectionMode.Single;
			TreeView.Tree.CursorChanged += HandleCursorChanged;
			TreeView.ShadowType = ShadowType.In;
			treeViewPlaceholder.Add (TreeView);
			treeViewPlaceholder.ShowAll ();
			
//			this.descriptionLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 9"));
			this.documentationLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 12"));
			this.documentationLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 225));
			this.documentationLabel.Wrap = true;
			
			PropertyService.PropertyChanged += HandlePropertyChanged;
			
			var options = new Mono.TextEditor.TextEditorOptions ();
			options.FontName = PropertyService.Get<string> ("FontName");
			options.ShowFoldMargin = false;
			options.ShowIconMargin = false;
			options.ShowInvalidLines = false;
			options.ShowLineNumberMargin = false;
			options.ShowSpaces = false;
			options.ShowTabs = false;
			options.HighlightCaretLine = true;
			options.ColorScheme = PropertyService.Get ("ColorScheme", "Default");
			this.inspectEditor.Options = options;
			
			inspectEditor.ButtonPressEvent += HandleInspectEditorButtonPressEvent;
			this.inspectEditor.Document.ReadOnly = true;
//			this.inspectEditor.Document.SyntaxMode = new Mono.TextEditor.Highlighting.MarkupSyntaxMode ();
			this.inspectEditor.TextViewMargin.GetLink = delegate(Mono.TextEditor.MarginMouseEventArgs arg) {
				var loc = inspectEditor.PointToLocation (arg.X, arg.Y);
				int offset = inspectEditor.LocationToOffset (loc);
				var referencedSegment = ReferencedSegments != null ? ReferencedSegments.FirstOrDefault (seg => seg.Contains (offset)) : null;
				if (referencedSegment == null)
					return null;
				if (referencedSegment.Reference is TypeDefinition)
					return new DomCecilType ((TypeDefinition)referencedSegment.Reference).HelpUrl;
				
				if (referencedSegment.Reference is MethodDefinition)
					return new DomCecilMethod ((MethodDefinition)referencedSegment.Reference).HelpUrl;
				
				if (referencedSegment.Reference is PropertyDefinition)
					return new DomCecilProperty ((PropertyDefinition)referencedSegment.Reference).HelpUrl;
				
				if (referencedSegment.Reference is FieldDefinition)
					return new DomCecilField ((FieldDefinition)referencedSegment.Reference).HelpUrl;
				
				if (referencedSegment.Reference is EventDefinition)
					return new DomCecilEvent ((EventDefinition)referencedSegment.Reference).HelpUrl;
				
				if (referencedSegment.Reference is FieldDefinition)
					return new DomCecilField ((FieldDefinition)referencedSegment.Reference).HelpUrl;
				
				if (referencedSegment.Reference is TypeReference) {
					var returnType = DomCecilMethod.GetReturnType ((TypeReference)referencedSegment.Reference);
					if (returnType.GenericArguments.Count == 0)
						return "T:" + returnType.FullName;
					return "T:" + returnType.FullName + "`" + returnType.GenericArguments.Count;
				}
				return referencedSegment.Reference.ToString ();
			};
			this.inspectEditor.LinkRequest += InspectEditorhandleLinkRequest;
			this.scrolledwindowEditor.Child = this.inspectEditor;
//			this.inspectLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 250));
			
//			this.vpaned1.ExposeEvent += VPaneExpose;
			this.hpaned1.ExposeEvent += HPaneExpose;
/*			this.notebook1.SwitchPage += delegate {
				// Hack for the switch page select all bug.
//				this.inspectLabel.Selectable = false;
			};*/

			this.languageCombobox.AppendText (GettextCatalog.GetString ("Summary"));
			this.languageCombobox.AppendText (GettextCatalog.GetString ("IL"));
			this.languageCombobox.AppendText (GettextCatalog.GetString ("C#"));
			this.languageCombobox.Active = PropertyService.Get ("AssemblyBrowser.InspectLanguage", 2);
			this.languageCombobox.Changed += LanguageComboboxhandleChanged;
			this.searchentry1.Ready = true;
			this.searchentry1.WidthRequest = 200;
			this.searchentry1.Visible = true;
			this.searchentry1.EmptyMessage = GettextCatalog.GetString ("Search for types or members");
			this.searchentry1.InnerEntry.Changed += SearchEntryhandleChanged;
			
			CheckMenuItem checkMenuItem = this.searchentry1.AddFilterOption (0, GettextCatalog.GetString ("Types"));
			checkMenuItem.Active = true;
			checkMenuItem.Toggled += delegate {
				if (checkMenuItem.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Type;
					CreateColumns ();
					StartSearch ();
				}
			};
			
			CheckMenuItem checkMenuItem1 = this.searchentry1.AddFilterOption (1, GettextCatalog.GetString ("Members"));
			checkMenuItem1.Toggled += delegate {
				if (checkMenuItem1.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Member;
					CreateColumns ();
					StartSearch ();
				}
			};
			comboboxVisibilty.InsertText (0, GettextCatalog.GetString ("Only public members"));
			comboboxVisibilty.InsertText (1, GettextCatalog.GetString ("All members"));
			comboboxVisibilty.Active = 0;
			comboboxVisibilty.Changed += delegate {
				PublicApiOnly = comboboxVisibilty.Active == 0;
				this.TreeView.GetRootNode ().Options[ "PublicApiOnly"] = PublicApiOnly;
				FillInspectLabel ();
			};
			/*
			this.searchInCombobox.Active = 0;
			this.searchInCombobox.Changed += SearchInComboboxhandleChanged;
			*/
			this.notebook1.SetTabLabel (this.documentationScrolledWindow, new Label (GettextCatalog.GetString ("Documentation")));
			this.notebook1.SetTabLabel (this.notebookInspection, new Label (GettextCatalog.GetString ("Inspect")));
			this.notebook1.SetTabLabel (this.searchWidget, new Label (GettextCatalog.GetString ("Search")));
			//this.searchWidget.Visible = false;
				
			typeListStore = new Gtk.ListStore (typeof (Gdk.Pixbuf), // type image
			                                   typeof (string),     // name
			                                   typeof (string),     // namespace
			                                   typeof (string),     // assembly
				                               typeof (IMember)
			                                  );
			
			memberListStore = new Gtk.ListStore (typeof (Gdk.Pixbuf), // member image
			                                   typeof (string),     // name
			                                   typeof (string),     // Declaring type full name
			                                   typeof (string),     // assembly
				                               typeof (IMember)
			                                  );
			CreateColumns ();
			SetInspectWidget ();
//			this.searchEntry.Changed += SearchEntryhandleChanged;
			this.searchTreeview.RowActivated += SearchTreeviewhandleRowActivated;
			this.searchentry1.ShowAll ();
			this.buttonBack.Clicked += this.OnNavigateBackwardActionActivated;
			this.buttonForeward.Clicked += this.OnNavigateForwardActionActivated;
			this.notebook1.ShowTabs = false;
			this.notebookInspection.ShowTabs = false;
			this.ShowAll ();
		}
Example #15
0
		void UpdateFromCatalog ()
		{
			filter = this.searchEntryFilter.Entry.Text;
			if (!IsCaseSensitive && filter != null)
				filter = filter.ToUpper ();
			if (RegexSearch) {
				try {
					RegexOptions options = RegexOptions.Compiled;
					if (!IsCaseSensitive)
						options |= RegexOptions.IgnoreCase;
					regex = new Regex (filter, options);
				} catch (Exception e) {
					IdeApp.Workbench.StatusBar.ShowError (e.Message);
					this.searchEntryFilter.Entry.ModifyBase (StateType.Normal, errorColor);
					return;
				}
			}
			this.searchEntryFilter.Entry.ModifyBase (StateType.Normal, Style.Base (StateType.Normal));
			StopFilterWorkerThread ();
			updateThread.RunWorkerAsync ();
		}
Example #16
0
        private void LoadSetting()
        {
            TextEditorOptions options = new TextEditorOptions();
            options.ColorScheme = "Moscrif";
            options.ShowInvalidLines = true;
            options.ShowLineNumberMargin = true;
            options.AutoIndent = true;
            options.TabSize = MainClass.Settings.SourceEditorSettings.TabSpace;//8;
            options.TabsToSpaces= MainClass.Settings.SourceEditorSettings.TabsToSpaces;

            options.ShowEolMarkers =MainClass.Settings.SourceEditorSettings.ShowEolMarker;
            options.ShowRuler =MainClass.Settings.SourceEditorSettings.ShowRuler;
            options.RulerColumn = MainClass.Settings.SourceEditorSettings.RulerColumn;
            options.ShowTabs=MainClass.Settings.SourceEditorSettings.ShowTab;
            options.ShowSpaces=MainClass.Settings.SourceEditorSettings.ShowSpaces;

            options.EnableAnimations=MainClass.Settings.SourceEditorSettings.EnableAnimations;
            options.ShowLineNumberMargin =MainClass.Settings.SourceEditorSettings.ShowLineNumber;

            options.HighlightCaretLine = true;

            options.DefaultEolMarker = "\n";
            options.OverrideDocumentEolMarker= true;

            if (!String.IsNullOrEmpty(MainClass.Settings.SourceEditorSettings.EditorFont))
                options.FontName = MainClass.Settings.SourceEditorSettings.EditorFont;

            try{//check parse style
                Mono.TextEditor.Highlighting.Style style = SyntaxModeService.GetColorStyle(null, "Moscrif");
            }catch(Exception ex){
                options.ColorScheme = "";

                //MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_styles"),ex.Message, Gtk.MessageType.Error,null);
                //msd.ShowDialog();
                Tool.Logger.Error(MainClass.Languages.Translate("error_load_styles"));
                Tool.Logger.Error(ex.Message);
            }
            editor.Options = options;
            //
            editor.Options.ShowFoldMargin = true;
        }