当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.GetIterAtOffset方法代码示例

本文整理汇总了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);
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:13,代码来源:InsertBugAction.cs

示例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));

		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:14,代码来源:InsertBugAction.cs

示例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;
 }
开发者ID:binarytemple,项目名称:tomboy-image,代码行数:9,代码来源:InsertImageAction.cs

示例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);
     }
 }
开发者ID:binarytemple,项目名称:tomboy-image,代码行数:9,代码来源:DeleteImageAction.cs

示例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);
        }
开发者ID:binarytemple,项目名称:tomboy-image,代码行数:14,代码来源:InsertImageAction.cs

示例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,
//.........这里部分代码省略.........
开发者ID:MatteoNardi,项目名称:Tomboy,代码行数:101,代码来源:NoteBuffer.cs

示例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;
                }
            }
        }
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:53,代码来源:EditableTextView.cs

示例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);
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:13,代码来源:Undo.cs

示例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);
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:11,代码来源:Undo.cs

示例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);
			}
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:8,代码来源:Undo.cs

示例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);
			}
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:10,代码来源:Undo.cs


注:本文中的Gtk.GetIterAtOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。