Beispiel #1
0
 public void ApplyChanges()
 {
     Settings.Default.Theme                   = Theme;
     Settings.Default.FontFamily              = FontFamily;
     Settings.Default.FontStretch             = FontStretch.ToString();
     Settings.Default.FontWeight              = FontWeight.ToString();
     Settings.Default.ScratchpadNumberOfLines = ScratchpadNumberOfLines;
     Settings.Default.ToastNotificationVerticalFillPercentage   = ToastNotificationVerticalFillPercentage;
     Settings.Default.ToastNotificationHorizontalFillPercentage = ToastNotificationHorizontalFillPercentage;
     Settings.Default.ToastNotificationSecondsPerCharacter      = ToastNotificationSecondsPerCharacter;
     Settings.Default.CursorWidthInPixels                  = CursorWidthInPixels;
     Settings.Default.CursorHeightInPixels                 = CursorHeightInPixels;
     Settings.Default.MagnifierCenterOnScreen              = MagnifierCenterOnScreen;
     Settings.Default.MagnifySourcePercentageOfScreen      = MagnifySourcePercentageOfScreen;
     Settings.Default.MagnifyDestinationPercentageOfScreen = MagnifyDestinationPercentageOfScreen;
     Settings.Default.ConversationOnlyMode                 = ConversationOnlyMode;
     Settings.Default.ConversationConfirmEnable            = ConversationConfirmEnable;
     Settings.Default.ConversationConfirmOnlyMode          = ConversationConfirmOnlyMode;
     Settings.Default.StartupKeyboard             = StartupKeyboard;
     Settings.Default.MainWindowMinimisedPosition = MinimisedPosition;
     Settings.Default.KeyCase = KeyCase;
     Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen = MainWindowFullDockThicknessAsPercentageOfScreen;
     Settings.Default.MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness = MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness;
     Settings.Default.ConversationBorderThickness = ConversationBorderThickness;
     Settings.Default.EnableQuitKeys             = EnableQuitKeys;
     Settings.Default.EnableAttentionKey         = EnableAttentionKey;
     Settings.Default.EnableCopyAllScratchpadKey = EnableCopyAllScratchpadKey;
     Settings.Default.DynamicKeyboardsLocation   = DynamicKeyboardsLocation;
     Settings.Default.StartupKeyboardFile        = StartupKeyboardFile;
 }
Beispiel #2
0
 protected virtual Font CreateFont(string fam, double size, FontStyle style, FontWeight weigth, FontStretch stretch)
 {
     return(Font.FromName(fam + " " +
                          style.ToString() + " " +
                          weigth.ToString() + " " +
                          stretch.ToString() + " " +
                          size.ToString(CultureInfo.InvariantCulture)));
 }
Beispiel #3
0
        public void ApplyChanges()
        {
            Settings.Default.Theme                   = Theme;
            Settings.Default.MainWindowOpacity       = (double)Opacity / 100.0f;
            Settings.Default.FontFamily              = FontFamily;
            Settings.Default.FontStretch             = FontStretch.ToString();
            Settings.Default.FontWeight              = FontWeight.ToString();
            Settings.Default.ScratchpadNumberOfLines = ScratchpadNumberOfLines;
            Settings.Default.ToastNotificationVerticalFillPercentage   = ToastNotificationVerticalFillPercentage;
            Settings.Default.ToastNotificationHorizontalFillPercentage = ToastNotificationHorizontalFillPercentage;
            Settings.Default.ToastNotificationSecondsPerCharacter      = ToastNotificationSecondsPerCharacter;
            Settings.Default.CursorWidthInPixels                  = CursorWidthInPixels;
            Settings.Default.CursorHeightInPixels                 = CursorHeightInPixels;
            Settings.Default.GazeIndicatorStyle                   = (GazeIndicatorStyles)Enum.Parse(typeof(GazeIndicatorStyles), GazeIndicatorStyle);
            Settings.Default.GazeIndicatorSize                    = GazeIndicatorSize;
            Settings.Default.MagnifierCenterOnScreen              = MagnifierCenterOnScreen;
            Settings.Default.MagnifySourcePercentageOfScreen      = MagnifySourcePercentageOfScreen;
            Settings.Default.MagnifyDestinationPercentageOfScreen = MagnifyDestinationPercentageOfScreen;
            Settings.Default.ConversationOnlyMode                 = ConversationOnlyMode;
            Settings.Default.ConversationConfirmEnable            = ConversationConfirmEnable;
            Settings.Default.ConversationConfirmOnlyMode          = ConversationConfirmOnlyMode;
            Settings.Default.StartupKeyboard             = StartupKeyboard;
            Settings.Default.MainWindowMinimisedPosition = MinimisedPosition;
            Settings.Default.KeyCase = KeyCase;
            Settings.Default.MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness = MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness;
            Settings.Default.ConversationBorderThickness = ConversationBorderThickness;
            Settings.Default.DynamicKeyboardsLocation    = DynamicKeyboardsLocation;
            Settings.Default.StartupKeyboardFile         = StartupKeyboardFile;

            // We don't apply changes to window/size position if Optikey's state has changed to one in which re-positioning isn't supported
            bool allowReposition = windowManipulationService.GetPersistedState() &&
                                   Settings.Default.MainWindowState != WindowStates.Maximised &&
                                   Settings.Default.MainWindowState != WindowStates.Minimised &&
                                   Settings.Default.MainWindowState != WindowStates.Hidden &&
                                   Settings.Default.MainWindowDockSize != DockSizes.Collapsed;

            if (allowReposition)
            {
                // Changes to window state, these methods will save the new values also
                if (Settings.Default.MainWindowState != MainWindowState ||
                    Settings.Default.MainWindowDockPosition != DockPosition ||
                    !Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen.IsCloseTo(
                        MainWindowFullDockThicknessAsPercentageOfScreen) ||
                    !Settings.Default.MainWindowFloatingSizeAndPosition.IsCloseTo(FloatingSizeAndPosition))
                {
                    Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen = MainWindowFullDockThicknessAsPercentageOfScreen;
                    Settings.Default.MainWindowFloatingSizeAndPosition = FloatingSizeAndPosition;

                    // this also saves the changes
                    windowManipulationService.ChangeState(MainWindowState, DockPosition);
                }
            }

            windowManipulationService.SetOpacity(Settings.Default.MainWindowOpacity);
            Settings.Default.EnableResizeWithMouse = EnableResizeWithMouse;
            windowManipulationService.SetResizeState();
        }
 public void ApplyChanges()
 {
     Settings.Default.Theme = Theme;
     Settings.Default.FontFamily = FontFamily;
     Settings.Default.FontStretch = FontStretch.ToString();
     Settings.Default.FontWeight = FontWeight.ToString();
     Settings.Default.ToastNotificationVerticalFillPercentage = ToastNotificationVerticalFillPercentage;
     Settings.Default.ToastNotificationHorizontalFillPercentage = ToastNotificationHorizontalFillPercentage;
     Settings.Default.ToastNotificationSecondsPerCharacter = ToastNotificationSecondsPerCharacter;
     Settings.Default.MinImageDisplayTimeInSeconds = MinImageDisplayTimeInSeconds;
     Settings.Default.DelayBeforeProgressingInSeconds = DelayBeforeProgressingInSeconds;
 }
Beispiel #5
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement(FontElementName);
     writer.WriteAttributeString(StyleAttributeName, FontStyle.ToString());
     writer.WriteAttributeString(VariantAttributeName, FontVariant.ToString());
     writer.WriteAttributeString(WidthAttributeName, FontWidth.ToString());
     writer.WriteAttributeString(StretchAttributeName, FontStretch.ToString());
     foreach (var fontSource in _sources)
     {
         fontSource.WriteXml(writer);
     }
     writer.WriteEndElement();
 }
Beispiel #6
0
        public override int GetHashCode()
        {
            StringBuilder builder = new StringBuilder();

            if (FontFamily != null)
            {
                builder.Append(FontFamily.ToString());
            }
            builder.Append(FontStyle.ToString());
            builder.Append(FontStretch.ToString());
            builder.Append(((ushort)FontWeight.Weight).ToString());
            builder.Append(WordWrap.ToString());
            builder.Append(MaximumSize.ToString());
            return(builder.ToString().GetHashCode());
        }
Beispiel #7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder(Font.FamilyName);

            if (Style != FontStyle.Normal)
            {
                sb.Append(' ').Append(Style.ToString());
            }
            if (Weight != FontWeight.Normal)
            {
                sb.Append(' ').Append(Weight.ToString());
            }
            if (Stretch != FontStretch.Normal)
            {
                sb.Append(' ').Append(Stretch.ToString());
            }
            sb.Append(' ').Append(Font.PointSize.ToString(CultureInfo.InvariantCulture));
            return(sb.ToString());
        }
Beispiel #8
0
 public void ApplyChanges()
 {
     Settings.Default.Theme                   = Theme;
     Settings.Default.FontFamily              = FontFamily;
     Settings.Default.FontStretch             = FontStretch.ToString();
     Settings.Default.FontWeight              = FontWeight.ToString();
     Settings.Default.ScratchpadNumberOfLines = ScratchpadNumberOfLines;
     Settings.Default.ToastNotificationVerticalFillPercentage   = ToastNotificationVerticalFillPercentage;
     Settings.Default.ToastNotificationHorizontalFillPercentage = ToastNotificationHorizontalFillPercentage;
     Settings.Default.ToastNotificationSecondsPerCharacter      = ToastNotificationSecondsPerCharacter;
     Settings.Default.CursorWidthInPixels                  = CursorWidthInPixels;
     Settings.Default.CursorHeightInPixels                 = CursorHeightInPixels;
     Settings.Default.MagnifySourcePercentageOfScreen      = MagnifySourcePercentageOfScreen;
     Settings.Default.MagnifyDestinationPercentageOfScreen = MagnifyDestinationPercentageOfScreen;
     Settings.Default.ConversationOnlyMode                 = ConversationOnlyMode;
     Settings.Default.StartupKeyboard             = StartupKeyboard;
     Settings.Default.MainWindowMinimisedPosition = MinimisedPosition;
     Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen = MainWindowFullDockThicknessAsPercentageOfScreen;
     Settings.Default.MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness = MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness;
 }
Beispiel #9
0
 public virtual T WithFontStretch(FontStretch fontStretch)
 {
     return(SetAttr(new { fontStretch = fontStretch.ToString().ToLower() }));
 }
Beispiel #10
0
 /// <summary>
 /// Formats the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public static string Format(this FontStretch value)
 {
     return(value.ToString());
 }