本文整理汇总了C#中Gtk.GetIterAtOffset方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetIterAtOffset方法的具体用法?C# Gtk.GetIterAtOffset怎么用?C# Gtk.GetIterAtOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.GetIterAtOffset方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Undo
public override void Undo (Gtk.TextBuffer buffer)
{
// Tag images change the offset by one, but only when deleting.
Gtk.TextIter start_iter = buffer.GetIterAtOffset (Offset);
Gtk.TextIter end_iter = buffer.GetIterAtOffset (Offset + chop.Length + 1);
buffer.Delete (ref start_iter, ref end_iter);
buffer.MoveMark (buffer.InsertMark, buffer.GetIterAtOffset (Offset));
buffer.MoveMark (buffer.SelectionBound, buffer.GetIterAtOffset (Offset));
Tag.WidgetLocation = null;
ApplySplitTags (buffer);
}
示例2: Redo
public override void Redo (Gtk.TextBuffer buffer)
{
RemoveSplitTags (buffer);
Gtk.TextIter cursor = buffer.GetIterAtOffset (Offset);
Gtk.TextTag[] tags = {Tag};
buffer.InsertWithTags (ref cursor, Id, tags);
buffer.MoveMark (buffer.SelectionBound, buffer.GetIterAtOffset (Offset));
buffer.MoveMark (buffer.InsertMark,
buffer.GetIterAtOffset (Offset + chop.Length));
}
示例3: Redo
public void Redo(Gtk.TextBuffer buffer)
{
Debug.Assert (imagePosition != -1);
var iter = buffer.GetIterAtOffset (imagePosition);
addin.InsertImage (iter, imageInfo, false);
buffer.MoveMark (buffer.InsertMark, iter);
buffer.MoveMark (buffer.SelectionBound, iter);
imagePosition = -1;
}
示例4: Undo
public void Undo(Gtk.TextBuffer buffer)
{
if (innerAction != null)
innerAction.Undo (buffer);
foreach (var pair in deletedImages) {
var iter = buffer.GetIterAtOffset (pair.Key);
addin.InsertImage (iter, pair.Value, false);
}
}
示例5: Undo
public void Undo(Gtk.TextBuffer buffer)
{
imagePosition = imageInfo.Position;
imageInfoList.Remove (imageInfo);
imageInfo.DisplayWidth = imageInfo.Widget.ImageSize.Width;
imageInfo.DisplayHeight = imageInfo.Widget.ImageSize.Height;
TextIter imageBoxBegin = buffer.GetIterAtOffset (imagePosition);
TextIter imageBoxEnd = imageBoxBegin;
imageBoxEnd.ForwardChar ();
buffer.Delete (ref imageBoxBegin, ref imageBoxEnd);
buffer.MoveMark (buffer.InsertMark, imageBoxBegin);
buffer.MoveMark (buffer.SelectionBound, imageBoxBegin);
}
示例6: Deserialize
public static void Deserialize (Gtk.TextBuffer buffer,
Gtk.TextIter start,
XmlTextReader xml)
{
int offset = start.Offset;
Stack<TagStart> stack = new Stack<TagStart> ();
TagStart tag_start;
NoteTagTable note_table = buffer.TagTable as NoteTagTable;
int curr_depth = -1;
// A stack of boolean values which mark if a
// list-item contains content other than another list
Stack<bool> list_stack = new Stack<bool> ();
while (xml.Read ()) {
switch (xml.NodeType) {
case XmlNodeType.Element:
if (xml.Name == "note-content")
break;
tag_start = new TagStart ();
tag_start.Start = offset;
if (note_table != null &&
note_table.IsDynamicTagRegistered (xml.Name)) {
tag_start.Tag =
note_table.CreateDynamicTag (xml.Name);
} else if (xml.Name == "list") {
curr_depth++;
break;
} else if (xml.Name == "list-item") {
if (curr_depth >= 0) {
if (xml.GetAttribute ("dir") == "rtl") {
tag_start.Tag =
note_table.GetDepthTag (curr_depth, Pango.Direction.Rtl);
} else {
tag_start.Tag =
note_table.GetDepthTag (curr_depth, Pango.Direction.Ltr);
}
list_stack.Push (false);
} else {
Logger.Error("</list> tag mismatch");
}
} else {
tag_start.Tag = buffer.TagTable.Lookup (xml.Name);
}
if (tag_start.Tag is NoteTag) {
((NoteTag) tag_start.Tag).Read (xml, true);
}
stack.Push (tag_start);
break;
case XmlNodeType.Text:
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
Gtk.TextIter insert_at = buffer.GetIterAtOffset (offset);
buffer.Insert (ref insert_at, xml.Value);
offset += xml.Value.Length;
// If we are inside a <list-item> mark off
// that we have encountered some content
if (list_stack.Count > 0) {
list_stack.Pop ();
list_stack.Push (true);
}
break;
case XmlNodeType.EndElement:
if (xml.Name == "note-content")
break;
if (xml.Name == "list") {
curr_depth--;
break;
}
tag_start = stack.Pop ();
if (tag_start.Tag == null)
break;
Gtk.TextIter apply_start, apply_end;
apply_start = buffer.GetIterAtOffset (tag_start.Start);
apply_end = buffer.GetIterAtOffset (offset);
if (tag_start.Tag is NoteTag) {
((NoteTag) tag_start.Tag).Read (xml, false);
}
// Insert a bullet if we have reached a closing
// <list-item> tag, but only if the <list-item>
// had content.
DepthNoteTag depth_tag = tag_start.Tag as DepthNoteTag;
if (depth_tag != null && list_stack.Pop ()) {
((NoteBuffer) buffer).InsertBullet (ref apply_start,
depth_tag.Depth,
//.........这里部分代码省略.........
示例7: Deserialize
public static void Deserialize (Gtk.TextBuffer buffer, Gtk.TextIter start, string content)
{
StringReader reader = new StringReader(content);
int intCharacter;
char convertedCharacter;
int offset = start.Offset;
string sbuffer = String.Empty;
Stack<TagStart> stack = new Stack<TagStart> ();
TagStart tag_start;
while (true) {
intCharacter = reader.Read ();
if (intCharacter == -1) break;
convertedCharacter = Convert.ToChar (intCharacter);
if (sbuffer != String.Empty || convertedCharacter == '<') {
sbuffer += convertedCharacter;
if (sbuffer == "<bold>") {
tag_start = new TagStart ();
tag_start.Start = offset;
tag_start.Tag = buffer.TagTable.Lookup ("bold");
stack.Push (tag_start);
sbuffer = String.Empty;
} else if (sbuffer == "<italic>") {
tag_start = new TagStart ();
tag_start.Start = offset;
tag_start.Tag = buffer.TagTable.Lookup ("italic");
stack.Push (tag_start);
sbuffer = String.Empty;
} else if (sbuffer == "</bold>" || sbuffer == "</italic>") {
if (stack.Count > 0) {
tag_start = stack.Pop ();
Gtk.TextIter apply_start, apply_end;
apply_start = buffer.GetIterAtOffset (tag_start.Start);
apply_end = buffer.GetIterAtOffset (offset);
buffer.ApplyTag (tag_start.Tag, apply_start, apply_end);
sbuffer = String.Empty;
}
} else if (sbuffer.Length > 9) {
Gtk.TextIter insert_at = buffer.GetIterAtOffset(offset);
buffer.Insert (ref insert_at, sbuffer);
offset += sbuffer.Length;
sbuffer = String.Empty;
}
} else {
Gtk.TextIter insert_at = buffer.GetIterAtOffset(offset);
buffer.Insert (ref insert_at, convertedCharacter.ToString ());
offset += 1;
}
}
}
示例8: Undo
public void Undo (Gtk.TextBuffer buffer)
{
Gtk.TextIter iter = buffer.GetIterAtOffset (offset);
iter.ForwardLine ();
iter = buffer.GetIterAtLine (iter.Line);
((NoteBuffer) buffer).RemoveBullet (ref iter);
iter.ForwardToLineEnd ();
buffer.MoveMark (buffer.InsertMark, iter);
buffer.MoveMark (buffer.SelectionBound, iter);
}
示例9: Redo
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);
}
示例10: RemoveSplitTags
protected void RemoveSplitTags (Gtk.TextBuffer buffer)
{
foreach (TagData tag in splitTags) {
Gtk.TextIter start = buffer.GetIterAtOffset (tag.start);
Gtk.TextIter end = buffer.GetIterAtOffset (tag.end);
buffer.RemoveTag(tag.tag, start, end);
}
}
示例11: ApplySplitTags
protected void ApplySplitTags (Gtk.TextBuffer buffer)
{
foreach (TagData tag in splitTags) {
int offset = GetSplitOffset ();
Gtk.TextIter start = buffer.GetIterAtOffset (tag.start - offset);
Gtk.TextIter end = buffer.GetIterAtOffset (tag.end - offset);
buffer.ApplyTag(tag.tag, start, end);
}
}