Ejemplo n.º 1
0
 public ProDictFrm(InputMode ninput, WinInput nwinput)
 {
     this.input  = ninput;
     this.winput = nwinput;
     InitializeComponent();
     CheckForIllegalCrossThreadCalls = false;
 }
Ejemplo n.º 2
0
        private async void Loop()
        {
            for (;; await Task.Delay(1000 / targetFPS))
            {
                if (!isRunning)
                {
                    return;
                }

                isLayerFocused = false;
                if (MainForm.instance.OnMouse() && (!WinInput.GetKey(KeyCode.LeftMouse) || MainForm.instance.layerNamer.OnMouse()))
                {
                    //레이어 체크
                    for (int i = 0; i < LayerManager.layerList.Count; i++)
                    {
                        Layer layer = LayerManager.layerList[i];
                        if (layer.mainPanel.OnMouse())
                        {
                            isLayerFocused = true;
                            //레이어 포커스
                            if (LayerManager.focusedLayer != layer)
                            {
                                LayerManager.UnFocusLayer();
                                LayerManager.FocusLayer(layer);
                            }
                            //레이어네이머 붙이기
                            MainForm.instance.layerNamer.AttachLayer(layer);
                            break;
                        }
                    }
                }
                if (!isLayerFocused)
                {
                    //레이어 포커스 해제
                    LayerManager.UnFocusLayer();

                    //레이어네이머 떼기
                    if (!MainForm.instance.layerNamer.isEditing)
                    {
                        MainForm.instance.layerNamer.ClearLayer();
                    }
                }

                WinInput.Update();
            }
        }
Ejemplo n.º 3
0
 public UserDict(InputMode ninput, WinInput nwinput)
 {
     this.input  = ninput;
     this.winput = nwinput;
     InitializeComponent();
 }
Ejemplo n.º 4
0
        public virtual void KeysPressed(Keys[] pressedKeys)
        {
            if (!Focused)
            {
                return;
            }

            if (pressedKeys.Count() > 0)
            {
                // We have to do this to always show the strip when any letter is pressed
                ResetStrip(true);

                // Catch normal keys then transform to array
                Keys[] normalKeys = pressedKeys.Intersect(Settings.AllowedKeysInput).ToArray();

                if (normalKeys.Count() > 0)
                {
                    // We catch just one key
                    Keys key = normalKeys[0];

                    KeyBuffer buffer = TakeOrCreate(key);

                    // Change caps lock status

                    // check if can write key
                    if (buffer.Time > _bufferInterval)
                    {
                        if (key == Keys.Back)
                        {
                            if (!string.IsNullOrEmpty(Font.Text))
                            {
                                Text = Text.Substring(0, Text.Length - 1);
                            }
                        }
                        else
                        {
                            bool isCapsActive = ((ushort)WinInput.GetKeyState(WinInput.Key.CapsLock)) != 0;

                            //Refactor key string
                            string keyString = key.ToString();

                            // Refactor uppercase
                            Keys[] upperKeys = pressedKeys.Intersect(Settings.UpperKeysInput).ToArray();

                            keyString = TransformKey(key, keyString, upperKeys.Length > 0);

                            // Handles shift and caps lock conflict
                            if (isCapsActive && upperKeys.Length <= 0)
                            {
                                keyString = keyString.ToUpper();
                            }
                            else if (!isCapsActive && upperKeys.Length > 0)
                            {
                                keyString = keyString.ToUpper();
                            }
                            else
                            {
                                keyString = keyString.ToLower();
                            }

                            Text += keyString;
                        }

                        // Reset buffer
                        buffer.Time = 0;
                    }
                }
            }
        }