Esempio n. 1
0
        private void SetLayoutFromButton(Button sender, char input)
        {
            string btn = sender.Name;

            btn = btn.Substring(btn.IndexOf("_") + 1);
            int slice = Convert.ToInt32(btn.Substring(0, btn.IndexOf("_")));

            btn = btn.Substring(btn.IndexOf("_") + 1);
            int x = Convert.ToInt32(btn.Substring(0, btn.IndexOf("_")));

            btn = btn.Substring(btn.IndexOf("_") + 1);
            int y = Convert.ToInt32(btn.Substring(0, btn.IndexOf("_")));

            btn = btn.Substring(btn.IndexOf("_") + 1);
            int z = Convert.ToInt32(btn);


            if (cbAllLayers.Checked)
            {
                foreach (ClKeyData k in layout.keys)
                {
                    if (k.slice == slice && k.x == x && k.y == y)
                    {
                        k.key = ClKey.GetKeyFromChar(input);
                    }
                }
            }
            else
            {
                layout.keys.Find(k => (k.slice == slice && k.x == x && k.y == y && k.z == z)).key = ClKey.GetKeyFromChar(input);
            }
            MdGlobals.board.LoadLayout(layout);
        }
Esempio n. 2
0
 public static void Initiate()
 {
     SERIAL_SET_LAYER_COMMAND = "uniqueksetlayer";
     selectedSpecial          = false;
     selectedKey     = new ClKey();
     kselect         = new FmKeySelector();
     kselect.TopMost = true;
 }
Esempio n. 3
0
 public ClKeyData(int slice, int x, int y, int z)
 {
     key        = new ClKey();
     this.x     = x;
     this.y     = y;
     this.z     = z;
     this.slice = slice;
 }
Esempio n. 4
0
 public ClKeyData()
 {
     key   = new ClKey();
     x     = 0;
     y     = 0;
     z     = 0;
     slice = 0;
 }
Esempio n. 5
0
        public static ClKey GetKeyFromChar(char input)
        {
            ClKey cky = dKeys.Find(k => (k.ktype == 0 && k.val == Convert.ToByte(input)));

            if (cky != null)
            {
                return(cky);
            }
            return(new ClKey());
        }
Esempio n. 6
0
        public FmMain()
        {
            InitializeComponent();

            ClKey.iniList();
            MdGlobals.Initiate();

            /*
             * var nkb = new ClKeyboard();
             * nkb.keyboardName = "Diverge II";
             * nkb.keyboardType = "Diverge II";
             * nkb.fileFormat = "ukd2";
             * nkb.layers = 3;
             *
             * var nbs1 = new ClBoardSlice("uniqueksetkey", "Left Side", 0, nkb.layers);
             * for (int i = 0; i < 8; i++)
             * {
             *  for (int j = 0; j < 5; j++)
             *  {
             *      if (i == 7 && j != 4)
             *      {
             *          // do nothing
             *      }
             *      else
             *      {
             *          var clb = new ClButton(i, j, 72, 72, 5 + (72 * i), 30 + (72 * j));
             *          nbs1.keys.Add(clb);
             *
             *      }
             *
             *  }
             * }
             * nkb.slices.Add(nbs1);
             *
             *
             * var nbs2 = new ClBoardSlice("uniqueksetsubkey", "Right Side", 1, nkb.layers);
             * for (int i = 0; i < 8; i++)
             * {
             *  for (int j = 0; j < 5; j++)
             *  {
             *      if (i == 7 && j != 4)
             *      {
             *          // do nothing
             *      }
             *      else
             *      {
             *
             *          var clb = new ClButton(i, j, 72, 72, 509 - (72 * i), 30 + (72 * j));
             *          nbs2.keys.Add(clb);
             *      }
             *
             *  }
             * }
             * nkb.slices.Add(nbs2);
             *
             * MdCore.Serialize<ClKeyboard>(nkb, @"C:\Users\blahlicus\Documents\ArbitesR\Keyboards\diverge-ii.uktb");
             * //*/



            /*
             * var nkb = new ClKeyboard();
             * nkb.keyboardName = "Diverge TM";
             * nkb.keyboardType = "Diverge TM";
             * nkb.fileFormat = "ukdtm";
             * nkb.layers = 3;
             *
             * var nbs1 = new ClBoardSlice("uniqueksetkey", "Left Side", 0, nkb.layers);
             * for (int i = 0; i < 6; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      if (i == 5 && j == 3)
             *      {
             *          // do nothing
             *      }
             *      else
             *      {
             *          var clb = new ClButton(i, j, 72, 72, 5 + (72 * i), 30 + (72 * j));
             *          nbs1.keys.Add(clb);
             *
             *      }
             *
             *  }
             * }
             * nkb.slices.Add(nbs1);
             *
             *
             * var nbs2 = new ClBoardSlice("uniqueksetsubkey", "Right Side", 1, nkb.layers);
             * for (int i = 0; i < 6; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      if (i == 5 && j == 3)
             *      {
             *          // do nothing
             *      }
             *      else
             *      {
             *
             *          var clb = new ClButton(i, j, 72, 72, 365 - (72 * i), 30 + (72 * j));
             *          nbs2.keys.Add(clb);
             *      }
             *
             *  }
             * }
             * nkb.slices.Add(nbs2);
             *
             * MdCore.Serialize<ClKeyboard>(nkb, @"C:\Users\blahlicus\Documents\ArbitesR\Keyboards\diverge-tm.uktb");
             * //*/



            /*
             * var nkb = new ClKeyboard();
             * nkb.keyboardName = "Terminus Mini";
             * nkb.keyboardType = "Terminus Mini";
             * nkb.fileFormat = "uktm";
             * nkb.layers = 3;
             *
             * var nbs1 = new ClBoardSlice("uniqueksetkey", "", 0, nkb.layers);
             * for (int i = 0; i < 12; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      if ((i == 5 || i == 7) && j == 3)
             *      {
             *          // do nothing
             *      }
             *      else
             *      {
             *          var clb = new ClButton(i, j, 72, 72, 5 + (72 * i), 30 + (72 * j));
             *          nbs1.keys.Add(clb);
             *
             *      }
             *
             *  }
             * }
             * nkb.slices.Add(nbs1);
             *
             *
             * MdCore.Serialize<ClKeyboard>(nkb, @"C:\Users\blahlicus\Documents\ArbitesR\Keyboards\terminus-mini.uktb");
             * //*/



            /*
             * MdGlobals.board = new UCBoard(nkb);
             * MdGlobals.board.Dock = DockStyle.Fill;
             * MdGlobals.board.Location = new Point(30, 30);
             * MdGlobals.board.Parent = spcEditLayout.Panel2;
             * var dp = new FmRichTextDisplay(nkb.GenerateSerialCommands(MdGlobals.board.layout));
             * dp.Show();
             */
        }