Example #1
0
 public IOProcessor(KeyProcessor kpr)
 {
     SetKPR(kpr);
     bf  = new Buffer();
     log = new Log();
     cfg = new Config("MyInput\\");
 }
Example #2
0
 public IOProcessor(KeyProcessor kpr)
 {
     SetKPR(kpr);
     bf = new Buffer();
     log = new Log();
     cfg = new Config("MyInput\\");
 }
Example #3
0
 public void SetActiveScript(KeyProcessor kpr)
 {
     ScriptName = kpr.getscript();
     iop = mfm.iop;
 }
Example #4
0
 internal void SetActiveScript(MyInput.Keyboard_Classes.KeyProcessor kp)
 {
     ScriptName = kp.getscript();
     this.iop   = mfm.iop;
 }
Example #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //MessageBox.Show("This version of MyInput Beta is for use by \r\nMyanmar Posts and Telecommunications\r\nfor demonstration purpose at ICT Week.\r\nAll other rights reserved.\r\nCopyright 2000-2010\r\nTechnomation Studios.");
            //UserInterface.Glass.ExtendGlassIntoClientArea(this, 0, 0, Width, Height);
            kp = new KeyProcessor("NULL");
            iop = new IOProcessor(kp);
            iop.SetMainHandle(this);
            imp = new IMEProcessor(kime, this, iop);
            //kl = new KeyboardLayout("NULL");
            dkstate = "none";
            cfg = new Config("MyInput\\");
            //cfg.Write("embed-crypt", EmbeddingControl.createPublicKey("589114946"));
            int xxx = Screen.GetWorkingArea(this).Width - this.Width + 1;
            int yyy = Screen.GetWorkingArea(this).Height - this.Height;
            string left = cfg.Read("mfx", xxx.ToString());
            string percent = cfg.Read("ypercent", Pixel2Percent(yyy, Screen.GetWorkingArea(this).Height).ToString());
            this.Top = Percent2Pixel(Convert.ToDouble(percent), Screen.GetWorkingArea(this).Height);
            this.Left = Convert.ToInt32(left);
            togglekey = Convert.ToInt32(cfg.Read("toggle", "119"));
            scrkey = Convert.ToInt32(cfg.Read("scriptshortcut", "122"));
            osk = Convert.ToInt32(cfg.Read("osk", "121"));
            enableenable = Convert.ToBoolean(cfg.Read("enableenable", "true"));
            toggleenable = Convert.ToBoolean(cfg.Read("toggleenable", "true"));
            screnable = Convert.ToBoolean(cfg.Read("screnable", "true"));
            autohide = Convert.ToBoolean(cfg.Read("autoshow", "true"));
            oskenable = Convert.ToBoolean(cfg.Read("oskenable", "true"));
            virtualize = Convert.ToBoolean(cfg.Read("virtualize", "true"));
            Layouts = new ArrayList();
            Scripts = new ArrayList();
            string[] s = System.IO.Directory.GetFiles("Layouts\\");
            foreach (string x in s)
            {
                if (x.EndsWith(".keylayout"))
                {
                    string ss = Directory.GetCurrentDirectory() + "\\" + x;
                    KeyboardLayout kl = new KeyboardLayout(ss);
                    if (kl.getname() != null)
                    {
                        Layout l = new Layout();
                        l.name = kl.getname();
                        l.isIME = false;
                        l.scripts = kl.getScripts();
                        Layouts.Add(l);
                    }
                    kl = null;
                }
                else if (x.EndsWith(".dll"))
                {
                    Layout l = new Layout();
                    l.name = x.Substring(x.LastIndexOf("\\") + 1);
                    l.name = l.name.Substring(0, l.name.IndexOf("."));
                    l.isIME = true;
                    l.scripts = null;
                    Layouts.Add(l);
                }
            }
            s = System.IO.Directory.GetFiles("Scripts\\");
            foreach (string x in s)
            {
                string ss = Directory.GetCurrentDirectory() + "\\" + x;
                if (ss.EndsWith(".ikl"))
                {
                    ss = ss.Substring(ss.LastIndexOf("\\") + 1);
                    ss = ss.Substring(0, ss.Length - 4);
                    if (!ScriptExists(ss))
                    {
                        Scripts.Add(ss);
                    }
                }
                else if (ss.EndsWith(".ikb"))
                {
                    ss = ss.Substring(ss.LastIndexOf("\\") + 1);
                    ss = ss.Substring(0, ss.Length - 4);
                    if (!ScriptExists(ss))
                    {
                        Scripts.Add(ss);
                    }
                }
            }

            foreach (string sx in Scripts)
            {
                ToolStripMenuItem i = new ToolStripMenuItem(sx);
                i.Click += ScriptClick;
                scripts_menu.Items.Add(i);
            }

            foreach (Layout l in Layouts)
            {
                ToolStripMenuItem i = new ToolStripMenuItem(l.name);
                i.Click += LayoutClick;
                layouts.Items.Add(i);
            }


            string lay = cfg.Read("layout", "Type Writer");
            string scr = cfg.Read("script", "MM Unicode");
            if (LayoutExists(lay))
            {
                laybtn.Text = lay;
            }
            else
            {
                laybtn.Text = "Type Writer";
            }
            if (ScriptExists(scr))
            {
                UpdateScript(scr);
            }
            else
            {
                UpdateScript("MM Unicode");
            }
            System.GC.Collect();
            if (!true)
            {
                try
                {
                    string sss = cfg.Read("embed-crypt");
                    if (EmbeddingControl.isValid(sss))
                    {
                        embedcrypt.Enabled = true;
                        actv.Enabled = false;
                        scrbtn.Enabled = false;
                        laybtn.Enabled = false;
                        //glassButton4.Enabled = false;
                    }
                    else
                    {
                        //internet();
                    }
                }
                catch (Exception ex)
                {
                    //internet();
                }
            }
            else
            {
                enablekey = Convert.ToInt32(cfg.Read("enable", "120"));
            }
            this.Refresh();
            Program.kh.SetHandle(this);
            Program.kh.Initiate();
        }
Example #6
0
        private void UpdateScript(string p)
        {
            MethodInvoker mk = delegate
            {
                kp = new KeyProcessor(p);
                iop.SetKPR(kp);
                if (kl != null)
                {
                    if (hw != null)
                        hw.SetActiveScript(kp);
                }
                else if (kime != null)
                {
                    imp.Reset(kime, iop);
                }
                cfg.Write("script", p);
            };
            scrbtn.Text = p;
            scrbtn.Enabled = false;
            mk.BeginInvoke(UpdateScriptCB, null);
            if (!donwarn)
            {
                if (p == "ZawGyi" || p == "XPartial")
                {

                    Warning w = new Warning();
                    w.SetText(p);
                    w.Show();
                    w.Top = this.Top - 28;
                    w.Left = this.Left;
                    w.Width = this.Width;
                }
            }
            else
            {
                donwarn = false;
            }
        }
Example #7
0
 public void SetKPR(KeyProcessor kpr)
 {
     kp     = kpr;
     Script = kpr.getscript();
 }
Example #8
0
 public void SetKPR(KeyProcessor kpr)
 {
     kp = kpr;
     Script = kpr.getscript();
 }