Пример #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ssEd ed = new ssEd(Environment.GetCommandLineArgs(), 1);

            ed.Log = new ssText(ed, "Type 'H' for help\r\n", null, "~~ss~~", ed.defs.encoding);
            ed.Log.AddForm(new ssForm(ed, ed.Log));

            Application.Run(ed.Log.Frm);
        }
Пример #2
0
        public void Init(ssEd ed, IntPtr hdc)
        {
            if (needsInit)
            {
                fontNum = ed.defs.fontNum;
                for (int i = 0; i < fontCnt; i++)
                {
                    fontNm[i]    = ed.defs.fontNm[i];
                    fontStyle[i] = ed.defs.fontStyle[i];
                    fontSz[i]    = ed.defs.fontSz[i];
                }

                opts = ssGDI.DT_TABSTOP | ssGDI.DT_EXPANDTABS | ssGDI.DT_NOPREFIX;

                autoIndent  = ed.defs.autoIndent;
                programming = ed.defs.programming;
                spInTab     = ed.defs.spInTab;
                expTabs     = ed.defs.expTabs;
                top         = ed.defs.top;
                left        = ed.defs.left;
                width       = ed.defs.width;
                height      = ed.defs.height;
                eventset    = ed.defs.eventSet;
            }

            font  = new Font(fontNm[fontNum], fontSz[fontNum], fontStyle[fontNum]);
            hfont = font.ToHfont();

            tm = new ssGDI.ssTEXTMETRIC();

            IntPtr oldfnt = ssGDI.SelectObject(hdc, hfont);

            if (!ssGDI.GetTextMetrics(hdc, ref tm))
            {
                throw new ssException("error getting text metrics");
            }
            //kps = new ssGDI.ssKERNINGPAIR[1000];
            //n = ssGDI.GetKerningPairsA(hdc, 0, null);
            ssGDI.SelectObject(hdc, oldfnt);

            aveCharWidth = tm.tmAveCharWidth;
            tabPix       = aveCharWidth * spInTab;
            lineht       = tm.tmHeight;

            dtp              = new ssGDI.ssDRAWTEXTPARAMS();
            dtp.cbSize       = (uint)System.Runtime.InteropServices.Marshal.SizeOf(dtp);
            dtp.iLeftMargin  = 0;
            dtp.iRightMargin = 0;
            dtp.iTabLength   = spInTab;

            needsInit = false;
        }
Пример #3
0
 public ssTransLog(ssEd e, ssText t)
 {
     ts             = null;
     log            = true;
     ed             = e;
     txt            = t;
     seqRoot        = new ssTrans(ssTrans.Type.delete, 0, t.dot, null, null);
     adjEdge        = new ssRange(0, 0);
     getnewtrans    = true;
     canconsolidate = true;
     savepoint      = 0;
     olddot         = new ssRange();
     rex            = new Regex(@"[\w\s]");
 }
Пример #4
0
        static void Main(string[] args)
        {
            ssEd ed = new ssEd(args, 0);

            ed.ProcessArgs();
            //
            for (;;)
            {
                string s = Console.ReadLine();
                if (s == null)
                {
                    s = "q";                 // on eof (if redirected) need to go through standard exit to save files, etc.
                }
                ed.Do(s);
            }
        }
Пример #5
0
        public void Show(ssEd ed)
        {
            ed.MsgLn("Supposedly " + len + " chars, " + pCnt + " pieces");
            int cnt  = 0;
            int pcnt = 0;

            for (piece p = head.nxt; p != tail; p = p.nxt)
            {
                cnt += p.len;
                pcnt++;

                /*ed.MsgLn((p.old ? "- " : "+ ")
                 + p.loc + ", "
                 + p.len
                 +  //+ (p.old ? oldTxt.Substring(p.loc, p.len) : newTxt.ToString(p.loc, p.len))
                 +  );*/
            }
            ed.MsgLn("Counted " + cnt + " chars, " + pcnt + " pieces");
            if (pCnt > pCntThresh)
            {
                //Reset(ToString());
            }
        }
Пример #6
0
        public ssText(ssEd ee, string s, string eoln, string n, Encoding enc)
        {
            nxt         = null;
            txt         = new ssRawTextV2(s);
            firstTry    = true;
            cmdaffected = false;
            dot         = new ssRange();
            mark        = new ssRange();
            EOLN        = eoln;
            fixedLn     = 0;
            if (EOLN == null)
            {
                EOLN = crlf;
            }
            nm       = n;
            ed       = ee;
            encoding = enc;
            tlog     = new ssTransLog(ed, this);

            /*/win Remove for non-windowing version
             * frms = null;
             * frm = null;
             * // Remove for non-windowing version */
        }