protected override void InsertTimeStamp(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, string timestamp, MessageModel msg) { if (String.IsNullOrWhiteSpace(msg.ID)) { buffer.Insert(ref iter, timestamp); } else { var uri = new Uri(String.Format("https://twitter.com/{0}/status/{1}", msg.GetNick(), msg.ID)); var tags = new List <Gtk.TextTag>(); // link URI tag var linkTag = new LinkTag(uri); linkTag.TextEvent += OnLinkTagTextEvent; _MessageTextTagTable.Add(linkTag); tags.Add(linkTag); // link style tag tags.Add(LinkTag); buffer.InsertWithTags(ref iter, timestamp, tags.ToArray()); } buffer.Insert(ref iter, " "); }
public void StartUpload(Gtk.TextBuffer updateWindow) { //Create a temp file updateWindow.Insert(updateWindow.EndIter, "Saving file.\n"); PintaCore.Workspace.ActiveDocument.Save(false); //Using Imgur API key updateWindow.Insert(updateWindow.EndIter, "Uploading file.\n"); string result = PostToImgur(PintaCore.Workspace.ActiveDocument.PathAndFileName, "ecf58baa7533e4c4535205bcac51a010"); string web_path = ParseResult(result); updateWindow.Insert(updateWindow.EndIter, "The imgur address is:\n"); updateWindow.Insert(updateWindow.EndIter, web_path); }
private void InsertToBuffer(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, UrlMessagePartModel urlPart) { var linkText = urlPart.Text ?? urlPart.Url; Uri uri; try { uri = new Uri(urlPart.Url); } catch (UriFormatException ex) { #if LOG4NET _Logger.Error("AddMessage(): Invalid URL: " + urlPart.Url, ex); #endif buffer.Insert(ref iter, linkText); return; } var tags = new List <Gtk.TextTag>(); // link URI tag var linkTag = new LinkTag(uri); linkTag.TextEvent += OnLinkTagTextEvent; _MessageTextTagTable.Add(linkTag); tags.Add(linkTag); // link style tag tags.Add(LinkTag); buffer.InsertWithTags(ref iter, linkText, tags.ToArray()); }
static void AddAlternativeText(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, ImageMessagePartModel imgPart) { if (!String.IsNullOrEmpty(imgPart.AlternativeText)) { buffer.Insert(ref iter, imgPart.AlternativeText); } }
public static void ConvertDatabaseToEditCategorie(string raw, ref Gtk.TextBuffer buffer) { var splittedTags = Regex.Split(raw, "(<.>|</.>|<..>)"); // What a noobish Regex var tagList = new List <Gtk.TextTag>(); // Split text into HTML-tags and insert the text with them var endIter = buffer.EndIter; foreach (var textBit in splittedTags) { switch (textBit) { case "<br>": buffer.Insert(ref endIter, "\n"); break; case "<b>": tagList.Add(boldTag); break; case "</b>": tagList.Remove(boldTag); break; case "<i>": tagList.Add(italicTag); break; case "</i>": tagList.Remove(italicTag); break; default: if (tagList.Count != 0) { buffer.InsertWithTags(ref endIter, textBit, tagList.ToArray()); } else { buffer.Insert(ref endIter, textBit); } break; } } }
public void Redo(Gtk.TextBuffer buffer) { Gtk.TextIter iter = buffer.GetIterAtOffset(offset); buffer.Insert(ref iter, "\n"); ((NoteBuffer)buffer).InsertBullet(ref iter, depth, direction); buffer.MoveMark(buffer.InsertMark, iter); buffer.MoveMark(buffer.SelectionBound, iter); }
private void InsertToBuffer(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, TextMessagePartModel fmsgti) { var tags = new List <Gtk.TextTag>(); if (fmsgti.Text == null) { // Gtk.TextBuffer.Insert*() asserts on text == NULL return; } if (fmsgti.ForegroundColor != TextColor.None) { var bg = ColorConverter.GetTextColor(BackgroundColor); if (fmsgti.BackgroundColor != TextColor.None) { bg = fmsgti.BackgroundColor; } TextColor color = TextColorTools.GetBestTextColor( fmsgti.ForegroundColor, bg ); string tagname = GetTextTagName(color, null); var tag = _MessageTextTagTable.Lookup(tagname); tags.Add(tag); } if (fmsgti.BackgroundColor != TextColor.None) { // TODO: get this from ChatView string tagname = GetTextTagName(null, fmsgti.BackgroundColor); var tag = _MessageTextTagTable.Lookup(tagname); tags.Add(tag); } if (fmsgti.Underline) { #if LOG4NET && MSG_DEBUG _Logger.Debug("AddMessage(): fmsgti.Underline is true"); #endif tags.Add(UnderlineTag); } if (fmsgti.Bold) { #if LOG4NET && MSG_DEBUG _Logger.Debug("AddMessage(): fmsgti.Bold is true"); #endif tags.Add(BoldTag); } if (fmsgti.Italic) { #if LOG4NET && MSG_DEBUG _Logger.Debug("AddMessage(): fmsgti.Italic is true"); #endif tags.Add(ItalicTag); } if (tags.Count > 0) { buffer.InsertWithTags(ref iter, fmsgti.Text, tags.ToArray()); } else { buffer.Insert(ref iter, fmsgti.Text); } }
protected virtual void InsertTimeStamp(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, string timestamp, MessageModel msg) { timestamp = String.Format("{0} ", timestamp); buffer.Insert(ref iter, timestamp); }