Exemple #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;
 }
		internal KeyboardDescription(IKeyboardAdaptor engine, KeyboardType type)
		{
			Engine = engine;
			Type = type;
			IsAvailable = true;
			OperatingSystem = Environment.OSVersion.Platform;
		}
 internal KeyboardDescription(IKeyboardAdaptor engine, KeyboardType type)
 {
     Engine          = engine;
     Type            = type;
     IsAvailable     = true;
     OperatingSystem = Environment.OSVersion.Platform;
 }
Exemple #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;
 }
 /// <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;
 }
		/// <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);
 }
			/// <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();
			}
Exemple #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);
        }
        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));
        }
        /// <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)
        {
        }
Exemple #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)
 {
 }
Exemple #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));
        }
Exemple #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)
 {
 }
 /// <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)
 {
 }
Exemple #17
0
 public IbusKeyboardDescription(IKeyboardAdaptor engine, IBusEngineDesc ibusKeyboard) :
     base(FormatKeyboardIdentifier(ibusKeyboard), ibusKeyboard.LongName, ibusKeyboard.Language,
          null, engine, KeyboardType.OtherIm)
 {
     IBusKeyboardEngine = ibusKeyboard;
 }
 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);
 }
        /// <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;
        }
 /// <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;
        }
Exemple #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;
 }
 /// <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)
 {
 }
Exemple #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);
        }
 public WinKeyboardDescription(IntPtr hkl, IKeyboardAdaptor engine)
     : this(new TfInputProcessorProfile(), HklToLangId(hkl), hkl, engine)
 {
 }