Пример #1
0
 public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard)
 {
     // NOTE: on Windows InputLanguage.LayoutName returns a wrong name in some cases.
     // Therefore we need this overload so that we can identify the keyboard correctly.
     keyboard = _keyboards.FirstOrDefault(kd => kd.InputLanguage != null && kd.InputLanguage.Equals(language));
     return(keyboard != null);
 }
Пример #2
0
 internal WinKeyboardDescription(string keyboardId, string localizedKeyboardName, string inputLanguageLayoutName, string cultureName, bool isAvailable, IInputLanguage inputLanguage, WinKeyboardAdaptor engine) : base(keyboardId, localizedKeyboardName, inputLanguageLayoutName, cultureName, isAvailable, engine.SwitchingAdaptor)
 {
     InputLanguage  = inputLanguage;
     _localizedName = localizedKeyboardName;
     ConversionMode = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL);
     _useNfcContext = IsKeymanKeyboard(cultureName);
 }
Пример #3
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="SIL.Windows.Forms.Keyboarding.Linux.XkbKeyboardDescription"/> class.
		/// </summary>
		public XkbKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable,
			IInputLanguage language, IKeyboardSwitchingAdaptor engine, int groupIndex)
			: base(id, name, layout, locale, isAvailable, engine)
		{
			InputLanguage = language;
			GroupIndex = groupIndex;
		}
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="SIL.Windows.Forms.Keyboarding.Linux.XkbKeyboardDescription"/> class.
 /// </summary>
 public XkbKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable,
                               IInputLanguage language, IKeyboardSwitchingAdaptor engine, int groupIndex)
     : base(id, name, layout, locale, isAvailable, engine)
 {
     InputLanguage = language;
     GroupIndex    = groupIndex;
 }
		public IKeyboardDefinition GetKeyboard(IInputLanguage language)
		{
			IKeyboardDefinition keyboard;
			if (TryGetKeyboard(language, out keyboard))
				return keyboard;
			return _nullKeyboard;
		}
Пример #6
0
        public IKeyboardDefinition GetKeyboard(IInputLanguage language)
        {
            IKeyboardDefinition keyboard;

            if (TryGetKeyboard(language, out keyboard))
            {
                return(keyboard);
            }
            return(NullKeyboard);
        }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:SIL.Windows.Forms.Keyboarding.Windows.WinKeyboardDescription"/> class.
 /// </summary>
 internal WinKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable,
                                 IInputLanguage inputLanguage, WinKeyboardAdaptor engine, string localizedName, TfInputProcessorProfile profile)
     : base(id, name, layout, locale, isAvailable, engine)
 {
     InputLanguage         = inputLanguage;
     _localizedName        = localizedName;
     InputProcessorProfile = profile;
     ConversionMode        = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL);
     _useNfcContext        = !IsKeymanKeyboard(profile);
 }
Пример #8
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="T:SIL.Windows.Forms.Keyboarding.Windows.WinKeyboardDescription"/> class.
		/// </summary>
		internal WinKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable,
			IInputLanguage inputLanguage, WinKeyboardAdaptor engine, string localizedName, TfInputProcessorProfile profile)
			: base(id, name, layout, locale, isAvailable, engine)
		{
			InputLanguage = inputLanguage;
			_localizedName = localizedName;
			InputProcessorProfile = profile;
			ConversionMode = (int) (Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL);
			_useNfcContext = !IsKeymanKeyboard(profile);
		}
Пример #9
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class.
		/// </summary>
		internal KeyboardDescription(string name, string layout, string locale,
			IInputLanguage language, IKeyboardSwitchingAdaptor engine, KeyboardType type = KeyboardType.System)
		{
			InternalName = name;
			Layout = layout;
			Locale = locale;
			Engine = engine;
			Type = type;
			IsAvailable = true;
			OperatingSystem = Environment.OSVersion.Platform;
			InputLanguage = language;
		}
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class.
 /// </summary>
 internal KeyboardDescription(string name, string layout, string locale,
                              IInputLanguage language, IKeyboardAdaptor engine, KeyboardType type)
 {
     InternalName    = name;
     Layout          = layout;
     Locale          = locale;
     Engine          = engine;
     Type            = type;
     IsAvailable     = true;
     OperatingSystem = Environment.OSVersion.Platform;
     InputLanguage   = language;
 }
Пример #11
0
        /// <summary>
        /// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>.
        /// </summary>
        private static IKeyboardDefinition GetKeyboardDescription(IInputLanguage inputLanguage)
        {
            IKeyboardDefinition sameLayout  = KeyboardDescription.Zero;
            IKeyboardDefinition sameCulture = KeyboardDescription.Zero;
            // TODO: write some tests
            var requestedLayout = GetLayoutNameEx(inputLanguage.Handle).Name;

            foreach (KeyboardDescription keyboardDescription in Keyboard.Controller.AllAvailableKeyboards)
            {
                try
                {
                    if (requestedLayout == keyboardDescription.Layout)
                    {
                        if (keyboardDescription.Locale == inputLanguage.Culture.Name)
                        {
                            return(keyboardDescription);
                        }
                        if (sameLayout == null)
                        {
                            sameLayout = keyboardDescription;
                        }
                    }
                    else if (keyboardDescription.Locale == inputLanguage.Culture.Name && sameCulture == null)
                    {
                        sameCulture = keyboardDescription;
                    }
                }
                catch (CultureNotFoundException)
                {
                    // we get an exception for non-supported cultures, probably because of a
                    // badly applied .NET patch.
                    // http://www.ironspeed.com/Designer/3.2.4/WebHelp/Part_VI/Culture_ID__XXX__is_not_a_supported_culture.htm and others
                }
            }
            return(sameLayout ?? sameCulture);
        }
Пример #12
0
        /// <summary>
        /// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>.
        /// </summary>
        internal static KeyboardDescription GetKeyboardDescription(IInputLanguage inputLanguage)
        {
            KeyboardDescription sameLayout  = null;
            KeyboardDescription sameCulture = null;
            // TODO: write some tests
            string requestedLayout = GetLayoutNameEx(inputLanguage.Handle).Name;

            foreach (WinKeyboardDescription keyboardDescription in KeyboardController.Instance.AvailableKeyboards.OfType <WinKeyboardDescription>())
            {
                try
                {
                    if (requestedLayout == keyboardDescription.Layout)
                    {
                        if (keyboardDescription.Locale == inputLanguage.Culture.Name)
                        {
                            return(keyboardDescription);
                        }
                        if (sameLayout == null)
                        {
                            sameLayout = keyboardDescription;
                        }
                    }
                    else if (keyboardDescription.Locale == inputLanguage.Culture.Name && sameCulture == null)
                    {
                        sameCulture = keyboardDescription;
                    }
                }
                catch (CultureNotFoundException)
                {
                    // we get an exception for non-supported cultures, probably because of a
                    // badly applied .NET patch.
                    // http://www.ironspeed.com/Designer/3.2.4/WebHelp/Part_VI/Culture_ID__XXX__is_not_a_supported_culture.htm and others
                }
            }
            return(sameLayout ?? sameCulture ?? KeyboardController.NullKeyboard);
        }
Пример #13
0
 public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard)
 {
     return(TryGetKeyboard(language.LayoutName, language.Culture.Name, out keyboard));
 }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Linux.XkbKeyboardDescription"/> class.
        /// </summary>
        /// <param name='name'>Display name of the keyboard</param>
        /// <param name='layout'>Name of the keyboard layout</param>
        /// <param name='locale'>The locale of the keyboard</param>
        /// <param name='engine'>The keyboard adaptor that will handle this keyboard</param>
        /// <param name='groupIndex'>The group index of this xkb keyboard</param>
        internal XkbKeyboardDescription(string name, string layout, string locale,
			IInputLanguage language, IKeyboardAdaptor engine, int groupIndex)
            : base(name, layout, locale, language, engine)
        {
            GroupIndex = groupIndex;
        }
 public void SetKeyboard(IInputLanguage language)
 {
 }
Пример #16
0
 protected void SetInputLanguage(IInputLanguage inputLanguage)
 {
     InputLanguage = inputLanguage;
 }
Пример #17
0
 public void SetInputLanguage(IInputLanguage language)
 {
     InputLanguage = language;
 }
Пример #18
0
		public IKeyboardDefinition GetKeyboard(IInputLanguage language)
		{
			throw new NotImplementedException();
		}
Пример #19
0
 public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     return GetKeyboardDescription(inputLanguage);
 }
Пример #20
0
 /// <summary/>
 public KeyboardDescription GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     return(null);
 }
Пример #21
0
		public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard)
		{
			// NOTE: on Windows InputLanguage.LayoutName returns a wrong name in some cases.
			// Therefore we need this overload so that we can identify the keyboard correctly.
			keyboard = _keyboards.FirstOrDefault(kd => kd.InputLanguage != null && kd.InputLanguage.Equals(language));
			return keyboard != null;
		}
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Linux.XkbKeyboardDescription"/> class.
 /// </summary>
 /// <param name='name'>Display name of the keyboard</param>
 /// <param name='layout'>Name of the keyboard layout</param>
 /// <param name='locale'>The locale of the keyboard</param>
 /// <param name='engine'>The keyboard adaptor that will handle this keyboard</param>
 /// <param name='groupIndex'>The group index of this xkb keyboard</param>
 internal XkbKeyboardDescription(string name, string layout, string locale,
                                 IInputLanguage language, IKeyboardAdaptor engine, int groupIndex)
     : base(name, layout, locale, language, engine)
 {
     GroupIndex = groupIndex;
 }
Пример #23
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class.
        /// </summary>
        internal KeyboardDescription(string name, string layout, string locale,
			IInputLanguage language, IKeyboardAdaptor engine)
            : this(name, layout, locale, language, engine, KeyboardType.System)
        {
        }
Пример #24
0
 public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     throw new NotImplementedException("Keyman keyboards that are not associated with a language cannot be looked up by language.");
 }
 private void Initialize(string displayName, WinKeyboardAdaptor.LayoutName layoutName, string locale, IInputLanguage inputLanguage)
 {
     ConversionMode = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL);
     InternalName = GetDisplayName(displayName, layoutName.Name);
     InternalLocalizedName = GetDisplayName(displayName, layoutName.LocalizedName);
     Layout = layoutName.Name;
     Locale = locale;
     SetInputLanguage(inputLanguage);
 }
Пример #26
0
		protected void SetInputLanguage(IInputLanguage inputLanguage)
		{
			InputLanguage = inputLanguage;
		}
Пример #27
0
 private KeyboardDescription GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     return(GetKeyboardDescription(inputLanguage));
 }
 public IKeyboardDefinition GetKeyboard(IInputLanguage language)
 {
     return(TrivialKeyboard);
 }
Пример #29
0
		private KeyboardDescription GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
		{
			return GetKeyboardDescription(inputLanguage);
		}
Пример #30
0
		public void SetInputLanguage(IInputLanguage language)
		{
			InputLanguage = language;
		}
Пример #31
0
 public IKeyboardDefinition GetKeyboard(IInputLanguage language)
 {
     // NOTE: on Windows InputLanguage.LayoutName returns a wrong name in some cases.
     // Therefore we need this overload so that we can identify the keyboard correctly.
     return Keyboards
         .Where(keyboard => keyboard is KeyboardDescription &&
             ((KeyboardDescription)keyboard).InputLanguage != null &&
             ((KeyboardDescription)keyboard).InputLanguage.Equals(language))
         .DefaultIfEmpty(KeyboardDescription.Zero)
         .First();
 }
		public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard)
		{
			return TryGetKeyboard(language.LayoutName, language.Culture.Name, out keyboard);
		}
Пример #33
0
 public void SetKeyboard(IInputLanguage language)
 {
     SetKeyboard(GetKeyboard(language));
 }
 public IKeyboardDefinition GetKeyboard(IInputLanguage language)
 {
     return TrivialKeyboard;
 }
Пример #35
0
 public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     return(GetKeyboardDescription(inputLanguage));
 }
Пример #36
0
 public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     throw new NotImplementedException("Keyman keyboards that are not associated with a language cannot be looked up by language.");
 }
Пример #37
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class.
 /// </summary>
 internal KeyboardDescription(string name, string layout, string locale,
                              IInputLanguage language, IKeyboardAdaptor engine)
     : this(name, layout, locale, language, engine, KeyboardType.System)
 {
 }
Пример #38
0
 public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage)
 {
     throw new NotImplementedException();
 }
Пример #39
0
 public void SetKeyboard(IInputLanguage language)
 {
 }
Пример #40
0
 /// <summary>
 /// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>.
 /// </summary>
 private static KeyboardDescription GetKeyboardDescription(IInputLanguage inputLanguage)
 {
     KeyboardDescription sameLayout = null;
     KeyboardDescription sameCulture = null;
     // TODO: write some tests
     var requestedLayout = GetLayoutNameEx(inputLanguage.Handle).Name;
     foreach (KeyboardDescription keyboardDescription in Keyboard.Controller.AllAvailableKeyboards)
     {
         try
         {
             if (requestedLayout == keyboardDescription.Layout)
             {
                 if (keyboardDescription.Locale == inputLanguage.Culture.Name)
                     return keyboardDescription;
                 if (sameLayout == null)
                     sameLayout = keyboardDescription;
             }
             else if (keyboardDescription.Locale == inputLanguage.Culture.Name && sameCulture == null)
                 sameCulture = keyboardDescription;
         }
         catch (CultureNotFoundException)
         {
             // we get an exception for non-supported cultures, probably because of a
             // badly applied .NET patch.
             // http://www.ironspeed.com/Designer/3.2.4/WebHelp/Part_VI/Culture_ID__XXX__is_not_a_supported_culture.htm and others
         }
     }
     return sameLayout ?? sameCulture;
 }
Пример #41
0
 private void Initialize(string displayName, WinKeyboardAdaptor.LayoutName layoutName, string locale, IInputLanguage inputLanguage)
 {
     ConversionMode        = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL);
     InternalName          = GetDisplayName(displayName, layoutName.Name);
     InternalLocalizedName = GetDisplayName(displayName, layoutName.LocalizedName);
     Layout = layoutName.Name;
     Locale = locale;
     SetInputLanguage(inputLanguage);
 }