Esempio n. 1
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed)
            {

            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenOptions);
                        break;

                    case Keys.S:
                        CGraphics.FadeTo(EScreens.ScreenSong);
                        break;

                    case Keys.Enter:
                        CGraphics.FadeTo(EScreens.ScreenTest);
                        break;
                }
            }
            return true;
        }
Esempio n. 2
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the key arguments from a key event
 /// </summary>
 /// <param name="e">Key event</param>
 ////////////////////////////////////////////////////////////
 public KeyEventArgs(KeyEvent e)
 {
     Code    = e.Code;
     Alt     = e.Alt != 0;
     Control = e.Control != 0;
     Shift   = e.Shift != 0;
 }
Esempio n. 3
0
		/// <summary>
		/// Process pressed key in order to bind it 
		/// </summary>
		protected override bool OnKeyDown( KeyEvent e )
		{
			if( base.OnKeyDown( e ) )
				return true;
			//new key allready detected
			if( _newJoystickValue != null || _newKeyboardMousevalue != null )
				return true;

			if( e.Key == EKeys.Escape )
			{
				SetShouldDetach();
				return true;
			}

			if( controlItem != null && _oldKeyboardMouseValue != null )
			{
				_newKeyboardMousevalue = new GameControlsManager.SystemKeyboardMouseValue( e.Key ) { Parent = controlItem };
				GameControlsManager.SystemKeyboardMouseValue key;
				if( GameControlsManager.Instance.IsAlreadyBinded( e.Key, out key ) )
				{
					_conflictKeyboardMouseValue = key;
					CreateConfirmDialogue( "Key " + e.Key + " is already bound to " + key.Parent.ControlKey + ". Override ?, or Click Clear to remove the bind" );

					return true;
				}
				SetKey();
				SetShouldDetach();
				return true;
			}

			return false;
		}
        void ShootPrimitive(KeyEvent ke)
        {
            #if Debug
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            if (ke.key == KeyCode.KC_B) {
                string type;
                switch ((int) Math.RangeRandom(0, 5)) {
                    case 0:
                    default:
                        type = "Box"; break;
                    case 1:
                        type = "Sphere"; break;
                    case 2:
                        type = "Cylinder"; break;
                    case 3:
                        type = "Cone"; break;
                    case 4:
                        type = "Capsule"; break;
                }
                Vector3 pos = LKernel.GetG<PlayerManager>().MainPlayer.NodePosition + Vector3.UNIT_Y;

                LKernel.GetG<Spawner>().Spawn(type, pos);
            }
            #endif
        }
Esempio n. 5
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
            {

            }
            else
            {
                bool processed = false;
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenSong);
                        break;

                    case Keys.Enter:

                        for (int i = 0; i < ButtonPlayer.Length; i++)
                        {
                            if (Buttons[htButtons(ButtonPlayer[i])].Selected)
                            {
                                processed = true;
                                CGame.NumPlayer = i + 1;

                                UpdateSelection();
                                UpdateVisibility();

                                CConfig.NumPlayer = CGame.NumPlayer;
                                CConfig.SaveConfig();

                                CheckMics();

                                break;
                            }
                        }

                        if (!processed && Buttons[htButtons(ButtonBack)].Selected)
                        {
                            processed = true;
                            CGraphics.FadeTo(EScreens.ScreenSong);
                        }

                        if (!processed && Buttons[htButtons(ButtonStart)].Selected)
                        {
                            processed = true;
                            StartSong();
                        }

                        break;
                }

                if (!processed)
                    UpdateSelection();
            }

            return true;
        }
Esempio n. 6
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            if (KeyEvent.KeyPressed)
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenHighscore);
                        break;

                    case Keys.Enter:
                        CGraphics.FadeTo(EScreens.ScreenHighscore);
                        break;

                    case Keys.Left:
                        ChangeRound(-1);
                        break;

                    case Keys.Right:
                        ChangeRound(1);
                        break;
                }
            }
            return true;
        }
        protected override bool OnKeyDown(KeyEvent e)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnKeyDown(e);

            //change camera type
            if (e.Key == EKeys.F7)
            {
                FreeCameraEnabled = !FreeCameraEnabled;
                GameEngineApp.Instance.AddScreenMessage(
                    string.Format("Camera type: {0}", FreeCameraEnabled ? "Free" : "Default"));
                return true;
            }

            //GameControlsManager
            if (EntitySystemWorld.Instance.Simulation)
            {
                if (!FreeCameraEnabled && !IsCutSceneEnabled())
                {
                    if (GameControlsManager.Instance.DoKeyDown(e))
                        return true;
                }
            }

            return base.OnKeyDown(e);
        }
        void OnKeyboardPress_Anything(KeyEvent ke)
        {
            // if the input is swallowed, don't do anything
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            string s = string.Empty;
            switch (ke.key) {
                case KeyCode.KC_0:
                    s = Settings.Default.MainMenuName; break;
                case KeyCode.KC_1:
                    s = "flat"; break;
                case KeyCode.KC_2:
                    s = "testlevel"; break;
                case KeyCode.KC_3:
                    s = "SweetAppleAcres"; break;
                case KeyCode.KC_4:
                    s = "WhitetailWoods"; break;
                case KeyCode.KC_5:
                    s = "TestAI"; break;
            }
            if (!string.IsNullOrEmpty(s)) {
                LKernel.GetG<LevelManager>().LoadLevel(new LevelChangeRequest() {
                    NewLevelName = s,
                    CharacterNames = LKernel.GetG<Players.PlayerManager>().MakeCharacterString(),
                });
            }
        }
Esempio n. 9
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed)
            {

            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        Close();
                        break;

                    case Keys.Enter:
                        if (Buttons[htButtons(ButtonExit)].Selected)
                        {
                            Close();
                        }
                        break;

                    case Keys.Left:
                        OnChange();
                        break;

                    case Keys.Right:
                        OnChange();
                        break;
                }
            }
            return true;
        }
Esempio n. 10
0
        void OnKeyboardPress(KeyEvent eventArgs)
        {
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            Kart kart = LKernel.GetG<PlayerManager>().MainPlayer.Kart;

            Vector3 pos;
            Quaternion quat;

            switch (eventArgs.key) {
                case KeyCode.KC_NUMPAD0:
                    pos = new Vector3(122.245f, 55f, 135.99f);
                    quat = new Quaternion(0.3107f, 0.001f, 0.9505f, 0.0029f);
                    break;
                default:
                    return;
            }

            Matrix4 mat = new Matrix4();
            mat.MakeTransform(pos, Vector3.UNIT_SCALE, quat);

            kart.Body.WorldTransform = mat;
            kart.Body.Activate();
        }
Esempio n. 11
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
            {

            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenMain);
                        break;

                    case Keys.Enter:
                        CGraphics.FadeTo(EScreens.ScreenMain);
                        break;

                    case Keys.F:
                        FadeAndPause();
                        break;

                    case Keys.S:
                        PlayFile();
                        break;

                    case Keys.P:
                        PauseFile();
                        break;
                }
            }

            return true;
        }
Esempio n. 12
0
        protected override bool OnKeyDown( KeyEvent e )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnKeyDown( e );

            //change camera type
            if( e.Key == EKeys.F7 )
            {
                FreeCameraEnabled = !FreeCameraEnabled;

                GameEngineApp.Instance.AddScreenMessage(
                    string.Format( "Camera type: {0}", FreeCameraEnabled ? "Free" : "Default" ) );

                return true;
            }

            //select another demo map
            if( e.Key == EKeys.F3 )
            {
                GameWorld.Instance.NeedChangeMap( "Maps\\MainDemo\\Map.map", "Teleporter_Maps", null );
                return true;
            }

            return base.OnKeyDown( e );
        }
        public override void KeyDown(KeyEvent ev)
        {
            if (DelegateTool != null)
                DelegateTool.KeyDown (ev);

            if (ev.Key == Gdk.Key.Delete)
                DeleteFigures (ev.View);
        }
Esempio n. 14
0
 public void ContainerKeyDownEvent(KeyEvent evt)
 {
     foreach (Control control in Controls)
     {
         //if (control.Bound.Contains(evt.Position.X, evt.Position.Y))
         control.KeyDown(evt);
     }
 }
        void Press(KeyEvent eventArgs)
        {
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            if (eventArgs.key == KeyCode.KC_H)
                LKernel.GetG<PlayerManager>().MainPlayer.Kart.ForEachWheel(w => w.Friction = 0.8f);
        }
Esempio n. 16
0
			public override bool onEditorAction(TextView textView, int actionId, KeyEvent keyEvent)
			{
				if (actionId == EditorInfo.IME_NULL && keyEvent.Action == KeyEvent.ACTION_DOWN)
				{
					outerInstance.sendMessage();
				}
				return true;
			}
Esempio n. 17
0
        public BrowserTabView()
        {
            InitializeComponent();

            browser.RequestHandler = new RequestHandler();
            if (CefSharpSettings.WcfEnabled)
            {
                browser.RegisterJsObject("bound", new BoundObject());
            }
            browser.RegisterAsyncJsObject("boundAsync", new AsyncBoundObject());

            browser.LifeSpanHandler = new LifespanHandler();
            browser.MenuHandler = new MenuHandler();
            browser.GeolocationHandler = new GeolocationHandler();
            browser.DownloadHandler = new DownloadHandler();
            browser.PreviewTextInput += (sender, args) =>
            {
                var host = browser.GetBrowser().GetHost();
                var keyEvent = new KeyEvent();

                foreach (var character in args.Text)
                {
                    keyEvent.WindowsKeyCode = character;
                    keyEvent.Type = KeyEventType.Char;
                    host.SendKeyEvent(keyEvent);
                }

                args.Handled = true;
            };

            browser.LoadError += (sender, args) =>
            {
                // Don't display an error for downloaded files.
                if (args.ErrorCode == CefErrorCode.Aborted)
                {
                    return;
                }

                // Don't display an error for external protocols that we allow the OS to
                // handle. See OnProtocolExecution().
                //if (args.ErrorCode == CefErrorCode.UnknownUrlScheme)
                //{
                //	var url = args.Frame.Url;
                //	if (url.StartsWith("spotify:"))
                //	{
                //		return;
                //	}
                //}

                // Display a load error message.
                var errorBody = string.Format("<html><body bgcolor=\"white\"><h2>Failed to load URL {0} with error {1} ({2}).</h2></body></html>",
                                              args.FailedUrl, args.ErrorText, args.ErrorCode);

                args.Frame.LoadStringForUrl(errorBody, args.FailedUrl);
            };

            CefExample.RegisterTestResources(browser);
        }
Esempio n. 18
0
 public KeyBinding(string alias, Keys k, bool ctrl, bool shift, bool alt, KeyEvent kevent)
 {
     Alias = alias;
     Key = k;
     Ctrl = ctrl;
     Shift = shift;
     Alt = alt;
     KeyEvent = kevent;
 }
Esempio n. 19
0
        /// <summary>
        /// Eventually we'll probably want something so if there's a panel open, pressing escape closes the topmost one,
        /// and when you've closed all of them, this should pause, and not quit. But oh well this is temporary really.
        /// </summary>
        void OnEscPress(KeyEvent eventArgs)
        {
            var lcm = LKernel.GetG<LuaConsoleManager>();

            if (lcm.IsVisible)
                lcm.Hide();
            else
                Launch.Quit = true;
        }
        void Release(KeyEvent eventArgs)
        {
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            if (eventArgs.key == KeyCode.KC_H) {
                LKernel.GetG<PlayerManager>().MainPlayer.Kart.ForEachWheel(w => w.Friction = w.DefaultFrictionSlip);
            }
        }
Esempio n. 21
0
 void addressEditBox_PreKeyDown( KeyEvent e, ref bool handled )
 {
     if( e.Key == EKeys.Return )
     {
         webBrowserControl.LoadURL( addressEditBox.Text );
         webBrowserControl.Focus();
         handled = true;
     }
 }
		protected override bool OnKeyDown( KeyEvent e )
		{
			if( e.Key == EKeys.Escape || e.Key == EKeys.Space )
			{
				MapEditorInterface.Instance.FunctionalityArea = null;
				return true;
			}
			return base.OnKeyDown( e );
		}
Esempio n. 23
0
        void OnKeyboardPress(KeyEvent eventArgs)
        {
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            Kart kart = LKernel.GetG<PlayerManager>().MainPlayer.Kart;

            Vector3 pos;
            Quaternion quat;

            switch (eventArgs.key) {
                case KeyCode.KC_NUMPAD0:
                    pos = new Vector3(-50.8083f, -6.74291f, 324.711f) / 5f;
                    quat = new Quaternion(0.7039f, 0, 0.7102f, 0);
                    break;
                case KeyCode.KC_NUMPAD1:
                    pos = new Vector3(-282.546f, 20.7933f, 327.82f) / 5f;
                    quat = new Quaternion(0.7789f, 0, 0.627f, 0);
                    break;
                case KeyCode.KC_NUMPAD2:
                    pos = new Vector3(-354.992f, -3.4451f, -204.558f) / 5f;
                    quat = new Quaternion(1, 0, 0, 0);
                    break;
                case KeyCode.KC_NUMPAD3:
                    pos = new Vector3(-305.8f, 45.4037f, -693.169f) / 5f;
                    quat = new Quaternion(0.7143f, 0, -0.6998f, 0);
                    break;
                case KeyCode.KC_NUMPAD4:
                    pos = new Vector3(79.2f, 45.2845f, -696.161f) / 5f;
                    quat = new Quaternion(0.70514f, 0, -0.709f, 0);
                    break;
                case KeyCode.KC_NUMPAD5:
                    pos = new Vector3(283.799f, 14.8f, -350.52f) / 5f;
                    quat = new Quaternion(0, 0, 1, 0);
                    break;
                case KeyCode.KC_NUMPAD6:
                    pos = new Vector3(218.534f, 2.806f, -13.362f) / 5f;
                    quat = new Quaternion(0.8834f, 0, 0.4686f, 0);
                    break;
                case KeyCode.KC_NUMPAD7:
                    pos = new Vector3(85.0738f, -2.5893f, 114.471f) / 5f;
                    quat = new Quaternion(-0.0593f, 0, 0.9982f, 0);
                    break;
                default:
                    return;
            }

            // I copied all of the rotations wrong so we need to rotate them by 180 degrees around the Y axis
            quat = quat * new Quaternion(0, 0, 1, 0);

            Matrix4 mat = new Matrix4();
            mat.MakeTransform(pos, Vector3.UNIT_SCALE, quat);

            kart.Body.WorldTransform = mat;
            kart.Body.Activate();
        }
Esempio n. 24
0
 protected override bool OnKeyDown(KeyEvent e)
 {
     if (base.OnKeyDown(e))
         return true;
     if (e.Key == EKeys.Escape)
     {
         SetShouldDetach();
         return true;
     }
     return false;
 }
        protected override bool OnKeyUp(KeyEvent e)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnKeyUp(e);

            //GameControlsManager
            GameControlsManager.Instance.DoKeyUp(e);

            return base.OnKeyUp(e);
        }
Esempio n. 26
0
 protected override bool OnKeyDown( KeyEvent e )
 {
     if( base.OnKeyDown( e ) )
         return true;
     if( e.Key == EKeys.Escape || e.Key == EKeys.Return || e.Key == EKeys.Space )
     {
         Destroy( true );
         return true;
     }
     return false;
 }
        private void UT_SubscribeToEvents(Context context, IList<KeyEvent> expectedEvents, KeyEventSubscriptionType? eventSubscriptionType = null, string key = null, KeyEvent? eventType = null)
        {
            ConcurrentQueue<KeyValuePair<string, KeyEvent>> result = new ConcurrentQueue<KeyValuePair<string, KeyEvent>>();
            CountdownEvent handle = new CountdownEvent(expectedEvents.Count);
            Action<string, KeyEvent> action = (k, e) =>
            {
                result.Enqueue(new KeyValuePair<string, KeyEvent>(k, e));
                handle.Signal();
            };

            Action unsubscribeAction = () => { };

            if (key == null && !eventType.HasValue && eventSubscriptionType.HasValue)
            {
                context.KeyEvents.Subscribe(eventSubscriptionType.Value, action);
                unsubscribeAction = () => context.KeyEvents.Unsubscribe(eventSubscriptionType.Value);
            }
            else if (key != null)
            {
                context.KeyEvents.Subscribe(key, action);
                unsubscribeAction = () => context.KeyEvents.Unsubscribe(key);
            }
            else if (eventType.HasValue)
            {
                context.KeyEvents.Subscribe(eventType.Value, action);
                unsubscribeAction = () => context.KeyEvents.Unsubscribe(eventType.Value);
            }

            var objectKey = key ?? Guid.NewGuid().ToString();

            context.Cache.SetObject(objectKey, new { Name = "alex", Created = DateTime.UtcNow });
            context.Cache.Remove(objectKey);

            Assert.IsTrue(handle.Wait(5000));
            Assert.AreEqual(expectedEvents.Count, result.Count);

            foreach (var expectedEvent in expectedEvents)
            {
                KeyValuePair<string, KeyEvent> e;
                Assert.IsTrue(result.TryDequeue(out e));
                Assert.AreEqual(expectedEvent, e.Value);
                Assert.AreEqual(objectKey, e.Key);
            }

            //Now test Unsubscribe. No more events should be received in queue and handle will timeout.
            handle.Reset(1);
            unsubscribeAction();
            context.Cache.SetObject(objectKey, new { Name = "alex", Created = DateTime.UtcNow }, TimeSpan.FromMilliseconds(500));
            Assert.IsFalse(handle.Wait(1000));
            Assert.IsTrue(result.IsEmpty);

            context.KeyEvents.Unsubscribe(KeyEventSubscriptionType.All);
        }
Esempio n. 28
0
 public void OnKeyEvent(List<Keys> key, KeyEvent keyEvent, GameTime time)
 {
     // change color?
     if (Knot.SelectedEdges.Count () > 0 && Keys.C.IsDown ()) {
         ColorPicker picker = new ColorPicker (screen, new WidgetInfo (), DisplayLayer.Dialog);
         picker.OnSelectColor = (c) => screen.RemoveGameComponents (time, picker);
         foreach (Edge edge in Knot.SelectedEdges) {
             picker.OnSelectColor += (c) => edge.Color = c;
         }
         screen.AddGameComponents (time, picker);
     }
 }
        protected virtual bool OnKeyPressed(KeyEvent evt)
        {
            if (!Game.KeyboardCaptured) {
                switch (evt.key) {
                    case KeyCode.KC_W:
                    case KeyCode.KC_UP:
                        mCameraMan.GoingUp = true;
                        mCameraMan.GoingForward = true;
                        break;

                    case KeyCode.KC_S:
                    case KeyCode.KC_DOWN:
                        mCameraMan.GoingDown = true;
                        mCameraMan.GoingBack = true;
                        break;

                    case KeyCode.KC_A:
                    case KeyCode.KC_LEFT:
                        mCameraMan.GoingLeft = true;
                        break;

                    case KeyCode.KC_D:
                    case KeyCode.KC_RIGHT:
                        mCameraMan.GoingRight = true;
                        break;

                    case KeyCode.KC_E:
                    case KeyCode.KC_PGUP:
                        mCameraMan.GoingBack = true;
                        break;

                    case KeyCode.KC_Q:
                    case KeyCode.KC_PGDOWN:
                        mCameraMan.GoingForward = true;
                        break;

                    case KeyCode.KC_LSHIFT:
                    case KeyCode.KC_RSHIFT:
                        mCameraMan.FastMove = true;
                        break;

                    case KeyCode.KC_T:
                        CycleTextureFilteringMode();
                        break;

                    case KeyCode.KC_SYSRQ:
                        TakeScreenshot();
                        break;
                }
            }
            return true;
        }
Esempio n. 30
0
        protected override bool OnKeyDown( KeyEvent e )
        {
            if( base.OnKeyDown( e ) )
                return true;

            if( e.Key == EKeys.Escape )
            {
                Close();
                return true;
            }

            return false;
        }
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.ImeNull && e.Action == KeyEventActions.Up)
     {
         host.SendMessage(v.Text);
     }
     return(true);
 }
        private List <KeyEvent> GetKeyEvents(string idAopNetwork)
        {
            var endpoint    = new Uri("http://aopwiki-rdf.prod.openrisknet.org/sparql/");
            var queryString = new SparqlParameterizedString();

            queryString.Namespaces.AddNamespace("dc", new Uri("http://purl.org/dc/elements/1.1/"));
            queryString.Namespaces.AddNamespace("aopo", new Uri("http://aopkb.org/aop_ontology#"));
            queryString.Namespaces.AddNamespace("rdfs", new Uri("http://www.w3.org/2000/01/rdf-schema#"));
            queryString.SetUri("value", new Uri("http://aopwiki-rdf.prod.openrisknet.org/sparql/"));
            queryString.SetUri("id", new Uri($@"http://identifiers.org/aop/{idAopNetwork}"));
            queryString.CommandText = (@"
                SELECT ?AopName ?KEid ?KEname ?AopAo ?AopMie ?CellTypeContext ?OrganContext
                WHERE {
                    ?KE a aopo:KeyEvent ; 
                     rdfs:label ?KEid ; 
                     dc:title ?KEname .
                    ?AopId a aopo:AdverseOutcomePathway ;
                     aopo:has_key_event ?KE ;
                     rdfs:label ?AopName .
                    OPTIONAL {
                        ?AopAo aopo:has_adverse_outcome ?KE ;
                         aopo:AdverseOutcomePathway ?AopId .
                    }
                    OPTIONAL {
                        ?AopMie aopo:has_molecular_initiating_event ?KE ;
                        aopo:AdverseOutcomePathway ?AopId .
                    }
                    OPTIONAL { ?KE aopo:CellTypeContext ?CellTypeContext . }
                    OPTIONAL { ?KE aopo:OrganContext ?OrganContext . }
                    FILTER (?AopId = @id)
                }");
            var parser    = new SparqlQueryParser();
            var processor = new RemoteQueryProcessor(new SparqlRemoteEndpoint(endpoint));
            var query     = parser.ParseFromString(queryString);
            var resultSet = processor.ProcessQuery(query);

            if (resultSet is SparqlResultSet)
            {
                var result = new List <KeyEvent>();
                foreach (var resultRow in (resultSet as SparqlResultSet))
                {
                    var id    = (resultRow["KEid"] as ILiteralNode)?.Value;
                    var isMie = (resultRow["AopMie"] as IUriNode) != null;
                    var isAo  = (resultRow["AopAo"] as IUriNode) != null;
                    var hasCellTypeContext = (resultRow["CellTypeContext"] as IUriNode) != null;
                    var hasOrganContext    = (resultRow["OrganContext"] as IUriNode) != null;
                    var record             = new KeyEvent()
                    {
                        Id                     = id.Replace("KE ", ""),
                        Name                   = id,
                        Description            = ((ILiteralNode)resultRow["KEname"]).Value,
                        BiologicalOrganisation = GetBiologicalOrganisation(isMie, isAo, hasCellTypeContext, hasOrganContext)
                    };
                    result.Add(record);
                }
                return(result);
            }
            else
            {
                return(null);
            }
        }
        // Implementing IOnKeyboardActionListener interface


        public void OnKey(Keycode primaryCode, Keycode[] keyCodes)
        {
            if (!this.EditText.IsFocused)
            {
                return;
            }

            // Ensure key is pressed to avoid removing focus
            this.keyPressed = true;

            // Create event for key press
            long eventTime = JavaSystem.CurrentTimeMillis();

            var ev = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, primaryCode, 0, 0, 0, 0,
                                  KeyEventFlags.SoftKeyboard | KeyEventFlags.KeepTouchMode);

            // Ensure native keyboard is hidden
            var imm = (InputMethodManager)this.context.GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(this.EditText.WindowToken, HideSoftInputFlags.None);

            this.EditText.InputType = this.inputTypeToUse;

            if (!keys.Contains(ev.KeyCode))
            {
                return;
            }

            switch (ev.KeyCode)
            {
            case Keycode.Enter:
                // Sometimes EditText takes long to update the HasFocus status
                if (this.EditText.HasFocus)
                {
                    // Close the keyboard, remove focus and launch command asociated action
                    this.HideKeyboardView();

                    this.ClearFocus();

                    this.entryWithCustomKeyboard.EnterCommand?.Execute(null);
                }

                break;

            case Keycode.Comma:
                if (this.EditText.HasFocus)
                {
                    string editTextText = EditText.Text;
                    int    count        = editTextText.Count(f => f == ',');
                    if (count >= 1)
                    {
                        return;
                    }

                    if (string.IsNullOrEmpty(editTextText))
                    {
                        return;
                    }

                    if (this.entryWithCustomKeyboard.DecimalPoint == 0)
                    {
                        return;
                    }
                }
                break;

            case Keycode.Del:
                break;

            default:
                if (this.EditText.HasFocus)
                {
                    string editTextText = EditText.Text;
                    if (editTextText.Length == this.entryWithCustomKeyboard.IntegerPoint && !editTextText.Contains(","))
                    {
                        return;
                    }
                    else
                    {
                        if (editTextText.Contains(","))
                        {
                            var numbers     = editTextText.Split(',', '.');
                            int commaIndex  = editTextText.IndexOf(",", StringComparison.Ordinal);
                            int cursorIndex = EditText.SelectionStart;
                            if (commaIndex < cursorIndex)
                            {
                                if (numbers[1].Length == this.entryWithCustomKeyboard.DecimalPoint)
                                {
                                    return;
                                }
                            }
                            else
                            {
                                if (numbers[0].Length == this.entryWithCustomKeyboard.IntegerPoint)
                                {
                                    return;
                                }
                            }
                        }
                    }
                }
                break;
            }

            // Set the cursor at the end of the text
            // this.EditText.SetSelection(this.EditText.Text.Length);

            if (this.EditText.HasFocus)
            {
                this.DispatchKeyEvent(ev);

                this.keyPressed = false;
            }
        }
Esempio n. 34
0
 public KeyCodeEventPair(KeyCode keyCode, KeyEvent keyEvent)
 {
     KeyCode  = keyCode;
     KeyEvent = keyEvent;
 }
Esempio n. 35
0
        bool TextView.IOnEditorActionListener.OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            // Fire Completed and dismiss keyboard for hardware / physical keyboards
            if (actionId == ImeAction.Done || (actionId == ImeAction.ImeNull && e.KeyCode == Keycode.Enter && e.Action == KeyEventActions.Up))
            {
                _textBlock.ClearFocus();
                v.HideKeyboard();
                SearchConfirmed?.Invoke(this, EventArgs.Empty);
                Controller.QueryConfirmed();
            }

            return(true);
        }
Esempio n. 36
0
 private bool KeyPressed(KeyEvent arg)
 {
     PressSomeKey(arg.key);
     return(true);
 }
Esempio n. 37
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
        {
            switch (e.Type)
            {
            case EventType.Command:
                var de = (DataEvent)e;
                switch (de.Action)
                {
                case "ResultsPanel.ClearResults":
                    de.Handled = true;
                    ResultsPanelHelper.ClearResults((string)de.Data);
                    break;

                case "ResultsPanel.ShowResults":
                    e.Handled = true;
                    ResultsPanelHelper.ShowResults((string)de.Data);
                    break;
                }
                break;

            case EventType.ApplySettings:
            case EventType.ApplyTheme:
                ResultsPanelHelper.ApplySettings();
                break;

            case EventType.ProcessStart:
                this.pluginUI.ClearOutput();
                break;

            case EventType.ProcessEnd:
                this.pluginUI.DisplayOutput();
                break;

            case EventType.Trace:
                ResultsPanelHelper.OnTrace();
                break;

            case EventType.FileOpen:
                ResultsPanelHelper.OnFileOpen((TextEvent)e);
                break;

            case EventType.Keys:
                KeyEvent ke = (KeyEvent)e;
                switch (PluginBase.MainForm.GetShortcutItemId(ke.Value))
                {
                case null:
                    break;

                case "ResultsPanel.ShowNextResult":
                    ke.Handled = ResultsPanelHelper.ActiveUI.NextEntry();
                    break;

                case "ResultsPanel.ShowPrevResult":
                    ke.Handled = ResultsPanelHelper.ActiveUI.PreviousEntry();
                    break;

                case "ResultsPanel.ClearResults":
                    ke.Handled = ResultsPanelHelper.ActiveUI.ClearOutput();
                    break;

                case "ResultsPanel.ClearIgnoredEntries":
                    ke.Handled = ResultsPanelHelper.ActiveUI.ClearIgnoredEntries();
                    break;

                default:
                    if (ke.Value == PanelContextMenu.CopyEntryKeys)
                    {
                        ke.Handled = ResultsPanelHelper.ActiveUI.CopyTextShortcut();
                    }
                    else if (ke.Value == PanelContextMenu.IgnoreEntryKeys)
                    {
                        ke.Handled = ResultsPanelHelper.ActiveUI.IgnoreEntryShortcut();
                    }
                    break;
                }

                break;
            }
        }
Esempio n. 38
0
 public bool KeyTyped(KeyEvent keyEvent)
 {
     return(true);
 }
Esempio n. 39
0
 public bool OnKey(View v, Keycode keyCode, KeyEvent e)
 {
     throw new NotImplementedException();
 }
Esempio n. 40
0
 protected virtual void OnKeyEvent(KeyEvent keyEvent)
 {
 }
Esempio n. 41
0
 public bool KeyReleased(KeyEvent keyEvent)
 {
     return(true);
 }
 /// <summary>
 /// Responds to key typed events; does nothing. </summary>
 /// <param name="e"> the KeyEvent that happened. </param>
 public virtual void keyTyped(KeyEvent e)
 {
 }
 /// <summary>
 /// Responds to key released events; calls 'processTableSelection' with the
 /// newly-selected index in the table. </summary>
 /// <param name="e"> the KeyEvent that happened. </param>
 public virtual void keyReleased(KeyEvent e)
 {
     processTableSelection(__worksheet.getSelectedRow());
 }
 /// <summary>
 /// Responds to key pressed events; does nothing. </summary>
 /// <param name="e"> the KeyEvent that happened. </param>
 public virtual void keyPressed(KeyEvent e)
 {
 }
Esempio n. 45
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            MessagingCenter.Send(keyCode.ToString(), BaseViewModel.MSG_KeyDown);

            return(base.OnKeyDown(keyCode, e));
        }
Esempio n. 46
0
        private void UpdateImGuiInput(InputSnapshot snapshot)
        {
            ImGuiIOPtr io = ImGui.GetIO();

            Vector2 mousePosition = snapshot.MousePosition;

            // Determine if any of the mouse buttons were pressed during this snapshot period, even if they are no longer held.
            bool leftPressed   = false;
            bool middlePressed = false;
            bool rightPressed  = false;

            foreach (MouseEvent me in snapshot.MouseEvents)
            {
                if (me.Down)
                {
                    switch (me.MouseButton)
                    {
                    case MouseButton.Left:
                        leftPressed = true;
                        break;

                    case MouseButton.Middle:
                        middlePressed = true;
                        break;

                    case MouseButton.Right:
                        rightPressed = true;
                        break;
                    }
                }
            }

            io.MouseDown[0] = leftPressed || snapshot.IsMouseDown(MouseButton.Left);
            io.MouseDown[1] = rightPressed || snapshot.IsMouseDown(MouseButton.Right);
            io.MouseDown[2] = middlePressed || snapshot.IsMouseDown(MouseButton.Middle);
            io.MousePos     = mousePosition;
            io.MouseWheel   = snapshot.WheelDelta;

            IReadOnlyList <char> keyCharPresses = snapshot.KeyCharPresses;

            for (int i = 0; i < keyCharPresses.Count; i++)
            {
                char c = keyCharPresses[i];
                io.AddInputCharacter(c);
            }

            IReadOnlyList <KeyEvent> keyEvents = snapshot.KeyEvents;

            for (int i = 0; i < keyEvents.Count; i++)
            {
                KeyEvent keyEvent = keyEvents[i];
                io.KeysDown[(int)keyEvent.Key] = keyEvent.Down;
                if (keyEvent.Key == Key.ControlLeft)
                {
                    _controlDown = keyEvent.Down;
                }
                if (keyEvent.Key == Key.ShiftLeft)
                {
                    _shiftDown = keyEvent.Down;
                }
                if (keyEvent.Key == Key.AltLeft)
                {
                    _altDown = keyEvent.Down;
                }
                if (keyEvent.Key == Key.WinLeft)
                {
                    _winKeyDown = keyEvent.Down;
                }
            }

            io.KeyCtrl  = _controlDown;
            io.KeyAlt   = _altDown;
            io.KeyShift = _shiftDown;
            io.KeySuper = _winKeyDown;
        }
Esempio n. 47
0
        public bool KeyPressed(KeyEvent keyEvent)
        {
            var movementVector = new Vector2();

            var giveThrough = true;

            if (mNeo)
            {
                foreach (var key in keyEvent.CurrentKeys)
                {
                    switch (key)
                    {
                    case Keys.V:
                        movementVector.Y = -CameraMovementSpeed;
                        giveThrough      = false;
                        break;

                    case Keys.I:
                        movementVector.Y = CameraMovementSpeed;
                        giveThrough      = false;
                        break;

                    case Keys.U:
                        movementVector.X = -CameraMovementSpeed;
                        giveThrough      = false;
                        break;

                    case Keys.A:
                        movementVector.X = CameraMovementSpeed;
                        giveThrough      = false;
                        break;
                    }
                }
            }
            else
            {
                foreach (var key in keyEvent.CurrentKeys)
                {
                    switch (key)
                    {
                    case Keys.W:
                        movementVector.Y = -CameraMovementSpeed;
                        giveThrough      = false;
                        break;

                    case Keys.S:
                        movementVector.Y = CameraMovementSpeed;
                        giveThrough      = false;
                        break;

                    case Keys.A:
                        movementVector.X = -CameraMovementSpeed;
                        giveThrough      = false;
                        break;

                    case Keys.D:
                        movementVector.X = CameraMovementSpeed;
                        giveThrough      = false;
                        break;
                    }
                }
            }

            // make sure to scale the movement vector with the zoom level, since we don't want super slow movement when zoomed out
            // and super fast movement when zoomed in
            Position = Position + movementVector * (1 / Zoom);

            return(giveThrough);
        }
Esempio n. 48
0
        bool TextView.IOnEditorActionListener.OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            // Fire Completed and dismiss keyboard for hardware / physical keyboards
            if (actionId == ImeAction.Done || actionId == _currentInputImeFlag || (actionId == ImeAction.ImeNull && e.KeyCode == Keycode.Enter && e.Action == KeyEventActions.Up))
            {
                global::Android.Views.View nextFocus = null;
                if (_currentInputImeFlag == ImeAction.Next)
                {
                    nextFocus = FocusSearch(v, FocusSearchDirection.Forward);
                }

                if (nextFocus != null)
                {
                    nextFocus.RequestFocus();
                    if (!nextFocus.OnCheckIsTextEditor())
                    {
                        v.HideKeyboard();
                    }
                }
                else
                {
                    EditText.ClearFocus();
                    v.HideKeyboard();
                }

                ((IEntryController)Element).SendCompleted();
            }

            return(true);
        }
Esempio n. 49
0
 public KeyBinding(string alias, Keys k, bool ctrl, bool shift, bool alt, KeyEvent kevent, KeyBindingDelegate kdel)
     : this(alias, k, ctrl, shift, alt, kevent)
 {
     Callback = kdel;
 }
Esempio n. 50
0
        private unsafe void UpdateImGuiInput(OpenTKWindow window, InputSnapshot snapshot)
        {
            IO         io          = ImGui.GetIO();
            MouseState cursorState = Mouse.GetCursorState();
            MouseState mouseState  = Mouse.GetState();

            if (window.NativeWindow.Bounds.Contains(cursorState.X, cursorState.Y) && !RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                // TODO: This does not take into account viewport coordinates.
                if (window.Exists)
                {
                    Point windowPoint = window.NativeWindow.PointToClient(new Point(cursorState.X, cursorState.Y));
                    io.MousePosition = new System.Numerics.Vector2(
                        windowPoint.X / window.ScaleFactor.X,
                        windowPoint.Y / window.ScaleFactor.Y);
                }
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                io.MousePosition = new System.Numerics.Vector2(
                    cursorState.X,
                    cursorState.Y);
            }
            else
            {
                io.MousePosition = new System.Numerics.Vector2(-1f, -1f);
            }

            io.MouseDown[0] = mouseState.LeftButton == ButtonState.Pressed;
            io.MouseDown[1] = mouseState.RightButton == ButtonState.Pressed;
            io.MouseDown[2] = mouseState.MiddleButton == ButtonState.Pressed;

            float delta = snapshot.WheelDelta;

            io.MouseWheel = delta;

            ImGui.GetIO().MouseWheel = delta;

            IReadOnlyList <char> keyCharPresses = snapshot.KeyCharPresses;

            for (int i = 0; i < keyCharPresses.Count; i++)
            {
                char c = keyCharPresses[i];
                ImGui.AddInputCharacter(c);
            }

            IReadOnlyList <KeyEvent> keyEvents = snapshot.KeyEvents;

            for (int i = 0; i < keyEvents.Count; i++)
            {
                KeyEvent keyEvent = keyEvents[i];
                io.KeysDown[(int)keyEvent.Key] = keyEvent.Down;
                if (keyEvent.Key == Key.ControlLeft)
                {
                    _controlDown = keyEvent.Down;
                }
                if (keyEvent.Key == Key.ShiftLeft)
                {
                    _shiftDown = keyEvent.Down;
                }
                if (keyEvent.Key == Key.AltLeft)
                {
                    _altDown = keyEvent.Down;
                }
            }

            io.CtrlPressed  = _controlDown;
            io.AltPressed   = _altDown;
            io.ShiftPressed = _shiftDown;
        }
Esempio n. 51
0
 public ActionMapEventArgs(KeyEvent keyEvent, string actionName, float value)
 {
     KeyEvent   = keyEvent;
     ActionName = actionName;
     Value      = value;
 }
Esempio n. 52
0
        public bool OnEditorAction(TextView textView, [GeneratedEnum] ImeAction actionId, KeyEvent keyEvent)
        {
            bool handled = false;

            if (actionId == ImeAction.Go)
            {
                submit(null);
                handled = true;
            }
            return(handled);
        }
Esempio n. 53
0
 private bool KeyReleased(KeyEvent arg)
 {
     return(true);
 }
Esempio n. 54
0
 void SendKeyEvent(KeyEvent e)
 {
     XobotActivityManager.Invoke((window) => window.SendKeyEvent(e));
 }
Esempio n. 55
0
        bool TextView.IOnEditorActionListener.OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            if (actionId == ImeAction.Done)
            {
                OnKeyboardDoneButtonPressed(EditText, EventArgs.Empty);
                EditText.ClearFocus();
                v.HideKeyboard();
            }

            // Fire Completed and dismiss keyboard for hardware / physical keyboards
            if (actionId == ImeAction.ImeNull && e.KeyCode == Keycode.Enter)
            {
                OnKeyboardDoneButtonPressed(EditText, EventArgs.Empty);
                EditText.ClearFocus();
                v.HideKeyboard();
            }

            return(true);
        }
Esempio n. 56
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            switch (e.Type)
            {
            case EventType.Command:
                DataEvent evnt = (DataEvent)e;
                if (evnt.Action == "ResultsPanel.ClearResults")
                {
                    e.Handled = true;
                    this.pluginUI.ClearOutput();
                }
                else if (evnt.Action == "ResultsPanel.ShowResults")
                {
                    e.Handled = true;
                    this.pluginUI.AddLogEntries();
                    this.pluginUI.DisplayOutput();
                }
                break;

            case EventType.ApplySettings:
                this.pluginUI.ApplySettings();
                break;

            case EventType.ProcessStart:
                this.pluginUI.ClearOutput();
                break;

            case EventType.ProcessEnd:
                this.pluginUI.DisplayOutput();
                break;

            case EventType.Trace:
                this.pluginUI.AddLogEntries();
                break;

            case EventType.FileOpen:
                TextEvent fileOpen = (TextEvent)e;
                this.pluginUI.AddSquiggles(fileOpen.Value);
                break;

            case EventType.Keys:
                KeyEvent ke = (KeyEvent)e;
                if (ke.Value == this.NextError)
                {
                    ke.Handled = true;
                    this.pluginUI.NextEntry(null, null);
                }
                else if (ke.Value == this.PrevError)
                {
                    ke.Handled = true;
                    this.pluginUI.PreviousEntry(null, null);
                }
                break;

            case EventType.Shortcut:
                DataEvent de = (DataEvent)e;
                if (de.Action == "ResultsPanel.ShowNextResult")
                {
                    this.NextError = (Keys)de.Data;
                }
                else if (de.Action == "ResultsPanel.ShowPrevResult")
                {
                    this.PrevError = (Keys)de.Data;
                }
                break;
            }
        }
Esempio n. 57
0
 public override bool DispatchKeyEvent(KeyEvent e)
 {
     return(_view.DispatchKeyEvent(e));
 }
Esempio n. 58
0
 public static bool DispatchKeyEvent(KeyEvent keyEvent)
 {
     return(SDLActivity.DispatchKeyEvent(keyEvent));
 }
 protected void OnKeyDown(KeyEvent keyEvent)
 {
     KeyPressed?.Invoke(keyEvent);
 }
 /// <summary>
 /// Call this from a drag source view like this:
 ///
 /// <pre>
 ///  @Override
 ///  public boolean dispatchKeyEvent(KeyEvent event) {
 ///      return mDragController.dispatchKeyEvent(this, event)
 ///              || super.dispatchKeyEvent(event);
 /// </pre>
 /// </summary>
 public bool DispatchKeyEvent(KeyEvent ev)
 {
     return(mDragging);
 }