Beispiel #1
0
        public void LoadLayout(ClLayoutContainer input)
        {
            this.layout = input;

            while (layout.keys.Count < layers.Count)
            {
                this.SLMain.Items.RemoveAt(layers.Count - 1);
                layers.RemoveAt(layers.Count - 1);
            }
            int tempi = layers.Count;

            while (layers.Count < layout.keys.Count)
            {
                if (layout.keys[tempi].Count == sliceInfo.keys.Count)
                {
                    AddLayer(layers.Count, false);
                }
                else
                {
                    AddLayer(layers.Count, true);
                }
                tempi++;
            }
            foreach (UCLayer layer in layers)
            {
                layer.LoadLayout(layout);
            }
        }
Beispiel #2
0
 public void LoadLayout(ClLayoutContainer input)
 {
     this.layout = input;
     foreach (Button btn in buttons)
     {
         foreach (ClKeyData kd in layout.keys[index])
         {
             if (btn.Tag.ToString() == "bt_" + kd.slice + "_" + kd.x + "_" + kd.y + "_" + index)
             {
                 btn.Text = kd.key.display;
                 if (kd.key.ktype == 255 && kd.key.val == 0)
                 {
                     float cf = 0.09f;
                     var   nc = new Color(SystemColors.Control);
                     nc.R = (255 - SystemColors.Control.R) * cf + SystemColors.Control.R;
                     nc.G = (255 - SystemColors.Control.G) * cf + SystemColors.Control.G;
                     nc.B = (255 - SystemColors.Control.B) * cf + SystemColors.Control.B;
                     btn.BackgroundColor = nc;
                 }
                 else
                 {
                     btn.BackgroundColor = SystemColors.Control;
                 }
             }
         }
     }
 }
Beispiel #3
0
 public void LoadLayout(ClLayoutContainer input)
 {
     this.layout = input;
     foreach (UCSlice slice in slices)
     {
         slice.LoadLayout(layout);
     }
 }
Beispiel #4
0
 public UCBoard()
 {
     //teste dit
     InitializeComponent();
     slices             = new List <UCSlice>();
     layout             = new ClLayoutContainer();
     BtnSave.Click     += (sender, e) => btSave_Click(sender, e);
     BtnLoad.Click     += (sender, e) => btLoad_Click(sender, e);
     BtnAddLayer.Click += (sender, e) => btAddLayer_Click(sender, e);
 }
Beispiel #5
0
        public List <string> GenerateSerialCommands(ClLayoutContainer input)
        {
            List <string> output = new List <string>();

            output.Add(MdGlobals.SERIAL_SET_LAYER_COMMAND + "(" + layers + " ");
            foreach (ClBoardSlice slice in slices)
            {
                output.AddRange(slice.GenerateSerialCommands(input));
            }
            return(output);
        }
Beispiel #6
0
        public UCLayer(List <ClButton> buttons, int sliceIndex, int index, ClLayoutContainer layout, bool init)
        {
            InitializeComponent();
            this.buttons = new List <Button>();


            this.sliceIndex = sliceIndex;
            this.index      = index;
            this.layout     = layout;
            this.LName.Text = "Layer " + index.ToString();

            int maxx = 0, maxy = 0;

            foreach (ClButton input in buttons)
            {
                if (input.gw + input.gx > maxx)
                {
                    maxx = input.gw + input.gx + 5;
                }
                if (input.gh + input.gy > maxy)
                {
                    maxy = input.gh + input.gy + 5;
                }
                var btn = new Button();
                btn.Tag = "bt_" + sliceIndex + "_" + input.x + "_" + input.y + "_" + index;
                if (init)
                {
                    var nkd = new ClKeyData(sliceIndex, input.x, input.y);
                    if (index != 0)
                    {
                        foreach (ClKeyData kd in layout.keys[0])
                        {
                            if (kd.slice == sliceIndex && kd.x == input.x && kd.y == input.y && kd.key.allLayers)
                            {
                                nkd.key = new ClKey(kd.key);
                                break;
                            }
                        }
                    }
                    layout.keys[index].Add(nkd);
                }
                btn.Size = new Size(input.gw, input.gh);
                PLMain.Add(btn, input.gx, input.gy);
                btn.Click   += (sender, e) => this.KeyBtnClicked(sender, e);
                btn.KeyDown += (sender, e) => this.KeyBtnKeyPressed(sender, e);
                this.buttons.Add(btn);
                LoadLayout(this.layout);
            }
            maxy                  = maxy + 33;
            ClientSize            = new Size(maxx, maxy);
            BtnDeleteLayer.Click += (sender, e) => this.btDelete_Click(sender, e);
        }
Beispiel #7
0
        public UCSlice(ClBoardSlice input, ClLayoutContainer layout)
        {
            InitializeComponent();
            this.layout     = layout;
            layers          = new List <UCLayer>();
            LName.Text      = input.sliceName;
            this.sliceInfo  = input;
            this.sliceIndex = input.sliceIndex;

            for (int i = 0; i < layout.keys.Count; i++)
            {
                AddLayer(i, true);
            }
        }
Beispiel #8
0
        public List <string> GenerateSerialCommands(ClLayoutContainer input)
        {
            List <string> output = new List <string>();
            int           _lay   = 0;

            foreach (List <ClKeyData> ckdl in input.keys)
            {
                foreach (ClKeyData ckd in ckdl)
                {
                    if (ckd.slice == sliceIndex)
                    {
                        output.Add(command + "(" + ckd.x + "(" + ckd.y + "(" + _lay + "(" + ckd.key.val + "(" + ckd.key.ktype + " ");
                    }
                }
                _lay++;
            }
            return(output);
        }
Beispiel #9
0
        public UCBoard(ClKeyboard keyboard)
        {
            InitializeComponent();
            slices = new List <UCSlice>();
            layout = new ClLayoutContainer();

            for (int i = 0; i < 3; i++)
            {
                layout.keys.Add(new List <ClKeyData>());
            }
            layout.keyboardType = keyboard.keyboardType;
            saveExtension       = "." + keyboard.fileFormat;
            foreach (ClBoardSlice slice in keyboard.slices)
            {
                var ns = new UCSlice(slice, this.layout);
                this.slices.Add(ns);
                SLMain.Items.Add(ns);
            }
            maxLayer           = keyboard.layers;
            LName.Text         = "Keyboard Type: " + keyboard.keyboardName;
            BtnSave.Click     += (sender, e) => btSave_Click(sender, e);
            BtnLoad.Click     += (sender, e) => btLoad_Click(sender, e);
            BtnAddLayer.Click += (sender, e) => btAddLayer_Click(sender, e);
        }