コード例 #1
0
        void ToggleModifier(int letterPos, char c, SequenceDisposition disposition)
        {
            string curLetter = GetLetterWithModifiers(letterPos);
            int    i         = curLetter.IndexOf(c);

            if (i > 0)
            {
                ToggleModifier(letterPos, c, disposition, false);
            }
            else
            {
                ToggleModifier(letterPos, c, disposition, true);
            }
        }
コード例 #2
0
        void CycleModifiers(char[] modifiers, char[][] exclusivityGroup, SequenceDisposition disposition, bool emptyStep)
        {
            string curLetter = CurLetterWithModifiers();
            int    i         = curLetter.IndexOfAny(modifiers);

            if (i < 0)
            {
                int sel = CurLetterPos() + curLetter.Length;
                foreach (char[] arr in exclusivityGroup)
                {
                    if (arr == modifiers)
                    {
                        continue;
                    }
                    foreach (char toDelete in arr)
                    {
                        if (curLetter.IndexOf(toDelete) > -1)
                        {
                            ToggleModifier(toDelete);
                            ModifierRemoved(CurLetterPos(), toDelete, exclusivityGroup);
                        }
                    }
                }
                ToggleModifier(modifiers[0], disposition);
                ModifierAdded(CurLetterPos(), modifiers[0], exclusivityGroup);
            }
            else
            {
                char c = curLetter[i];
                int  j = Array.IndexOf(modifiers, c);
                ToggleModifier(c);
                ModifierRemoved(CurLetterPos(), c, exclusivityGroup);
                j++;
                if ((!emptyStep) && (j >= modifiers.Length))
                {
                    j = 0;
                }
                if (j < modifiers.Length)
                {
                    ToggleModifier(modifiers[j], disposition);
                    ModifierAdded(CurLetterPos(), modifiers[j], exclusivityGroup);
                }
            }
        }
コード例 #3
0
        void ToggleModifier(int letterPos, char c, SequenceDisposition disposition, bool toggleOn)
        {
            string letter    = GetLetterWithModifiers(letterPos);
            string curLetter = CurLetterWithModifiers();
            int    sel       = CurLetterPos() + curLetter.Length;
            int    i         = letter.IndexOf(c);

            if ((i > 0) && (!toggleOn))
            {
                for (; i > 0; i = letter.IndexOf(c))
                {
                    letter = letter.Remove(i);
                    sel--;
                }
            }
            else if (toggleOn)
            {
                int pos;
                switch (disposition)
                {
                case SequenceDisposition.Last:
                    pos = letter.Length;
                    break;

                case SequenceDisposition.Second:
                    pos = Math.Min(2, letter.Length);
                    break;

                case SequenceDisposition.First:
                default:
                    pos = 1;
                    break;
                }
                letter = letter.Insert(pos, c.ToString());
                sel++;
            }
            ReplaceLetter(letterPos, letter);
            this.SelectionStart = sel;
        }
コード例 #4
0
 void ToggleModifier(char c, SequenceDisposition disposition)
 {
     ToggleModifier(CurLetterPos(), c, disposition);
 }