Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:SIL.FieldWorks.Common.Keyboarding.KeyboardDescription"/> class.
 /// </summary>
 public KeyboardDescription(int id, string name, IKeyboardAdaptor engine, KeyboardType type)
 {
     Id     = id;
     Name   = name;
     Engine = engine;
     Type   = type;
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Windows.KeymanKeyboardDescription"/> class.
 /// </summary>
 public KeymanKeyboardDescription(string layout, bool isKeyman6, IKeyboardAdaptor engine)
     : base(engine, KeyboardType.OtherIm)
 {
     InternalName = layout;
     Layout = layout;
     IsKeyman6 = isKeyman6;
 }
Ejemplo n.º 3
0
		internal KeyboardDescription(IKeyboardAdaptor engine, KeyboardType type)
		{
			Engine = engine;
			Type = type;
			IsAvailable = true;
			OperatingSystem = Environment.OSVersion.Platform;
		}
Ejemplo n.º 4
0
 internal KeyboardDescription(IKeyboardAdaptor engine, KeyboardType type)
 {
     Engine          = engine;
     Type            = type;
     IsAvailable     = true;
     OperatingSystem = Environment.OSVersion.Platform;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Windows.KeymanKeyboardDescription"/> class.
 /// </summary>
 public KeymanKeyboardDescription(string layout, bool isKeyman6, IKeyboardAdaptor engine)
     : base(engine, KeyboardType.OtherIm)
 {
     InternalName = layout;
     Layout       = layout;
     IsKeyman6    = isKeyman6;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
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 = KeyboardType.System)
		{
			InternalName = name;
			Layout = layout;
			Locale = locale;
			Engine = engine;
			Type = type;
			IsAvailable = true;
			OperatingSystem = Environment.OSVersion.Platform;
			InputLanguage = language;
		}
 public WinKeyboardDescription(string locale, string layout, IKeyboardAdaptor engine)
     : base(engine, KeyboardType.System)
 {
     InputLanguageWrapper inputLanguage = null;
     try
     {
         inputLanguage = new InputLanguageWrapper(new CultureInfo(locale), IntPtr.Zero, layout);
     }
     catch (CultureNotFoundException)
     {
         // ignore if we can't find a culture (this can happen e.g. when a language gets
         // removed that was previously assigned to a WS) - see LT-15333
     }
     Initialize(locale, new WinKeyboardAdaptor.LayoutName(layout), locale, inputLanguage);
 }
Ejemplo n.º 9
0
			/// <summary>
			/// Sets the available keyboard adaptors. Note that if this is called more than once, the adapters
			/// installed previously will be closed and no longer useable. Do not pass adapter instances that have been
			/// previously passed. At least one adapter must be of type System.
			/// </summary>
			public static void SetKeyboardAdaptors(IKeyboardAdaptor[] adaptors)
			{
				if (!(Keyboard.Controller is IKeyboardControllerImpl))
					Keyboard.Controller = new KeyboardControllerImpl();

				Instance.Keyboards.Clear(); // InitializeAdaptors below will fill it in again.
				if (Adaptors != null)
				{
					foreach (var adaptor in Adaptors)
						adaptor.Close();
				}

				Adaptors = adaptors;

				InitializeAdaptors();
			}
Ejemplo n.º 10
0
        public WinKeyboardDescription(string locale, string layout, IKeyboardAdaptor engine)
            : base(engine, KeyboardType.System)
        {
            InputLanguageWrapper inputLanguage = null;

            try
            {
                inputLanguage = new InputLanguageWrapper(new CultureInfo(locale), IntPtr.Zero, layout);
            }
            catch (CultureNotFoundException)
            {
                // ignore if we can't find a culture (this can happen e.g. when a language gets
                // removed that was previously assigned to a WS) - see LT-15333
            }
            Initialize(locale, new WinKeyboardAdaptor.LayoutName(layout), locale, inputLanguage);
        }
Ejemplo n.º 11
0
        private WinKeyboardDescription(TfInputProcessorProfile profile, ushort langId, IntPtr hkl, IKeyboardAdaptor engine)
            : base(engine, KeyboardType.System)
        {
            var winEngine = engine as WinKeyboardAdaptor;
            Debug.Assert(winEngine != null);

            InputProcessorProfile = profile;

            var culture = new CultureInfo(langId);
            string locale;
            string cultureName;
            try
            {
                cultureName = culture.DisplayName;
                locale = culture.Name;
            }
            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
                cultureName = "[Unknown Language]";
                locale = "en-US";
            }
            WinKeyboardAdaptor.LayoutName layoutName;
            if (profile.Hkl == IntPtr.Zero && profile.ProfileType != TfProfileType.Illegal)
            {
                layoutName = new WinKeyboardAdaptor.LayoutName(winEngine.ProcessorProfiles.GetLanguageProfileDescription(
                    ref profile.ClsId, profile.LangId, ref profile.GuidProfile));
            }
            else
                layoutName = WinKeyboardAdaptor.GetLayoutNameEx(hkl);

            Initialize(cultureName, layoutName, locale,
                new InputLanguageWrapper(culture, hkl, layoutName.Name));
        }
Ejemplo n.º 12
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)
        {
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Windows.WinKeyboardDescription"/> class.
 /// </summary>
 public WinKeyboardDescription(TfInputProcessorProfile profile, IKeyboardAdaptor engine)
     : this(profile, profile.LangId, profile.Hkl, engine)
 {
 }
Ejemplo n.º 14
0
        private WinKeyboardDescription(TfInputProcessorProfile profile, ushort langId, IntPtr hkl, IKeyboardAdaptor engine)
            : base(engine, KeyboardType.System)
        {
            var winEngine = engine as WinKeyboardAdaptor;

            Debug.Assert(winEngine != null);

            InputProcessorProfile = profile;

            var    culture = new CultureInfo(langId);
            string locale;
            string cultureName;

            try
            {
                cultureName = culture.DisplayName;
                locale      = culture.Name;
            }
            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
                cultureName = "[Unknown Language]";
                locale      = "en-US";
            }
            WinKeyboardAdaptor.LayoutName layoutName;
            if (profile.Hkl == IntPtr.Zero && profile.ProfileType != TfProfileType.Illegal)
            {
                layoutName = new WinKeyboardAdaptor.LayoutName(winEngine.ProcessorProfiles.GetLanguageProfileDescription(
                                                                   ref profile.ClsId, profile.LangId, ref profile.GuidProfile));
            }
            else
            {
                layoutName = WinKeyboardAdaptor.GetLayoutNameEx(hkl);
            }

            Initialize(cultureName, layoutName, locale,
                       new InputLanguageWrapper(culture, hkl, layoutName.Name));
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:SIL.FieldWorks.Common.Keyboarding.KeyboardDescription"/> class.
 /// </summary>
 public KeyboardDescription(int id, string name, IKeyboardAdaptor engine)
     : this(id, name, engine, KeyboardType.System)
 {
 }
Ejemplo n.º 16
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)
 {
 }
Ejemplo n.º 17
0
 public IbusKeyboardDescription(IKeyboardAdaptor engine, IBusEngineDesc ibusKeyboard) :
     base(FormatKeyboardIdentifier(ibusKeyboard), ibusKeyboard.LongName, ibusKeyboard.Language,
          null, engine, KeyboardType.OtherIm)
 {
     IBusKeyboardEngine = ibusKeyboard;
 }
Ejemplo n.º 18
0
 internal void AddKeyboardForLayout(XklConfigRegistry.LayoutDescription layout, int iGroup, IKeyboardAdaptor engine)
 {
     var description = GetDescription(layout);
     CultureInfo culture = null;
     try
     {
         culture = new CultureInfo(layout.LocaleId);
     }
     catch (ArgumentException)
     {
         // This can happen if the locale is not supported.
         // TODO: fix mono's list of supported locales. Doesn't support e.g. de-BE.
         // See mono/tools/locale-builder.
     }
     var inputLanguage = new InputLanguageWrapper(culture, IntPtr.Zero, layout.Language);
     var keyboard = new XkbKeyboardDescription(description, layout.LayoutId, layout.LocaleId,
         inputLanguage, engine, iGroup);
     KeyboardController.Manager.RegisterKeyboard(keyboard);
 }
Ejemplo n.º 19
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;
        }
Ejemplo n.º 20
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 IbusKeyboardDescription(IKeyboardAdaptor engine, IBusEngineDesc ibusKeyboard)
            : base(FormatKeyboardIdentifier(ibusKeyboard), ibusKeyboard.LongName, ibusKeyboard.Language,
			null, engine, KeyboardType.OtherIm)
        {
            IBusKeyboardEngine = ibusKeyboard;
        }
Ejemplo n.º 22
0
 public WinKeyboardDescription(IntPtr hkl, IKeyboardAdaptor engine)
     : this(new TfInputProcessorProfile(), HklToLangId(hkl), hkl, engine)
 {
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:SIL.FieldWorks.Common.Keyboarding.Linux.XkbKeyboardDescription"/> class.
 /// </summary>
 /// <param name='id'>Keyboard identifier.</param>
 /// <param name='name'>Name of the keyboard layout</param>
 /// <param name='engine'>The keyboard adaptor that will handle this keyboard</param>
 /// <param name='groupIndex'>The group index of this xkb keyboard</param>
 public XkbKeyboardDescription(int id, string name, IKeyboardAdaptor engine,
                               int groupIndex) : base(id, name, engine)
 {
     GroupIndex = groupIndex;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Windows.WinKeyboardDescription"/> class.
 /// </summary>
 public WinKeyboardDescription(TfInputProcessorProfile profile, IKeyboardAdaptor engine)
     : this(profile, profile.LangId, profile.Hkl, engine)
 {
 }
Ejemplo n.º 25
0
        internal void AddKeyboardForLayout(XklConfigRegistry.LayoutDescription layout, int iGroup, IKeyboardAdaptor engine)
        {
            var         description = GetDescription(layout);
            CultureInfo culture     = null;

            try
            {
                culture = new CultureInfo(layout.LocaleId);
            }
            catch (ArgumentException)
            {
                // This can happen if the locale is not supported.
                // TODO: fix mono's list of supported locales. Doesn't support e.g. de-BE.
                // See mono/tools/locale-builder.
            }
            var inputLanguage = new InputLanguageWrapper(culture, IntPtr.Zero, layout.Language);
            var keyboard      = new XkbKeyboardDescription(description, layout.LayoutId, layout.LocaleId,
                                                           inputLanguage, engine, iGroup);

            KeyboardController.Manager.RegisterKeyboard(keyboard);
        }
Ejemplo n.º 26
0
 public WinKeyboardDescription(IntPtr hkl, IKeyboardAdaptor engine)
     : this(new TfInputProcessorProfile(), HklToLangId(hkl), hkl, engine)
 {
 }