Ejemplo n.º 1
0
        private void imgTablet_MouseDown(object sender, MouseEventArgs e)
        {
            if (this.keyLayouts != null)
            {
                foreach (HuionKeyLayout keyLayout in this.keyLayouts)
                {
                    if (keyLayout.mouseEnter(e.X, e.Y))
                    {
                        this.mCheckedKeyLayout = keyLayout;
                        this.imgTablet.Refresh();
                        if (this.mCheckedKeyLayout.KeyType == HuionKeyType.MULTIKEY)
                        {
                            this.comboBoxMekey.Visible = true;
                            this.comboBoxMekey.Text    = this.mCheckedKeyLayout.MutliKeys[this.mTouchIndex].ToString();
                            this.clickBtn.Visible      = false;
                            break;
                        }

                        this.comboBoxMekey.Visible = false;
                        this.clickBtn.Visible      = true;
                        this.clickBtn.Text         = this.mCheckedKeyLayout.Key.ToString();
                        break;
                    }
                }
            }

            TimerSession.userOperation();
        }
Ejemplo n.º 2
0
        private void imgTablet_MouseMove(object sender, MouseEventArgs e)
        {
            TimerSession.userOperation();
            if (this.mCurrentKeyLayout != null && this.mCurrentKeyLayout.mouseEnter(e.X, e.Y))
            {
                this.imgTablet.Cursor = Cursors.Hand;
            }
            else
            {
                if (this.keyLayouts != null)
                {
                    foreach (HuionKeyLayout keyLayout in this.keyLayouts)
                    {
                        if (keyLayout.mouseEnter(e.X, e.Y))
                        {
                            this.mCurrentKeyLayout = keyLayout;
                            this.imgTablet.Refresh();
                            this.imgTablet.Cursor = Cursors.Hand;
                            return;
                        }
                    }
                }

                this.imgTablet.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 3
0
        public static HuionKeyLayout swapLayout(Size imageSize, HNStruct.HNSize keyPanelSize,
                                                HNStruct.HNLayoutEkey keyLayout)
        {
            HuionKeyLayout huionKeyLayout = new HuionKeyLayout();
            float          num1           = (float)imageSize.Width / (float)keyPanelSize.cx;
            float          num2           = (float)imageSize.Height / (float)keyPanelSize.cy;
            Rectangle      rectangle1     = swapLayout(imageSize, keyPanelSize, keyLayout.rect);
            Rectangle      rectangle2     = swapLayout(imageSize, keyPanelSize, keyLayout.inRect);

            huionKeyLayout.Center = new Point()
            {
                X = (int)Math.Round((double)keyLayout.center.x * (double)num1),
                Y = (int)Math.Round((double)keyLayout.center.y * (double)num2)
            };
            huionKeyLayout.InnerRect = rectangle2;
            huionKeyLayout.Rect      = rectangle1;
            return(huionKeyLayout);
        }
Ejemplo n.º 4
0
        private void comboBoxMekey_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.mTouchIndex = this.comboBoxMekey.SelectedIndex;
            if (this.keyLayouts == null)
            {
                return;
            }
            HuionKeyLayout keyLayout = this.keyLayouts[this.keyLayouts.Length - 1];

            if (DeployConfig.getOemType() == OEMType.HUION && DeployConfig.isNewUI)
            {
                FormEKey_New formEkeyNew = new FormEKey_New((object)keyLayout, keyLayout.MutliKeys[this.getMeIndex()]);
                formEkeyNew.callback += new EKeyCallback(this.form_TransfEvent);
                int num = (int)formEkeyNew.ShowDialog();
            }
            else
            {
                FormEKey formEkey = new FormEKey((object)keyLayout, keyLayout.MutliKeys[this.getMeIndex()]);
                formEkey.callback += new EKeyCallback(this.form_TransfEvent);
                int num = (int)formEkey.ShowDialog();
            }
        }
Ejemplo n.º 5
0
        private void form_TransfEvent(object holder, HNStruct.HNEkey value)
        {
            HuionKeyLayout huionKeyLayout = (HuionKeyLayout)holder;

            if (huionKeyLayout.KeyType == HuionKeyType.HARDKEY)
            {
                this.clickBtn.Text = value.ToString();
                huionKeyLayout.Key = value;
                HNStruct.globalInfo.hbtns[huionKeyLayout.KeyIndex] = value;
                TabletConfigUtils.config.ctxEkeys[0].hbtns[huionKeyLayout.KeyIndex] =
                    HNStruct.globalInfo.hbtns[huionKeyLayout.KeyIndex];
            }
            else if (huionKeyLayout.KeyType == HuionKeyType.SOFTKEY)
            {
                this.clickBtn.Text = value.ToString();
                huionKeyLayout.Key = value;
                HNStruct.globalInfo.sbtns[huionKeyLayout.KeyIndex] = value;
                TabletConfigUtils.config.ctxEkeys[0].sbtns[huionKeyLayout.KeyIndex] =
                    HNStruct.globalInfo.sbtns[huionKeyLayout.KeyIndex];
            }
            else
            {
                if (huionKeyLayout.KeyType != HuionKeyType.MULTIKEY)
                {
                    return;
                }
                int meIndex = this.getMeIndex();
                huionKeyLayout.MutliKeys[meIndex]  = value;
                HNStruct.globalInfo.mbtns[meIndex] = value;
                this.SetTouchSinger(this.mTouchIndex);
                for (int index = 0; index < (int)TabletConfigUtils.config.ctxEkeys[0].ctxMek[0].eks[0].num; ++index)
                {
                    TabletConfigUtils.config.ctxEkeys[0].ctxMek[0].eks[0].eks[index] = HNStruct.globalInfo.mbtns[index];
                }
                Console.WriteLine("shezhi");
            }
        }
Ejemplo n.º 6
0
        private void FormHotKey_Load(object sender, EventArgs e)
        {
            this.setViewText8Locale();
            this.clickBtn.Parent      = (Control)this.imgTablet;
            this.clickBtn.UseMnemonic = false;
            this.comboBoxMekey.Parent = (Control)this.imgTablet;
            this.imgTablet.Image      = ImageHelper.getDllScaleImage(HNStruct.devTypeString, (Control)this.imgTablet);
            this.imgTablet.Size       = this.imgTablet.Image.Size;
            this.imgTablet.Location   = new Point((this.Width - this.imgTablet.Width) / 2,
                                                  (this.Height - this.imgTablet.Height) / 2 - 20);
            Point point = new Point(this.imgTablet.Width / 2, this.imgTablet.Height / 2);

            point.Y -= this.clickBtn.Height / 2;
            point.X -= this.clickBtn.Width / 2;
            this.clickBtn.Location      = point;
            this.comboBoxMekey.Location = this.clickBtn.Location;
            curEkeyIndex = 0;
            this.comboBoxMekey.Visible = false;
            this.keyLayouts            = new HuionKeyLayout[(int)HNStruct.globalInfo.layoutTablet.hbtnNum +
                                                            (int)HNStruct.globalInfo.layoutTablet.sbtnNum +
                                                            (int)HNStruct.globalInfo.layoutTablet.mekeyNum];
            for (int index = 0; (long)index < (long)HNStruct.globalInfo.layoutTablet.hbtnNum; ++index)
            {
                this.keyLayouts[index] = Utils.swapLayout(this.imgTablet.Size, HNStruct.globalInfo.layoutTablet.size,
                                                          HNStruct.globalInfo.hbtnLayouts[index]);
                this.keyLayouts[index].KeyType  = HuionKeyType.HARDKEY;
                this.keyLayouts[index].Key      = HNStruct.globalInfo.hbtns[index];
                this.keyLayouts[index].KeyIndex = index;
            }

            for (int index = 0; (long)index < (long)HNStruct.globalInfo.layoutTablet.sbtnNum; ++index)
            {
                HuionKeyLayout huionKeyLayout = Utils.swapLayout(this.imgTablet.Size,
                                                                 HNStruct.globalInfo.layoutTablet.size, HNStruct.globalInfo.sbtnLayouts[index]);
                huionKeyLayout.KeyType  = HuionKeyType.SOFTKEY;
                huionKeyLayout.Key      = HNStruct.globalInfo.sbtns[index];
                huionKeyLayout.KeyIndex = index;
                this.keyLayouts[(long)HNStruct.globalInfo.layoutTablet.hbtnNum + (long)index] = huionKeyLayout;
            }

            for (int index = 0; (long)index < (long)HNStruct.globalInfo.layoutTablet.mekeyNum; ++index)
            {
                HuionKeyLayout huionKeyLayout = Utils.swapLayout(this.imgTablet.Size,
                                                                 HNStruct.globalInfo.layoutTablet.size, HNStruct.globalInfo.mekeyLayouts[index]);
                huionKeyLayout.KeyType   = HuionKeyType.MULTIKEY;
                huionKeyLayout.MutliKeys = HNStruct.globalInfo.mbtns;
                huionKeyLayout.KeyIndex  = index;
                this.keyLayouts[
                    (long)(HNStruct.globalInfo.layoutTablet.hbtnNum + HNStruct.globalInfo.layoutTablet.sbtnNum) +
                    (long)index] = huionKeyLayout;
            }

            if (this.keyLayouts.Length != 0)
            {
                this.mCheckedKeyLayout = this.keyLayouts[0];
            }
            if (HNStruct.globalInfo.layoutTablet.hbtnNum > 0U)
            {
                this.clickBtn.Text = HNStruct.globalInfo.hbtns[0].ToString();
            }
            else
            {
                this.clickBtn.Visible = false;
            }
            this.SetTouchSinger(this.mTouchIndex);
            this.UpdateHnConfigToView();
        }