public void edit_slide_button(DiagramKey key)
 {
     if (key.TypeName != DiagramKey.KEY_SLIDEH &&
         key.TypeName != DiagramKey.KEY_SLIDEV)
     {
         return;
     }
     _SlideKey = key;
     show_key(key);
     if (this.ShowDialog() == DialogResult.OK)
     {
     }
     else
     {
     }
 }
        private void save_key(DiagramKey key)
        {
            switch (key.TypeName)
            {
            case DiagramKey.KEY_SLIDEV:
            {
                save_slidev_key((DiagramKeySlideV)key);
            }
            break;

            case DiagramKey.KEY_SLIDEH:
            {
                save_slideh_key((DiagramKeySlideH)key);
            }
            break;
            }
        }
Example #3
0
        //[Category("Legend Sheet")]
        //[DisplayName("Background color")]
        //[Editor(typeof(ColorEditorUI), typeof(UITypeEditor))]
        //[TypeConverter(typeof(ColorConverterUI))]
        //public new Color BackColor
        //{
        //    get { return base.BackColor; }
        //    set
        //    {
        //        if (base.BackColor != value)
        //        {
        //            if (m_objs != null)
        //                m_objs.Snapshot();
        //            base.BackColor = value;
        //            this.Modified = true;
        //            if (this.OnRefreshPropertiesGrid != null)
        //                this.OnRefreshPropertiesGrid(this, null);
        //            //Refresh();
        //        }
        //    }
        //}
        //public enum PS2Code
        //{
        //    AT = 1, //AT,XT,PS2
        //    XT,
        //    PS2,


        //}
        //private PS2Code _PS2Set = PS2Code.XT ;
        //[DisplayName("PS/2 Set")]
        //[Description("PS/2 code set")]
        //public PS2Code PS2Set
        //{
        //    get { return _PS2Set; }
        //    set
        //    {
        //        if (_PS2Set != value)
        //        {

        //            _PS2Set = value;
        //            this.Modified = true;
        //        }
        //    }
        //}
        #endregion

        public void set_all_keys_beep_duration(int nDuration)
        {
            int ncount = m_objs.GetSize();

            for (int i = 0; i < ncount; i++)
            {
                DiagramEntity entity = (DiagramEntity)m_objs.GetAt(i);
                if (entity.TypeName == DiagramKeyMatrix.KEY_MATRIX)
                {
                    ((DiagramKeyMatrix)entity).set_all_child_beep_duration(nDuration);
                }
                else
                {
                    DiagramKey key = (DiagramKey)m_objs.GetAt(i);
                    key.BeepDuration = nDuration;
                }
            }
        }
Example #4
0
        public override void ExportToXml(CLCIXML xml)

        /* ============================================================
         *      Function :		ExportToXml
         *      Description :	Saves a string representation of the
         *                                      container (normally the virtual size) and
         *                                      all objects to "stra".
         *      Access :		Public
         *
         *      Return :		void
         *      Parameters :	CStringArray& stra	-	The array to fill
         *
         *      Usage :			Call to save the data of the editor to a
         *                                      XML.
         *
         * ============================================================*/
        {
            xml.new_group("screen", true);
            xml.new_attribute("image", DiagramKey.ImageToBase64(this.Image, ImageFormat.Png));
            xml.new_attribute("bg", ColorTranslator.ToWin32(this.BackColor).ToString());
            xml.new_attribute("borderbg", ColorTranslator.ToWin32(this.BorderColor).ToString());
            xml.new_attribute("interchardelay", this.InterCharDelay.ToString());
            xml.new_attribute("sensitivity", this.Sensitivity.ToString());
            xml.new_attribute("touchdelay", this.TouchDelay.ToString());
            xml.new_attribute("macro1", this.Macro1.ToString());
            xml.new_attribute("macro2", this.Macro2.ToString());
            xml.new_attribute("macro3", this.Macro3.ToString());
            xml.new_attribute("macro4", this.Macro4.ToString());
            xml.new_attribute("macro5", this.Macro5.ToString());
            xml.new_attribute("count", m_objs.GetSize().ToString());
            xml.back_to_parent();

            m_objs.ExportToXml(xml);

            this.Modified = false;; // SetModified(FALSE);
        }
Example #5
0
        /// <summary>
        /// load setting from cvs text
        /// 0	[0,0,1,1][0][0][Macro key contents] <0x0d> <0x0a>	Macro1
        //1	[0,0,1,1][0][0][Macro key contents] <0x0d> <0x0a>	Macro2
        //2	[0,0,1,1][0][0][Macro key contents] <0x0d> <0x0a>	Macro3
        //3	[0,0,1,1][0][0][Macro key contents] <0x0d> <0x0a>	Macro4
        //4	[0,0,1,1][0][0][Macro key contents] <0x0d> <0x0a>	Macro5
        //5	[Key rectangle][Beep pitch][Beep duration][Key content 0] ... [Key content n]<0x0d><0x0a>	Key definitions
        //...	  ...	  ...
        //...	  ...	  ...
        //Last	[PS2 code set][Inter-Code-Delay][Touch sensitivity][Touch delay]<0x0d><0x0a>	Properties definition

        /// </summary>
        /// <param name="strCVS"></param>
        public void LoadCSV(string strCSV)
        {
            if (strCSV.Length == 0)
            {
                return;
            }
            List <string> ar = new List <string>();

            if (Util.string2lines(strCSV, ar) < 5)
            {
                return;
            }

            string s = "";

            //parse 5 macro
            s = ar[0];
            this.Macro1.FromCSV(parse_csv_macro(s));

            s = ar[1];
            this.Macro2.FromCSV(parse_csv_macro(s));

            s = ar[2];
            this.Macro3.FromCSV(parse_csv_macro(s));

            s = ar[3];
            this.Macro4.FromCSV(parse_csv_macro(s));

            s = ar[4];
            this.Macro5.FromCSV(parse_csv_macro(s));



            //others is the buttons setting, except last line
            int i = 5;

            //for (int i=5; i<ar.Count-1; i++)
            while (i < ar.Count - 1)
            {
                DiagramKey key = null;
                s = ar[i];
                if (!is_key_csv(s))
                {
                    i++;
                    continue;
                }
                if (s.IndexOf(KB9Const.CSV_SlideL) >= 0)
                {
                    //if (i + 3 < ar.Count - 1)
                    //{
                    key = parse_csv_key_slideh(s);
                    //i += 4;

                    //}
                    //else
                    i++;
                }
                else if (s.IndexOf(KB9Const.CSV_SlideU) >= 0)
                {
                    // if (i + 3 < ar.Count - 1)
                    //{
                    key = parse_csv_key_slidev(s);    //, ar[i + 1], ar[i + 2], ar[i + 3]);
                    //  i += 4;
                    //}
                    //else
                    i++;
                }
                else
                {
                    key = parse_csv_key_area(s);
                    i++;
                }

                if (key != null)
                {
                    m_objs.Add(key);
                }
            }

            s = ar[ar.Count - 1];
            parse_csv_kb9000(s);

            this.Refresh();
            FireShowPropertiesEvent(null);
        }
Example #6
0
        public override bool ImportFromXml(CLCIXML xml)

        /* ============================================================
         *      Function :		ImportFromXml
         *      Description :	Load configuration from application self xml file.
         *      Access :		Public
         *
         *      Return :		bool				-	"true" if "str" is a
         *                                                                                      representation of a
         *                                                                                      'paper'.
         *      Parameters :	const string& str	-	String representation.
         *
         *      Usage :			Call to set the size of the virtual paper
         *                                      from a string.
         *
         * ============================================================*/
        {
            //load background color
            xml.back_to_root();
            if (!xml.get_first_group("screen"))
            {
                return(false);
            }
            string s = "";

            xml.get_attribute("image", ref s);
            if (s.Length > 0)
            {
                this._Image = DiagramKey.Base64ToImage(s);
            }

            string strVal = string.Empty;

            xml.get_attribute("bg", ref strVal);
            //if (strVal == string.Empty)
            //    strVal = "16777215";
            Color c = System.Drawing.ColorTranslator.FromWin32(Util.string2int(strVal, 16777215));

            this.BackColor = c;

            strVal = string.Empty;
            xml.get_attribute("borderbg", ref strVal);
            //if (strVal == string.Empty)
            //    strVal = "16777215";
            Color clr = System.Drawing.ColorTranslator.FromWin32(Util.string2int(strVal, 16777215));

            this.BorderColor = clr;


            strVal = "";
            xml.get_attribute("interchardelay", ref strVal);
            this.InterCharDelay = Util.string2int(strVal, 50);//.ToString());

            strVal = "";
            xml.get_attribute("sensitivity", ref strVal);
            this.Sensitivity = Util.string2int(strVal, 50);//.ToString());

            strVal = "";
            xml.get_attribute("touchdelay", ref strVal);
            this.TouchDelay = Util.string2int(strVal, 50);//.ToString());


            strVal = "";
            xml.get_attribute("macro1", ref strVal);
            this.Macro1.SetKeyCodeString(strVal);

            strVal = "";
            xml.get_attribute("macro2", ref strVal);
            this.Macro2.SetKeyCodeString(strVal);

            strVal = "";
            xml.get_attribute("macro3", ref strVal);
            this.Macro3.SetKeyCodeString(strVal);

            strVal = "";
            xml.get_attribute("macro4", ref strVal);
            this.Macro4.SetKeyCodeString(strVal);

            strVal = "";
            xml.get_attribute("macro5", ref strVal);
            this.Macro5.SetKeyCodeString(strVal);

            //////////////

            xml.get_attribute("count", ref strVal);
            int nCount = int.Parse(strVal);

            xml.back_to_parent();
            bool result = m_objs.ImportFromXml(xml, nCount);

            m_objs.ClearRedo();
            m_objs.ClearUndo();
            Refresh();

            return(result);
        }