本文整理汇总了C#中Gtk.TextBuffer.CreateMark方法的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer.CreateMark方法的具体用法?C# TextBuffer.CreateMark怎么用?C# TextBuffer.CreateMark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TextBuffer
的用法示例。
在下文中一共展示了TextBuffer.CreateMark方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatTextBuffer
private void FormatTextBuffer(TextBuffer textBuffer, XmlNode linkTextNode)
{
XmlNodeList childNodes = linkTextNode.ChildNodes;
foreach(XmlNode childNode in childNodes)
{
if (childNode.Name.Equals("a"))
{
XmlAttribute href = childNode.Attributes["href"];
if (href != null)
{
string textTagName = href.Value;
TextTag textTag = textBuffer.TagTable.Lookup(textTagName);
if (textTag != null)
{
TextMark startTagMark = textBuffer.CreateMark(textTagName, textBuffer.EndIter, true);
textBuffer.InsertAtCursor(childNode.InnerText);
TextIter startTagIter = textBuffer.GetIterAtMark(startTagMark);
TextIter endTagIter = textBuffer.EndIter;
textBuffer.ApplyTag(textTag, startTagIter, endTagIter);
}
}
else
textBuffer.InsertAtCursor(childNode.InnerText);
}
else
{
textBuffer.InsertAtCursor(childNode.InnerText);
}
}
textBuffer.ApplyTag("small-font", textBuffer.StartIter, textBuffer.EndIter);
}
示例2: LogView
public LogView ()
{
buffer = new TextBuffer (new TextTagTable ());
textEditorControl = new LogTextView (buffer);
textEditorControl.Editable = false;
scrollView.ShadowType = ShadowType.None;
scrollView.Add (textEditorControl);
PackEnd (scrollView, true, true, 0);
bold = new TextTag ("bold");
bold.Weight = Weight.Bold;
buffer.TagTable.Add (bold);
errorTag = new TextTag ("error");
errorTag.Foreground = "#dc3122";
errorTag.Weight = Weight.Bold;
buffer.TagTable.Add (errorTag);
debugTag = new TextTag ("debug");
debugTag.Foreground = "#256ada";
buffer.TagTable.Add (debugTag);
consoleLogTag = new TextTag ("consoleLog");
consoleLogTag.Foreground = "darkgrey";
buffer.TagTable.Add (consoleLogTag);
tag = new TextTag ("0");
tag.LeftMargin = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false);
UpdateCustomFont ();
IdeApp.Preferences.CustomOutputPadFont.Changed += HandleCustomFontChanged;
outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
InitSearchWidget ();
}
示例3: LogView
public LogView ()
{
buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
textEditorControl = new LogTextView (buffer);
textEditorControl.Editable = false;
ShadowType = ShadowType.None;
Add (textEditorControl);
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (bold);
errorTag = new TextTag ("error");
errorTag.Foreground = "red";
errorTag.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (errorTag);
consoleLogTag = new TextTag ("consoleLog");
consoleLogTag.Foreground = "darkgrey";
buffer.TagTable.Add (consoleLogTag);
tag = new TextTag ("0");
tag.LeftMargin = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false);
UpdateCustomFont (IdeApp.Preferences.CustomOutputPadFont);
IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;
outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
}
示例4: TextRange
public TextRange (TextIter start, TextIter end)
{
if (start.Buffer != end.Buffer)
throw new Exception ("Start buffer and end buffer do not match");
buffer = start.Buffer;
start_mark = buffer.CreateMark (null, start, true);
end_mark = buffer.CreateMark (null, end, true);
}
示例5: GtkHighlighter
public GtkHighlighter(TextBuffer buffer)
{
this.buffer = buffer;
lineStart = buffer.CreateMark(null, buffer.EndIter, true);
}
示例6: OutputConsole
public OutputConsole()
{
buffer = new Gtk.TextBuffer(new Gtk.TextTagTable());
textEditorControl = new Gtk.TextView(buffer);
textEditorControl.Editable = true;
sw = new ScrolledWindow();
sw.ShadowType = ShadowType.Out;
sw.Add(textEditorControl);
this.PackStart(sw, true, true, 0);
vbt = new VBox();
Gdk.Pixbuf clear_pixbuf = MainClass.Tools.GetIconFromStock("file-new.png", IconSize.SmallToolbar);
Button btnClear = new Button(new Gtk.Image(clear_pixbuf));
btnClear.TooltipText = MainClass.Languages.Translate("clear");
btnClear.Relief = ReliefStyle.None;
btnClear.CanFocus = false;
btnClear.WidthRequest = btnClear.HeightRequest = 24;
btnClear.Clicked += delegate(object sender, EventArgs e) {
Clear();
};
Gdk.Pixbuf save_pixbuf = MainClass.Tools.GetIconFromStock("save.png", IconSize.SmallToolbar);
Button btnSave = new Button(new Gtk.Image(save_pixbuf));
btnSave.TooltipText = MainClass.Languages.Translate("save");
btnSave.Relief = ReliefStyle.None;
btnSave.CanFocus = false;
btnSave.WidthRequest = btnSave.HeightRequest = 24;
btnSave.Clicked += delegate(object sender, EventArgs e) {
Save();
};
vbt.WidthRequest = 24;
vbt.PackStart(btnClear, false, false, 0);
vbt.PackStart(btnSave, false, false, 0);
this.PackEnd(vbt, false, false, 0);
bold = new TextTag("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add(bold);
errorTag = new TextTag("error");
errorTag.Foreground = "red";
buffer.TagTable.Add(errorTag);
consoleLogTag = new TextTag("consoleLog");
consoleLogTag.Foreground = "darkgrey";
buffer.TagTable.Add(consoleLogTag);
tag = new TextTag("0");
tag.LeftMargin = 10;
buffer.TagTable.Add(tag);
tags.Add(tag);
endMark = buffer.CreateMark("end-mark", buffer.EndIter, false);
outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);
customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
textEditorControl.ModifyFont(customFont);
textEditorControl.KeyPressEvent += HandleTextEditorControlKeyPressEvent;
this.ShowAll();
}