本文整理汇总了C#中Gtk.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetText方法的具体用法?C# Gtk.GetText怎么用?C# Gtk.GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.GetText方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyCJKToBlock
void ApplyCJKToBlock(Gtk.TextIter start, Gtk.TextIter end)
{
NoteBuffer.GetBlockExtents (ref start,
ref end,
512 /* XXX */,
cjk_tag);
Buffer.RemoveTag (cjk_tag, start, end);
MatchCJK m = new MatchCJK (start.GetText (end));
foreach (MatchCJK.CJKGroup g in m) {
Gtk.TextIter start_cpy = start;
start_cpy.ForwardChars (g.Start);
end = start;
end.ForwardChars (g.End);
Buffer.ApplyTag (cjk_tag, start_cpy, end);
}
}
示例2: ApplyEALToBlock
void ApplyEALToBlock(Gtk.TextIter start, Gtk.TextIter end)
{
AddLanguageTag ();
NoteBuffer.GetBlockExtents (ref start,
ref end,
512 /* XXX */,
eal_tag);
Buffer.RemoveTag (eal_tag, start, end);
MatchEAL m = new MatchEAL (start.GetText (end));
foreach (MatchEAL.EALGroup g in m) {
Gtk.TextIter start_cpy = start;
start_cpy.ForwardChars (g.Start);
end = start;
end.ForwardChars (g.End);
Buffer.ApplyTag (eal_tag, start_cpy, end);
}
}
示例3: RemoveTaskFromLine
/// <summary>
/// Remove the task from the line specified by the TextIter. This
/// will remove the TextTag and also the "todo:" portion of the line
/// so it will no longer be a task. The task summary text will be
/// left on the line.
/// <param name="iter">The TextIter specifying the line where the
/// task should be removed.</param>
/// <returns>True if a task was removed, otherwise False.</returns>
/// </summary>
bool RemoveTaskFromLine (ref Gtk.TextIter iter)
{
if (RemoveTaskTagFromLine (iter) == false)
return false;
while (iter.StartsLine () == false) {
iter.BackwardChar ();
}
Gtk.TextIter line_end = iter;
while (line_end.EndsLine () == false) {
line_end.ForwardChar ();
}
// line_end.ForwardToLineEnd ();
string text = iter.GetText (line_end);
Buffer.Delete (ref iter, ref line_end);
text = GetTaskSummaryFromLine (text);
if (text.Length > 0)
Buffer.Insert (ref iter, text);
return true;
}
示例4: ApplyTaskTagToBlock
void ApplyTaskTagToBlock (ref Gtk.TextIter start, Gtk.TextIter end)
{
Gtk.TextIter line_end = start;
while (line_end.EndsLine () == false) {
line_end.ForwardChar ();
}
// For some reason, the above code behaves like it should (i.e.,
// without advancing to the next line). The line below that's
// commented out doesn't work. It ends up advancing the iter to
// the end of the next line. Very strange!
// line_end.ForwardToLineEnd ();
TaskTag task_tag = GetTaskTagFromLineIter (ref start);
if (task_tag != null) {
Buffer.RemoveTag (task_tag, start, line_end);
} else {
task_tag = last_removed_tag;
}
string text = start.GetText (line_end);
// Logger.Debug ("Evaluating with regex: {0}", text);
TaskManager task_mgr = TasksApplicationAddin.DefaultTaskManager;
Task task;
Match match = regex.Match (text);
if (match.Success) {
string summary = GetTaskSummaryFromLine (text);
if (task_tag == null) {
task = task_mgr.Create (summary);
task.QueueSave (true);
task.OriginNoteUri = Note.Uri;
task_tag = (TaskTag)
Note.TagTable.CreateDynamicTag ("task");
task_tag.Uri = task.Uri;
} else {
task = task_mgr.FindByUri (task_tag.Uri);
if (task != null) {
task.Summary = summary;
} else {
Logger.Debug ("FIXME: Add code to remove the task tag if this case is hit");
}
}
Buffer.ApplyTag (task_tag, start, line_end);
last_removed_tag = null;
} else if (task_tag != null) {
// This task should be deleted
task = task_mgr.FindByUri (task_tag.Uri);
if (task != null) {
task_mgr.Delete (task);
}
last_removed_tag = null;
}
}
示例5: HandleTextInserted
void HandleTextInserted(object o, Gtk.TextInsertedArgs args)
{
if (String.IsNullOrEmpty (args.GetText ()))
return;
var pargs = new TextInputEventArgs (args.GetText ());
ApplicationContext.InvokeUserCode (delegate {
EventSink.OnTextInput (pargs);
});
if (pargs.Handled)
((GLib.Object)o).StopSignal ("insert-text");
}
示例6: ApplyWikiwordToBlock
void ApplyWikiwordToBlock (Gtk.TextIter start, Gtk.TextIter end)
{
NoteBuffer.GetBlockExtents (ref start,
ref end,
80 /* max wiki name */,
broken_link_tag);
Buffer.RemoveTag (broken_link_tag, start, end);
for (Match match = regex.Match (start.GetText (end));
match.Success;
match = match.NextMatch ()) {
System.Text.RegularExpressions.Group group = match.Groups [1];
Gtk.TextIter start_cpy = start;
start_cpy.ForwardChars (group.Index);
end = start_cpy;
end.ForwardChars (group.Length);
if (Note.TagTable.HasLinkTag (start_cpy))
break;
Logger.Debug ("Highlighting wikiword: '{0}' at offset {1}",
group,
group.Index);
if (Manager.Find (group.ToString ()) == null) {
Buffer.ApplyTag (broken_link_tag, start_cpy, end);
}
}
}
示例7: OpenOrCreateLink
bool OpenOrCreateLink (Gtk.TextIter start, Gtk.TextIter end)
{
string link_name = start.GetText (end);
Note link = Manager.Find (link_name);
if (link == null) {
Logger.Debug ("Creating note '{0}'...", link_name);
try {
link = Manager.Create (link_name);
} catch {
// Fail silently.
}
}
// FIXME: We used to also check here for (link != this.Note), but
// somehow this was causing problems receiving clicks for the
// wrong instance of a note (see bug #413234). Since a
// link:internal tag is never applied around text that's the same
// as the current note's title, it's safe to omit this check and
// also works around the bug.
if (link != null) {
Logger.Debug ("Opening note '{0}' on click...", link_name);
link.Window.Present ();
return true;
}
return false;
}
示例8: HighlightNoteInBlock
void HighlightNoteInBlock (Note find_note, Gtk.TextIter start, Gtk.TextIter end)
{
string buffer_text = start.GetText (end).ToLower();
string find_title_lower = find_note.Title.ToLower ();
int idx = 0;
while (true) {
idx = buffer_text.IndexOf (find_title_lower, idx);
if (idx < 0)
break;
TrieHit hit = new TrieHit (idx,
idx + find_title_lower.Length,
find_title_lower,
find_note);
DoHighlight (hit, start, end);
idx += find_title_lower.Length;
}
}
示例9: ToggleMark
private void ToggleMark(Gtk.TextIter iter)
{
/*
* If char under iter is a marked symbol, changes for an unmarked symbol and
* viceversa.
*/
string uchar;
Gtk.TextBuffer b;
Gtk.TextIter iterNext;
string charToggled = "";
bool found = true;
b = iter.Buffer;
iterNext = iter;
iterNext.ForwardChar();
uchar = iter.GetText(iterNext);
if (uchar == CHECK_UNMARKED /* ☐ */ ){
charToggled = CHECK_MARKED;
}else if (uchar == CHECK_MARKED /* ☑ */ ){
charToggled = CHECK_UNMARKED;
}else if (uchar == CHECK_XMARKED /* ☒ */ ){
charToggled = CHECK_UNMARKED;
}else if (uchar == CHECK_TICK /* ✓ */ ){
charToggled = CHECK_UNMARKED;
}else if (uchar == CHECK_BALLOTX /* ✗ */ ){
charToggled = CHECK_UNMARKED;
}else{
found = false;
}
if (found){
b.Delete(ref iter, ref iterNext);
b.Insert(ref iter, charToggled);
}
}
示例10: CurrentCharIsMark
private bool CurrentCharIsMark(Gtk.TextIter iter)
{
/*
* Returns true when char under iter is any of mark predefined symbols.
*/
Gtk.TextIter siguiente = new Gtk.TextIter();
siguiente = iter;
siguiente.ForwardChar();
bool res = false;
string car = iter.GetText(siguiente);
foreach (string s in UPATTERNS) {
if (car == s){
res = true;
break;
}
}
return res;
}
示例11: HighlightInBlock
void HighlightInBlock (Gtk.TextIter start, Gtk.TextIter end)
{
foreach (TrieHit hit in galago.Trie.FindMatches (start.GetText (end))) {
Gtk.TextIter match_start =
Buffer.GetIterAtOffset(start.Offset + hit.Start);
// Don't create links inside note or URL links
if (match_start.HasTag (url_tag) ||
match_start.HasTag (link_tag))
continue;
Gtk.TextIter match_end = match_start;
match_end.ForwardChars (hit.End - hit.Start);
Logger.Log ("Matching Person '{0}' at {1}-{2}...",
hit.Key,
hit.Start,
hit.End);
Buffer.ApplyTag (person_tag, match_start, match_end);
}
}
示例12: OnActivate
protected override bool OnActivate (NoteEditor editor,
Gtk.TextIter start,
Gtk.TextIter end)
{
string persona = start.GetText (end);
PersonLink plink = (PersonLink) galago.Trie.Lookup (persona);
try {
plink.SendMessage ();
} catch (Exception e) {
string title = Catalog.GetString ("Cannot contact '{0}'");
title = String.Format (title, persona);
string message = Catalog.GetString ("Error running gaim-remote: {0}");
message = String.Format (message, e.Message);
Logger.Log (message);
HIGMessageDialog dialog =
new HIGMessageDialog (editor.Toplevel as Gtk.Window,
Gtk.DialogFlags.DestroyWithParent,
Gtk.MessageType.Info,
Gtk.ButtonsType.Ok,
title,
message);
dialog.Run ();
dialog.Destroy ();
}
return true;
}