Example #1
0
        public TerminalOptions Import(TerminalOptions src)
        {
            //•\Ž¦
            _lineSpacing = src._lineSpacing;

            //ƒ^[ƒ~ƒiƒ‹
            _closeOnDisconnect       = src._closeOnDisconnect;
            _beepOnBellChar          = src._beepOnBellChar;
            _askCloseOnExit          = src._askCloseOnExit;
            _charDecodeErrorBehavior = src._charDecodeErrorBehavior;
            _disconnectNotification  = src._disconnectNotification;

            //‘€ì
            _terminalBufferSize = src._terminalBufferSize;
            _send0x7FByDel      = src._send0x7FByDel;
            _send0x7FByBack     = src._send0x7FByBack;
            _zone0x1F           = src._zone0x1F;
            _customKeySettings  = src._customKeySettings;
            _keepAliveInterval  = src._keepAliveInterval;

            //ƒƒO
            _defaultLogType      = src._defaultLogType;
            _defaultLogDirectory = src._defaultLogDirectory;

            //PreferenceEditor‚Ì‚Ý
            _shellHistoryLimitCount = src._shellHistoryLimitCount;

            return(this);
        }
Example #2
0
        public void DefineItems(/* IPreferenceBuilder builder */)
        {
            //•\Ž¦
            _lineSpacing = 0;

            //ƒ^[ƒ~ƒiƒ‹
            _closeOnDisconnect       = true;
            _beepOnBellChar          = false;
            _askCloseOnExit          = false;
            _charDecodeErrorBehavior = WarningOption.MessageBox;
            _disconnectNotification  = WarningOption.StatusBar;

            //‘€ì
            _terminalBufferSize = 1000;
            _send0x7FByDel      = false;
            _send0x7FByBack     = false;
            _zone0x1F           = KeyboardStyle.None;
            _customKeySettings  = "";
            _keepAliveInterval  = 60000;

            //ƒƒO
            _defaultLogType      = LogType.None;
            _defaultLogDirectory = "";

            //PreferenceEditor‚Ì‚Ý
            _shellHistoryLimitCount = 100;
        }
Example #3
0
 /// <summary>
 /// Handles a selection change in the styles list, loading that style in the main form.
 /// </summary>
 private void StyleList_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     this.DefinitionChanged?.Invoke(
         KeyboardDefinition.Load(this.SelectedCategory, this.SelectedDefinition),
         KeyboardStyle.Load(this.SelectedStyle.Name, this.SelectedStyle.Global),
         this.SelectedStyle.Global);
 }
Example #4
0
        public void Reset(ITerminalEmulatorOptions opt)
        {
            //TODO ここはPeripheralPanelとかぶっている。なんとかしたい
            StringBuilder bld = new StringBuilder();

            if (opt.Send0x7FByDel)
            {
                bld.Append("Delete=0x7F");
            }
            if (opt.Send0x7FByBack)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append("Back=0x7F");
            }

            KeyboardStyle ks = opt.Zone0x1F;

            if (ks != KeyboardStyle.None)
            {
                string s;
                if (ks == KeyboardStyle.Default)
                {
                    s = "Ctrl+D6=0x1E, Ctrl+Minus=0x1F";
                }
                else //Japanese
                {
                    s = "Ctrl+BackSlash=0x1F";
                }
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(s);
            }

            if (opt.CustomKeySettings.Length > 0)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(opt.CustomKeySettings);
            }

            //仕上げ。パースエラーがちょっとアレだ
            _keyFunction = KeyFunction.Parse(bld.ToString()).ToFixedStyle();
        }
Example #5
0
 /// <summary>
 /// Handles a selection change in the styles list, loading that style in the main form.
 /// </summary>
 private void StyleList_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     try
     {
         this.DefinitionChanged?.Invoke(
             KeyboardDefinition.Load(this.SelectedCategory, this.SelectedDefinition),
             KeyboardStyle.Load(this.SelectedStyle.Name, this.SelectedStyle.Global),
             this.SelectedStyle.Global);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Failed to load keyboard {this.SelectedDefinition}: {ex.Message}");
         return;
     }
 }
Example #6
0
        private void AdjustAutoKeySettings(object sender, EventArgs args)
        {
            if (_constructing)
            {
                return;
            }

            StringBuilder bld = new StringBuilder();

            if (_send0x7FByDel.Checked)
            {
                bld.Append("Delete=0x7F");
            }
            if (_send0x7FByBack.Checked)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append("Back=0x7F");
            }

            KeyboardStyle ks = ((EnumListItem <KeyboardStyle>)_zone0x1FBox.SelectedItem).Value;

            if (ks != KeyboardStyle.None)
            {
                string s;
                if (ks == KeyboardStyle.Default)
                {
                    s = "Ctrl+D6=0x1E, Ctrl+Minus=0x1F";
                }
                else //Japanese
                {
                    s = "Ctrl+BackSlash=0x1F";
                }
                //一応パース
                //KeyFunction.Parse(s);
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(s);
            }
            _autoKeySettingsBox.Text = bld.ToString();
        }
Example #7
0
        /// <summary>
        /// Handles the loading of the form, all settings are read, hooks are created and the keyboard is initialized.
        /// </summary>
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Load the settings
            if (!GlobalSettings.Load())
            {
                MessageBox.Show(
                    this,
                    $"Failed to load the settings: {GlobalSettings.Errors}",
                    "Failed to load settings");
            }

            this.Location = new Point(GlobalSettings.Settings.X, GlobalSettings.Settings.Y);
            var title = GlobalSettings.Settings.WindowTitle;

            this.Text = string.IsNullOrWhiteSpace(title) ? $"NohBoard {Version.Get}" : title;

            this.GetLatestVersion().Start();

            // Load a definition if possible.
            if (GlobalSettings.Settings.LoadedKeyboard != null && GlobalSettings.Settings.LoadedCategory != null)
            {
                try
                {
                    GlobalSettings.Settings.UpdateDefinition(KeyboardDefinition
                                                             .Load(GlobalSettings.Settings.LoadedCategory, GlobalSettings.Settings.LoadedKeyboard), false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(
                        "There was an error loading the saved keyboard definition file:" +
                        $"{Environment.NewLine}{ex.Message}");
                    GlobalSettings.Settings.LoadedCategory = null;
                    GlobalSettings.Settings.LoadedKeyboard = null;
                }
            }

            // Load a style if possible.
            if (GlobalSettings.CurrentDefinition != null && GlobalSettings.Settings.LoadedStyle != null)
            {
                try
                {
                    GlobalSettings.Settings.UpdateStyle(KeyboardStyle.Load(
                                                            GlobalSettings.Settings.LoadedStyle,
                                                            GlobalSettings.Settings.LoadedGlobalStyle), false);
                    this.LoadKeyboard();
                    this.ResetBackBrushes();
                }
                catch
                {
                    GlobalSettings.Settings.LoadedStyle = null;
                    MessageBox.Show(
                        $"Failed to load style {GlobalSettings.Settings.LoadedStyle}, loading default style.",
                        "Error loading style.");
                }

                // Enable the mouse hook only if there are mouse keys on the screen.
                if (GlobalSettings.CurrentDefinition.Elements.Any(x => !(x is KeyboardKeyDefinition)))
                {
                    HookManager.EnableMouseHook();
                }

                // Enable the keyboard hook only if there are keyboard keys on the screen.
                if (GlobalSettings.CurrentDefinition.Elements.Any(x => x is KeyboardKeyDefinition))
                {
                    HookManager.EnableKeyboardHook();
                }
            }

            this.UpdateTimer.Interval  = GlobalSettings.Settings.UpdateInterval;
            this.UpdateTimer.Enabled   = true;
            this.KeyCheckTimer.Enabled = true;

            this.Activate();
            this.ApplySettings();
        }
Example #8
0
        /// <summary>
        /// Handles the loading of the form, all settings are read, hooks are created and the keyboard is initialized.
        /// </summary>
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Load the settings
            if (!GlobalSettings.Load())
            {
                MessageBox.Show(
                    this,
                    $"Failed to load the settings: {GlobalSettings.Errors}",
                    "Failed to load settings");
            }

            this.Location = new Point(GlobalSettings.Settings.X, GlobalSettings.Settings.Y);
            this.Text     = $"NohBoard {Version.Get}";

            this.GetLatestVersion().Start();

            // Load a definition if possible.
            if (GlobalSettings.Settings.LoadedKeyboard != null && GlobalSettings.Settings.LoadedCategory != null)
            {
                try
                {
                    GlobalSettings.CurrentDefinition = KeyboardDefinition
                                                       .Load(GlobalSettings.Settings.LoadedCategory, GlobalSettings.Settings.LoadedKeyboard);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(
                        "There was an error loading the saved keyboard definition file:" +
                        $"{Environment.NewLine}{ex.Message}");
                    GlobalSettings.Settings.LoadedCategory = null;
                    GlobalSettings.Settings.LoadedKeyboard = null;
                }
            }

            // Load a style if possible.
            if (GlobalSettings.CurrentDefinition != null && GlobalSettings.Settings.LoadedStyle != null)
            {
                try
                {
                    GlobalSettings.CurrentStyle = KeyboardStyle.Load(
                        GlobalSettings.Settings.LoadedStyle,
                        GlobalSettings.Settings.LoadedGlobalStyle);
                    this.ResetBackBrushes();
                }
                catch
                {
                    GlobalSettings.Settings.LoadedStyle = null;
                    MessageBox.Show(
                        $"Failed to load style {GlobalSettings.Settings.LoadedStyle}, loading default style.",
                        "Error loading style.");
                }
            }

            HookManager.EnableMouseHook();
            HookManager.EnableKeyboardHook();

            this.UpdateTimer.Enabled   = true;
            this.KeyCheckTimer.Enabled = true;

            this.Activate();
            this.ApplySettings();
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyboardStyleForm" /> class.
 /// </summary>
 /// <param name="initialStyle">The initial style.</param>
 public KeyboardStyleForm(KeyboardStyle initialStyle)
 {
     this.initialStyle = initialStyle ?? new KeyboardStyle();
     this.currentStyle = this.initialStyle.Clone();
     this.InitializeComponent();
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyboardStyleForm" /> class.
 /// </summary>
 /// <param name="initialStyle">The initial style.</param>
 public KeyboardStyleForm(KeyboardStyle initialStyle)
 {
     this.initialStyle = initialStyle;
     this.currentStyle = initialStyle;
     this.InitializeComponent();
 }
Example #11
0
 public void SetActive(bool isVisible, KeyboardStyle style = KeyboardStyle.KeyboardNumPad)
 {
     gameObject.SetActive(isVisible);
     Keyboard.SetActive(isVisible);
 }