public void TestSimpleCSharpHtml() { if (Platform.IsWindows) { Assert.Inconclusive(); } var data = Create("class Foo {}"); data.ColorStyle = SyntaxModeService.GetColorStyle("TangoLight"); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "text/x-csharp"); string generatedHtml = HtmlWriter.GenerateHtml(data); Assert.AreEqual( @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""> <HTML> <HEAD> <META HTTP-EQUIV=""CONTENT-TYPE"" CONTENT=""text/html; charset=utf-8""> <META NAME=""GENERATOR"" CONTENT=""Mono Text Editor""> </HEAD> <BODY> <FONT face = 'Mono'> <SPAN style='color:#009695;'>class</SPAN><SPAN style='color:#444444;'> Foo </SPAN><SPAN style='color:#444444;'>{}</SPAN></FONT> </BODY></HTML> ", generatedHtml); }
public void TestXml() { var data = Create( @"<foo attr1 = ""1"" attr2 = ""2"" />"); data.ColorStyle = SyntaxModeService.GetColorStyle("TangoLight"); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "application/xml"); string generatedHtml = HtmlWriter.GenerateHtml(data); Console.WriteLine(generatedHtml); Assert.AreEqual( @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""> <HTML> <HEAD> <META HTTP-EQUIV=""CONTENT-TYPE"" CONTENT=""text/html; charset=utf-8""> <META NAME=""GENERATOR"" CONTENT=""Mono Text Editor""> </HEAD> <BODY> <FONT face = 'Mono'> <SPAN style='color:#444444;'><</SPAN><SPAN style='color:#3364a4;'>foo</SPAN><BR> <SPAN style='color:#3364a4;'> </SPAN><SPAN style='color:#444444;'>attr1</SPAN><SPAN style='color:#444444;'> =</SPAN><SPAN style='color:#3364a4;'> </SPAN><SPAN style='color:#f57d00;'>"</SPAN><SPAN style='color:#f57d00;'>1</SPAN><SPAN style='color:#f57d00;'>"</SPAN><BR> <SPAN style='color:#3364a4;'> </SPAN><SPAN style='color:#444444;'>attr2</SPAN><SPAN style='color:#444444;'> =</SPAN><SPAN style='color:#3364a4;'> </SPAN><SPAN style='color:#f57d00;'>"</SPAN><SPAN style='color:#f57d00;'>2</SPAN><SPAN style='color:#f57d00;'>"</SPAN><BR> <SPAN style='color:#444444;'>/</SPAN><SPAN style='color:#444444;'>></SPAN></FONT> </BODY></HTML> " , generatedHtml); }
public void TestXml() { var data = Create( @"<foo attr1 = ""1"" attr2 = ""2"" />"); data.ColorStyle = SyntaxModeService.GetColorStyle("TangoLight"); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "application/xml"); string generatedRtf = RtfWriter.GenerateRtf(data); Assert.AreEqual( @"{\rtf1\ansi\deff0\adeflang1025 {\fonttbl {\f0\fnil\fprq1\fcharset128 Mono;} } {\colortbl ;\red68\green68\blue68;\red51\green100\blue164;\red245\green125\blue0;}\viewkind4\uc1\pard \f0 \fs20\cf1 \cf1 <\cf2 foo\line \tab\cf1 attr1 =\cf2 \cf3 ""1""\line \cf2\tab\cf1 attr2 =\cf2 \cf3 ""2""\line \cf1 />\line }" , generatedRtf); }
public void TestXml() { if (Platform.IsWindows) { Assert.Inconclusive(); } var data = Create(""); data.ColorStyle = SyntaxModeService.GetColorStyle("Tango"); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "application/xml"); data.Text = @"<foo attr1 = ""1"" attr2 = ""2"" />"; SyntaxModeService.WaitUpdate(data.Document); string generatedHtml = HtmlWriter.GenerateHtml(data); Assert.AreEqual( @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""> <HTML> <HEAD> <META HTTP-EQUIV=""CONTENT-TYPE"" CONTENT=""text/html; charset=utf-8""> <META NAME=""GENERATOR"" CONTENT=""Mono Text Editor""> </HEAD> <BODY> <FONT face = 'Mono'> <SPAN style='color:#000000;'><</SPAN><SPAN style='color:#204987;'>foo</SPAN><BR> <SPAN style='color:#204987;'> </SPAN><SPAN style='color:#f57800;'>attr1</SPAN><SPAN style='color:#000000;'> =</SPAN><SPAN style='color:#204987;'> </SPAN><SPAN style='color:#a40000;'>"</SPAN><SPAN style='color:#a40000;'>1</SPAN><SPAN style='color:#a40000;'>"</SPAN><BR> <SPAN style='color:#204987;'> </SPAN><SPAN style='color:#f57800;'>attr2</SPAN><SPAN style='color:#000000;'> =</SPAN><SPAN style='color:#204987;'> </SPAN><SPAN style='color:#a40000;'>"</SPAN><SPAN style='color:#a40000;'>2</SPAN><SPAN style='color:#a40000;'>"</SPAN><BR> <SPAN style='color:#000000;'>/</SPAN><SPAN style='color:#000000;'>></SPAN></FONT> </BODY></HTML> " , generatedHtml); }
public static string GetMarkup(string input, string syntaxMode) { var data = new TextEditorData(new TextDocument(input)); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, syntaxMode); data.ColorStyle = SyntaxModeService.GetColorStyle("TangoLight"); return(data.GetMarkup(0, data.Length, false)); }
public static string GetMarkup(string input, string syntaxMode) { Document doc = new Document(); doc.SyntaxMode = SyntaxModeService.GetSyntaxMode(syntaxMode); doc.Text = input; return(doc.SyntaxMode.GetMarkup(doc, TextEditorOptions.DefaultOptions, SyntaxModeService.GetColorStyle(null, "TangoLight"), 0, doc.Length, false)); }
public void TestSimpleCSharpRtf() { var data = Create("class Foo {}"); var style = SyntaxModeService.GetColorStyle(null, "TangoLight"); ISyntaxMode mode = SyntaxModeService.GetSyntaxMode(data.Document, "text/x-csharp"); string generatedRtf = RtfWriter.GenerateRtf(data.Document, mode, style, data.Options); Assert.AreEqual( @"{\rtf1\ansi\deff0\adeflang1025{\fonttbl{\f0\fnil\fprq1\fcharset128 Mono;}}{\colortbl ;\red92\green53\blue102;\red0\green0\blue0;}\viewkind4\uc1\pard\f0\fs20\cf1\b\cf1 class\b0\cf2 Foo \{\}\par" + Environment.NewLine + "}", generatedRtf); }
public void TestSimpleCSharpHtml() { var data = Create("class Foo {}"); var style = SyntaxModeService.GetColorStyle("TangoLight"); ISyntaxMode mode = SyntaxModeService.GetSyntaxMode(data.Document, "text/x-csharp"); string generatedHtml = HtmlWriter.GenerateHtml(data.Document, mode, style, data.Options); Assert.AreEqual( @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""><HTML><BODY><FONT face = 'Mono'><SPAN style = 'color:#009695;' >class</SPAN><SPAN style = 'color:#444444;' > Foo </SPAN><SPAN style = 'color:#444444;' >{}</SPAN></FONT></BODY></HTML>", generatedHtml); }
public static string[] GetCommentTags(string fileName) { //Document doc = IdeApp.Workbench.ActiveDocument; string loadedMimeType = DesktopService.GetMimeTypeForUri(fileName); SyntaxMode mode = null; foreach (string mt in DesktopService.GetMimeTypeInheritanceChain(loadedMimeType)) { mode = SyntaxModeService.GetSyntaxMode(mt); if (mode != null) { break; } } if (mode == null) { return(null); } List <string> ctags; if (mode.Properties.TryGetValue("LineComment", out ctags) && ctags.Count > 0) { return(new string [] { ctags [0] }); } List <string> tags = new List <string> (); if (mode.Properties.TryGetValue("BlockCommentStart", out ctags)) { tags.Add(ctags [0]); } if (mode.Properties.TryGetValue("BlockCommentEnd", out ctags)) { tags.Add(ctags [0]); } if (tags.Count == 2) { return(tags.ToArray()); } else { return(null); } }
public void TestSimpleCSharpRtf() { var data = Create("class Foo {}"); data.ColorStyle = SyntaxModeService.GetColorStyle("TangoLight"); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "text/x-csharp"); string generatedRtf = RtfWriter.GenerateRtf(data); Assert.AreEqual( @"{\rtf1\ansi\deff0\adeflang1025 {\fonttbl {\f0\fnil\fprq1\fcharset128 Mono;} } {\colortbl ;\red0\green150\blue149;\red68\green68\blue68;}\viewkind4\uc1\pard \f0 \fs20\cf1 \cf1 class\cf2 Foo \{\}\line }", generatedRtf); }
public void TestChunkValidity() { const string text = @"System.Console.WriteLine();"; var data = new TextEditorData(new TextDocument(@"namespace FooBar { class Test { " + text + @" } }")); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "text/x-csharp"); data.ColorStyle = SyntaxModeService.GetColorStyle("Light"); var line = data.GetLine(5); var chunks = data.GetChunks(line, line.Offset + 3, line.Length - 3); StringBuilder sb = new StringBuilder(); foreach (var chunk in chunks) { sb.Append(data.GetTextAt(chunk)); } Assert.AreEqual(text, sb.ToString()); }
public void TestSimpleCSharpRtf() { if (Platform.IsWindows) { Assert.Inconclusive(); } var data = Create("class Foo {}"); data.ColorStyle = SyntaxModeService.GetColorStyle("Tango"); data.Document.SyntaxMode = SyntaxModeService.GetSyntaxMode(data.Document, "text/x-csharp"); string generatedRtf = RtfWriter.GenerateRtf(data); Assert.AreEqual( @"{\rtf1\ansi\deff0\adeflang1025 {\fonttbl {\f0\fnil\fprq1\fcharset128 Mono;} } {\colortbl ;\red51\green100\blue164;\red0\green0\blue0;}\viewkind4\uc1\pard \f0 \fs20\cf1 \cf1 class\cf2 Foo \{\}\line }", generatedRtf); }
void CopyData(TextEditorData data, Selection selection) { copiedDocument = null; monoDocument = null; if (selection != null && data != null && data.Document != null) { copiedDocument = new TextDocument(); monoDocument = new TextDocument(); this.docStyle = data.ColorStyle; this.options = data.Options; this.mode = SyntaxModeService.GetSyntaxMode(monoDocument, data.MimeType); switch (selection.SelectionMode) { case SelectionMode.Normal: isBlockMode = false; var segment = selection.GetSelectionRange(data); var text = data.GetTextAt(segment); copiedDocument.Text = text; monoDocument.Text = text; var line = data.Document.GetLineByOffset(segment.Offset); var spanStack = line.StartSpan.Clone(); SyntaxModeService.ScanSpans(data.Document, this.mode as SyntaxMode, this.mode as SyntaxMode, spanStack, line.Offset, segment.Offset); this.copiedDocument.GetLine(DocumentLocation.MinLine).StartSpan = spanStack; break; case SelectionMode.Block: isBlockMode = true; DocumentLocation visStart = data.LogicalToVisualLocation(selection.Anchor); DocumentLocation visEnd = data.LogicalToVisualLocation(selection.Lead); int startCol = System.Math.Min(visStart.Column, visEnd.Column); int endCol = System.Math.Max(visStart.Column, visEnd.Column); for (int lineNr = selection.MinLine; lineNr <= selection.MaxLine; lineNr++) { DocumentLine curLine = data.Document.GetLine(lineNr); int col1 = curLine.GetLogicalColumn(data, startCol) - 1; int col2 = System.Math.Min(curLine.GetLogicalColumn(data, endCol) - 1, curLine.Length); if (col1 < col2) { copiedDocument.Insert(copiedDocument.TextLength, data.Document.GetTextAt(curLine.Offset + col1, col2 - col1)); monoDocument.Insert(monoDocument.TextLength, data.Document.GetTextAt(curLine.Offset + col1, col2 - col1)); } if (lineNr < selection.MaxLine) { // Clipboard line end needs to be system dependend and not the document one. copiedDocument.Insert(copiedDocument.TextLength, Environment.NewLine); // \r in mono document stands for block selection line end. monoDocument.Insert(monoDocument.TextLength, "\r"); } } line = data.Document.GetLine(selection.MinLine); spanStack = line.StartSpan.Clone(); SyntaxModeService.ScanSpans(data.Document, this.mode as SyntaxMode, this.mode as SyntaxMode, spanStack, line.Offset, line.Offset + startCol); this.copiedDocument.GetLine(DocumentLocation.MinLine).StartSpan = spanStack; break; } } else { copiedDocument = null; } }
protected override void OnActivated() { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.OkCancel, "Are you sure?", "", Gtk.MessageType.Question); int result = md.ShowDialog(); if (result != (int)Gtk.ResponseType.Ok) { return; } ProgressDialog progressDialog; string filename = System.IO.Path.Combine(MainClass.Paths.ConfingDir, "completedcache"); sqlLiteDal = new SqlLiteDal(filename); string sql = ""; if (sqlLiteDal.CheckExistTable("completed")) { sql = "DROP TABLE completed ;"; sqlLiteDal.RunSqlScalar(sql); } sql = "CREATE TABLE completed (id INTEGER PRIMARY KEY, name TEXT, signature TEXT, type NUMERIC, parent TEXT,summary TEXT ,returnType TEXT ) ;"; sqlLiteDal.RunSqlScalar(sql); SyntaxMode mode = new SyntaxMode(); mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); progressDialog = new ProgressDialog("Generated...", ProgressDialog.CancelButtonType.None, mode.Keywords.Count(), MainClass.MainWindow); foreach (Keywords kw in mode.Keywords) { progressDialog.Update(kw.ToString()); foreach (string wrd in kw.Words) { insertNewRow(wrd, wrd, (int)CompletionDataTyp.keywords, "", "", ""); } } Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("data.json", null, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); fc.TransientFor = MainClass.MainWindow; fc.SetCurrentFolder(@"d:\Work\docs-api\output\"); if (fc.Run() != (int)ResponseType.Accept) { return; } string json; string fileName = fc.Filename; progressDialog.Destroy(); fc.Destroy(); progressDialog = new ProgressDialog("Generated...", ProgressDialog.CancelButtonType.None, 100, MainClass.MainWindow); using (StreamReader file = new StreamReader(fileName)) { json = file.ReadToEnd(); file.Close(); file.Dispose(); } //XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(json); //doc.Save(fileName+"xml"); /*JObject jDoc= JObject.Parse(json); * //classes * Console.WriteLine("o.Count->"+jDoc.Count); * * foreach (JProperty jp in jDoc.Properties()){ * Console.WriteLine(jp.Name); * } * Console.WriteLine("------------"); * JObject classes = (JObject)jDoc["classes"]; * foreach (JProperty jp in classes.Properties()){ * Console.WriteLine(jp.Name); * JObject classDefin = (JObject)classes[jp.Name]; * string name = (string)classDefin["name"]; * string shortname = (string)classDefin["shortname"]; * string description = (string)classDefin["description"]; * //string type = (string)classDefin["type"]; * insertNewRow(name,name,(int)CompletionDataTyp.types,"",description,name); * } * Console.WriteLine("------------"); * * JArray classitems = (JArray)jDoc["classitems"]; * foreach (JObject classitem in classitems){ * * string name = (string)classitem["name"]; * Console.WriteLine(name); * * string description = (string)classitem["description"]; * string itemtype = (string)classitem["itemtype"]; * string classParent = (string)classitem["class"]; * string signature = (string)classitem["name"]; * CompletionDataTyp type = CompletionDataTyp.noting; * string returnType= classParent; * * switch (itemtype){ * case "method":{ * JArray paramsArray = (JArray)classitem["params"]; * signature = signature+ GetParams(paramsArray); * type = CompletionDataTyp.members; * JObject returnJO =(JObject)classitem["return"] ; * if(returnJO!=null){ * returnType = (string)returnJO["type"]; * } * * break; * } * case "property":{ * * string tmpType = (string)classitem["type"]; * if(!String.IsNullOrEmpty(tmpType)){ * returnType=tmpType.Replace("{","").Replace("}",""); * } * type = CompletionDataTyp.properties; * break; * } * case "event":{ * JArray paramsArray = (JArray)classitem["params"]; * signature = signature+ GetParams(paramsArray); * type = CompletionDataTyp.events; * break; * } * case "attribute":{ * continue; * break; * } * default:{ * type = CompletionDataTyp.noting; * break; * } * * } * * insertNewRow(name,signature,(int)type,classParent,description,returnType); * }*/ //classitems // string name = (string)o["project"]["name"]; // Console.WriteLine(name); progressDialog.Destroy(); md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Done", "", Gtk.MessageType.Info); md.ShowDialog(); return; /* * * Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Select DOC Directory (with xml)", null, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); * FileInfo[] xmls = new FileInfo[]{}; * * if (fc.Run() == (int)ResponseType.Accept) { * * DirectoryInfo di = new DirectoryInfo(fc.Filename); * xmls = di.GetFiles("*.xml"); * //List<string> output = new List<string>(); * * //MainClass.CompletedCache.ListTypes= listSignature.Distinct().ToList(); * //MainClass.CompletedCache.ListMembers= listMemberSignature.Distinct().ToList(); * } * progressDialog.Destroy(); * fc.Destroy(); * progressDialog = new ProgressDialog("Generated...",ProgressDialog.CancelButtonType.None,xmls.Length ,MainClass.MainWindow); * foreach (FileInfo xml in xmls) * { * try * { * progressDialog.Update(xml.Name); * if(!xml.Name.StartsWith("_")) * getObject(xml.FullName); * } * catch(Exception ex) { * Console.WriteLine(ex.Message); * Console.WriteLine(ex.StackTrace); * return; * } * } * progressDialog.Destroy(); * * md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Done", "", Gtk.MessageType.Info); * md.ShowDialog();*/ }
public SourceEditor(string filePath) { if (MainClass.Settings.SourceEditorSettings == null) { MainClass.Settings.SourceEditorSettings = new Moscrif.IDE.Option.Settings.SourceEditorSetting(); } errors = new List <ErrorMarker>(); lastPrecompile = DateTime.Now; control = new Gtk.ScrolledWindow(); (control as Gtk.ScrolledWindow).ShadowType = Gtk.ShadowType.Out; editorAction = new Gtk.ActionGroup("sourceeditor"); searchPattern = null; editor = new TextEdit(); LoadSetting(); SyntaxMode mode = new SyntaxMode(); string extension = System.IO.Path.GetExtension(filePath); //editor.AccelCanActivate switch (extension) { case ".ms": { try{ mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); }catch (Exception ex) { MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error, null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; (editor as ICompletionWidget).BanCompletion = false; break; } case ".js": { try{ mode = SyntaxModeService.GetSyntaxMode("text/x-java"); }catch (Exception ex) { MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error, null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; (editor as ICompletionWidget).BanCompletion = false; break; } case ".mso": { try{ mode = SyntaxModeService.GetSyntaxMode("text/moscrif"); }catch (Exception ex) { MessageDialogs msd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_load_syntax"), MainClass.Languages.Translate("error_load_syntax_f1"), Gtk.MessageType.Error, null); msd.ShowDialog(); Tool.Logger.Error(ex.Message); } isCompileExtension = true; break; } case ".xml": { mode = SyntaxModeService.GetSyntaxMode("application/xml"); break; } case ".txt": case ".app": break; default: break; } //editor.Document. editor.Document.SyntaxMode = mode; //modified = true; editor.Document.LineChanged += delegate(object sender, LineEventArgs e) { OnBookmarkUpdate(); OnModifiedChanged(true); }; editor.Caret.PositionChanged += delegate(object sender, DocumentLocationEventArgs e) { OnWriteToStatusbar(String.Format(statusFormat, editor.Caret.Location.Line + 1, editor.Caret.Location.Column, editor.Caret.Offset)); }; FileAttributes fa = File.GetAttributes(filePath); if ((fa & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { onlyRead = true; //editor.Document.ReadOnly= true; } try { using (StreamReader file = new StreamReader(filePath)) { editor.Document.Text = file.ReadToEnd(); file.Close(); file.Dispose(); } } catch (Exception ex) { MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_cannot_open", filePath), ex.Message, Gtk.MessageType.Error, null); ms.ShowDialog(); return; } //Console.WriteLine(editor.Document.Text.Replace("\r","^").Replace("\n","$")); (control as Gtk.ScrolledWindow).Add(editor); control.ShowAll(); fileName = filePath; fileSeting = MainClass.Workspace.WorkspaceUserSetting.FilesSetting.Find(x => x.FileName == fileName); if (fileSeting == null) { fileSeting = new FileSetting(fileName); } editor.TextViewMargin.ButtonPressed += OnTextMarginButtonPress; editor.IconMargin.ButtonPressed += OnIconMarginButtonPress; //editor.KeyPressEvent += OnKeyPressEvent; editor.KeyReleaseEvent += OnKeyReleaseEvent; editor.ButtonPressEvent += OnButtonPressEvent; bookmarkActions = new IdeBookmarkActions(editor, fileSeting); breakpointActions = new IdeBreakpointActions(editor); autoCompleteActions = new IdeAutocompleteAction(editor, editor); editAction = new IdeEditAction(editor); Gtk.Action act = new Gtk.Action("sourceeditor_togglebookmark", ""); act.Activated += bookmarkActions.ToggleBookmark; editorAction.Add(act); Gtk.Action act2 = new Gtk.Action("sourceeditor_clearbookmark", ""); act2.Activated += bookmarkActions.ClearBookmarks; editorAction.Add(act2); Gtk.Action act3 = new Gtk.Action("sourceeditor_nextbookmark", ""); act3.Activated += bookmarkActions.NextBookmark; editorAction.Add(act3); Gtk.Action act4 = new Gtk.Action("sourceeditor_prevbookmark", ""); act4.Activated += bookmarkActions.PreviousBookmark; editorAction.Add(act4); Gtk.Action act5 = new Gtk.Action("sourceeditor_addbreakpoint", ""); act5.Activated += breakpointActions.AddBreakpoints; editorAction.Add(act5); Gtk.Action act6 = new Gtk.Action("sourceeditor_inserttemplate", ""); act6.Activated += autoCompleteActions.InsertTemplate; editorAction.Add(act6); Gtk.Action act7 = new Gtk.Action("sourceeditor_insertautocomplete", ""); act7.Activated += autoCompleteActions.InsertCompletion; editorAction.Add(act7); Gtk.Action act8 = new Gtk.Action("sourceeditor_pasteClipboard", ""); act8.Activated += editAction.PasteText; editorAction.Add(act8); Gtk.Action act9 = new Gtk.Action("sourceeditor_copyClipboard", ""); act9.Activated += editAction.CopyText; editorAction.Add(act9); Gtk.Action act10 = new Gtk.Action("sourceeditor_cutClipboard", ""); act10.Activated += editAction.CutText; editorAction.Add(act10); Gtk.Action act11 = new Gtk.Action("sourceeditor_gotoDefinition", ""); act11.Activated += editAction.GoToDefinition; editorAction.Add(act11); Gtk.Action act12 = new Gtk.Action("sourceeditor_commentUncomment", ""); act12.Activated += editAction.CommentUncomment; editorAction.Add(act12); List <FoldSegment> list = editor.GetFolding(); foreach (SettingValue sv in fileSeting.Folding) { FoldSegment foldS = list.Find(x => x.Offset.ToString() == sv.Display); if (foldS != null) { bool isfolding = false; if (Boolean.TryParse(sv.Value, out isfolding)) { foldS.IsFolded = isfolding; } } } this.editor.Document.UpdateFoldSegments(list, true); //foreach (int bm in fileSeting.Bookmarks){ foreach (MyBookmark bm in fileSeting.Bookmarks2) { LineSegment ls = this.editor.Document.GetLine(bm.Line); if (ls != null) { ls.IsBookmarked = true; } //this.editor.Document.Lines[bm].IsBookmarked = true; } }