Beispiel #1
0
        private void QwertyPage_PropertyClicked(PropertyPage props, ClickType click, int propIdx, int rowIdx, int colIdx)
        {
            if (propIdx == 1 && colIdx >= 2)
            {
                if (click == ClickType.Double)
                {
                    var dlg = new PropertyDialog("", 300, false, true, dialog);
                    dlg.Properties.AddLabel(null, "Press the new key or ESC to cancel.");
                    dlg.Properties.Build();

                    // TODO : Make this cross-platform.
#if FAMISTUDIO_WINDOWS
                    dlg.KeyDown += (sender, e) =>
                    {
                        if (PlatformUtils.KeyCodeToString((int)e.KeyCode) != null)
                        {
                            if (e.KeyCode != Keys.Escape)
                            {
                                AssignQwertyKey(rowIdx, colIdx - 2, (int)e.KeyCode);
                            }
                            dlg.Close();
                        }
                    };
#elif FAMISTUDIO_LINUX || FAMISTUDIO_MACOS
                    dlg.KeyPressEvent += (o, args) =>
                    {
                        // These 2 keys are used by the QWERTY input.
                        if (args.Event.Key != Gdk.Key.Tab &&
                            args.Event.Key != Gdk.Key.BackSpace &&
                            PlatformUtils.KeyCodeToString((int)args.Event.Key) != null)
                        {
                            if (args.Event.Key != Gdk.Key.Escape)
                            {
                                AssignQwertyKey(rowIdx, colIdx - 2, (int)args.Event.Key);
                            }
                            dlg.Accept();
                        }
                    };
#endif
                    dlg.ShowDialogAsync(null, (r) => { });

                    pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings());
                }
                else if (click == ClickType.Right)
                {
                    qwertyKeys[rowIdx, colIdx - 2] = -1;
                    pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings());
                }
            }
            else if (propIdx == 2 && click == ClickType.Button)
            {
                Array.Copy(Settings.DefaultQwertyKeys, qwertyKeys, Settings.DefaultQwertyKeys.Length);
                pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings());
            }
        }
Beispiel #2
0
        void QwertyListDoubleClicked(PropertyPage props, int propertyIndex, int itemIndex, int columnIndex)
        {
            if (columnIndex < 2)
            {
                return;
            }

            var dlg = new PropertyDialog(300, false, true, dialog);

            dlg.Properties.AddLabel(null, "Press the new key or ESC to cancel.");
            dlg.Properties.Build();

            // TODO : Make this cross-platform.
#if FAMISTUDIO_WINDOWS
            dlg.KeyDown += (sender, e) =>
            {
                if (PlatformUtils.KeyCodeToString((int)e.KeyCode) != null)
                {
                    if (e.KeyCode != Keys.Escape)
                    {
                        AssignQwertyKey(itemIndex, columnIndex - 2, (int)e.KeyCode);
                    }
                    dlg.Close();
                }
            };
#else
            dlg.KeyPressEvent += (o, args) =>
            {
                // These 2 keys are used by the QWERTY input.
                if (args.Event.Key != Gdk.Key.Tab &&
                    args.Event.Key != Gdk.Key.BackSpace &&
                    PlatformUtils.KeyCodeToString((int)args.Event.Key) != null)
                {
                    if (args.Event.Key != Gdk.Key.Escape)
                    {
                        AssignQwertyKey(itemIndex, columnIndex - 2, (int)args.Event.Key);
                    }
                    dlg.Accept();
                }
            };
#endif
            dlg.ShowDialog(null);

            pages[(int)ConfigSection.QWERTY].UpdateMultiColumnList(1, GetQwertyMappingStrings());
        }