public UC_W_doubleBtn()
        {
            InitializeComponent();

            m_identifier = Page.DoubleBtn;
            m_next = Page.WheelBtn;
            m_previous = Page.ClassicCurve;

            m_gesture = new MyGesture("DoubleButton");
            m_gesture.Activator = new GestureParts.DoubleButton(MouseButtons.Left, MouseButtons.Right);

            cB_gesture.Checked = Config.User.UsingDoubleBtn;

            cB_triggerBtn.Items.Add(Translation.Name_LeftButton);
            cB_modifierBtn.Items.Add(Translation.Name_RightButton);
            cB_modifierBtn.SelectedIndex = 0;
            cB_triggerBtn.SelectedIndex = 0;

            m_caption = Translation.GetText("W_DB_caption");
            I_infoText = Translation.GetText("W_DB_info");
            cB_gesture.Text = Translation.Name_RockerGesture;
            rTB_instructions.AppendText(Translation.GetText("W_DB_instructions"));
            lbl_triggerBtn.Text = Translation.Name_RockerHoldDownBtn;
            lbl_and.Text = Translation.GetText("W_G_lbl_and");
            lbl_modifierBtn.Text = Translation.Name_RockerExecuteBtn;
            rTB_description.AppendText("\n" + Translation.GetText("W_DB_description") + "\n");
        }
示例#2
0
        public UC_W_doubleBtn()
        {
            InitializeComponent();

            m_identifier = Page.DoubleBtn;
            m_next       = Page.WheelBtn;
            m_previous   = Page.ClassicCurve;

            m_gesture           = new MyGesture("DoubleButton");
            m_gesture.Activator = new GestureParts.DoubleButton(MouseButtons.Left, MouseButtons.Right);

            cB_gesture.Checked = Config.User.UsingDoubleBtn;

            cB_triggerBtn.Items.Add(Translation.Name_LeftButton);
            cB_modifierBtn.Items.Add(Translation.Name_RightButton);
            cB_modifierBtn.SelectedIndex = 0;
            cB_triggerBtn.SelectedIndex  = 0;

            m_caption       = Translation.GetText("W_DB_caption");
            I_infoText      = Translation.GetText("W_DB_info");
            cB_gesture.Text = Translation.Name_RockerGesture;
            rTB_instructions.AppendText(Translation.GetText("W_DB_instructions"));
            lbl_triggerBtn.Text  = Translation.Name_RockerHoldDownBtn;
            lbl_and.Text         = Translation.GetText("W_G_lbl_and");
            lbl_modifierBtn.Text = Translation.Name_RockerExecuteBtn;
            rTB_description.AppendText("\n" + Translation.GetText("W_DB_description") + "\n");
        }
示例#3
0
        private int DrawText(Graphics g, Rectangle r, String txt)
        {
            Color backColor = Color.Transparent;
            Color foreColor = this.ForeColor;

            if (m_listItem.Selected && !IsGroup(m_listItem) && (m_columnIndex == 0 || this.FullRowSelect))
            {
                backColor = SystemColors.Highlight;//this.BackColor;
                foreColor = SystemColors.HighlightText;
            }
            MyGesture item = m_gestures[m_listItem.Index];

            if ((item != null && item.AppGroup != null && !item.AppGroup.Checked) || !m_listItem.Checked)
            {
                foreColor = SystemColors.GrayText;
            }

            TextFormatFlags flags = TextFormatFlags.EndEllipsis | TextFormatFlags.NoPrefix |
                                    TextFormatFlags.VerticalCenter | TextFormatFlags.PreserveGraphicsTranslateTransform |
                                    TextFormatFlags.SingleLine;

            Font font = IsGroup(m_listItem) ? new Font(this.Font, FontStyle.Bold) : this.Font;

            TextRenderer.DrawText(g, txt, font, r, foreColor, backColor, flags);
            Size size = TextRenderer.MeasureText(txt, font);

            //if (m_columnIndex == 0)
            //{
            //    size = TextRenderer.MeasureText(txt, this.Font);
            //    if (r.Width > size.Width)
            //        r.Width = size.Width;
            //    m_event.DrawFocusRectangle(r);
            //}
            return(size.Width);
        }
示例#4
0
 private void button_next_Click(object sender, EventArgs e)
 {
     if (btn_next.DialogResult == DialogResult.OK)
     {
         if (!m_appMode)
         {
             m_network = uc_gesture.MyNNetwork;
             foreach (MyGesture group in uc_actions.NewGroups)
             {
                 m_newGestures.Add(group);
             }
             foreach (MyGesture group in uc_actions.SelectedGroups)
             {
                 string    id   = MyGesture.CreateUniqueId(m_tempGesture, m_gestures);
                 MyGesture gest = new MyGesture(id);
                 gest.SetItem(m_tempGesture);
                 gest.Activator = m_tempGesture.Activator;
                 gest.Action    = m_tempGesture.Action;
                 gest.AppGroup  = group;
                 m_newGestures.Add(gest);
                 m_gestures.Add(gest);
             }
         }
         else
         {
             string    id   = MyGesture.CreateUniqueId(m_tempGesture, m_gestures);
             MyGesture gest = new MyGesture(id);
             gest.SetItem(m_tempGesture);
             gest.Action    = m_tempGesture.Action;
             gest.Activator = new MouseActivator(string.Empty, MouseActivator.Types.Undefined);
             m_newGestures.Add(gest);
         }
     }
     MoveToPage(m_currentControl.Next);
 }
 public void SetItem(MyGesture gesture)
 {
     m_active = gesture.Active;
     m_caption = gesture.Caption;
     m_description = gesture.Description;
     m_executionType = gesture.ExecutionType;
     m_itemPos = gesture.ItemPos;
     SetMainListItem();
 }
示例#6
0
 public void SetItem(MyGesture gesture)
 {
     m_active        = gesture.Active;
     m_caption       = gesture.Caption;
     m_description   = gesture.Description;
     m_executionType = gesture.ExecutionType;
     m_itemPos       = gesture.ItemPos;
     SetMainListItem();
 }
示例#7
0
        public UC_W_classicCurve()
        {
            InitializeComponent();

            m_identifier = Page.ClassicCurve;
            m_next       = Page.DoubleBtn;
            m_previous   = Page.Welcome;

            List <PointF> points = new List <PointF>();

            //Curve G
            points.AddRange(new PointF[] { new PointF(253, 100), new PointF(252, 99), new PointF(249, 98), new PointF(247, 98), new PointF(243, 98),
                                           new PointF(241, 98), new PointF(238, 98), new PointF(235, 98), new PointF(230, 98), new PointF(227, 99), new PointF(223, 100), new PointF(218, 101),
                                           new PointF(215, 101), new PointF(215, 101), new PointF(212, 102), new PointF(208, 103), new PointF(205, 103), new PointF(200, 104), new PointF(196, 106),
                                           new PointF(191, 108), new PointF(187, 110), new PointF(182, 111), new PointF(177, 113), new PointF(171, 115), new PointF(165, 119), new PointF(159, 123),
                                           new PointF(156, 125), new PointF(149, 129), new PointF(145, 132), new PointF(141, 135), new PointF(136, 140), new PointF(132, 144), new PointF(130, 147),
                                           new PointF(126, 152), new PointF(123, 157), new PointF(121, 161), new PointF(119, 166), new PointF(117, 171), new PointF(115, 177), new PointF(114, 182),
                                           new PointF(114, 187), new PointF(113, 194), new PointF(113, 198), new PointF(113, 203), new PointF(113, 209), new PointF(113, 215), new PointF(114, 219),
                                           new PointF(116, 225), new PointF(118, 230), new PointF(120, 236), new PointF(122, 240), new PointF(125, 245), new PointF(128, 250), new PointF(132, 255),
                                           new PointF(134, 258), new PointF(139, 263), new PointF(144, 267), new PointF(148, 270), new PointF(157, 275), new PointF(163, 280), new PointF(170, 283),
                                           new PointF(177, 286), new PointF(183, 288), new PointF(191, 291), new PointF(199, 292), new PointF(206, 293), new PointF(214, 293), new PointF(221, 293),
                                           new PointF(229, 293), new PointF(236, 293), new PointF(243, 293), new PointF(250, 293), new PointF(257, 292), new PointF(263, 291), new PointF(270, 289),
                                           new PointF(275, 287), new PointF(281, 284), new PointF(284, 282), new PointF(290, 278), new PointF(295, 275), new PointF(300, 271), new PointF(304, 268),
                                           new PointF(308, 263), new PointF(311, 259), new PointF(315, 253), new PointF(318, 249), new PointF(321, 245), new PointF(322, 241), new PointF(323, 238),
                                           new PointF(323, 235), new PointF(323, 232), new PointF(323, 229), new PointF(323, 226), new PointF(323, 223), new PointF(322, 220), new PointF(320, 217),
                                           new PointF(319, 213), new PointF(317, 210), new PointF(315, 207), new PointF(312, 204), new PointF(310, 201), new PointF(306, 199), new PointF(303, 196),
                                           new PointF(299, 194), new PointF(296, 193), new PointF(290, 191), new PointF(285, 190), new PointF(280, 189), new PointF(275, 188), new PointF(268, 188),
                                           new PointF(261, 188), new PointF(255, 188), new PointF(249, 188), new PointF(243, 188), new PointF(239, 188), new PointF(235, 188), new PointF(231, 188),
                                           new PointF(228, 188), new PointF(224, 188), new PointF(220, 190), new PointF(218, 191), new PointF(216, 192), new PointF(215, 193), new PointF(213, 195),
                                           new PointF(212, 197), new PointF(210, 199), new PointF(210, 201), new PointF(209, 203), new PointF(209, 205), new PointF(208, 208), new PointF(208, 210),
                                           new PointF(207, 213), new PointF(207, 216), new PointF(207, 218), new PointF(207, 220) });

            m_gesture           = new MyGesture("ClassicCurve");
            m_gesture.Activator = new GestureParts.ClassicCurve(points, m_gesturesCollection);

            cB_gesture.Checked = Config.User.UsingClassicCurve;

            for (int i = 0; i < ConvertValue.MouseButtonsCount; i++)
            {
                cB_toggleBtn.Items.Add(Translation.GetMouseBtnText(ConvertValue.IndexToMouseBtn(i)));
            }

            cB_toggleBtn.SelectedIndex = ConvertValue.MouseBtnToIndex(Config.User.BtnToggle);

            cB_toggleExample.Items.Add(Translation.Name_RightButton);
            cB_toggleExample.SelectedIndex = 0;

            m_caption          = Translation.GetText("W_CC_caption");
            I_infoText         = Translation.GetText("W_CC_info");
            cB_gesture.Text    = Translation.Name_CurveGesture;
            lbl_toggleBtn.Text = lbl_toggleBtn2.Text = Translation.Name_CurveHoldDownBtn;
            rTB_instructions.AppendText(Translation.GetText("W_CC_instructions"));
            lbl_and.Text           = Translation.GetText("W_G_lbl_and");
            lbl_mouseMovement.Text = Translation.GetText("W_G_lbl_mouseMovement");
            rTB_description.AppendText("\n" + Translation.GetText("W_CC_description") + "\n");
        }
        public UC_W_classicCurve()
        {
            InitializeComponent();

            m_identifier = Page.ClassicCurve;
            m_next = Page.DoubleBtn;
            m_previous = Page.Welcome;

            List<PointF> points = new List<PointF>();
            //Curve G
            points.AddRange(new PointF[] { new PointF(253, 100), new PointF(252, 99), new PointF(249, 98), new PointF(247, 98), new PointF(243, 98), 
                new PointF(241, 98), new PointF(238, 98), new PointF(235, 98), new PointF(230, 98), new PointF(227, 99), new PointF(223, 100), new PointF(218, 101), 
                new PointF(215, 101), new PointF(215, 101), new PointF(212, 102), new PointF(208, 103), new PointF(205, 103), new PointF(200, 104), new PointF(196, 106), 
                new PointF(191, 108), new PointF(187, 110), new PointF(182, 111), new PointF(177, 113), new PointF(171, 115), new PointF(165, 119), new PointF(159, 123), 
                new PointF(156, 125), new PointF(149, 129), new PointF(145, 132), new PointF(141, 135), new PointF(136, 140), new PointF(132, 144), new PointF(130, 147), 
                new PointF(126, 152), new PointF(123, 157), new PointF(121, 161), new PointF(119, 166), new PointF(117, 171), new PointF(115, 177), new PointF(114, 182), 
                new PointF(114, 187), new PointF(113, 194), new PointF(113, 198), new PointF(113, 203), new PointF(113, 209), new PointF(113, 215), new PointF(114, 219), 
                new PointF(116, 225), new PointF(118, 230), new PointF(120, 236), new PointF(122, 240), new PointF(125, 245), new PointF(128, 250), new PointF(132, 255), 
                new PointF(134, 258), new PointF(139, 263), new PointF(144, 267), new PointF(148, 270), new PointF(157, 275), new PointF(163, 280), new PointF(170, 283), 
                new PointF(177, 286), new PointF(183, 288), new PointF(191, 291), new PointF(199, 292), new PointF(206, 293), new PointF(214, 293), new PointF(221, 293), 
                new PointF(229, 293), new PointF(236, 293), new PointF(243, 293), new PointF(250, 293), new PointF(257, 292), new PointF(263, 291), new PointF(270, 289), 
                new PointF(275, 287), new PointF(281, 284), new PointF(284, 282), new PointF(290, 278), new PointF(295, 275), new PointF(300, 271), new PointF(304, 268), 
                new PointF(308, 263), new PointF(311, 259), new PointF(315, 253), new PointF(318, 249), new PointF(321, 245), new PointF(322, 241), new PointF(323, 238), 
                new PointF(323, 235), new PointF(323, 232), new PointF(323, 229), new PointF(323, 226), new PointF(323, 223), new PointF(322, 220), new PointF(320, 217), 
                new PointF(319, 213), new PointF(317, 210), new PointF(315, 207), new PointF(312, 204), new PointF(310, 201), new PointF(306, 199), new PointF(303, 196), 
                new PointF(299, 194), new PointF(296, 193), new PointF(290, 191), new PointF(285, 190), new PointF(280, 189), new PointF(275, 188), new PointF(268, 188), 
                new PointF(261, 188), new PointF(255, 188), new PointF(249, 188), new PointF(243, 188), new PointF(239, 188), new PointF(235, 188), new PointF(231, 188), 
                new PointF(228, 188), new PointF(224, 188), new PointF(220, 190), new PointF(218, 191), new PointF(216, 192), new PointF(215, 193), new PointF(213, 195), 
                new PointF(212, 197), new PointF(210, 199), new PointF(210, 201), new PointF(209, 203), new PointF(209, 205), new PointF(208, 208), new PointF(208, 210), 
                new PointF(207, 213), new PointF(207, 216), new PointF(207, 218), new PointF(207, 220)});

            m_gesture = new MyGesture("ClassicCurve");
            m_gesture.Activator = new GestureParts.ClassicCurve(points, m_gesturesCollection);

            cB_gesture.Checked = Config.User.UsingClassicCurve;

            for (int i = 0; i < ConvertValue.MouseButtonsCount; i++)
                cB_toggleBtn.Items.Add(Translation.GetMouseBtnText(ConvertValue.IndexToMouseBtn(i)));

            cB_toggleBtn.SelectedIndex = ConvertValue.MouseBtnToIndex(Config.User.BtnToggle);

            cB_toggleExample.Items.Add(Translation.Name_RightButton);
            cB_toggleExample.SelectedIndex = 0;

            m_caption = Translation.GetText("W_CC_caption");
            I_infoText = Translation.GetText("W_CC_info");
            cB_gesture.Text = Translation.Name_CurveGesture;
            lbl_toggleBtn.Text = lbl_toggleBtn2.Text = Translation.Name_CurveHoldDownBtn;
            rTB_instructions.AppendText(Translation.GetText("W_CC_instructions"));
            lbl_and.Text = Translation.GetText("W_G_lbl_and");
            lbl_mouseMovement.Text = Translation.GetText("W_G_lbl_mouseMovement");
            rTB_description.AppendText("\n" + Translation.GetText("W_CC_description") + "\n");
        }
示例#9
0
 private void ChangeItemsState(bool active)
 {
     ListView.SelectedListViewItemCollection items;
     items = listView_GesturesActions.SelectedItems;
     for (int i = 0; i < items.Count; i++)
     {
         string    itemId        = items[i].Name;
         MyGesture activeGesture = m_gestures[itemId];
         activeGesture.Active  = active;
         activeGesture.Checked = active;
         listView_GesturesActions.Items[itemId].Checked = active;
     }
 }
示例#10
0
        private void GetGroupItemsIndexes(ListViewItem group, out int start, out int end)
        {
            // get items count in list view because might be different from gestures (~collapsed & expanded)
            end   = this.Items.Count;
            start = group.Index;
            MyGesture groupGest = m_gestures[group.Name];
            int       next      = m_gestures.Groups.IndexOf(groupGest);

            next++;
            if (next < m_gestures.Groups.Count)
            {
                //end = m_gestures.Groups.IndexOf(m_gestures.Groups[next][next].Index;
                end = m_gestures.Groups[next].Index;
            }
            start++;
        }
示例#11
0
 private void btn_addApp_Click(object sender, EventArgs e)
 {
     GUI.Form_addGesture addGesture = new GUI.Form_addGesture();
     addGesture.Gestures = m_gesturesCollection;
     addGesture.AppMode  = true;
     if (addGesture.ShowDialog() == DialogResult.OK)
     {
         foreach (MyGesture gesture in addGesture.NewGestures)
         {
             MyGesture gestureToAdd = new MyGesture(gesture);
             gesture.SetActionIcon(iL_applications);
             m_gesturesCollection.Add(gestureToAdd);
             m_newGroups.Add(gestureToAdd);
             cCB_groups.AddItem(gestureToAdd.ID, gestureToAdd.Caption);
         }
     }
 }
        private void MyInitializing()
        {
            typeof(GroupBox).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, groupBox_MainPanel, new object[] { true });
            this.FormBorderStyle = FormBorderStyle.Fixed3D;
            m_tempGesture = new MyGesture(string.Empty);
            m_newGestures = new List<MyGesture>();
            m_selectedGroups = new List<MyGesture>();

            #region User Control Declaration

            uc_openPrgFld = new UC_openPrgFld();
            uc_actions = new UC_actions();
            uc_name = new UC_name();
            uc_gesture = new UC_gesture();
            uc_customKeystrokes = new UC_customKeystrokes();
            uc_selectProgram = new UC_selectProgram();
            uc_plainText = new UC_plainText();
            uc_clipboard = new UC_clipboard();
            uc_mailSearchWeb = new UC_mailSearchWeb();

            groupBox_MainPanel.Controls.Add(uc_actions);
            groupBox_MainPanel.Controls.Add(uc_name);
            groupBox_MainPanel.Controls.Add(uc_gesture);
            groupBox_MainPanel.Controls.Add(uc_openPrgFld);
            groupBox_MainPanel.Controls.Add(uc_customKeystrokes);
            groupBox_MainPanel.Controls.Add(uc_selectProgram);
            groupBox_MainPanel.Controls.Add(uc_plainText);
            groupBox_MainPanel.Controls.Add(uc_clipboard);
            groupBox_MainPanel.Controls.Add(uc_mailSearchWeb);

            foreach (BaseActionControl myControl in groupBox_MainPanel.Controls)
            {                
                myControl.Dock = DockStyle.Fill;
                myControl.TempGesture = m_tempGesture;
                myControl.CanContinue += new BaseActionControl.DlgCanContinue(Continue);
                myControl.ChangeAboutText += new BaseActionControl.DlgChangeAboutText(ChangeAboutText);
                myControl.ChangeInfoText += new BaseActionControl.DlgChangeInfoText(uC_infoIcon1.ChangeInfoText);
                myControl.Visible = false;
            }

            #endregion User Control Declaration

            btn_back.Text = Translation.Btn_back;
            btn_cancel.Text = Translation.Btn_cancel;
            btn_next.Text = Translation.Btn_next;
        }
示例#13
0
        private void RedrawGesture()
        {
            List <MyGesture> gests = m_gestures.MatchedGestures(listView_GesturesActions.SelectedItemCurve);

            if (gests.Count == 0)
            {
                if (m_prevSelectedGesture != null)
                {
                    m_prevSelectedGesture.Activator.AbortAnimating();
                }
                Graphics gp = Graphics.FromImage(pB_displayGesture.Image);
                gp.FillRectangle(new SolidBrush(pB_displayGesture.BackColor), 0, 0, pB_displayGesture.Width, pB_displayGesture.Height);
                pB_displayGesture.Invalidate();
                gp.Dispose();
                m_prevSelectedGesture = null;
            }
            else
            {
                if (m_prevSelectedGesture != gests[0])
                {
                    if (m_prevSelectedGesture != null)
                    {
                        m_prevSelectedGesture.Activator.AbortAnimating();
                    }
                    m_prevSelectedGesture = gests[0];
                    m_prevSelectedGesture.Activator.DrawToPictureBox(pB_displayGesture);
                }
                else
                {
                    if (m_animateGesture)
                    {
                        m_prevSelectedGesture = gests[0];
                        m_prevSelectedGesture.Activator.AnimateToPictureBox(pB_displayGesture);
                    }
                }
            }
            cLV_matchedGestures.SetMatchedItems(listView_GesturesActions.MatchedGestures);

            List <MyGesture> selectedGestures = new List <MyGesture>();

            foreach (ListViewItem item in listView_GesturesActions.SelectedItems)
            {
                selectedGestures.Add(m_gestures[item.Name]);
            }
            cLV_matchedGestures.DrawFocusRectangleAround(selectedGestures);
        }
示例#14
0
        private void MyInitializing()
        {
            typeof(GroupBox).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, groupBox_MainPanel, new object[] { true });
            this.FormBorderStyle = FormBorderStyle.Fixed3D;
            m_tempGesture        = new MyGesture(string.Empty);
            m_newGestures        = new List <MyGesture>();
            m_selectedGroups     = new List <MyGesture>();

            #region User Control Declaration

            uc_openPrgFld       = new UC_openPrgFld();
            uc_actions          = new UC_actions();
            uc_name             = new UC_name();
            uc_gesture          = new UC_gesture();
            uc_customKeystrokes = new UC_customKeystrokes();
            uc_selectProgram    = new UC_selectProgram();
            uc_plainText        = new UC_plainText();
            uc_clipboard        = new UC_clipboard();
            uc_mailSearchWeb    = new UC_mailSearchWeb();

            groupBox_MainPanel.Controls.Add(uc_actions);
            groupBox_MainPanel.Controls.Add(uc_name);
            groupBox_MainPanel.Controls.Add(uc_gesture);
            groupBox_MainPanel.Controls.Add(uc_openPrgFld);
            groupBox_MainPanel.Controls.Add(uc_customKeystrokes);
            groupBox_MainPanel.Controls.Add(uc_selectProgram);
            groupBox_MainPanel.Controls.Add(uc_plainText);
            groupBox_MainPanel.Controls.Add(uc_clipboard);
            groupBox_MainPanel.Controls.Add(uc_mailSearchWeb);

            foreach (BaseActionControl myControl in groupBox_MainPanel.Controls)
            {
                myControl.Dock             = DockStyle.Fill;
                myControl.TempGesture      = m_tempGesture;
                myControl.CanContinue     += new BaseActionControl.DlgCanContinue(Continue);
                myControl.ChangeAboutText += new BaseActionControl.DlgChangeAboutText(ChangeAboutText);
                myControl.ChangeInfoText  += new BaseActionControl.DlgChangeInfoText(uC_infoIcon1.ChangeInfoText);
                myControl.Visible          = false;
            }

            #endregion User Control Declaration

            btn_back.Text   = Translation.Btn_back;
            btn_cancel.Text = Translation.Btn_cancel;
            btn_next.Text   = Translation.Btn_next;
        }
示例#15
0
        protected override void OnDragDrop(DragEventArgs drgevent)
        {
            base.OnDragDrop(drgevent);

            // reorder also collection of gestures according to items in list
            List <MyGesture> gestures = new List <MyGesture>();

            foreach (ListViewItem item in this.Items)
            {
                MyGesture gest = null;
                for (int i = 0; i < m_gestures.Count; i++)
                {
                    if (m_gestures[i].ID == item.Tag.ToString())
                    {
                        gest = m_gestures[i];
                        break;
                    }
                }
                gestures.Add(gest);
            }
            m_gestures = gestures;
        }
        public UC_W_wheelBtn()
        {
            InitializeComponent();

            m_identifier = Page.WheelBtn;
            m_next = Page.Activation;
            m_previous = Page.DoubleBtn;

            m_gesture = new MyGesture("WheelButton");
            m_gesture.Activator = new GestureParts.WheelButton(MouseButtons.XButton1);
            
            cB_gesture.Checked = Config.User.UsingWheelBtn;
            cb_trigger.SelectedIndex = 0;

            m_caption = Translation.GetText("W_WB_caption");
            I_infoText = Translation.GetText("W_WB_info");
            cB_gesture.Text = Translation.Name_WheelGesture;
            rTB_instructions.AppendText(Translation.GetText("W_WB_instructions"));
            lbl_triggerBtn.Text = Translation.Name_WheelHoldDownBtn;
            lbl_and.Text = Translation.GetText("W_G_lbl_and");
            lbl_mouseWheel.Text = Translation.Name_MouseWheel;
            rTB_description.AppendText("\n" + Translation.GetText("W_WB_description") + "\n");
        }
示例#17
0
        public UC_W_wheelBtn()
        {
            InitializeComponent();

            m_identifier = Page.WheelBtn;
            m_next       = Page.Activation;
            m_previous   = Page.DoubleBtn;

            m_gesture           = new MyGesture("WheelButton");
            m_gesture.Activator = new GestureParts.WheelButton(MouseButtons.XButton1);

            cB_gesture.Checked       = Config.User.UsingWheelBtn;
            cb_trigger.SelectedIndex = 0;

            m_caption       = Translation.GetText("W_WB_caption");
            I_infoText      = Translation.GetText("W_WB_info");
            cB_gesture.Text = Translation.Name_WheelGesture;
            rTB_instructions.AppendText(Translation.GetText("W_WB_instructions"));
            lbl_triggerBtn.Text = Translation.Name_WheelHoldDownBtn;
            lbl_and.Text        = Translation.GetText("W_G_lbl_and");
            lbl_mouseWheel.Text = Translation.Name_MouseWheel;
            rTB_description.AppendText("\n" + Translation.GetText("W_WB_description") + "\n");
        }
示例#18
0
        private void ExecuteRecognizedGestures(GesturesCollection recognizedGestures)
        {
            //form_top.ClearContextMenu();
            int threadID = Thread.CurrentThread.ManagedThreadId;
            int index = 0;
            MyGesture gest;

            switch (recognizedGestures.Count)
            {
                case 0:
                    // if curve wasnt recognize then hide form_transparent
                    //form_top.MakeNonTopMost();
                    break;
                case 1:
                    gest = recognizedGestures[index];
                    if (gest.ExecutionType == ExecuteType.Implicit || gest.ExecutionType == ExecuteType.ImplicitIfUnique)
                    {
                        Debug.WriteLine("Execute : " + gest.ID);
                        switch (gest.Action.Name)
                        {
                            case TypeOfAction.SpecialOptions.SPECIAL_ZOOM:
                                //int area_width = Math.Abs(area_right - area_left);
                                //int area_height = Math.Abs(area_bottom - area_top);
                                //recognizedGestures[0].gAction.Details = string.Format("{0}:{1}:{2}:{3}", area_left, area_top, area_width, area_height);
                                gest.Action.Details = string.Format("{0}:{1}:{2}:{3}", 10, 10, 100, 100);
                                goto default;
                            //break;
                            case TypeOfAction.WindowOptions.WND_TRANSPARENT:
                            case TypeOfAction.VolumeOptions.VOLUME_SET:
                                ToolStripMenuItem[] items = tSMI_arrayMenu(gest);
                                
                                if (threadID == m_threadID)
                                    lock (this) 
                                    {  
                                        form_top.ClearContextMenu();
                                    }
                                else break;

                                for (int i = 0; i < items.Length; i++)
                                {
                                    if (threadID == m_threadID)
                                        lock (this) 
                                        { 
                                            form_top.AddItemToCms(items[i]);
                                        }
                                    else break;
                                }
                                //foreach (ToolStripMenuItem item in items)
                                //    form_top.AddItemToCms(cMS_MatchedGestures, item);
                                if (threadID == m_threadID)
                                    lock (this) 
                                    { 
                                        form_top.ShowContextMenu();
                                    }
                                break;
                            default:
                                // gesture was recognized therefore hide the form_transparent
                                //form_top.MakeNonTopMost();

                                m_execute = gest;
                                //Thread threadExecuteAction = new Thread(new ThreadStart(ExecuteAction));
                                //threadExecuteAction.Name = "Execute Action";
                                //threadExecuteAction.Start();
                                
                                // no need to do it in thread as it is already in one
                                ExecuteAction();
                                break;
                        }
                        break;
                    }
                    else goto default;
                //break;
                default:
                    if (threadID == m_threadID)
                        lock (this) 
                        {
                            form_top.ClearContextMenu();
                        }

                    for (int i = 0; i < recognizedGestures.Count; i++)
                    {
                        gest = recognizedGestures[i];
                        if (gest.ExecutionType == ExecuteType.Implicit)
                        {
                            index = i;
                            goto case 1;
                        }
                        if (threadID == m_threadID)
                            lock (this)
                            {
                                switch (gest.Action.Name)
                                {
                                    case TypeOfAction.WindowOptions.WND_TRANSPARENT:
                                    case TypeOfAction.VolumeOptions.VOLUME_SET:
                                        //case TypeOfAction.SpecialControl.SPECIAL_ZOOM:
                                        //form_top.AddItemToCms(cMS_MatchedGestures, tSMI_dropDownMenu(gest));
                                        form_top.AddItemToCms(tSMI_dropDownMenu(gest));
                                        break;
                                    default:
                                        //ToolStripMenuItem item = new ToolStripMenuItem();
                                        //item.Image = gest.ImageList.Images[gest.ID];
                                        //item.Name = gest.ID;
                                        //item.Text = gest.Caption;
                                        //form_top.AddItemToCms(cMS_SameGestures, item);
                                        //form_top.AddItemToCms(cMS_MatchedGestures, gest.ToToolStripMenuItem(m_imgListActions));
                                        form_top.AddItemToCms(gest.ToToolStripMenuItem(m_imgListActions));
                                        break;
                                }
                            }
                    }
                    if (threadID == m_threadID)
                        lock (this) 
                        { 
                            form_top.ShowContextMenu();
                        }

                    break;
            }
        }
示例#19
0
 private void RedrawGesture()
 {
     List<MyGesture> gests = m_gestures.MatchedGestures(listView_GesturesActions.SelectedItemCurve);
     if (gests.Count == 0)
     {
         if (m_prevSelectedGesture != null)
             m_prevSelectedGesture.Activator.AbortAnimating();
         Graphics gp = Graphics.FromImage(pB_displayGesture.Image);
         gp.FillRectangle(new SolidBrush(pB_displayGesture.BackColor), 0, 0, pB_displayGesture.Width, pB_displayGesture.Height);
         pB_displayGesture.Invalidate();
         gp.Dispose();
         m_prevSelectedGesture = null;
     }
     else
     {
         if (m_prevSelectedGesture != gests[0])
         {
             if (m_prevSelectedGesture != null)
                 m_prevSelectedGesture.Activator.AbortAnimating();
             m_prevSelectedGesture = gests[0];
             m_prevSelectedGesture.Activator.DrawToPictureBox(pB_displayGesture);
         }
         else
         {
             if (m_animateGesture)
             {
                 m_prevSelectedGesture = gests[0];
                 m_prevSelectedGesture.Activator.AnimateToPictureBox(pB_displayGesture);
             }
         }
     }            
     cLV_matchedGestures.SetMatchedItems(listView_GesturesActions.MatchedGestures);
     
     List<MyGesture> selectedGestures = new List<MyGesture>();
     foreach (ListViewItem item in listView_GesturesActions.SelectedItems)
         selectedGestures.Add(m_gestures[item.Name]);
     cLV_matchedGestures.DrawFocusRectangleAround(selectedGestures);
 }
示例#20
0
        void tSMI_groupItem_Click(object sender, EventArgs e)
        {
            string groupKey = ((ToolStripMenuItem)sender).Name;

            if (m_copyGestures)
            {
                ListView.SelectedListViewItemCollection items = listView_GesturesActions.SelectedItems;
                for (int i = 0; i < items.Count; i++)
                {
                    string itemId = items[i].Name;
                    string id     = MyGesture.CreateUniqueId(m_gestures[itemId], m_gestures);
                    //MyGesture gest = new MyGesture(id);
                    //gest.SetItem(m_gestures[pos]);
                    //gest.Activator = m_gestures[pos].Activator;
                    //gest.Action = m_gestures[pos].Action;
                    //gest.AppGroup = m_gestures[groupKey];
                    MyGesture gest = new MyGesture(id, m_gestures[itemId], m_gestures[groupKey]);
                    gest.SetActionIcon(iL_actions);
                    gest.SetActionIcon(m_engine.ImgListActions);
                    gest.SetGestureIcon(iL_gestures);

                    int index = m_gestures.AutoInsert(new MyGesture(gest));
                    listView_GesturesActions.ResizeColumn = true; //will resize columns at the end
                    listView_GesturesActions.Items.Insert(index, m_gestures[index]);
                }
                listView_GesturesActions.Refresh(); //will resize columns at the end
                listView_GesturesActions.Update();
                //listView_GesturesActions.ReselectItems();
                SaveSettings();
                RedrawGesture();
            }
            else //add new gestures
            {
                Form_addGesture addGesture = new Form_addGesture();
                addGesture.SelectedGroups = new List <MyGesture>()
                {
                    m_gestures[groupKey]
                };
                addGesture.Gestures      = new GesturesCollection(m_gestures.GetAll().ToArray());
                addGesture.ShowInTaskbar = false;
                addGesture.MyNNetwork    = new MyNeuralNetwork(m_engine.Network);
                addGesture.MyNNetwork.LoadCurves();
                if (addGesture.ShowDialog() == DialogResult.OK)
                {
                    listView_GesturesActions.BeginUpdate();
                    foreach (MyGesture gesture in addGesture.NewGestures)
                    {
                        gesture.SetActionIcon(iL_actions);
                        gesture.SetActionIcon(m_engine.ImgListActions);
                        gesture.SetGestureIcon(iL_gestures);
                        int index = m_gestures.AutoInsert(new MyGesture(gesture));
                        listView_GesturesActions.ResizeColumn = true; //will resize columns at the end
                        // do not insert it because it should be added into collapsed group
                        if (index != -1)
                        {
                            listView_GesturesActions.Items.Insert(index, m_gestures[index]);
                        }
                    }
                    listView_GesturesActions.EndUpdate();
                    listView_GesturesActions.Refresh(); //will resize columns at the end
                    m_engine.Network = addGesture.MyNNetwork;
                    CheckButtonsState();
                    SaveSettings();
                    RedrawGesture();
                }
            }
        }
        private void Form_modifyGesture_Load(object sender, EventArgs e)
        {
            if (!m_appMode)
            {
                this.Size = new Size(680, 580);
                this.Text = modifiedGestures[0].Caption;
                bool singleGesture = true;
                bool singleCurve = true;
                tempGesture = new MyGesture(modifiedGestures[0]);
                if (modifiedGestures.Length > 1)
                {
                    this.Text = Translation.GetText("MG_multiple"); //Modify Multiple Gestures
                    singleGesture = false;
                    string curve = modifiedGestures[0].Activator.ID;
                    foreach (MyGesture gest in modifiedGestures)
                        if (curve != gest.Activator.ID)
                            singleCurve = false;
                    if (!singleCurve)
                    {
                        tempGesture = new MyGesture(string.Empty);
                        tempGesture.Action = modifiedGestures[0].Action;
                    }
                }
                uc_openPrgFld.TempGesture = tempGesture;
                uc_mailSearchWeb.TempGesture = tempGesture;
                uc_gesture.MyNNetwork = m_network;
                uc_gesture.MyNNetworkOriginal = m_networkOriginal;
                uc_gesture.TempGesture = tempGesture;
                uc_name.TempGesture = tempGesture;
                uc_gesture.Gestures = gestures;
                uc_name.Gestures = gestures;
                uc_customKeystrokes.TempGesture = tempGesture;
                uc_plainText.TempGesture = tempGesture;
                uc_clipboard.TempGesture = tempGesture;
                uc_clipboard.Gestures = gestures;

                if (singleGesture)
                {
                    TabPage tP_gesture = new TabPage();
                    tP_gesture.Text = Translation.GetText("MG_tP_gesture"); //  "Gesture";
                    tP_gesture.Controls.Add(uc_gesture);                    
                    TabPage tP_name = new TabPage();
                    tP_name.Text = Translation.GetText("MG_tP_name"); // "Name"
                    tP_name.Controls.Add(uc_name);

                    TabPage tp_mailSearchWeb = new TabPage();
                    TabPage tP_openPrgFld = new TabPage();
                    TabPage tP_customKeystrokes = new TabPage();
                    switch (tempGesture.Action.Name)
                    {
                        case WindowsShell.SHELL_START_PRG:
                            tP_openPrgFld.Text = Translation.GetText("MG_tP_program"); // "Program";
                            tP_openPrgFld.Controls.Add(uc_openPrgFld);
                            tabControl1.TabPages.Add(tP_openPrgFld);
                            break;                      
                        case WindowsShell.SHELL_OPEN_FLDR:
                            tP_openPrgFld.Text = Translation.GetText("MG_tP_folder"); // "Folder";
                            tP_openPrgFld.Controls.Add(uc_openPrgFld);
                            tabControl1.TabPages.Add(tP_openPrgFld);
                            break;
                        case InternetOptions.INTERNET_SEARCH_WEB:
                        case InternetOptions.INTERNET_OPEN_WEBSITE:
                            tp_mailSearchWeb.Text = Translation.GetText("MG_tP_url"); // "Website Url";
                            tp_mailSearchWeb.Controls.Add(uc_mailSearchWeb);
                            tabControl1.TabPages.Add(tp_mailSearchWeb);
                            break;
                        case InternetOptions.INTERNET_SEND_EMAIL:
                            tp_mailSearchWeb.Text = Translation.GetText("MG_tP_mail"); // "E-mail";
                            tp_mailSearchWeb.Controls.Add(uc_mailSearchWeb);
                            tabControl1.TabPages.Add(tp_mailSearchWeb);
                            break;
                        case InternetOptions.INTERNET_TAB_NEW:
                        case InternetOptions.INTERNET_TAB_CLOSE:
                        case InternetOptions.INTERNET_TAB_REOPEN:
                        case KeystrokesOptions.KEYSTROKES_ZOOM_IN:
                        case KeystrokesOptions.KEYSTROKES_ZOOM_OUT:
                        case KeystrokesOptions.KEYSTROKES_SYSTEM_COPY:
                        case KeystrokesOptions.KEYSTROKES_SYSTEM_CUT:
                        case KeystrokesOptions.KEYSTROKES_SYSTEM_PASTE:
                        case KeystrokesOptions.KEYSTROKES_CUSTOM:
                        case ExtrasOptions.EXTRAS_CUSTOM_WHEEL_BTN:
                        case ExtrasOptions.EXTRAS_TAB_SWITCHER:
                        case ExtrasOptions.EXTRAS_TASK_SWITCHER:
                        case ExtrasOptions.EXTRAS_ZOOM:
                            tP_customKeystrokes.Text = Translation.GetText("MG_tP_customKeystrokes"); // "Custom Keystrokes";
                            tP_customKeystrokes.Controls.Add(uc_customKeystrokes);
                            tabControl1.TabPages.Add(tP_customKeystrokes);
                            break;
                        case KeystrokesOptions.KEYSTROKES_PRIVATE_COPY_TEXT:
                        case KeystrokesOptions.KEYSTROKES_PRIVATE_PASTE_TEXT:
                            TabPage tP_clipboard = new TabPage();
                            tP_clipboard.Text = Translation.GetText("MG_tP_privateClipboard"); // "Private Clipboard";
                            tP_clipboard.Controls.Add(uc_clipboard);
                            tabControl1.TabPages.Add(tP_clipboard);
                            break;
                        case KeystrokesOptions.KEYSTROKES_PLAIN_TEXT:
                            TabPage tP_plainText = new TabPage();
                            tP_plainText.Text = Translation.GetText("MG_tP_plainText"); // "Plain Text";
                            tP_plainText.Controls.Add(uc_plainText);
                            tabControl1.TabPages.Add(tP_plainText);
                            break;
                    }
                    tabControl1.TabPages.Add(tP_gesture);
                    tabControl1.TabPages.Add(tP_name);
                }
                else
                {
                    TabPage tP_gesture = new TabPage();
                    tP_gesture.Text = Translation.GetText("MG_tP_gesture"); //"Gesture"
                    tP_gesture.Controls.Add(uc_gesture);
                    tabControl1.TabPages.Add(tP_gesture);
                }
            }
            else
            {
                this.Text = modifiedGestures[0].Caption;
                this.Size = new Size(530, 430);
                tempGesture = new MyGesture(modifiedGestures[0]);
                uc_selectProgram.TempGesture = tempGesture;
                TabPage tP_application = new TabPage();
                tP_application.Text = Translation.GetText("MG_tP_application"); // "Application"
                tP_application.Controls.Add(uc_selectProgram);
                tabControl1.TabPages.Add(tP_application);
            }
            foreach (TabPage page in tabControl1.TabPages)
                page.Padding = new Padding(15, 10, 15, 10);

            
        }
 private void button_next_Click(object sender, EventArgs e)
 {
     if (btn_next.DialogResult == DialogResult.OK)
     {
         if (!m_appMode)
         {
             m_network = uc_gesture.MyNNetwork;
             foreach (MyGesture group in uc_actions.NewGroups)
                 m_newGestures.Add(group);
             foreach (MyGesture group in uc_actions.SelectedGroups)
             {
                 string id = MyGesture.CreateUniqueId(m_tempGesture, m_gestures);
                 MyGesture gest = new MyGesture(id);
                 gest.SetItem(m_tempGesture);
                 gest.Activator = m_tempGesture.Activator;
                 gest.Action = m_tempGesture.Action;
                 gest.AppGroup = group;
                 m_newGestures.Add(gest);
                 m_gestures.Add(gest);
             }
         }
         else
         {
             string id = MyGesture.CreateUniqueId(m_tempGesture, m_gestures);
             MyGesture gest = new MyGesture(id);
             gest.SetItem(m_tempGesture);
             gest.Action = m_tempGesture.Action;
             gest.Activator = new MouseActivator(string.Empty, MouseActivator.Types.Undefined);
             m_newGestures.Add(gest);
         }
     }
     MoveToPage(m_currentControl.Next);
 }
示例#23
0
        private ToolStripMenuItem[] tSMI_arrayMenu(MyGesture gesture)
        {
            double[] lvl = new double[] { };
            string postfix = string.Empty;
            switch (gesture.Action.Name)
            {
                case TypeOfAction.WindowOptions.WND_TRANSPARENT:
                    lvl = TypeOfAction.WindowOptions.TransparencyLvl;
                    postfix = "%";
                    break;
                case TypeOfAction.VolumeOptions.VOLUME_SET:
                    lvl = TypeOfAction.VolumeOptions.VolumeLvl;
                    postfix = "%";
                    break;
                //case TypeOfAction.SpecialControl.SPECIAL_ZOOM:
                //    lvl = TypeOfAction.SpecialControl.ZoomLvl;
                //    postfix = "x";
                //    break;
            }

            ToolStripMenuItem[] items = new ToolStripMenuItem[lvl.Length];
            for (int i = 0; i < lvl.Length; i++)
            {
                items[i] = new ToolStripMenuItem();
                items[i].Text = String.Format("{0} {1}", lvl[i], postfix);
                items[i].Name = gesture.ID;
                items[i].Tag = lvl[i].ToString();
            }
            return items;
        }
示例#24
0
        private void Form_modifyGesture_Load(object sender, EventArgs e)
        {
            if (!m_appMode)
            {
                this.Size = new Size(680, 580);
                this.Text = modifiedGestures[0].Caption;
                bool singleGesture = true;
                bool singleCurve   = true;
                tempGesture = new MyGesture(modifiedGestures[0]);
                if (modifiedGestures.Length > 1)
                {
                    this.Text     = Translation.GetText("MG_multiple"); //Modify Multiple Gestures
                    singleGesture = false;
                    string curve = modifiedGestures[0].Activator.ID;
                    foreach (MyGesture gest in modifiedGestures)
                    {
                        if (curve != gest.Activator.ID)
                        {
                            singleCurve = false;
                        }
                    }
                    if (!singleCurve)
                    {
                        tempGesture        = new MyGesture(string.Empty);
                        tempGesture.Action = modifiedGestures[0].Action;
                    }
                }
                uc_openPrgFld.TempGesture     = tempGesture;
                uc_mailSearchWeb.TempGesture  = tempGesture;
                uc_gesture.MyNNetwork         = m_network;
                uc_gesture.MyNNetworkOriginal = m_networkOriginal;
                uc_gesture.TempGesture        = tempGesture;
                uc_name.TempGesture           = tempGesture;
                uc_gesture.Gestures           = gestures;
                uc_name.Gestures = gestures;
                uc_customKeystrokes.TempGesture = tempGesture;
                uc_plainText.TempGesture        = tempGesture;
                uc_clipboard.TempGesture        = tempGesture;
                uc_clipboard.Gestures           = gestures;

                if (singleGesture)
                {
                    TabPage tP_gesture = new TabPage();
                    tP_gesture.Text = Translation.GetText("MG_tP_gesture"); //  "Gesture";
                    tP_gesture.Controls.Add(uc_gesture);
                    TabPage tP_name = new TabPage();
                    tP_name.Text = Translation.GetText("MG_tP_name"); // "Name"
                    tP_name.Controls.Add(uc_name);

                    TabPage tp_mailSearchWeb    = new TabPage();
                    TabPage tP_openPrgFld       = new TabPage();
                    TabPage tP_customKeystrokes = new TabPage();
                    switch (tempGesture.Action.Name)
                    {
                    case WindowsShell.SHELL_START_PRG:
                        tP_openPrgFld.Text = Translation.GetText("MG_tP_program");     // "Program";
                        tP_openPrgFld.Controls.Add(uc_openPrgFld);
                        tabControl1.TabPages.Add(tP_openPrgFld);
                        break;

                    case WindowsShell.SHELL_OPEN_FLDR:
                        tP_openPrgFld.Text = Translation.GetText("MG_tP_folder");     // "Folder";
                        tP_openPrgFld.Controls.Add(uc_openPrgFld);
                        tabControl1.TabPages.Add(tP_openPrgFld);
                        break;

                    case InternetOptions.INTERNET_SEARCH_WEB:
                    case InternetOptions.INTERNET_OPEN_WEBSITE:
                        tp_mailSearchWeb.Text = Translation.GetText("MG_tP_url");     // "Website Url";
                        tp_mailSearchWeb.Controls.Add(uc_mailSearchWeb);
                        tabControl1.TabPages.Add(tp_mailSearchWeb);
                        break;

                    case InternetOptions.INTERNET_SEND_EMAIL:
                        tp_mailSearchWeb.Text = Translation.GetText("MG_tP_mail");     // "E-mail";
                        tp_mailSearchWeb.Controls.Add(uc_mailSearchWeb);
                        tabControl1.TabPages.Add(tp_mailSearchWeb);
                        break;

                    case InternetOptions.INTERNET_TAB_NEW:
                    case InternetOptions.INTERNET_TAB_CLOSE:
                    case InternetOptions.INTERNET_TAB_REOPEN:
                    case KeystrokesOptions.KEYSTROKES_ZOOM_IN:
                    case KeystrokesOptions.KEYSTROKES_ZOOM_OUT:
                    case KeystrokesOptions.KEYSTROKES_SYSTEM_COPY:
                    case KeystrokesOptions.KEYSTROKES_SYSTEM_CUT:
                    case KeystrokesOptions.KEYSTROKES_SYSTEM_PASTE:
                    case KeystrokesOptions.KEYSTROKES_CUSTOM:
                    case ExtrasOptions.EXTRAS_CUSTOM_WHEEL_BTN:
                    case ExtrasOptions.EXTRAS_TAB_SWITCHER:
                    case ExtrasOptions.EXTRAS_TASK_SWITCHER:
                    case ExtrasOptions.EXTRAS_ZOOM:
                        tP_customKeystrokes.Text = Translation.GetText("MG_tP_customKeystrokes");     // "Custom Keystrokes";
                        tP_customKeystrokes.Controls.Add(uc_customKeystrokes);
                        tabControl1.TabPages.Add(tP_customKeystrokes);
                        break;

                    case KeystrokesOptions.KEYSTROKES_PRIVATE_COPY_TEXT:
                    case KeystrokesOptions.KEYSTROKES_PRIVATE_PASTE_TEXT:
                        TabPage tP_clipboard = new TabPage();
                        tP_clipboard.Text = Translation.GetText("MG_tP_privateClipboard");     // "Private Clipboard";
                        tP_clipboard.Controls.Add(uc_clipboard);
                        tabControl1.TabPages.Add(tP_clipboard);
                        break;

                    case KeystrokesOptions.KEYSTROKES_PLAIN_TEXT:
                        TabPage tP_plainText = new TabPage();
                        tP_plainText.Text = Translation.GetText("MG_tP_plainText");     // "Plain Text";
                        tP_plainText.Controls.Add(uc_plainText);
                        tabControl1.TabPages.Add(tP_plainText);
                        break;
                    }
                    tabControl1.TabPages.Add(tP_gesture);
                    tabControl1.TabPages.Add(tP_name);
                }
                else
                {
                    TabPage tP_gesture = new TabPage();
                    tP_gesture.Text = Translation.GetText("MG_tP_gesture"); //"Gesture"
                    tP_gesture.Controls.Add(uc_gesture);
                    tabControl1.TabPages.Add(tP_gesture);
                }
            }
            else
            {
                this.Text   = modifiedGestures[0].Caption;
                this.Size   = new Size(530, 430);
                tempGesture = new MyGesture(modifiedGestures[0]);
                uc_selectProgram.TempGesture = tempGesture;
                TabPage tP_application = new TabPage();
                tP_application.Text = Translation.GetText("MG_tP_application"); // "Application"
                tP_application.Controls.Add(uc_selectProgram);
                tabControl1.TabPages.Add(tP_application);
            }
            foreach (TabPage page in tabControl1.TabPages)
            {
                page.Padding = new Padding(15, 10, 15, 10);
            }
        }
示例#25
0
        private void tSB_modify_Click(object sender, EventArgs e)
        {
            if (listView_GesturesActions.SelectedItems.Count == 0 ||
                !PossibleToModify())
            {
                return;
            }
            GesturesCollection modify         = new GesturesCollection();
            GesturesCollection gestures       = new GesturesCollection(m_gestures.GetAll().ToArray());
            List <string>      curvesToDelete = new List <string>();

            for (int i = listView_GesturesActions.SelectedItems.Count; i > 0; i--)
            {
                string itemId = listView_GesturesActions.SelectedItems[i - 1].Name;
                modify.Add(new MyGesture(gestures[itemId]));

                bool   classicCurve = gestures[itemId].Activator.Type == BaseActivator.Types.ClassicCurve;
                string curve        = gestures.Remove(gestures[itemId]);
                if (curve != string.Empty && classicCurve)
                {
                    curvesToDelete.Add(curve);
                }
            }
            modify.Reverse();
            //GesturesCollection gestures = new GesturesCollection(m_gestures.ToArray());
            //gestures.RemoveAt(index);
            Form_modifyGesture modifyGesture = new Form_modifyGesture();

            modifyGesture.ModifiedGestures   = modify.ToArray();
            modifyGesture.Gestures           = gestures;
            modifyGesture.ShowInTaskbar      = false;
            modifyGesture.MyNNetwork         = new MyNeuralNetwork(m_engine.Network);
            modifyGesture.MyNNetworkOriginal = new MyNeuralNetwork(m_engine.Network);
            modifyGesture.MyNNetwork.LoadCurves();
            modifyGesture.MyNNetwork.UnlearnCurves(curvesToDelete.ToArray(), true);
            if (modify.Count == 1 && modify[0].IsGroup)
            {
                modifyGesture.AppMode = true;
            }

            if (modifyGesture.ShowDialog() == DialogResult.OK)
            {
                m_engine.Network = modifyGesture.MyNNetwork;
                CheckButtonsState();
                listView_GesturesActions.BeginUpdate();
                foreach (MyGesture gesture in modifyGesture.ModifiedGestures)
                {
                    int index = m_gestures[gesture.ID].Index;
                    m_gestures[index] = new MyGesture(gesture);
                    m_gestures[index].SetActionIcon(iL_actions);
                    m_gestures[index].SetGestureIcon(iL_gestures);
                    m_gestures[index].SetActionIcon(m_engine.ImgListActions);
                    if (m_gestures.MatchedGestures(m_gestures[index].Activator.ID).Count == 1)
                    {
                        m_gestures[index].SetGestureIcon(iL_gestures);
                    }

                    listView_GesturesActions.Items[index] = m_gestures[index];
                }
                listView_GesturesActions.EndUpdate();
                listView_GesturesActions.Refresh(); //will resize column
                listView_GesturesActions.Update();
                SaveSettings();
                RedrawGesture();
            }
            else
            {
            }        // DialogResult.Cancel
        }
示例#26
0
 private bool IsActive(MyGesture gesture)
 {
     return(gesture.Active && gesture.AppGroup.Active);
 }
示例#27
0
        private int DrawImage(Graphics g, Rectangle r, Object imageSelector)
        {
            if (imageSelector == null || imageSelector == System.DBNull.Value)
            {
                return(0);
            }
            ImageList il = this.SmallImageList;

            //if (m_viewMode == ViewModes.Action || IsGroup(m_listItem))
            //    il = this.SmallImageList;
            //else
            //    il = this.LargeImageList;
            if (il != null)
            {
                int imgIndex = -1;

                if (imageSelector is Int32)
                {
                    imgIndex = (Int32)imageSelector;
                }
                else
                {
                    String selectorAsString = imageSelector as String;
                    if (selectorAsString != null)
                    {
                        imgIndex = il.Images.IndexOfKey(selectorAsString);
                    }
                }
                if (imgIndex >= 0)
                {
                    //Rectangle r2 = new Rectangle(r.X - this.Bounds.X, r.Y - this.Bounds.Y, r.Width, r.Height);
                    Rectangle r2    = new Rectangle(r.X, r.Y, r.Width, r.Height);
                    int       flags = ILD_TRANSPARENT;
                    if (m_listItem.Selected)
                    {
                        flags |= ILD_BLEND25;
                    }

                    MyGesture item = m_gestures[m_listItem.Index];
                    if ((item != null && item.AppGroup != null && !item.AppGroup.Checked) || !m_listItem.Checked)
                    {
                        ControlPaint.DrawImageDisabled(g, il.Images[imgIndex], r2.X, r2.Y, Color.Transparent);
                        //Bitmap bmp = new Bitmap(il.ImageSize.Width, il.ImageSize.Height);
                        //Graphics g2 = Graphics.FromImage(bmp);
                        //ControlPaint.DrawImageDisabled(g2, il.Images[imgIndex], 0, 0, Color.Transparent);
                        //g2.Dispose();
                        //ImageList il2 = new ImageList();
                        //il2.ImageSize = il.ImageSize;
                        //il2.ColorDepth = il.ColorDepth;
                        //il2.Images.Add(bmp);

                        //ImageList_Draw(il2.Handle, 0, g.GetHdc(), r2.X, r2.Y, flags);
                        //g.ReleaseHdc();
                    }
                    else
                    {
                        ImageList_Draw(il.Handle, imgIndex, g.GetHdc(), r2.X, r2.Y, flags);
                        g.ReleaseHdc();
                    }

                    if (!m_gestures[m_listItem.Index].IsWorking)
                    {
                        ImageList_Draw(il.Handle, 0, g.GetHdc(), r2.X, r2.Y, flags);
                        g.ReleaseHdc();
                    }
                    return(il.ImageSize.Width);
                }
            }
            return(0);
        }
示例#28
0
        void tSMI_groupItem_Click(object sender, EventArgs e)
        {
            string groupKey = ((ToolStripMenuItem)sender).Name;
            if (m_copyGestures)
            {
                ListView.SelectedListViewItemCollection items = listView_GesturesActions.SelectedItems;
                for (int i = 0; i < items.Count; i++)
                {
                    string itemId = items[i].Name;
                    string id = MyGesture.CreateUniqueId(m_gestures[itemId], m_gestures);
                    //MyGesture gest = new MyGesture(id);
                    //gest.SetItem(m_gestures[pos]);
                    //gest.Activator = m_gestures[pos].Activator;
                    //gest.Action = m_gestures[pos].Action;
                    //gest.AppGroup = m_gestures[groupKey];
                    MyGesture gest = new MyGesture(id, m_gestures[itemId], m_gestures[groupKey]);
                    gest.SetActionIcon(iL_actions);
                    gest.SetActionIcon(m_engine.ImgListActions);
                    gest.SetGestureIcon(iL_gestures);

                    int index = m_gestures.AutoInsert(new MyGesture(gest));
                    listView_GesturesActions.ResizeColumn = true; //will resize columns at the end
                    listView_GesturesActions.Items.Insert(index, m_gestures[index]);
                }
                listView_GesturesActions.Refresh(); //will resize columns at the end    
                listView_GesturesActions.Update();
                //listView_GesturesActions.ReselectItems();
                SaveSettings();
                RedrawGesture();
            }
            else //add new gestures
            {
                Form_addGesture addGesture = new Form_addGesture();
                addGesture.SelectedGroups = new List<MyGesture>() { m_gestures[groupKey] };
                addGesture.Gestures = new GesturesCollection(m_gestures.GetAll().ToArray());
                addGesture.ShowInTaskbar = false;
                addGesture.MyNNetwork = new MyNeuralNetwork(m_engine.Network);
                addGesture.MyNNetwork.LoadCurves();
                if (addGesture.ShowDialog() == DialogResult.OK)
                {
                    listView_GesturesActions.BeginUpdate();
                    foreach (MyGesture gesture in addGesture.NewGestures)
                    {
                        gesture.SetActionIcon(iL_actions);
                        gesture.SetActionIcon(m_engine.ImgListActions);
                        gesture.SetGestureIcon(iL_gestures);
                        int index = m_gestures.AutoInsert(new MyGesture(gesture));
                        listView_GesturesActions.ResizeColumn = true; //will resize columns at the end
                        // do not insert it because it should be added into collapsed group
                        if (index != -1)
                            listView_GesturesActions.Items.Insert(index, m_gestures[index]);
                    }
                    listView_GesturesActions.EndUpdate();
                    listView_GesturesActions.Refresh(); //will resize columns at the end               
                    m_engine.Network = addGesture.MyNNetwork;
                    CheckButtonsState();
                    SaveSettings();
                    RedrawGesture();
                }
            }

        }
示例#29
0
 private void btn_addApp_Click(object sender, EventArgs e)
 {
     GUI.Form_addGesture addGesture = new GUI.Form_addGesture();
     addGesture.Gestures = m_gesturesCollection;
     addGesture.AppMode = true;
     if (addGesture.ShowDialog() == DialogResult.OK)
     {                
         foreach (MyGesture gesture in addGesture.NewGestures)
         {
             MyGesture gestureToAdd = new MyGesture(gesture);
             gesture.SetActionIcon(iL_applications);
             m_gesturesCollection.Add(gestureToAdd);
             m_newGroups.Add(gestureToAdd);
             cCB_groups.AddItem(gestureToAdd.ID, gestureToAdd.Caption);
         }
     }
 }
示例#30
0
        private void tSB_modify_Click(object sender, EventArgs e)
        {
            if (listView_GesturesActions.SelectedItems.Count == 0
                || !PossibleToModify()) return;
            GesturesCollection modify = new GesturesCollection();
            GesturesCollection gestures = new GesturesCollection(m_gestures.GetAll().ToArray());
            List<string> curvesToDelete = new List<string>();
            for (int i = listView_GesturesActions.SelectedItems.Count; i > 0; i--)
            {
                string itemId = listView_GesturesActions.SelectedItems[i - 1].Name;
                modify.Add(new MyGesture(gestures[itemId]));

                bool classicCurve = gestures[itemId].Activator.Type == BaseActivator.Types.ClassicCurve;
                string curve = gestures.Remove(gestures[itemId]);
                if (curve != string.Empty && classicCurve)
                    curvesToDelete.Add(curve);
            }
            modify.Reverse();
            //GesturesCollection gestures = new GesturesCollection(m_gestures.ToArray());
            //gestures.RemoveAt(index);
            Form_modifyGesture modifyGesture = new Form_modifyGesture();
            modifyGesture.ModifiedGestures = modify.ToArray();
            modifyGesture.Gestures = gestures;
            modifyGesture.ShowInTaskbar = false;
            modifyGesture.MyNNetwork = new MyNeuralNetwork(m_engine.Network);
            modifyGesture.MyNNetworkOriginal = new MyNeuralNetwork(m_engine.Network);
            modifyGesture.MyNNetwork.LoadCurves();
            modifyGesture.MyNNetwork.UnlearnCurves(curvesToDelete.ToArray(), true);
            if (modify.Count == 1 && modify[0].IsGroup)
            {                
                modifyGesture.AppMode = true;
            }

            if (modifyGesture.ShowDialog() == DialogResult.OK)
            {
                m_engine.Network = modifyGesture.MyNNetwork;
                CheckButtonsState();
                listView_GesturesActions.BeginUpdate();
                foreach (MyGesture gesture in modifyGesture.ModifiedGestures)
                {
                    int index = m_gestures[gesture.ID].Index;
                    m_gestures[index] = new MyGesture(gesture);
                    m_gestures[index].SetActionIcon(iL_actions);                    
                    m_gestures[index].SetGestureIcon(iL_gestures);
                    m_gestures[index].SetActionIcon(m_engine.ImgListActions);
                    if (m_gestures.MatchedGestures(m_gestures[index].Activator.ID).Count == 1)
                        m_gestures[index].SetGestureIcon(iL_gestures);

                    listView_GesturesActions.Items[index] = m_gestures[index];
                }
                listView_GesturesActions.EndUpdate();
                listView_GesturesActions.Refresh(); //will resize column
                listView_GesturesActions.Update();
                SaveSettings();
                RedrawGesture();
            }
            else { } // DialogResult.Cancel
        }
示例#31
0
        private ToolStripMenuItem tSMI_dropDownMenu(MyGesture gesture)
        {
            //ToolStripMenuItem tSMI_menu = new ToolStripMenuItem();
            //tSMI_menu.Image = gesture.ImageList.Images[gesture.ID];
            //tSMI_menu.Text = gesture.ListItem.Caption;
            //tSMI_menu.Name = gesture.ID;
            ToolStripMenuItem tSMI_menu = gesture.ToToolStripMenuItem(m_imgListActions);

            tSMI_menu.DropDown = new ContextMenuStrip();
            ((ContextMenuStrip)tSMI_menu.DropDown).Text = form_top.CmsMatchedGestures.Text;//cMS_MatchedGestures.Text;
            ((ContextMenuStrip)tSMI_menu.DropDown).ShowImageMargin = false;
            ((ContextMenuStrip)tSMI_menu.DropDown).ShowCheckMargin = false;
            ((ContextMenuStrip)tSMI_menu.DropDown).ItemClicked += new ToolStripItemClickedEventHandler(cMS_MatchedGestures_ItemClicked);
            ToolStripMenuItem[] items = tSMI_arrayMenu(gesture);
            foreach (ToolStripMenuItem item in items)
            {
                //form_top.AddItemToCms((ContextMenuStrip)tSMI_menu.DropDown, item);
                //form_top.AddItemToCms(item);
                tSMI_menu.DropDownItems.Add(item);
            }
            return tSMI_menu;
        }
 private bool IsActive(MyGesture gesture)
 {
     return (gesture.Active && gesture.AppGroup.Active);
 }
示例#33
0
 void cMS_MatchedGestures_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {            
     ToolStripMenuItem item = (ToolStripMenuItem)e.ClickedItem;
     // do not close context menu when it contains dropdown menu - it has to open the context menu
     if (item.DropDown.Items.Count == 0)
         form_top.CloseContextMenuAsync();    
     m_execute = learntGestures[item.Name];
     switch (m_execute.Action.Name)
     {
         case TypeOfAction.SpecialOptions.SPECIAL_ZOOM:
             //int area_width = Math.Abs(area_right - area_left);
             //int area_height = Math.Abs(area_bottom - area_top);
             //ga.gAction.Details = string.Format("{0}:{1}:{2}:{3}", area_left, area_top, area_width, area_height);
             m_execute.Action.Details = string.Format("{0}:{1}:{2}:{3}", 10, 10, 100, 100);
             break;
         case TypeOfAction.WindowOptions.WND_TRANSPARENT:
             if (item.Tag != null)
                 m_execute.Action.Details = item.Tag.ToString();
             else return;
             break;
         case TypeOfAction.VolumeOptions.VOLUME_SET:
             if (item.Tag != null)
                 m_execute.Action.Details = item.Tag.ToString();
             else return;
             break;
     }
     Thread threadExecuteAction = new Thread(new ThreadStart(ExecuteAction));
     threadExecuteAction.Name = "Execute Action";
     threadExecuteAction.Start();
     //ExecuteAction();
 }