static SourceEditorView () { CodeSegmentPreviewWindow.CodeSegmentPreviewInformString = GettextCatalog.GetString ("Press 'F2' for focus"); ClipboardActions.CopyOperation.Copy += delegate (string text) { if (String.IsNullOrEmpty (text)) return; foreach (TextToolboxNode node in clipboardRing) { if (node.Text == text) { clipboardRing.Remove (node); break; } } TextToolboxNode item = new TextToolboxNode (text); string[] lines = text.Split ('\n'); for (int i = 0; i < 3 && i < lines.Length; i++) { if (i > 0) item.Description += Environment.NewLine; string line = lines [i]; if (line.Length > 16) line = line.Substring (0, 16) + "..."; item.Description += line; } item.Category = GettextCatalog.GetString ("Clipboard ring"); item.Icon = DesktopService.GetPixbufForFile ("a.txt", Gtk.IconSize.Menu); item.Name = text.Length > 16 ? text.Substring (0, 16) + "..." : text; item.Name = item.Name.Replace ("\t", "\\t"); item.Name = item.Name.Replace ("\n", "\\n"); clipboardRing.Add (item); while (clipboardRing.Count > 12) { clipboardRing.RemoveAt (0); } if (ClipbardRingUpdated != null) ClipbardRingUpdated (null, EventArgs.Empty); }; }
public override bool Equals(object o) { TextToolboxNode n = o as TextToolboxNode; return(n != null && text == n.text && base.Equals(o)); }