Exemplo n.º 1
0
 //win Remove for non-windowed version
 public void AddForm(ssForm f)
 {
     f.Nxt    = frms;
     frms     = f;
     frm      = f;
     frm.Text = FileName();
 }
Exemplo n.º 2
0
 public void DeleteAllForms()
 {
     for (ssForm f = frms; f != null; f = f.Nxt)
     {
         f.Close();
     }
 }
Exemplo n.º 3
0
        ssEvent pEvent(ssScanner scnr, ssForm f)
        {
            ssEvent e = new ssEvent();

            try {
                scnr.GetStrSpDelim(); e.k = (Keys)keyconv.ConvertFromString(scnr.S);
                scnr.GetStrSpDelim(); e.t = pType(scnr.S);
                if (e.t == ssEventType.press)
                {
                    scnr.GetStrSpDelim(); e.c = pChar(scnr.S);
                }
                if (scnr.C != '|' && scnr.C != '+' && scnr.C != ';')
                {
                    scnr.GetStrSpDelim(); e.a = pAction(scnr.S);
                }
                if (scnr.C != '|' && scnr.C != '+' && scnr.C != ';')
                {
                    scnr.GetStrSpDelim(); e.cont = bool.Parse(scnr.S);
                }
            }
            catch (Exception ee) {
                throw new ssException("error parsing event in events file" + "\r\n?" + ee.Message);
            }
            return(e);
        }
Exemplo n.º 4
0
        public ssEventDecoderV1(ssForm f)
        {
            frm     = f;
            evFile  = "ssEvents.ini";
            keyconv = new KeysConverter();
            methods = Type.GetType("ss.ssForm").GetMethods(
                BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
            actiontyp = Type.GetType("ss.ssAction");

            events    = LoadEvents(f, evFile);
            ematch    = events;
            ematchcnt = 0;

            mods     = new ssEvent();
            modstail = mods;

            elog     = new ssEvent();
            elogtail = elog;
            elogcnt  = 0;
            logging  = false;

            prvmod = Keys.None;

            defInsert = pAction("InsertChar");

            enabled = true;
        }
Exemplo n.º 5
0
 public void InvalidateMarksAndChange(int loc)
 {
     //win Remove contents of this routine for non-windowing version
     for (ssForm f = frms; f != null; f = f.Nxt)
     {
         f.InvalidateMarksAndChange(loc);
     }
     // Remove contents of this routine for non-windowing version */
 }
Exemplo n.º 6
0
 public void AdjMarks(int loc, int chg, bool insert)
 {
     //win Remove contents of this routine for non-windowing version
     for (ssForm f = frms; f != null; f = f.Nxt)
     {
         f.AdjMarks(loc, chg, insert);
     }
     // Remove contents of this routine for non-windowing version */
 }
Exemplo n.º 7
0
 public void FixLineLen(int n)
 {
     fixedLn = n;
     //win Remove contents of this routine for non-windowing version
     for (ssForm f = frms; f != null; f = f.Nxt)
     {
         f.ReDisplay();
     }
     // Remove contents of this routine for non-windowing version */
 }
Exemplo n.º 8
0
        // Remove contents of this routine for non-windowing version */


        public void ChangeEoln(string s)
        {
            EOLN = s;
            //win Remove contents of this routine for non-windowing version
            for (ssForm f = frms; f != null; f = f.Nxt)
            {
                f.ReDisplay();
            }
            // Remove contents of this routine for non-windowing version */
        }
Exemplo n.º 9
0
 //win Remove contents of this routine for non-windowing version
 public void MenuClick(Object sender, EventArgs e)
 {
     ed.WakeUpText(this);
     if (frms == null)
     {
         ssForm f = new ssForm(ed, this);
         AddForm(f);
         f.Show();
     }
 }
Exemplo n.º 10
0
        // Remove for non-windowed version */


        public void Rename(string n)
        {
            nm = n;
            ed.Msg(MenuLine());
            //win remove for non-windowed version
            for (ssForm f = frms; f != null; f = f.Nxt)
            {
                f.Text = FileName();
            }
            // remove for non-windowed version */
        }
Exemplo n.º 11
0
        ssEvent pEvent(ssScanner scnr, ssForm f)
        {
            ssEvent e;

            try {
                scnr.GetStrSpDelim();
                eSet es = FindEventSet(subsets, scnr.S);
                if (es != null)
                {
                    e = es.e.nxt.copy();
                    if (!AtEventBoundry(scnr))
                    {
                        scnr.GetChar();
                    }
                }
                else
                {
                    e   = new ssEvent();
                    e.k = (Keys)keyconv.ConvertFromString(scnr.S);
                    scnr.GetStrSpDelim(); e.t = pType(scnr.S);
                    if (e.t == ssEventType.press)
                    {
                        scnr.GetStrSpDelim(); e.c = pChar(scnr.S);
                    }
                    if (!AtEventBoundry(scnr))
                    {
                        scnr.GetStrSpDelim(); e.a = pAction(scnr.S, ref e.cmdopt);
                    }
                    if (!AtEventBoundry(scnr))
                    {
                        scnr.GetStrSpDelim(); e.cont = bool.Parse(scnr.S);
                    }
                    if (e.cmdopt != ssEventCmdOption.none)
                    {
                        scnr.SetDelim("\n");
                        scnr.AllowComment    = false;
                        scnr.GetStr(); e.cmd = scnr.S;
                        scnr.AllowComment    = true;
                        scnr.SetDelim("");
                        if (!AtEventBoundry(scnr))
                        {
                            scnr.GetChar();
                        }
                    }
                }
            }
            catch (Exception ee) {
                scnr.SetDelim("");
                scnr.AllowComment = true;
                throw new ssException("error parsing event in events file" + "\r\n?" + ee.Message);
            }
            return(e);
        }
Exemplo n.º 12
0
        eSet pSet(ssScanner scnr, ssForm f)
        {
            eSet es = null;
            eSet ss = null;

            for (;;)
            {
                switch (scnr.C)
                {
                case '=':
                case '<':
                    char c = scnr.C;
                    scnr.GetChar();
                    scnr.GetStrSpDelim();
                    eSet s = new eSet(null);
                    s.nm    = scnr.S;
                    s.e     = new ssEvent();
                    s.e.nxt = pEventTree(scnr, f);
                    if (c == '=')
                    {
                        s.nxt = es;
                        es    = s;
                    }
                    else
                    {
                        s.nxt   = subsets;
                        subsets = s;
                    }
                    break;

                case '\0':
                    return(es);

                default:
                    if (char.IsWhiteSpace(scnr.C))
                    {
                        scnr.GetChar();
                    }
                    else
                    {
                        throw new ssException("error parsing event set in events file");
                    }
                    break;
                }
            }
        }
Exemplo n.º 13
0
        private ssEvent LoadEvents(ssForm f, string fnm)
        {
            ssEvent es = new ssEvent();

            fnm = System.IO.Path.GetDirectoryName(Application.ExecutablePath) +
                  System.IO.Path.DirectorySeparatorChar + fnm;

            int       cnt  = 0;
            ssScanner scnr = null;

            while (cnt < 2 && scnr == null)
            {
                try {
                    cnt++;
                    scnr = new ssScanner(File.ReadAllText(fnm), true);
                    scnr.GetChar();
                }
                catch {
                    try {
                        if (cnt < 2)
                        {
                            f.Ed.MsgLn("creating default events file");
                            File.WriteAllText(fnm, defEvents);
                        }
                        else
                        {
                            throw new ssException("no events file");
                        }
                    }
                    catch (Exception ee) {
                        f.Ed.Err("error writing default events file" + "\r\n" + ee.Message);
                    }
                }
            }

            try {
                es.nxt = pEventTree(scnr, f);
            }
            catch (Exception e) {
                if (f == f.Ed.Log.Frm)
                {
                    f.Ed.Err(e.Message + ": " + scnr.S);                    // Guard this so you don't get messages for every form created.
                }
            }
            return(es);
        }
Exemplo n.º 14
0
        ssEvent pEventTree(ssScanner scnr, ssForm f)
        {
            ssEvent rt = pEvent(scnr, f);
            ssEvent e  = LastAlt(rt);

            for (;;)
            {
                switch (scnr.C)
                {
                case '|':
                    scnr.GetChar();
                    e.alt = pEvent(scnr, f);
                    e     = LastAlt(e);
                    break;

                case '+':
                    scnr.GetChar();
                    e.nxt = pEventTree(scnr, f);
                    break;

                case ';':
                    scnr.GetChar();
                    return(rt);

                case '\0':
                    return(rt);

                default:
                    if (char.IsWhiteSpace(scnr.C))
                    {
                        scnr.GetChar();
                    }
                    else
                    {
                        throw new ssException("error parsing event tree in events file");
                    }
                    break;
                }
            }
        }
Exemplo n.º 15
0
        public ssEventDecoderV2(ssForm f)
        {
            frm = f;
            ssEventCmdOption x = ssEventCmdOption.exec;

            evFile  = "ssEvents.ini";
            keyconv = new KeysConverter();
            methods = Type.GetType("ss.ssForm").GetMethods(
                BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
            defInsert = pAction("InsertChar", ref x);

            subsets = null;
            if (f == f.Ed.Log.Frm)
            {
                esets = LoadEvents(f, evFile);
            }
            else
            {
                esets = f.Ed.Log.Frm.Evd.esets;
            }
            curset = esets;
            SetEventSet(f.Ed.defs.eventSet);
        }
Exemplo n.º 16
0
        public void DeleteForm(ssForm ff)
        {
            ssForm p = null, f = frms;

            while (f != null && f != ff)
            {
                p = f; f = f.Nxt;
            }
            if (f == null)
            {
                return;
            }
            if (p == null)
            {
                frms = f.Nxt;
                frm  = frms;
            }
            else
            {
                p.Nxt = f.Nxt;
                frm   = p;
            }
        }
Exemplo n.º 17
0
        private eSet LoadEvents(ssForm f, string fnm)
        {
            eSet es = null;
            //ssEvent es = new ssEvent();

            int       cnt  = 0;
            ssScanner scnr = null;

            while (cnt < 2 && scnr == null)
            {
                try {
                    cnt++;
                    try {
                        scnr = new ssScanner(File.ReadAllText(fnm), true); // try local
                    }
                    catch {
                        fnm = System.IO.Path.GetDirectoryName(Application.ExecutablePath) +
                              System.IO.Path.DirectorySeparatorChar + fnm;
                        scnr = new ssScanner(File.ReadAllText(fnm), true); // try exe one
                    }
                    scnr.GetChar();
                }
                catch {
                    try {
                        if (cnt < 2)
                        {
                            f.Ed.MsgLn("creating default events file");
                            StreamWriter sw = new StreamWriter(fnm);
                            sw.WriteLine(defEvents);
                            sw.WriteLine("# Available commands:");
                            foreach (MethodInfo m in methods)
                            {
                                if (m.Name.Length > 2 && m.Name.Substring(0, 3) == "Cmd")
                                {
                                    sw.WriteLine(string.Format("#   {0}", m.Name));
                                }
                            }
                            sw.Close();
                        }
                        else
                        {
                            throw new ssException("no events file");
                        }
                    }
                    catch (Exception ee) {
                        f.Ed.Err("error writing default events file" + "\r\n" + ee.Message);
                    }
                }
            }

            try {
                es = pSet(scnr, f);
            }
            catch (Exception e) {
                if (f == f.Ed.Log.Frm)
                {
                    f.Ed.Err(e.Message + ": " + scnr.S);                    // Guard this so you don't get messages for every form created.
                }
            }
            return(es);
        }
Exemplo n.º 18
0
 public bool LastForm(ssForm f)
 {
     return(f == frms && f.Nxt == null);
 }