]> bicyclesonthemoon.info Git - cpied/commitdiff
- Added mouse support v1.2a
authorb <rowerynaksiezycu@gmail.com>
Tue, 9 Jul 2013 12:39:00 +0000 (14:39 +0200)
committerb <rowerynaksiezycu@gmail.com>
Tue, 9 Jul 2013 12:39:00 +0000 (14:39 +0200)
CPIED.CPP [moved from NAPISY.CPP with 52% similarity]
CPIED.PRJ [moved from NAPISY.PRJ with 80% similarity]
readthis.txt

similarity index 52%
rename from NAPISY.CPP
rename to CPIED.CPP
index 4ccbf744ef7b10e75788cacb5e6895aae873734d..b7297021773967b3f096d495a83a627a1219cea3 100644 (file)
+++ b/CPIED.CPP
@@ -7,6 +7,9 @@
 #include <dos.h>\r
 #include <bios.h>\r
 \r
+#define resetMaus setMaus\r
+\r
+//Strustures in the CPI file format\r
 struct FontFileHeader\r
 {\r
        unsigned char id0;\r
@@ -102,6 +105,7 @@ struct ScreenFontBitmap8
        int byo14[16];\r
        int byo16[16];\r
        int wys=8;\r
+       int prew;\r
        int cp=0;\r
        int lit=0x42;\r
        int pre;\r
@@ -111,8 +115,118 @@ struct ScreenFontBitmap8
        int prey;\r
        int key;\r
        int tab=0;\r
+       int pret;\r
        int any=0;\r
        char abc[17]="0123456789ABCDEF";\r
+       REGS iR;\r
+       REGS oR;\r
+       SREGS sR;\r
+       int maus=0;\r
+       int mausv=1;\r
+       int mausx;\r
+       int mausy;\r
+       //int premx;\r
+       //int premy;\r
+       int klik;\r
+       int prek;\r
+\r
+       \r
+void showMaus();\r
+void hideMaus();\r
+int setMaus();\r
+void getMaus(int *x,int *y,int *k);\r
+\r
+void nullpointers();\r
+void offset();\r
+\r
+void new8 ();\r
+void menu8();\r
+void cpwys();\r
+\r
+void displayDialog(int color,  char *text,  int type=0);\r
+int      message  (char *text, char *value, int type=1);\r
+void     question (char *text, char *result);\r
+unsigned question (char *text);\r
+\r
+void ramka8 ();\r
+void ramka14();\r
+void ramka16();\r
+void lin8 (int mode=0);\r
+void lin14(int mode=0);\r
+void lin16(int mode=0);\r
+void lit8 (int mode=0);\r
+void lit14(int mode=0);\r
+void lit16(int mode=0);\r
+\r
+void spc8 ();\r
+void spc14();\r
+void spc16();\r
+void bsp8 ();\r
+void bsp14();\r
+void bsp16();\r
+void ent8 ();\r
+void ent14();\r
+void ent16();\r
+\r
+int otw();\r
+int otw2();\r
+\r
+int zap();\r
+int zap2();\r
+\r
+int zmn();\r
+\r
+int newCPI ();\r
+int newCPI2(short CP, short h);\r
+\r
+void deleteCPI(short st=6,short a=0,short b=0);\r
+\r
+int newCP ();\r
+int newCP2(short CP,short h);\r
+\r
+int delCP();\r
+\r
+int newF  ();\r
+int newF2 (short h);\r
+int newF8 (short CP);\r
+int newF14(short CP);\r
+int newF16(short CP);\r
+\r
+int delF  ();\r
+int delF8 (short h);\r
+int delF14(short h);\r
+int delF16(short h);\r
+\r
+int main(int argc,char* argv[]);\r
+\r
+void showMaus()\r
+{\r
+       iR.x.ax=0x0001;\r
+       int86(0x33,&iR,&oR);\r
+}\r
+\r
+void hideMaus()\r
+{\r
+       iR.x.ax=0x0002;\r
+       int86(0x33,&iR,&oR);\r
+}\r
+\r
+int setMaus()\r
+{\r
+       iR.x.ax=0x0000;\r
+       oR.x.ax=0x0000;\r
+       int86(0x33,&iR,&oR);\r
+       return oR.x.ax;\r
+}\r
+\r
+void getMaus(int *x,int *y,int *k)\r
+{\r
+       iR.x.ax=0x0003;\r
+       int86(0x33,&iR,&oR);\r
+       *y=oR.x.dx;\r
+       *x=oR.x.cx;\r
+       *k=oR.x.bx;\r
+}\r
 \r
 void nullpointers()\r
 {\r
@@ -163,7 +277,7 @@ void offset()
        }\r
 \r
 }\r
-void deleteCPI(short st=6,short a=0,short b=0)\r
+void deleteCPI(short st,short a,short b)\r
 {\r
        short i,j;\r
        switch(st)\r
@@ -274,9 +388,9 @@ void new8()
        cleardevice();\r
        setcolor(GREEN);\r
        \r
-       outtextxy(0,0,  "Edytor napis¢w±");\r
+       outtextxy(0,0,  "CPI editor 1.2±");\r
        outtextxy(0,8,  "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");\r
-       outtextxy(600,16,"v1.1b");\r
+       //outtextxy(600,16,"v1.2a");\r
 }\r
 void menu8()\r
 {\r
@@ -296,10 +410,30 @@ void cpwys()
        outtextxy(0x78,0,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
        if(any)\r
        {\r
-               if(strlen(nazwap)<52)\r
-                       sprintf(cpw,"°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+               if((unsigned)(CPEH[cp]->codepage)>=1000)\r
+               {\r
+                       if((unsigned)(CPEH[cp]->codepage)>=10000)\r
+                       {\r
+                               if(strlen(nazwap)<52)\r
+                                       sprintf(cpw,"°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+                               else\r
+                                       sprintf(cpw,"°cp%03u°8x%02d°path too long°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys);\r
+                       }\r
+                       else\r
+                       {\r
+                               if(strlen(nazwap)<52)\r
+                                       sprintf(cpw,"°°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+                               else\r
+                                       sprintf(cpw,"°°cp%03u°8x%02d°path too long°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys);\r
+                       }\r
+               }\r
                else\r
-                       sprintf(cpw,"°cp%03u°8x%02d°path too long°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys);\r
+               {\r
+                       if(strlen(nazwap)<52)\r
+                               sprintf(cpw,"°°°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+                       else\r
+                               sprintf(cpw,"°°°cp%03u°8x%02d°path too long°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys);\r
+               }\r
        }\r
        else\r
                strcpy(cpw, "°No CPI open°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");\r
@@ -353,7 +487,7 @@ void ramka16()
                setcolor(RED);\r
        rectangle(495,110,624,367);\r
 }\r
-void lin14(int mode=0)\r
+void lin14(int mode)\r
 {\r
        if(!any)\r
                return;\r
@@ -468,7 +602,7 @@ void lin14(int mode=0)
                break;\r
        }\r
 }\r
-void lin8(int mode=0)\r
+void lin8(int mode)\r
 {\r
        if(!any)\r
                return;\r
@@ -583,7 +717,7 @@ void lin8(int mode=0)
                break;\r
        }\r
 }\r
-void lin16(int mode=0)\r
+void lin16(int mode)\r
 {\r
        if(!any)\r
                return;\r
@@ -698,7 +832,7 @@ void lin16(int mode=0)
                break;\r
        }\r
 }\r
-void lit8(int mode=0)\r
+void lit8(int mode)\r
 {\r
        if(!any)\r
                return;\r
@@ -747,25 +881,28 @@ void lit8(int mode=0)
                setcolor(color);\r
                ab[0]=abc[curx];\r
                outtextxy(20+16*curx,24,ab);\r
-               ab[0]=abc[cury];\r
-               outtextxy(8,36+16*cury,ab);\r
-               if(SFB8[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
-               {\r
-                       setcolor(BROWN);\r
-                       setfillstyle(SOLID_FILL,BROWN);\r
-               }\r
-               else\r
-               {\r
-                       setcolor(BLACK);\r
-                       setfillstyle(SOLID_FILL,BLACK);\r
-               }\r
-               bar(0x10+curx*0x10,0x20+cury*0x10,0x1f+curx*0x10,0x2f+cury*0x10);\r
-               if(wys==8)\r
-               {\r
-                       setcolor(GREEN);\r
-                       rectangle(0x10 + curx*0x10, 0x20 + cury*0x10 ,0x1f + curx*0x10, 0x2f + cury*0x10);\r
-                       setcolor(BLACK);\r
-                       rectangle(0x11 + curx*0x10, 0x21 + cury*0x10, 0x1e + curx*0x10, 0x2e + cury*0x10);\r
+               if(cury<8)\r
+                       {\r
+                       ab[0]=abc[cury];\r
+                       outtextxy(8,36+16*cury,ab);\r
+                       if(SFB8[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+                       {\r
+                               setcolor(BROWN);\r
+                               setfillstyle(SOLID_FILL,BROWN);\r
+                       }\r
+                       else\r
+                       {\r
+                               setcolor(BLACK);\r
+                               setfillstyle(SOLID_FILL,BLACK);\r
+                       }\r
+                       bar(0x10+curx*0x10,0x20+cury*0x10,0x1f+curx*0x10,0x2f+cury*0x10);\r
+                       if(wys==8)\r
+                       {\r
+                               setcolor(GREEN);\r
+                               rectangle(0x10 + curx*0x10, 0x20 + cury*0x10 ,0x1f + curx*0x10, 0x2f + cury*0x10);\r
+                               setcolor(BLACK);\r
+                               rectangle(0x11 + curx*0x10, 0x21 + cury*0x10, 0x1e + curx*0x10, 0x2e + cury*0x10);\r
+                       }\r
                }\r
                break;\r
        case 0:\r
@@ -813,7 +950,7 @@ void lit8(int mode=0)
                break;\r
        }\r
 }\r
-void lit14(int mode=0)\r
+void lit14(int mode)\r
 {\r
        if(!any)\r
                return;\r
@@ -862,25 +999,28 @@ void lit14(int mode=0)
                setcolor(color);\r
                ab[0]=abc[curx];\r
                outtextxy(20+16*curx,215,ab);\r
-               ab[0]=abc[cury];\r
-               outtextxy(8,227+16*cury,ab);\r
-               if(SFB14[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
-               {\r
-                       setcolor(BROWN);\r
-                       setfillstyle(SOLID_FILL,BROWN);\r
-               }\r
-               else\r
-               {\r
-                       setcolor(BLACK);\r
-                       setfillstyle(SOLID_FILL,BLACK);\r
-               }\r
-               bar(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
-               if(wys==14)\r
+               if(cury<14)\r
                {\r
-                       setcolor(GREEN);\r
-                       rectangle(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
-                       setcolor(BLACK);\r
-                       rectangle(17+curx*16,224+cury*16,30+curx*16,237+cury*16);\r
+                       ab[0]=abc[cury];\r
+                       outtextxy(8,227+16*cury,ab);\r
+                       if(SFB14[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+                       {\r
+                               setcolor(BROWN);\r
+                               setfillstyle(SOLID_FILL,BROWN);\r
+                       }\r
+                       else\r
+                       {\r
+                               setcolor(BLACK);\r
+                               setfillstyle(SOLID_FILL,BLACK);\r
+                       }\r
+                       bar(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
+                       if(wys==14)\r
+                       {\r
+                               setcolor(GREEN);\r
+                               rectangle(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
+                               setcolor(BLACK);\r
+                               rectangle(17+curx*16,224+cury*16,30+curx*16,237+cury*16);\r
+                       }\r
                }\r
                break;\r
        case 0:\r
@@ -928,7 +1068,7 @@ void lit14(int mode=0)
                break;\r
        }\r
 }\r
-void lit16(int mode=0)\r
+void lit16(int mode)\r
 {\r
        if(!any)\r
                return;\r
@@ -1085,7 +1225,7 @@ int otw2()
        int c;\r
        int d;\r
        int NT;\r
-       \r
+\r
        \r
        CPI=fopen(nazwap,"rb");\r
 \r
@@ -1395,7 +1535,7 @@ int zap2()
                }\r
        }\r
 \r
-       fprintf(CPI,"\r\nTen plik zosta\88 wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.1b\r\n autor programu:  Balthasar Szczepaäski%c",0x1a);\r
+       fprintf(CPI,"\r\nTen plik zosta\88 wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.2a\r\n autor programu:  Balthasar Szczepaäski%c",0x1a);\r
 \r
        fclose(CPI);\r
        return 0;\r
@@ -1611,7 +1751,7 @@ int delCP()
        byo16[FIH->num_codepages] = 0;\r
        byo14[FIH->num_codepages] = 0;\r
        byo8[FIH->num_codepages] = 0;\r
-       \r
+\r
        sprintf(err,"0:OK");\r
        return 0;\r
 }\r
@@ -1758,7 +1898,7 @@ int newCPI2(short CP, short h)
        return 0;\r
 }\r
 \r
-void displayDialog(int color,char *text,int type=0)\r
+void displayDialog(int color,char *text,int type)\r
 {\r
        gotoxy(21,13);\r
        char t1[43]="±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±";\r
@@ -1788,7 +1928,7 @@ void displayDialog(int color,char *text,int type=0)
        }\r
 }\r
 \r
-int message(char *text, char *value, int type=1)\r
+int message(char *text, char *value, int type)\r
 {\r
        if (type!=2)\r
        {\r
@@ -1922,7 +2062,7 @@ int main(int argc,char* argv[])
        }\r
        else\r
                any=0;\r
-       \r
+\r
        status=registerbgidriver(EGAVGA_driver);\r
        if (status < 0)\r
        {\r
@@ -1943,7 +2083,7 @@ int main(int argc,char* argv[])
                wys=16;\r
        else if(byo14[0])\r
                wys=14;\r
-       \r
+\r
 \r
        new8();\r
        menu8();\r
@@ -1958,518 +2098,1553 @@ int main(int argc,char* argv[])
        lin14();\r
        lin16();\r
 \r
+       //iR.x.ax=0x1;\r
+       //int86(0x33,&iR,&oR);\r
+       //iR.x.cx=0x01;\r
+       //iR.x.ax=0x0c;\r
+       //iR.x.dx=FP_OFF(inth);\r
+       //sR.es=FP_SEG(inth);\r
+       //int86x(0x33,&iR,&oR,&sR);\r
+       maus=setMaus();\r
+       if(maus)\r
+               showMaus();\r
        for(;;)\r
        {\r
-               key=bioskey(_KEYBRD_READ);\r
-               if(tab==0)\r
+               if(bioskey(_KEYBRD_READY))\r
                {\r
-                       if((key&0xFF00)==0x4800&&any)\r
+                       key=bioskey(_KEYBRD_READ);\r
+                       if(maus)\r
+                               hideMaus();\r
+                       if(tab==0)\r
                        {\r
-                               //w g¢r©\r
-                               prey=cury;\r
-                               prex=curx;\r
-                               cury+=wys-1;\r
-                               cury%=wys;\r
-                               switch(wys)\r
+                               if((key&0xFF00)==0x4800&&any)\r
                                {\r
-                               case 8:\r
-                                       lit8(2);\r
-                                       break;\r
-                               case 14:\r
-                                       lit14(2);\r
-                                       break;\r
-                               case 16:\r
-                                       lit16(2);\r
-                                       break;\r
+                                       //w g¢r©\r
+                                       prey=cury;\r
+                                       prex=curx;\r
+                                       cury+=wys-1;\r
+                                       cury%=wys;\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lit8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lit14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lit16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((key&0xFF00)==0x5000&&any)\r
+                               {\r
+                                       //w d¢\88\r
+                                       prey=cury;\r
+                                       prex=curx;\r
+                                       ++cury;\r
+                                       cury%=wys;\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lit8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lit14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lit16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((key&0xFF00)==0x4b00&&any)\r
+                               {\r
+                                       //w lewo\r
+                                       prey=cury;\r
+                                       prex=curx;\r
+                                       --curx;\r
+                                       curx&=0x7;\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lit8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lit14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lit16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((key&0xFF00)==0x4d00&&any)\r
+                               {\r
+                                       //w prawo\r
+                                       prey=cury;\r
+                                       prex=curx;\r
+                                       ++curx;\r
+                                       curx&=0x7;\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lit8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lit14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lit16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if ((key&0xFF00)==0x3900&&any)\r
+                               {\r
+                                       //spacja\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:                         \r
+                                               spc8();\r
+                                               lit8(1);\r
+                                               lin8(3);\r
+                                               break;\r
+                                       case 14:\r
+                                               spc14();\r
+                                               lit14(1);\r
+                                               lin14(3);\r
+                                               break;\r
+                                       case 16:\r
+                                               spc16();\r
+                                               lit16(1);\r
+                                               lin16(3);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if ((key&0xFF00)==0x0e00&&any)\r
+                               {\r
+                                       //backspace\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:                         \r
+                                               bsp8();\r
+                                               lit8(1);\r
+                                               lin8(3);\r
+                                               break;\r
+                                       case 14:\r
+                                               bsp14();\r
+                                               lit14(1);\r
+                                               lin14(3);\r
+                                               break;\r
+                                       case 16:\r
+                                               bsp16();\r
+                                               lit16(1);\r
+                                               lin16(3);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if ((key&0xFF00)==0x1c00&&any)\r
+                               {\r
+                                       //enter\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:                         \r
+                                               ent8();\r
+                                               lit8(1);\r
+                                               lin8(3);\r
+                                               break;\r
+                                       case 14:\r
+                                               ent14();\r
+                                               lit14(1);\r
+                                               lin14(3);\r
+                                               break;\r
+                                       case 16:\r
+                                               ent16();\r
+                                               lit16(1);\r
+                                               lin16(3);\r
+                                               break;\r
+                                       }\r
                                }\r
                        }\r
-                       if((key&0xFF00)==0x5000&&any)\r
+                       else\r
                        {\r
-                               //w d¢\88\r
-                               prey=cury;\r
-                               prex=curx;\r
-                               ++cury;\r
-                               cury%=wys;\r
+                               if((key&0xFF00)==0x4800&&any)\r
+                               {\r
+                                       //w g¢r© l\r
+                                       pre=lit;\r
+                                       lit-=16;\r
+                                       lit&=0xFF;\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((key&0xFF00)==0x5000&&any)\r
+                               {\r
+                                       //w d¢\88 l\r
+                                       pre=lit;\r
+                                       lit+=16;\r
+                                       lit&=0xFF;\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((key&0xFF00)==0x4b00&&any)\r
+                               {\r
+                                       //w lewo l\r
+                                       pre=lit;\r
+                                       --lit;\r
+                                       lit&=0xFF;\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((key&0xFF00)==0x4d00&&any)\r
+                               {\r
+                                       //w prawo l\r
+                                       pre=lit;\r
+                                       ++lit;\r
+                                       lit&=0xFF;\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(wys)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               break;\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+                       if ((key&0xFF00)==0x0f00&&any)\r
+                       {\r
+                               //tab\r
+                               if(!tab)\r
+                                       tab=1;\r
+                               else\r
+                                       tab=0;\r
                                switch(wys)\r
                                {\r
                                case 8:\r
-                                       lit8(2);\r
+                                       ramka8();\r
                                        break;\r
                                case 14:\r
-                                       lit14(2);\r
+                                       ramka14();\r
                                        break;\r
                                case 16:\r
-                                       lit16(2);\r
+                                       ramka16();\r
                                        break;\r
                                }\r
                        }\r
-                       if((key&0xFF00)==0x4b00&&any)\r
+                       if ((key&0xFF00)==0x5100&&any)\r
                        {\r
-                               //w lewo\r
+                               //cp++\r
+                               ++cp;\r
+                               cp%=FIH->num_codepages;\r
+                               prex=curx;\r
                                prey=cury;\r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+                               \r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               cpwys();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               \r
+                       }\r
+                       if ((key&0xFF00)==0x4900&&any)\r
+                       {\r
+                               //cp--\r
+                               cp+=FIH->num_codepages-1;\r
+                               cp%=FIH->num_codepages;\r
+                               \r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+\r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               cpwys();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+\r
+                       }\r
+                       if ((key&0xFF00)==0x4700&&any)\r
+                       {\r
+                               //wys--\r
                                prex=curx;\r
-                               --curx;\r
-                               curx&=0x7;\r
+                               prey=cury;\r
                                switch(wys)\r
                                {\r
                                case 8:\r
-                                       lit8(2);\r
+                                       if (byo16[cp]!=0)\r
+                                       {\r
+                                               wys=16;\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               ramka16();\r
+                                       }\r
+                                       else if(byo14[cp]!=0)\r
+                                       {\r
+                                               wys=14;\r
+                                               lin14(1);\r
+                                               lit14(1);\r
+                                               ramka14();\r
+                                       }\r
+                                       lin8(1);\r
+                                       lit8(1);\r
+                                       ramka8();\r
                                        break;\r
                                case 14:\r
+                                       if (byo8[cp]!=0)\r
+                                       {\r
+                                               wys=8;\r
+                                               cury%=8;\r
+                                               lin8(1);\r
+                                               lit8(2);\r
+                                               ramka8();\r
+                                       }\r
+                                       else if(byo16[cp]!=0)\r
+                                       {\r
+                                               wys=16;\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               ramka16();\r
+                                       }\r
+                                       lin14(1);\r
                                        lit14(2);\r
+                                       ramka14();\r
                                        break;\r
                                case 16:\r
+                                       if (byo14[cp]!=0)\r
+                                       {\r
+                                               wys=14;\r
+                                               cury%=14;\r
+                                               lin14(1);\r
+                                               lit14(2);\r
+                                               ramka14();\r
+                                       }\r
+                                       else if(byo8[cp]!=0)\r
+                                       {\r
+                                               wys=8;\r
+                                               cury%=8;\r
+                                               lin8(1);\r
+                                               lit8(2);\r
+                                               ramka8();\r
+                                       }\r
+                                       lin16(1);\r
                                        lit16(2);\r
+                                       ramka16();\r
                                        break;\r
                                }\r
+                               cpwys();\r
                        }\r
-                       if((key&0xFF00)==0x4d00&&any)\r
+                       if ((key&0xFF00)==0x4f00&&any)\r
                        {\r
-                               //w prawo\r
-                               prey=cury;\r
+                               //wys++\r
                                prex=curx;\r
-                               ++curx;\r
-                               curx&=0x7;\r
+                               prey=cury;\r
                                switch(wys)\r
                                {\r
                                case 8:\r
-                                       lit8(2);\r
+                                       if(byo14[cp]!=0)\r
+                                       {\r
+                                               wys=14;\r
+                                               lin14(1);\r
+                                               lit14(1);\r
+                                               ramka14();\r
+                                       }\r
+                                       else if (byo16[cp]!=0)\r
+                                       {\r
+                                               wys=16;\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               ramka16();\r
+                                       }\r
+                                       lin8(1);\r
+                                       lit8(1);\r
+                                       ramka8();\r
                                        break;\r
                                case 14:\r
+                                       if(byo16[cp]!=0)\r
+                                       {\r
+                                               wys=16;\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               ramka16();\r
+                                       }\r
+                                       else if (byo8[cp]!=0)\r
+                                       {\r
+                                               wys=8;\r
+                                               cury%=8;\r
+                                               lin8(1);\r
+                                               lit8(2);\r
+                                               ramka8();\r
+                                       }\r
+                                       lin14(1);\r
                                        lit14(2);\r
+                                       ramka14();\r
                                        break;\r
                                case 16:\r
+                                       if(byo8[cp]!=0)\r
+                                       {\r
+                                               wys=8;\r
+                                               cury%=8;\r
+                                               lin8(1);\r
+                                               lit8(2);\r
+                                               ramka8();\r
+                                       }\r
+                                       else if (byo14[cp]!=0)\r
+                                       {\r
+                                               wys=14;\r
+                                               cury%=14;\r
+                                               lin14(1);\r
+                                               lit14(2);\r
+                                               ramka14();\r
+                                       }\r
+                                       lin16(1);\r
                                        lit16(2);\r
+                                       ramka16();\r
                                        break;\r
                                }\r
+                               cpwys();\r
                        }\r
-                       if ((key&0xFF00)==0x3900&&any)\r
+                       \r
+                       if ((key&0xFF00)==0x3b00)\r
                        {\r
-                               //spacja\r
-                               switch(wys)\r
+                               //new CPI\r
+                               setcolor(RED);\r
+                               outtextxy(16,472,"new");\r
+                               deleteCPI();\r
+                               status=newCPI();\r
+                               while(status!=0)\r
                                {\r
-                               case 8:                         \r
-                                       spc8();\r
-                                       lit8(1);\r
-                                       lin8(3);\r
-                                       break;\r
-                               case 14:\r
-                                       spc14();\r
-                                       lit14(1);\r
-                                       lin14(3);\r
-                                       break;\r
-                               case 16:\r
-                                       spc16();\r
-                                       lit16(1);\r
-                                       lin16(3);\r
-                                       break;\r
+                                       if (message("CPI not created",err,2)==0)\r
+                                               status=newCPI();\r
+                                       else\r
+                                       {\r
+                                               break;\r
+                                               //closegraph();\r
+                                               //deleteCPI();\r
+                                               //return status;\r
+                                       }\r
                                }\r
-                       }\r
-                       if ((key&0xFF00)==0x0e00&&any)\r
-                       {\r
-                               //backspace\r
-                               switch(wys)\r
+                               any=!status;\r
+                               if(any)\r
                                {\r
-                               case 8:                         \r
-                                       bsp8();\r
-                                       lit8(1);\r
-                                       lin8(3);\r
-                                       break;\r
-                               case 14:\r
-                                       bsp14();\r
-                                       lit14(1);\r
-                                       lin14(3);\r
-                                       break;\r
-                               case 16:\r
-                                       bsp16();\r
-                                       lit16(1);\r
-                                       lin16(3);\r
-                                       break;\r
+                                       strcpy(nazwap,"new CPI");\r
+                                       cp=0;\r
+                                       if(byo8[0])\r
+                                               wys=8;\r
+                                       else if(byo16[0])\r
+                                               wys=16;\r
+                                       else if(byo14[0])\r
+                                               wys=14;\r
+                                       cury%=8;\r
                                }\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               \r
                        }\r
-                       if ((key&0xFF00)==0x1c00&&any)\r
+                       if ((key&0xFF00)==0x3c00&&any)\r
                        {\r
-                               //enter\r
-                               switch(wys)\r
+                               //zapisz\r
+                               setcolor(RED);\r
+                               outtextxy(72,472,"save");\r
+                               status=zap();\r
+                               while(status!=0)\r
                                {\r
-                               case 8:                         \r
-                                       ent8();\r
-                                       lit8(1);\r
-                                       lin8(3);\r
-                                       break;\r
-                               case 14:\r
-                                       ent14();\r
-                                       lit14(1);\r
-                                       lin14(3);\r
-                                       break;\r
-                               case 16:\r
-                                       ent16();\r
-                                       lit16(1);\r
-                                       lin16(3);\r
-                                       break;\r
+                                       if (message("CPI file not saved",err,2)==0)\r
+                                               status=zap();\r
+                                       else\r
+                                               break;\r
                                }\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               cury%=8;\r
+\r
+\r
                        }\r
-               }\r
-               else\r
-               {\r
-                       if((key&0xFF00)==0x4800&&any)\r
+\r
+\r
+                       if ((key&0xFF00)==0x3d00)\r
                        {\r
-                               //w g¢r© l\r
-                               pre=lit;\r
-                               lit-=16;\r
-                               lit&=0xFF;\r
+                               //wczytaj\r
+                               setcolor(RED);\r
+                               outtextxy(136,472,"load");\r
+                               deleteCPI();\r
+                               status=otw();\r
+                               while(status!=0)\r
+                               {\r
+                                       if (message("CPI file not loaded",err,2)==0)\r
+                                               status=otw();\r
+                                       else\r
+                                               break;\r
+                               }\r
+                               any=!status;\r
+                               cp=0;\r
+                               if(byo8[0])\r
+                                       wys=8;\r
+                               else if(byo16[0])\r
+                                       wys=16;\r
+                               else if(byo14[0])\r
+                                       wys=14;\r
+                               cury%=8;\r
+\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               switch(wys)\r
+\r
+                       }\r
+                       if((key&0xFF00)==0x3e00&&any)\r
+                       {\r
+                               \r
+                               //zapisz+system\r
+                               setcolor(RED);\r
+                               outtextxy(72,472,"save            use");\r
+                               status=zap();\r
+                               while(status!=0)\r
                                {\r
-                               case 8:\r
-                                       lin8(2);\r
-                                       break;\r
-                               case 14:\r
-                                       lin14(2);\r
-                                       break;\r
-                               case 16:\r
-                                       lin16(2);\r
-                                       break;\r
+                                       if (message("CPI file not saved",err,2)==0)\r
+                                               status=zap();\r
+                                       else\r
+                                               break;\r
+                               }\r
+                               if(status==0)\r
+                               {\r
+                                       sprintf(err,"mode con:cp prep=((%u) %s)",CPEH[cp]->codepage,nazwap);\r
+                                       puts(err);\r
+                                       system(err);\r
+                                       sprintf(err,"mode con:cp sel=%u",CPEH[cp]->codepage);\r
+                                       puts(err);\r
+                                       system(err);\r
+                                       delay(5000);\r
+                                       closegraph();\r
+                                       initgraph(&kart16,&tryb16,"");\r
+\r
                                }\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               cury%=8;\r
+\r
                        }\r
-                       if((key&0xFF00)==0x5000&&any)\r
+                       if ((key&0xFF00)==0x3f00&&any)\r
                        {\r
-                               //w d¢\88 l\r
-                               pre=lit;\r
-                               lit+=16;\r
-                               lit&=0xFF;\r
+                               //zmiana numeru\r
+                               setcolor(RED);\r
+                               outtextxy(256,472,"number");\r
+                               status=zmn();\r
+                               if(status!=0)\r
+                                       message("Number not changed",err);\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               switch(wys)\r
-                               {\r
-                               case 8:\r
-                                       lin8(2);\r
-                                       break;\r
-                               case 14:\r
-                                       lin14(2);\r
-                                       break;\r
-                               case 16:\r
-                                       lin16(2);\r
-                                       break;\r
-                               }\r
                        }\r
-                       if((key&0xFF00)==0x4b00&&any)\r
+                       if ((key&0xFF00)==0x4000&&any)\r
                        {\r
-                               //w lewo l\r
-                               pre=lit;\r
-                               --lit;\r
-                               lit&=0xFF;\r
+                               //new font\r
+                               setcolor(RED);\r
+                               outtextxy(336,472,"newF");\r
+                               status=newF();\r
+                               if(status!=0)\r
+                                       message("Fonr not created",err);\r
+                               offset();\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               switch(wys)\r
-                               {\r
-                               case 8:\r
-                                       lin8(2);\r
-                                       break;\r
-                               case 14:\r
-                                       lin14(2);\r
-                                       break;\r
-                               case 16:\r
-                                       lin16(2);\r
-                                       break;\r
-                               }\r
+                               \r
                        }\r
-                       if((key&0xFF00)==0x4d00&&any)\r
+                       if ((key&0xFF00)==0x4100&&any)\r
                        {\r
-                               //w prawo l\r
-                               pre=lit;\r
-                               ++lit;\r
-                               lit&=0xFF;\r
+                               //new CP\r
+                               setcolor(RED);\r
+                               outtextxy(400,472,"newCP");\r
+                               status=newCP();\r
+                               if(status!=0)\r
+                                       message("Codepage not created",err);\r
+                               else\r
+                                       cp=FIH->num_codepages-1;\r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+                               \r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               offset();\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               switch(wys)\r
+                               \r
+                       }\r
+                       if ((key&0xFF00)==0x4200&&any)\r
+                       {\r
+                               //delete font\r
+                               setcolor(RED);\r
+                               outtextxy(472,472,"delF");\r
+                               status=delF();\r
+                               if(status!=0)\r
+                                       message("Font not deleted",err);\r
+                               offset();\r
+\r
+                               if(wys==8&&byo8[cp]==0)\r
                                {\r
-                               case 8:\r
-                                       lin8(2);\r
-                                       break;\r
-                               case 14:\r
-                                       lin14(2);\r
-                                       break;\r
-                               case 16:\r
-                                       lin16(2);\r
-                                       break;\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
                                }\r
+                               \r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+                               \r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               \r
                        }\r
-               }\r
-               if ((key&0xFF00)==0x0f00&&any)\r
-               {\r
-                       //tab\r
-                       if(!tab)\r
-                               tab=1;\r
-                       else\r
-                               tab=0;\r
-                       switch(wys)\r
+                       if ((key&0xFF00)==0x4300&&any)\r
                        {\r
-                       case 8:\r
+                               //delete CP\r
+                               setcolor(RED);\r
+                               outtextxy(536,472,"delCP");\r
+                               status=delCP();\r
+                               if(status!=0)\r
+                                       message("Codepage not deleted",err);\r
+                               offset();\r
+                               \r
+                               cp%=FIH->num_codepages;\r
+                               \r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+\r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
                                ramka8();\r
-                               break;\r
-                       case 14:\r
                                ramka14();\r
-                               break;\r
-                       case 16:\r
                                ramka16();\r
-                               break;\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+\r
                        }\r
-               }\r
-               if ((key&0xFF00)==0x5100&&any)\r
-               {\r
-                       //cp++\r
-                       ++cp;\r
-                       cp%=FIH->num_codepages;\r
-                       prex=curx;\r
-                       prey=cury;\r
-                       if(wys==8&&byo8[cp]==0)\r
+                       if ((key&0xFF00)==0x4400)\r
                        {\r
-                               if(byo14[cp]!=0)\r
-                                       wys=14;\r
-                               else if(byo16[cp]!=0)\r
-                                       wys=16;\r
+                               //koniec\r
+                               setcolor(RED);\r
+                               outtextxy(616,472,"end");\r
+                               if(maus)\r
+                                       resetMaus();\r
+                               break;\r
                        }\r
-                       \r
-                       else if(wys==14&&byo14[cp]==0)\r
+                       while(bioskey(_KEYBRD_READY))\r
                        {\r
-                               if(byo16[cp]!=0)\r
-                                       wys=16;\r
-                               else if(byo8[cp]!=0)\r
-                                       wys=8;\r
+                               bioskey(_KEYBRD_READ);\r
                        }\r
+                       if(maus&&mausv)\r
+                               showMaus();\r
+               }\r
+               else if(maus)\r
+               {\r
+                       prek=klik;\r
+                       //premx=mausx;\r
+                       //premy=mausy;\r
+                       getMaus(&mausx,&mausy,&klik);\r
                        \r
-                       else if(wys==16&&byo16[cp]==0)\r
+                       if(any&&mausx>=16&&mausx<144&&mausy>=32&&mausy<160&&byo8[cp])\r
                        {\r
-                               if(byo8[cp]!=0)\r
-                                       wys=8;\r
-                               else if(byo14[cp]!=0)\r
-                                       wys=14;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               pret=tab;\r
+                               prew=wys;\r
+                               prex=curx;\r
+                               prey=cury;\r
+                               curx=(mausx-16)/16;\r
+                               cury=(mausy-32)/16;\r
+                               wys=8;\r
+                               tab=0;\r
+                               if(klik)\r
+                               {\r
+                                       if(klik&0x01)\r
+                                               ent8();\r
+                                       else if(klik&0x2)\r
+                                               bsp8();\r
+                                       else if(klik&0x4)\r
+                                               spc8();\r
+                                       lin8(3);\r
+                               }\r
+                               if(prew!=wys||pret)\r
+                                       ramka8();\r
+                               if(prex==curx&&prey==cury)\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               lin16(1);\r
+                                               ramka16();\r
+                                               lit8(1);\r
+                                               lit16(1);\r
+                                               lin8(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(1);\r
+                                               ramka14();\r
+                                               lit8(1);\r
+                                               lit14(1);\r
+                                               lin8(1);\r
+                                               break;\r
+                                       }\r
+                                       if(klik)\r
+                                               lit8(1);\r
+                               }\r
+                               else\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               ramka16();\r
+                                               lit8(1);\r
+                                               lit16(2);\r
+                                               lin8(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               ramka14();\r
+                                               lit8(1);\r
+                                               lit14(2);\r
+                                               lin8(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               lit8(2);\r
+                                       }\r
+                               }\r
                        }\r
-                       cury&=0x7;\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       cpwys();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       \r
-               }\r
-               if ((key&0xFF00)==0x4900&&any)\r
-               {\r
-                       //cp--\r
-                       cp+=FIH->num_codepages-1;\r
-                       cp%=FIH->num_codepages;\r
                        \r
-                       if(wys==8&&byo8[cp]==0)\r
+                       else if(any&&mausx>=16&&mausx<144&&mausy>=223&&mausy<447&&byo14[cp])\r
                        {\r
-                               if(byo14[cp]!=0)\r
-                                       wys=14;\r
-                               else if(byo16[cp]!=0)\r
-                                       wys=16;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               pret=tab;\r
+                               prew=wys;\r
+                               prex=curx;\r
+                               prey=cury;\r
+                               curx=(mausx-16)/16;\r
+                               cury=(mausy-223)/16;\r
+                               wys=14;\r
+                               tab=0;\r
+                               if(klik)\r
+                               {\r
+                                       if(klik&0x01)\r
+                                               ent14();\r
+                                       else if(klik&0x2)\r
+                                               bsp14();\r
+                                       else if(klik&0x4)\r
+                                               spc14();\r
+                                       lin14(3);\r
+                               }\r
+                               if(prew!=wys||pret)\r
+                                       ramka14();\r
+                               if(prex==curx&&prey==cury)\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               lin16(1);\r
+                                               ramka16();\r
+                                               lit14(1);\r
+                                               lit16(1);\r
+                                               lin14(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               lin8(1);\r
+                                               ramka8();\r
+                                               lit14(1);\r
+                                               lit8(1);\r
+                                               lin14(1);\r
+                                               break;\r
+                                       }\r
+                                       if(klik)\r
+                                               lit14(1);\r
+                               }\r
+                               else\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               ramka16();\r
+                                               lit14(1);\r
+                                               lit16(2);\r
+                                               lin14(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               ramka8();\r
+                                               lit14(1);\r
+                                               lit8(2);\r
+                                               lin14(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lit14(2);\r
+                                       }\r
+                               }\r
                        }\r
                        \r
-                       else if(wys==14&&byo14[cp]==0)\r
+                       else if(any&&mausx>=336&&mausx<464&&mausy>=111&&mausy<367&&byo16[cp])\r
                        {\r
-                               if(byo16[cp]!=0)\r
-                                       wys=16;\r
-                               else if(byo8[cp]!=0)\r
-                                       wys=8;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               pret=tab;\r
+                               prew=wys;\r
+                               prex=curx;\r
+                               prey=cury;\r
+                               curx=(mausx-336)/16;\r
+                               cury=(mausy-111)/16;\r
+                               wys=16;\r
+                               tab=0;\r
+                               if(klik)\r
+                               {\r
+                                       if(klik&0x01)\r
+                                               ent16();\r
+                                       else if(klik&0x2)\r
+                                               bsp16();\r
+                                       else if(klik&0x4)\r
+                                               spc16();\r
+                                       lin16(3);\r
+                               }\r
+                               if(prew!=wys||pret)\r
+                                       ramka16();\r
+                               if(prex==curx&&prey==cury)\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(1);\r
+                                               ramka8();\r
+                                               lit16(1);\r
+                                               lit8(1);\r
+                                               lin16(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(1);\r
+                                               ramka14();\r
+                                               lit16(1);\r
+                                               lit14(1);\r
+                                               lin16(1);\r
+                                               break;\r
+                                       }\r
+                                       if(klik)\r
+                                               lit16(1);\r
+                               }\r
+                               else\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               ramka8();\r
+                                               lit16(1);\r
+                                               lit8(2);\r
+                                               lin16(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               ramka14();\r
+                                               lit16(1);\r
+                                               lit14(2);\r
+                                               lin16(1);\r
+                                               break;\r
+                                       case 16:\r
+                                               lit16(2);\r
+                                       }\r
+                               }\r
                        }\r
                        \r
-                       else if(wys==16&&byo16[cp]==0)\r
+                       else if(any&&klik&&mausx>=176&&mausx<304&&mausy>=32&&mausy<160&&byo8[cp])\r
                        {\r
-                               if(byo8[cp]!=0)\r
-                                       wys=8;\r
-                               else if(byo14[cp]!=0)\r
-                                       wys=14;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               prew=wys;\r
+                               pre=lit;\r
+                               pret=tab;\r
+                               wys=8;\r
+                               tab=1;\r
+                               lit=((mausy-32)/8)*16+((mausx-176)/8);\r
+                               if (pre==lit)\r
+                               {\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               ramka16();\r
+                                               ramka8();\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               lin8(1);\r
+                                               lit8(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               ramka14();\r
+                                               ramka8();\r
+                                               lin14(1);\r
+                                               lit14(1);\r
+                                               lin8(1);\r
+                                               lit8(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               if(!pret)\r
+                                                       ramka8();\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               else\r
+                               {\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               ramka16();\r
+                                               ramka8();\r
+                                               lin8(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               ramka14();\r
+                                               ramka8();\r
+                                               lin8(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               if(!pret)\r
+                                                       ramka8();\r
+                                       }\r
+                               }\r
                        }\r
-                       cury&=0x7;\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       cpwys();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-\r
-               }\r
-               if ((key&0xFF00)==0x4700&&any)\r
-               {\r
-                       //wys--\r
-                       prex=curx;\r
-                       prey=cury;\r
-                       switch(wys)\r
+                       \r
+                       else if(any&&klik&&mausx>=176&&mausx<304&&mausy>=223&&mausy<447&&byo14[cp])\r
                        {\r
-                       case 8:\r
-                               if (byo16[cp]!=0)\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               prew=wys;\r
+                               pre=lit;\r
+                               pret=tab;\r
+                               wys=14;\r
+                               tab=1;\r
+                               lit=((mausy-223)/14)*16+((mausx-176)/8);\r
+                               if (pre==lit)\r
                                {\r
-                                       wys=16;\r
-                                       lin16(1);\r
-                                       lit16(1);\r
-                                       ramka16();\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               ramka16();\r
+                                               ramka14();\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               lin14(1);\r
+                                               lit14(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               ramka8();\r
+                                               ramka14();\r
+                                               lin8(1);\r
+                                               lit8(1);\r
+                                               lin14(1);\r
+                                               lit14(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               if(!pret)\r
+                                                       ramka14();\r
+                                               break;\r
+                                       }\r
                                }\r
-                               else if(byo14[cp]!=0)\r
+                               else\r
                                {\r
-                                       wys=14;\r
-                                       lin14(1);\r
-                                       lit14(1);\r
-                                       ramka14();\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               ramka16();\r
+                                               ramka14();\r
+                                               lin14(1);\r
+                                               break;\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               ramka8();\r
+                                               ramka14();\r
+                                               lin14(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               if(!pret)\r
+                                                       ramka14();\r
+                                       }\r
                                }\r
-                               lin8(1);\r
-                               lit8(1);\r
-                               ramka8();\r
-                               break;\r
-                       case 14:\r
-                               if (byo8[cp]!=0)\r
+                       }\r
+                       \r
+                       else if(any&&klik&&mausx>=496&&mausx<624&&mausy>=111&&mausy<367&&byo16[cp])\r
+                       {\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               prew=wys;\r
+                               pre=lit;\r
+                               pret=tab;\r
+                               wys=16;\r
+                               tab=1;\r
+                               lit=((mausy-111)/16)*16+((mausx-496)/8);\r
+                               if (pre==lit)\r
                                {\r
-                                       wys=8;\r
-                                       cury%=8;\r
-                                       lin8(1);\r
-                                       lit8(2);\r
-                                       ramka8();\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 8:\r
+                                               ramka8();\r
+                                               ramka16();\r
+                                               lin8(1);\r
+                                               lit8(1);\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               ramka14();\r
+                                               ramka16();\r
+                                               lin14(1);\r
+                                               lit14(1);\r
+                                               lin16(1);\r
+                                               lit16(1);\r
+                                               break;\r
+                                       case 16:\r
+                                               if(!pret)\r
+                                                       ramka16();\r
+                                               break;\r
+                                       }\r
                                }\r
-                               else if(byo16[cp]!=0)\r
+                               else\r
+                               {\r
+                                       lit8();\r
+                                       lit14();\r
+                                       lit16();\r
+                                       switch(prew)\r
+                                       {\r
+                                       case 8:\r
+                                               lin8(2);\r
+                                               ramka8();\r
+                                               ramka16();\r
+                                               lin16(1);\r
+                                               break;\r
+                                       case 14:\r
+                                               lin14(2);\r
+                                               ramka14();\r
+                                               ramka16();\r
+                                               lin16(1);\r
+                                               break;\r
+                                       case 16:\r
+                                               lin16(2);\r
+                                               if(!pret)\r
+                                                       ramka16();\r
+                                       }\r
+                               }\r
+                       }\r
+                       \r
+                       else if(any&&klik&&!prek&&mausx>=128&&mausx<184&&mausy<8)\r
+                       {\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //cp+-\r
+                               if(klik&0x01)\r
+                                       ++cp;\r
+                               else\r
+                                       cp+=FIH->num_codepages-1;\r
+                               cp%=FIH->num_codepages;\r
+                               prex=curx;\r
+                               prey=cury;\r
+                               if(wys==8&&byo8[cp]==0)\r
                                {\r
-                                       wys=16;\r
-                                       lin16(1);\r
-                                       lit16(1);\r
-                                       ramka16();\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
                                }\r
-                               lin14(1);\r
-                               lit14(2);\r
-                               ramka14();\r
-                               break;\r
-                       case 16:\r
-                               if (byo14[cp]!=0)\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
                                {\r
-                                       wys=14;\r
-                                       cury%=14;\r
-                                       lin14(1);\r
-                                       lit14(2);\r
-                                       ramka14();\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
                                }\r
-                               else if(byo8[cp]!=0)\r
+                               \r
+                               else if(wys==16&&byo16[cp]==0)\r
                                {\r
-                                       wys=8;\r
-                                       cury%=8;\r
-                                       lin8(1);\r
-                                       lit8(2);\r
-                                       ramka8();\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
                                }\r
-                               lin16(1);\r
-                               lit16(2);\r
+                               cury&=0x7;\r
+                               ramka8();\r
+                               ramka14();\r
                                ramka16();\r
-                               break;\r
+                               cpwys();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
-                       cpwys();\r
-               }\r
-               if ((key&0xFF00)==0x4f00&&any)\r
-               {\r
-                       //wys++\r
-                       prex=curx;\r
-                       prey=cury;\r
-                       switch(wys)\r
+                       \r
+                       else if(any&&klik&&!prek&&mausx>=192&&mausx<224&&mausy<8)\r
                        {\r
-                       case 8:\r
-                               if(byo14[cp]!=0)\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //wys+-\r
+                               prex=curx;\r
+                               prey=cury;\r
+                               switch(wys)\r
                                {\r
-                                       wys=14;\r
+                               case 8:\r
+                                       if(klik&0x1)\r
+                                       {\r
+                                               if(byo14[cp]!=0)\r
+                                               {       \r
+                                                       wys=14;\r
+                                                       lin14(1);\r
+                                                       lit14(1);\r
+                                                       ramka14();\r
+                                               }\r
+                                               else if (byo16[cp]!=0)\r
+                                               {\r
+                                                       wys=16;\r
+                                                       lin16(1);\r
+                                                       lit16(1);\r
+                                                       ramka16();\r
+                                               }\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               if (byo16[cp]!=0)\r
+                                               {\r
+                                                       wys=16;\r
+                                                       lin16(1);\r
+                                                       lit16(1);\r
+                                                       ramka16();\r
+                                               }\r
+                                               else if(byo14[cp]!=0)\r
+                                               {       \r
+                                                       wys=14;\r
+                                                       lin14(1);\r
+                                                       lit14(1);\r
+                                                       ramka14();\r
+                                               }\r
+                                       }\r
+                                       lin8(1);\r
+                                       lit8(1);\r
+                                       ramka8();\r
+                                       break;\r
+                               case 14:\r
+                                       if(klik&0x1)\r
+                                       {\r
+                                               if(byo16[cp]!=0)\r
+                                               {\r
+                                                       wys=16;\r
+                                                       lin16(1);\r
+                                                       lit16(1);\r
+                                                       ramka16();\r
+                                               }\r
+                                               else if (byo8[cp]!=0)\r
+                                               {\r
+                                                       wys=8;\r
+                                                       cury%=8;\r
+                                                       lin8(1);\r
+                                                       lit8(2);\r
+                                                       ramka8();\r
+                                               }\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               if (byo8[cp]!=0)\r
+                                               {\r
+                                                       wys=8;\r
+                                                       cury%=8;\r
+                                                       lin8(1);\r
+                                                       lit8(2);\r
+                                                       ramka8();\r
+                                               }\r
+                                               else if(byo16[cp]!=0)\r
+                                               {\r
+                                                       wys=16;\r
+                                                       lin16(1);\r
+                                                       lit16(1);\r
+                                                       ramka16();\r
+                                               }\r
+                                       }\r
                                        lin14(1);\r
-                                       lit14(1);\r
+                                       lit14(2);\r
                                        ramka14();\r
-                               }\r
-                               else if (byo16[cp]!=0)\r
-                               {\r
-                                       wys=16;\r
+                                       break;\r
+                               case 16:\r
+                                       if(klik&0x1)\r
+                                       {\r
+                                               if(byo8[cp]!=0)\r
+                                               {\r
+                                                       wys=8;\r
+                                                       cury%=8;\r
+                                                       lin8(1);\r
+                                                       lit8(2);\r
+                                                       ramka8();\r
+                                               }\r
+                                               else if (byo14[cp]!=0)\r
+                                               {\r
+                                                       wys=14;\r
+                                                       cury%=14;\r
+                                                       lin14(1);\r
+                                                       lit14(2);\r
+                                                       ramka14();\r
+                                               }\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               if (byo14[cp]!=0)\r
+                                               {\r
+                                                       wys=14;\r
+                                                       cury%=14;\r
+                                                       lin14(1);\r
+                                                       lit14(2);\r
+                                                       ramka14();\r
+                                               }\r
+                                               else if(byo8[cp]!=0)\r
+                                               {\r
+                                                       wys=8;\r
+                                                       cury%=8;\r
+                                                       lin8(1);\r
+                                                       lit8(2);\r
+                                                       ramka8();\r
+                                               }\r
+                                       }\r
                                        lin16(1);\r
-                                       lit16(1);\r
+                                       lit16(2);\r
                                        ramka16();\r
+                                       break;\r
                                }\r
-                               lin8(1);\r
-                               lit8(1);\r
-                               ramka8();\r
-                               break;\r
-                       case 14:\r
-                               if(byo16[cp]!=0)\r
+                               cpwys();\r
+                       }\r
+                       \r
+                       else if(klik&&!prek&&mausx<40&&mausy>=472)\r
+                       {\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //new CPI\r
+                               setcolor(RED);\r
+                               outtextxy(16,472,"new");\r
+                               deleteCPI();\r
+                               status=newCPI();\r
+                               while(status!=0)\r
                                {\r
-                                       wys=16;\r
-                                       lin16(1);\r
-                                       lit16(1);\r
-                                       ramka16();\r
+                                       if (message("CPI not created",err,2)==0)\r
+                                               status=newCPI();\r
+                                       else\r
+                                               break;\r
                                }\r
-                               else if (byo8[cp]!=0)\r
+                               any=!status;\r
+                               if(any)\r
                                {\r
-                                       wys=8;\r
+                                       strcpy(nazwap,"new CPI");\r
+                                       cp=0;\r
+                                       if(byo8[0])\r
+                                               wys=8;\r
+                                       else if(byo16[0])\r
+                                               wys=16;\r
+                                       else if(byo14[0])\r
+                                               wys=14;\r
                                        cury%=8;\r
-                                       lin8(1);\r
-                                       lit8(2);\r
-                                       ramka8();\r
                                }\r
-                               lin14(1);\r
-                               lit14(2);\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
                                ramka14();\r
-                               break;\r
-                       case 16:\r
-                               if(byo8[cp]!=0)\r
-                               {\r
-                                       wys=8;\r
-                                       cury%=8;\r
-                                       lin8(1);\r
-                                       lit8(2);\r
-                                       ramka8();\r
-                               }\r
-                               else if (byo14[cp]!=0)\r
-                               {\r
-                                       wys=14;\r
-                                       cury%=14;\r
-                                       lin14(1);\r
-                                       lit14(2);\r
-                                       ramka14();\r
-                               }\r
-                               lin16(1);\r
-                               lit16(2);\r
                                ramka16();\r
-                               break;\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
-                       cpwys();\r
-               }\r
-               \r
-               if ((key&0xFF00)==0x3b00)\r
-               {\r
-                       //new CPI\r
-                       setcolor(RED);\r
-                       outtextxy(16,472,"new");\r
-                       deleteCPI();\r
-                       status=newCPI();\r
-                       while(status!=0)\r
+                       \r
+                       else if(any&&klik&&!prek&&mausx>=56&&mausx<104&&mausy>=472)\r
                        {\r
-                               if (message("CPI not created",err,2)==0)\r
-                                       status=newCPI();\r
-                               else\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //save CPI\r
+                               setcolor(RED);\r
+                               outtextxy(72,472,"save");\r
+                               status=zap();\r
+                               while(status!=0)\r
                                {\r
-                                       break;\r
-                                       //closegraph();\r
-                                       //deleteCPI();\r
-                                       //return status;\r
+                                       if (message("CPI file not saved",err,2)==0)\r
+                                               status=zap();\r
+                                       else\r
+                                               break;\r
                                }\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               cury%=8;\r
                        }\r
-                       any=!status;\r
-                       if(any)\r
+                       \r
+                       else if(klik&&!prek&&mausx>=120&&mausx<168&&mausy>=472)\r
                        {\r
-                               strcpy(nazwap,"new CPI");\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //load CPI\r
+                               setcolor(RED);\r
+                               outtextxy(136,472,"load");\r
+                               deleteCPI();\r
+                               status=otw();\r
+                               while(status!=0)\r
+                               {\r
+                                       if (message("CPI file not loaded",err,2)==0)\r
+                                               status=otw();\r
+                                       else\r
+                                               break;\r
+                               }\r
+                               any=!status;\r
                                cp=0;\r
                                if(byo8[0])\r
                                        wys=8;\r
@@ -2478,333 +3653,283 @@ int main(int argc,char* argv[])
                                else if(byo14[0])\r
                                        wys=14;\r
                                cury%=8;\r
+\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
                        \r
-               }\r
-               if ((key&0xFF00)==0x3c00&&any)\r
-               {\r
-                       //zapisz\r
-                       setcolor(RED);\r
-                       outtextxy(72,472,"save");\r
-                       status=zap();\r
-                       while(status!=0)\r
-                       {\r
-                               if (message("CPI file not saved",err,2)==0)\r
-                                       status=zap();\r
-                               else\r
-                                       break;\r
-                       }\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       cury%=8;\r
-\r
-\r
-               }\r
-\r
-\r
-               if ((key&0xFF00)==0x3d00)\r
-               {\r
-                       //wczytaj\r
-                       setcolor(RED);\r
-                       outtextxy(136,472,"load");\r
-                       deleteCPI();\r
-                       status=otw();\r
-                       while(status!=0)\r
+                       else if(any&&klik&&!prek&&mausx>=184&&mausx<224&&mausy>=472)\r
                        {\r
-                               if (message("CPI file not loaded",err,2)==0)\r
-                                       status=otw();\r
-                               else\r
-                                       break;\r
-                       }\r
-                       any=!status;\r
-                       cp=0;\r
-                       if(byo8[0])\r
-                               wys=8;\r
-                       else if(byo16[0])\r
-                               wys=16;\r
-                       else if(byo14[0])\r
-                               wys=14;\r
-                       cury%=8;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //save & use CPI\r
+                               setcolor(RED);\r
+                               outtextxy(72,472,"save            use");\r
+                               status=zap();\r
+                               while(status!=0)\r
+                               {\r
+                                       if (message("CPI file not saved",err,2)==0)\r
+                                               status=zap();\r
+                                       else\r
+                                               break;\r
+                               }\r
+                               if(status==0)\r
+                               {\r
+                                       sprintf(err,"mode con:cp prep=((%u) %s)",CPEH[cp]->codepage,nazwap);\r
+                                       puts(err);\r
+                                       system(err);\r
+                                       sprintf(err,"mode con:cp sel=%u",CPEH[cp]->codepage);\r
+                                       puts(err);\r
+                                       system(err);\r
+                                       delay(5000);\r
+                                       closegraph();\r
+                                       initgraph(&kart16,&tryb16,"");\r
 \r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
+                               }\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
+                               cury%=8;\r
 \r
-               }\r
-               if((key&0xFF00)==0x3e00&&any)\r
-               {\r
-                       \r
-                       //zapisz+system\r
-                       setcolor(RED);\r
-                       outtextxy(72,472,"save            use");\r
-                       status=zap();\r
-                       while(status!=0)\r
-                       {\r
-                               if (message("CPI file not saved",err,2)==0)\r
-                                       status=zap();\r
-                               else\r
-                                       break;\r
-                       }\r
-                       if(status==0)\r
-                       {\r
-                               sprintf(err,"mode con:cp prep=((%u) %s)",CPEH[cp]->codepage,nazwap);\r
-                               puts(err);\r
-                               system(err);\r
-                               sprintf(err,"mode con:cp sel=%u",CPEH[cp]->codepage);\r
-                               puts(err);\r
-                               system(err);\r
-                               delay(5000);\r
-                               closegraph();\r
-                               initgraph(&kart16,&tryb16,"");\r
-\r
-                       }\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       cury%=8;\r
-\r
-               }\r
-               if ((key&0xFF00)==0x3f00&&any)\r
-               {\r
-                       //zmiana numeru\r
-                       setcolor(RED);\r
-                       outtextxy(256,472,"number");\r
-                       status=zmn();\r
-                       if(status!=0)\r
-                               message("Number not changed",err);\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-               }\r
-               if ((key&0xFF00)==0x4000&&any)\r
-               {\r
-                       //new font\r
-                       setcolor(RED);\r
-                       outtextxy(336,472,"newF");\r
-                       status=newF();\r
-                       if(status!=0)\r
-                               message("Fonr not created",err);\r
-                       offset();\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       \r
-               }\r
-               if ((key&0xFF00)==0x4100&&any)\r
-               {\r
-                       //new CP\r
-                       setcolor(RED);\r
-                       outtextxy(400,472,"newCP");\r
-                       status=newCP();\r
-                       if(status!=0)\r
-                               message("Codepage not created",err);\r
-                       else\r
-                               cp=FIH->num_codepages-1;\r
-                       if(wys==8&&byo8[cp]==0)\r
-                       {\r
-                               if(byo14[cp]!=0)\r
-                                       wys=14;\r
-                               else if(byo16[cp]!=0)\r
-                                       wys=16;\r
-                       }\r
-                       \r
-                       else if(wys==14&&byo14[cp]==0)\r
-                       {\r
-                               if(byo16[cp]!=0)\r
-                                       wys=16;\r
-                               else if(byo8[cp]!=0)\r
-                                       wys=8;\r
                        }\r
-                       \r
-                       else if(wys==16&&byo16[cp]==0)\r
+                               \r
+                       else if(any&&klik&&!prek&&mausx>=240&&mausx<304&&mausy>=472)\r
                        {\r
-                               if(byo8[cp]!=0)\r
-                                       wys=8;\r
-                               else if(byo14[cp]!=0)\r
-                                       wys=14;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //change CP #\r
+                               setcolor(RED);\r
+                               outtextxy(256,472,"number");\r
+                               status=zmn();\r
+                               if(status!=0)\r
+                                       message("Number not changed",err);\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
-                       cury&=0x7;\r
-                       offset();\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
                        \r
-               }\r
-               if ((key&0xFF00)==0x4200&&any)\r
-               {\r
-                       //delete font\r
-                       setcolor(RED);\r
-                       outtextxy(472,472,"delF");\r
-                       status=delF();\r
-                       if(status!=0)\r
-                               message("Font not deleted",err);\r
-                       offset();\r
                        \r
-                       if(wys==8&&byo8[cp]==0)\r
+                       else if(any&&klik&&!prek&&mausx>=320&&mausx<368&&mausy>=472)\r
                        {\r
-                               if(byo14[cp]!=0)\r
-                                       wys=14;\r
-                               else if(byo16[cp]!=0)\r
-                                       wys=16;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //new font\r
+                               setcolor(RED);\r
+                               outtextxy(336,472,"newF");\r
+                               status=newF();\r
+                               if(status!=0)\r
+                                       message("Fonr not created",err);\r
+                               offset();\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
                        \r
-                       else if(wys==14&&byo14[cp]==0)\r
+                       else if(any&&klik&&!prek&&mausx>=384&&mausx<440&&mausy>=472)\r
                        {\r
-                               if(byo16[cp]!=0)\r
-                                       wys=16;\r
-                               else if(byo8[cp]!=0)\r
-                                       wys=8;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //new CP\r
+                               setcolor(RED);\r
+                               outtextxy(400,472,"newCP");\r
+                               status=newCP();\r
+                               if(status!=0)\r
+                                       message("Codepage not created",err);\r
+                               else\r
+                                       cp=FIH->num_codepages-1;\r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+                               \r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               offset();\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
                        \r
-                       else if(wys==16&&byo16[cp]==0)\r
+                       else if(any&&klik&&!prek&&mausx>=456&&mausx<504&&mausy>=472)\r
                        {\r
-                               if(byo8[cp]!=0)\r
-                                       wys=8;\r
-                               else if(byo14[cp]!=0)\r
-                                       wys=14;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //delete font\r
+                               setcolor(RED);\r
+                               outtextxy(472,472,"delF");\r
+                               status=delF();\r
+                               if(status!=0)\r
+                                       message("Font not deleted",err);\r
+                               offset();\r
+\r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+                               \r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+                               \r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
-                       cury&=0x7;\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       \r
-               }\r
-               if ((key&0xFF00)==0x4300&&any)\r
-               {\r
-                       //delete CP\r
-                       setcolor(RED);\r
-                       outtextxy(536,472,"delCP");\r
-                       status=delCP();\r
-                       if(status!=0)\r
-                               message("Codepage not deleted",err);\r
-                       offset();\r
-                       \r
-                       cp%=FIH->num_codepages;\r
                        \r
-                       if(wys==8&&byo8[cp]==0)\r
+                       else if(any&&klik&&!prek&&mausx>=520&&mausx<576&&mausy>=472)\r
                        {\r
-                               if(byo14[cp]!=0)\r
-                                       wys=14;\r
-                               else if(byo16[cp]!=0)\r
-                                       wys=16;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               //delete CP\r
+                               setcolor(RED);\r
+                               outtextxy(536,472,"delCP");\r
+                               status=delCP();\r
+                               if(status!=0)\r
+                                       message("Codepage not deleted",err);\r
+                               offset();\r
+                               \r
+                               cp%=FIH->num_codepages;\r
+                               \r
+                               if(wys==8&&byo8[cp]==0)\r
+                               {\r
+                                       if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                                       else if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                               }\r
+\r
+                               else if(wys==14&&byo14[cp]==0)\r
+                               {\r
+                                       if(byo16[cp]!=0)\r
+                                               wys=16;\r
+                                       else if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                               }\r
+\r
+                               else if(wys==16&&byo16[cp]==0)\r
+                               {\r
+                                       if(byo8[cp]!=0)\r
+                                               wys=8;\r
+                                       else if(byo14[cp]!=0)\r
+                                               wys=14;\r
+                               }\r
+                               cury&=0x7;\r
+                               new8();\r
+                               menu8();\r
+                               cpwys();\r
+                               ramka8();\r
+                               ramka14();\r
+                               ramka16();\r
+                               lin8();\r
+                               lin14();\r
+                               lin16();\r
+                               lit8();\r
+                               lit14();\r
+                               lit16();\r
                        }\r
                        \r
-                       else if(wys==14&&byo14[cp]==0)\r
+                       else if(klik&&!prek&&mausx>=592&&mausy>=472)\r
                        {\r
-                               if(byo16[cp]!=0)\r
-                                       wys=16;\r
-                               else if(byo8[cp]!=0)\r
-                                       wys=8;\r
+                               hideMaus();\r
+                               mausv=0;\r
+                               setcolor(RED);\r
+                               outtextxy(616,472,"end");\r
+                               resetMaus();\r
+                               break;\r
                        }\r
                        \r
-                       else if(wys==16&&byo16[cp]==0)\r
+                       else\r
                        {\r
-                               if(byo8[cp]!=0)\r
-                                       wys=8;\r
-                               else if(byo14[cp]!=0)\r
-                                       wys=14;\r
+                               mausv=1;\r
+                               showMaus();\r
                        }\r
-                       cury&=0x7;\r
-                       new8();\r
-                       menu8();\r
-                       cpwys();\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       \r
-               }\r
-               if ((key&0xFF00)==0x4400)\r
-               {\r
-                       //koniec\r
-                       setcolor(RED);\r
-                       outtextxy(616,472,"end");\r
-                       break;\r
-               }\r
-               while(bioskey(_KEYBRD_READY))\r
-               {\r
-                       bioskey(_KEYBRD_READ);\r
                }\r
        }\r
 \r
similarity index 80%
rename from NAPISY.PRJ
rename to CPIED.PRJ
index 708586841cef40ba555d0d33b014ae2de5dd4268..eb94ba376ee7c298b8f558d5bd431ca5135925bf 100644 (file)
Binary files a/NAPISY.PRJ and b/CPIED.PRJ differ
index 5992ee781a67e256808e1c93cfd70f83ad0203c3..ab2d08c4f622794b3f7e29e39e61d48f6a9f4c62 100644 (file)
@@ -9,7 +9,7 @@
                # ##  ####  ###   #     #  #  #  # # #\r
                #  #  #  #  #     #  ###    ##    # #   \r
                                        Balthasar Szczepaäski\r
-Edytor napis¢w 1.1b - the cpi editor\r
+Edytor napis¢w 1.2a - the cpi editor\r
 \r
 ============================================================\r
 \r
@@ -121,29 +121,39 @@ The following actions can be performed:
 \r
 4. Controls\r
 \r
-create a new CPI - F1\r
-save a CPI file    F2\r
-load a CPI file    F3\r
-CP into VGA memory F4\r
-change CP number   F5\r
-new font           F6\r
-new codepage       F7\r
-delete a font      F8\r
-delete a codepage  F9\r
-close the program  F10\r
-\r
-move the cursor    arrow keys\r
-set a pixel        Enter\r
-unset a pixel      Backspace\r
-change a pixel     Space\r
-switch edit/select Tab\r
-next codepage      PageDown\r
-previous codepage  PageUp\r
-next font          End\r
-previous font      Home\r
+Everything can be controlled by the keyboard or mouse (if\r
+there is a mouse installed).\r
+\r
+Action             Keyboard       Mouse\r
+\r
+create a new CPI   F1          click the "1.new" text\r
+save a CPI file    F2          click the "2.save" text\r
+load a CPI file    F3          click the "3.load" text\r
+CP into VGA memory F4          click the "4.use" text\r
+change CP number   F5          click the "5.number" text\r
+new font           F6          click the "6.newF" text\r
+new codepage       F7          click the "7.newCP" text\r
+delete a font      F8          click the "8.delF" text\r
+delete a codepage  F9          click the "9.delCP" text\r
+close the program  F10         click the "10.end" text\r
+\r
+move the cursor    arrow keys  move the mouse\r
+select a character arrow keys* click the character\r
+set a pixel        Enter       left click the pixel\r
+unset a pixel      Backspace   right click the pixel\r
+change a pixel     Space       middle click the pixel\r
+switch edit/select Tab         changes automatically\r
+next codepage      PageDown    left click the "cp___" text\r
+previous codepage  PageUp      right click the "cp___" text\r
+next font          End         left click the "8x__" text\r
+previous font      Home        right click the "8x__" text\r
+\r
+*The function of arrow keys is changed with Tab.\r
 \r
 A file can also be opened using it's name as a command line\r
-parameter or by clicking its icon in Windows GUI.\r
+parameter or by clicking its icon in Windows GUI. If a wrong\r
+path is given the program closes without entering graphic\r
+mode.\r
 \r
 ============================================================\r
 \r
@@ -159,7 +169,7 @@ beta:
  - Command line parameter support\r
  - Debug information removed from screen\r
  - Fixed Function keys\r
-1.1\r
+1.1a\r
  - Full FONT flie format support\r
  - FONT.NT file format support (read only)\r
  - Codepage limit set from 6 to 16\r
@@ -179,6 +189,8 @@ beta:
    without entering graphic mode\r
  - Fixed a bug that crashed the program when loading a file\r
    from a long path\r
+1.2\r
+ - Added mouse support\r
 \r
 ============================================================\r
 \r
@@ -191,7 +203,6 @@ beta:
  - Exporting fonts to bitmaps\r
  - Importing fonts from bitmaps\r
  - Warnings\r
- - Mouse support\r
 \r
 ============================================================\r
 \r
@@ -204,10 +215,10 @@ none.
 8. Files\r
 \r
 EGAVGA  .OBJ   5658 BGI driver compiled to OBJ\r
-NAPISY  .EXE  94468 The program\r
-NAPISY  .CPP  50905 Source for the program\r
-NAPISY  .PRJ   4605 Turbo C++ 3.0 project file\r
-READTHIS.TXT   6875 This file\r
+CPIED   .EXE 107685 The program\r
+CPIED   .CPP  70458 Source for the program\r
+CPIED   .PRJ   4608 Turbo C++ 3.0 project file\r
+READTHIS.TXT   7794 This file\r
 \r
 ============================================================\r
 \r