};
[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,
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<MSymbol, Predefined> predefined_selectors;
static Selector ()
{
MSymbol[] symlist = new MSymbol[] { "@<", "@=", "@>", "@-", "@+",
"@[", "@]" };
foreach (MSymbol s in symlist)
- predefined_markers[s] = new Predefined (s);
+ predefined_selectors[s] = new Predefined (s);
}
}
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];
}
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)
{