From: handa Date: Thu, 1 Oct 2009 10:59:06 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18f80341e7c3f27769e588819b0ba1673ba4864e;p=m17n%2Fm17n-lib-cs.git *** empty log message *** --- diff --git a/MInputMethod.cs b/MInputMethod.cs index 0128e84..1a79af3 100644 --- a/MInputMethod.cs +++ b/MInputMethod.cs @@ -79,6 +79,21 @@ namespace M17N.Input }; [FlagsAttribute] + public enum ChangedStatus + { + None = 0x00, + StateTitle = 0x01, + Preedit = 0x02, + CursorPos = 0x04, + CandidateList = 0x08, + CandidateIndex = 0x10, + CandidateShow = 0x20, + } + + private static ChangedStatus CandidateAll = (ChangedStatus.CandidateList + | ChangedStatus.CandidateIndex + | ChangedStatus.CandidateShow); + [FlagsAttribute] public enum KeyModifier { None = 0x00000000, @@ -979,46 +994,39 @@ namespace M17N.Input return new Numbered (index); } + public override Xex.TermValue Clone () { return this; } + public class Numbered : Selector { int index; public Numbered (int index) { this.index = index; } - public override void Select (Candidates can) - { - if (can != null) - can.Select (index); - } + public override void Select (Candidates can) { can.Select (index); } } public class Predefined : Selector { private char tag; - private Predefined (MSymbol sym) { this.tag = sym.Name[1]; } + internal Predefined (MSymbol sym) { this.tag = sym.Name[1]; } public override void Select (Candidates can) { - if (can != null) + switch (tag) { - if (sym == Mat_less_than) - candidates.First (); - else if (sym == Mat_greater_than) - candidates.Last (); - else if (sym == Mat_minus) - candidates.Prev (); - else if (sym == Mat_plus) - candidates.Next (); - else if (sym == Mat_open_square_bracket) - candidates.PrevGroup (); - else if (sym == Mat_close_square_bracket) - candidates.NextGroup (); + case '<': candidates.First (); break; + case '>': candidates.Last (); break; + case '-': candidates.Prev (); break; + case '+': candidates.Next (); break; + case '[': candidates.PrevGroup (); break; + case ']': candidates.NextGroup (); break; + default: break; } } } - static Predefined predefined_selectors; + static new Dictionary predefined_selectors; static Selector () { @@ -1026,7 +1034,7 @@ namespace M17N.Input MSymbol[] symlist = new MSymbol[] { "@<", "@=", "@>", "@-", "@+", "@[", "@]" }; foreach (MSymbol s in symlist) - predefined_markers[s] = new Predefined (s); + predefined_selectors[s] = new Predefined (s); } } @@ -2027,9 +2035,10 @@ namespace M17N.Input private static Xex.Term Fselect (Xex.Domain domain, Xex.Variable vari, Xex.Term[] args) { - Selector sel = (Selector) args[0].Objval; + Candidates can = ((MInputContext) domain.context).candidates; - sel.Select (((MInputContext) domain.context).candidates); + if (can != null) + ((Selector) args[0].Objval).Select (can); return args[0]; } @@ -2192,24 +2201,9 @@ namespace M17N.Input internal Xex.Domain domain; - [FlagsAttribute] - public enum ChangedStatus - { - None = 0x00, - StateTitle = 0x01, - Preedit = 0x02, - CursorPos = 0x04, - CandidateList = 0x08, - CandidateIndex = 0x10, - CandidateShow = 0x20, - } - - private static ChangedStatus CandidateAll = (ChangedStatus.CandidateList - | ChangedStatus.CandidateIndex - | ChangedStatus.CandidateShow); - private ChangedStatus changed; + internal Mim.ChangedStatus changed; - public ChangedStatus Changed { get { return changed; } } + public Mim.ChangedStatus Changed { get { return changed; } } public MInputContext (MInputMethod im) {