home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 1: Collection A / 17Bit_Collection_A.iso / files / 1024.dms / 1024.adf / TextPlus / SrcE.lzh / SrcE / mainE.c < prev    next >
C/C++ Source or Header  |  1990-08-10  |  28KB  |  788 lines

  1. /*
  2.  *          mainE.c          © by Martin Steppler
  3.  */
  4.  
  5. #define QUAL_SHIFT   0x01
  6. #define QUAL_CTRL    0x02
  7. #define QUAL_AMIGA   0x04
  8. #define QUAL_ALT     0x08
  9. #define QUAL_LMB     0x10
  10. #define QUAL_MMB     0x20
  11. #define QUAL_RMB     0x40
  12.  
  13. BYTE pfadundfile[PATHSTRSIZE+FILESTRSIZE+12];
  14. struct FSRequest MyFSReq;
  15. struct Gadget ArrowGads[2], VertSlider;
  16. int numentries, topentry;
  17.  
  18. /* detaching */
  19. ULONG _BackGroundIO = 0;
  20. ULONG _stack = 4096L;
  21. ULONG _priority = 4L;
  22. char *_procname = "(-8 TextPlus2.2E 8-)";
  23.  
  24.  
  25. main(argc, argv)
  26. int argc;
  27. char *argv[];
  28. {
  29.    static ULONG  lsecs = 0L, lmics = 0L;   /* For detecting DoubleClick */
  30.    int len=0, init=2;
  31.  
  32.    SEITE=sei=71, MAX=ABSMAX; y=MIY; MAY=ABSMAY; sicher=TRUE; YKOD=ABSMAY*8-1; x=MIX;
  33.    MAS=150; snum=schrift=zg1=zg2=1; zg3=znum=5; zg4=75; zg5=72; se=-1; icfy=2;
  34.    kbuf[0]=EOS; kbufcode=numentries=topentry=bak=0; iconx=-1; icony=12;
  35.    grokle=ein=off=z=s=ze=meld=blo=ausri=vonri=stil=au=br=letztes=spe=zpe=0;
  36.    strcpy(tab,"1001001001001001001001001001001001001001001001001001001001001001001001001001000");
  37.  
  38.    Oeffnen();
  39.    strcpy(MyFSReq.matchpattern,"*");
  40.    strcpy(MyFSReq.dirname,     ":");
  41.    MyFSReq.leftedge     = 72;
  42.    MyFSReq.topedge      = 14;
  43.    MyFSReq.sorttype     =  0;
  44.    MyFSReq.flags        = FS_SHOW_DIRS_FIRST;
  45.    MyFSReq.fullname     = pfadundfile;
  46.    MyFSReq.pathgadstr   = "PATH";
  47.    MyFSReq.readingstr   = "Reading directory...";
  48.    MyFSReq.sortingstr   = "Sorting ...";
  49.    MyFSReq.emptydirstr  = "Directory is empty!";
  50.    MyFSReq.nomatchstr   = "No file matched the pattern!";
  51.    MyFSReq.selectfilestr= "Choose filename:";
  52.    MyFSReq.selectstr    = "Okay";
  53.    MyFSReq.cancelstr    = "Cancel";
  54.    se=0;
  55.    if(argc>=2) {
  56.       if(!strcmp(argv[1], "-i")) {
  57.          init=5;
  58.          if(argc>=3) { init++; strcpy(titel, argv[2]); }
  59.          else sprintf(titel, "Yet_untitled");
  60.       }
  61.       else if(argc>=3) {
  62.          if(!strcmp(argv[2], "-i")) { init=6; strcpy(titel, argv[1]); }
  63.       }
  64.    }
  65.    Iconify(init);
  66.    if(init==2 && argc==2) {
  67.       if(!FastLoad(argv[1])) {
  68.          NamenSetzen(argv[1]); strcpy(titel,argv[1]);
  69.          InitSlider(&VertSlider);
  70.       }
  71.    }
  72.    else if(init==2) {
  73.       NamenSetzen("Yet_untitled");
  74.       sprintf(titel, "Yet_untitled");
  75.    }
  76.    if(init==2) { Cursor(2); Cursor(1); }
  77.  
  78.    FOREVER
  79.    {
  80.       if(((topentry>=MAY-MIY+(len=s*(SEITE+1)+z)) || (topentry<=len+MIY-MAY) ||
  81.           numentries!=(se*(SEITE+1)+ze)) && icfy) {
  82.          topentry=len; InitSlider(&VertSlider);
  83.       }
  84.       Wait(1 << Fenster -> UserPort -> mp_SigBit);
  85.       while((nachricht=(struct IntuiMessage *) GetMsg(Fenster->UserPort))!=0L) {
  86.          switch(nachricht->Class) {
  87.             case RAWKEY:
  88.                Cursor(0); Tastaturabfrage(); Cursor(1);
  89.                break;
  90.             case CLOSEWINDOW:
  91.                if(sicher == TRUE) {
  92.                   Schluss();
  93.                   exit(RETURN_OK);
  94.                }
  95.                else if(icfy) {
  96.                   if(auto_frage(FrageText[0]) == TRUE) {
  97.                      Schluss();
  98.                      exit(RETURN_OK);
  99.                   }
  100.                }
  101.                else {
  102.                   sicher=TRUE; strcpy(Title, "»»» REALLY? «««  ");
  103.                   for(len=(nw.Width-36)/8-17; len>0; len--) strcat(Title, " ");
  104.                   SetWindowTitles(Fenster, Title, (char *)-1);
  105.                }
  106.                break;
  107.             case MENUPICK:
  108.                if(MENUNUM(nachricht->Code) != MENUNULL) {
  109.                   Cursor(0);
  110.                   Menueabfrage(MENUNUM(nachricht->Code), ITEMNUM(nachricht->Code));
  111.                   Cursor(1);
  112.                }
  113.                break;
  114.             case MOUSEBUTTONS:
  115.                switch(nachricht->Code) {
  116.                   case MENUDOWN:
  117.                      icfy=3;
  118.                      break;
  119.                   case SELECTDOWN:
  120.                      Cursor(0);
  121.                      if(DoubleClick(lsecs, lmics, nachricht->Seconds, nachricht->Micros)) {
  122.                         if(blo<=2) {
  123.                            BlockMarkieren();
  124.                            if(meld==TRUE) Meldung();
  125.                         }
  126.                         else {
  127.                            if(nachricht->Qualifier & (IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT))
  128.                               BlockLoeschen(bas,baz,bes,bez);
  129.                            else if(nachricht->Qualifier & (IEQUALIFIER_LALT|IEQUALIFIER_RALT))
  130.                               MarkierungLoeschen();
  131.                            else
  132.                               BlockEinfuegen(bas,baz,bes,bez);
  133.                            Meldung();
  134.                         }
  135.                      }
  136.                      else {
  137.                         lsecs = nachricht->Seconds;
  138.                         lmics = nachricht->Micros;
  139.                         Tabulator(FALSE, Fenster->GZZMouseX, Fenster->GZZMouseY);
  140.                      }
  141.                      meld=FALSE; Cursor(1);
  142.                      break;
  143.                   default:
  144.                      break;
  145.                }
  146.                break;
  147.             case NEWSIZE:
  148.                Cursor(0); NeueGroesse(); Cursor(1);
  149.                break;
  150.             case INTUITICKS:
  151.                if(ArrowGads[0].Flags&SELECTED) {
  152.                   Cursor(0); GetSlider(&VertSlider,-1); Cursor(1);
  153.                }
  154.                else if(ArrowGads[1].Flags&SELECTED) {
  155.                   Cursor(0); GetSlider(&VertSlider, 1); Cursor(1);
  156.                }
  157.                else if(VertSlider.Flags&SELECTED) {
  158.                   Cursor(0); GetSlider(&VertSlider, 0); Cursor(1);
  159.                }
  160.                else if(blo==2) {
  161.                   if(y==MAY && Fenster->GZZMouseY > (MAY-1)*8 ) {
  162.                       Cursor(0); YZPlus();  Cursor(1);
  163.                   }
  164.                   else if(y==MIY && Fenster->GZZMouseY < MIY*8) {
  165.                       Cursor(0); YZMinus(); Cursor(1);
  166.                   }
  167.                }
  168.                break;
  169.             case GADGETUP:
  170.                if(((struct Gadget *)nachricht->IAddress)->GadgetID == 2) {
  171.                   Cursor(0); GetSlider(&VertSlider, 0); Cursor(1);
  172.                }
  173.                break;
  174.             case MOUSEMOVE:
  175.                if(blo==2) {
  176.                   Cursor(0);
  177.                   Tabulator(2, Fenster->GZZMouseX, Fenster->GZZMouseY);
  178.                   Cursor(1);
  179.                }
  180.                break;
  181.             default:
  182.                break;
  183.          }
  184.          ReplyMsg(nachricht);
  185.       }
  186.       if(icfy==3) {
  187.          Iconify(1);
  188.          if(init==6) {
  189.             if(!FastLoad(titel)) InitSlider(&VertSlider);
  190.             init=2; Cursor(2);
  191.          }
  192.          else SText();
  193.          Cursor(1);
  194.       }
  195.       else if(icfy==4) {
  196.          Cursor(0); Iconify(0);
  197.       }
  198.    }
  199. }
  200. Menueabfrage(menue, punkt)
  201. int menue, punkt;
  202. {
  203.    switch(menue) {
  204.       case 0:                                  /* Dokument */
  205.          switch(punkt) {
  206.             case 0:                            /* Laden */
  207.                if(disk(TitelText[0])) {
  208.                   if(sicher == TRUE)
  209.                      TLaden(pfadundfile);
  210.                   else if(auto_frage(FrageText[2])==TRUE)
  211.                      TLaden(pfadundfile);
  212.                }
  213.                break;
  214.             case 1:                            /* Text Anhängen */
  215.                if(disk(TitelText[1]))
  216.                   TextAnhaengen(pfadundfile);
  217.                break;
  218.             case 3:                            /* Text Löschen */
  219.                if(sicher == TRUE) {
  220.                   TLoeschen();
  221.                   break;
  222.                }
  223.                if(auto_frage(FrageText[1]) == TRUE) {
  224.                   TLoeschen();
  225.                   sicher == TRUE;
  226.                }
  227.                break;
  228.             case 5:                            /* Speichern */
  229.                Speichern(titel, 0,0,se,ze);
  230.                break;
  231.             case 6:                            /* Speichern als ... */
  232.                if(disk(TitelText[2]))
  233.                   Speichern(pfadundfile, 0, 0, se, ze);
  234.                break;
  235.             case 7:                            /* Speichern & Beenden */
  236.                if(Speichern(titel, 0,0,se,ze)==TRUE) {
  237.                   Schluss();
  238.                   exit(RETURN_OK);
  239.                }
  240.                break;
  241.             case 9:                                /* Drucken */
  242.                drucken(TitelText[5], 0, 0, se, ze);
  243.                break;
  244.             case 11:                               /* Iconify */
  245.                icfy=4;
  246.                if(blo==2) blo==3;
  247.                break;
  248.             case 12:                               /* Hilfe */
  249.                Hilfe();
  250.                break;
  251.             case 13:                               /* Info */
  252.                nein_text.IText = (UBYTE *) "READ!";
  253.                AutoRequest(Fenster,&InfoText[0],NL,&nein_text,0,0,352,200);
  254.                nein_text.IText = (UBYTE *) "NO!";
  255.                break;
  256.             case 15:                               /* Ende */
  257.                if(sicher==TRUE) {
  258.                   Schluss();
  259.                   exit(RETURN_OK);
  260.                }
  261.                if(auto_frage(FrageText[0])==TRUE) {
  262.                   Schluss();
  263.                   exit(RETURN_OK);
  264.                }
  265.                break;
  266.          }
  267.          spe=zpe=0; break;
  268.       case 1:                                       /* Editieren */
  269.          switch(punkt) {
  270.             case 0:                                 /* Block markieren */
  271.                BlockMarkieren();
  272.                if(meld==TRUE) {
  273.                   meld=FALSE; Meldung();
  274.                }
  275.                break;
  276.             case 2:                                /* Block kopieren */
  277.                BlockEinfuegen(bas,baz,bes,bez);
  278.                meld=FALSE; Meldung();
  279.                break;
  280.             case 3:                                /* Block Löschen */
  281.                BlockLoeschen(bas,baz,bes,bez);
  282.                meld=FALSE; Meldung();
  283.                break;
  284.             case 5:                             /* Markierung löschen */
  285.                MarkierungLoeschen();
  286.                meld=FALSE; Meldung();
  287.                break;
  288.             case 7:                                 /* Block Laden */
  289.                if(disk(TitelText[3])) {
  290.                   if(se==MAS && ze==SEITE) {
  291.                      sprintf(buffer, "%s", FehlerText[2]);
  292.                      Meldung();
  293.                   }
  294.                   if(se==s && ze==z) {
  295.                      TextAnhaengen(pfadundfile); break;
  296.                   }
  297.                   sprintf(buffer, "Loading %s!", pfadundfile);
  298.                   Meldung();
  299.                   BLaden(pfadundfile);
  300.                   if(meld==TRUE) { Meldung(); meld=FALSE; }
  301.                }
  302.                break;
  303.             case 8:                                 /* Block Speichern */
  304.                if(disk(TitelText[4])) {
  305.                   Speichern(pfadundfile, bas, baz, bes, bez);
  306.                   sicher = FALSE;
  307.                }
  308.                break;
  309.             case 10:                                /* Block Drucken */
  310.                drucken(TitelText[6], bas, baz, bes, bez);
  311.                break;
  312.          }
  313.          spe=zpe=0; break;
  314.       case 2:                                      /* Einstellungen */
  315.          switch(punkt) {
  316.             case 0:                                /* Seitenlänge */
  317.                einstell(TitelText[7], 0, se, ze);
  318.                break;
  319.             case 1:                                /* Textbreite */
  320.                einstell(TitelText[8], 1, se, ze);
  321.                if(x>MAX) x=MAX; break;
  322.             case 3:                                /* Einfügen */
  323.                Einfuegen();
  324.                break;
  325.             case 4:                                /* Brief / ASCII */
  326.                Brief();
  327.                break;
  328.             case 5:                                /* Auto-Trenn */
  329.                Auto();
  330.                break;
  331.             case 6:                                /* Backup */
  332.                Backup(); Meldung();
  333.                break;
  334.             case 8:                               /* Gehe zu ... */
  335.                Gehezu(0);
  336.                break;
  337.             case 9:                               /* Gehe zur x. Zeile */
  338.                Gehezu(1);
  339.                break;
  340.          }
  341.          spe=zpe=0; break;
  342.       case 3:                                      /* Schrift */
  343.          switch(punkt) {
  344.             case 0:                                /* Normal */
  345.                Schriftart(0);
  346.                break;
  347.             case 1:                                /* Unterstrichen */
  348.                Schriftart(1);
  349.                break;
  350.             case 2:                                /* Fett */
  351.                Schriftart(2);
  352.                break;
  353.             case 3:                                /* Kursiv */
  354.                Schriftart(4);
  355.                break;
  356.             case 5:                                /* Linksbündig */
  357.                Ausrichtung(LINKS);
  358.                break;
  359.             case 6:                                /* Rechtsbündig */
  360.                Ausrichtung(RECHTS);
  361.                break;
  362.             case 7:                                /* Zentriert */
  363.                Ausrichtung(ZENTRIERT);
  364.                break;
  365.             case 8:                                /* Blocksatz */
  366.                Ausrichtung(BLOCKSATZ);
  367.                break;
  368.          }
  369.          break;
  370.       case 4:                                      /* Suchen         */
  371.          switch(punkt) {
  372.             case 0:                                /* Suchen         */
  373.                Gehezu(2);
  374.                break;
  375.             case 1:                                /*  "" nächstes   */
  376.                Suchen(0);
  377.                break;
  378.             case 2:                                /*  "" vorheriges */
  379.                Suchen(2);
  380.                break;
  381.             case 4:                                /* Ersetzen       */
  382.                Gehezu(3);
  383.                break;
  384.             case 5:                                /*  "" nächstes   */
  385.                Suchen(1);
  386.                break;
  387.             case 6:                                /*  "" vorheriges */
  388.                Suchen(3);
  389.                break;
  390.          }
  391.          break;
  392.    }
  393. }
  394. Tastaturabfrage()
  395. {
  396.    int ss, zz, qual, marke=TRUE, len;
  397.    UBYTE KeyBuffer[10];
  398.  
  399.    if (nachricht->Class != RAWKEY)           return(-2);
  400.    if (nachricht->Code & IECODE_UP_PREFIX)   return(-2);
  401.    len = DeadKeyConvert(nachricht, KeyBuffer, sizeof(KeyBuffer), NULL);
  402.    if(len==1 && ((KeyBuffer[0]>=32 && KeyBuffer[0]<=126) || KeyBuffer[0]>=160)) {
  403.       sicher = FALSE;
  404.       sprintf(buffer, "%c", KeyBuffer[0]);
  405.       StilAn();
  406.       if(blo>=2) {
  407.          if(blo==2 || (blo>2 && BloPruef())) SetAPen(RP, ROT);
  408.       }
  409.       Move(RP, (x-off)*8-8, y*8-2);
  410.       Text(RP, buffer, 1); if(blo) SetAPen(RP, WEISS);
  411.       Buchstabe(KeyBuffer[0]);
  412.       XPlus();
  413.       if(meld == TRUE) Meldung();
  414.       else ZSDisplay();
  415.       meld=FALSE;
  416.    }
  417.    else if(len>0) {
  418.       qual = 0;
  419.       if (nachricht->Qualifier & (IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT))
  420.           qual |= QUAL_SHIFT;
  421.       if (nachricht->Qualifier & (IEQUALIFIER_CONTROL))
  422.           qual |= QUAL_CTRL;
  423.       if (nachricht->Qualifier & (IEQUALIFIER_LALT|IEQUALIFIER_RALT))
  424.           qual |= QUAL_ALT;
  425.       /*
  426.       if (nachricht->Qualifier & (IEQUALIFIER_LCOMMAND|IEQUALIFIER_RCOMMAND))
  427.           qual |= QUAL_AMIGA;
  428.       if ((nachricht->Qualifier & IEQUALIFIER_CAPSLOCK) &&
  429.            actual == 1 && KeyBuffer[1] >= 'a' && KeyBuffer[1] <= 'z')
  430.           qual |= QUAL_SHIFT;
  431.       if (nachricht->Qualifier & IEQUALIFIER_LEFTBUTTON)
  432.           qual |= QUAL_LMB;
  433.       if (nachricht->Qualifier & IEQUALIFIER_MIDBUTTON)
  434.           qual |= QUAL_MMB;
  435.       if (nachricht->Qualifier & (IEQUALIFIER_RBUTTON))
  436.           qual |= QUAL_RMB;
  437.       */
  438.       switch(KeyBuffer[0]) {
  439.          case 155:
  440.             switch(KeyBuffer[1]) {
  441.                case 68:             /* Crsr left */
  442.                   if((qual & QUAL_CTRL) && blo>2) BlockSchieben(1);
  443.                   else if(qual & QUAL_ALT) JumpWord(0);
  444.                   else XMinus();
  445.                   break;
  446.                case 67:             /* Crsr right */
  447.                   if((qual & QUAL_CTRL) && blo>2) BlockSchieben(0);
  448.                   else if(qual & QUAL_ALT) JumpWord(1);
  449.                   else XPlus();
  450.                   break;
  451.                case 66:
  452.                   if(qual & QUAL_CTRL) {           /* d4 Seite vorwärts */
  453.                      y=MIY; z=spe=zpe=0;
  454.                      if(++s>se) { s=se; z=ze; marke=FALSE; }
  455.                      ss=s; zz=z; FastText();
  456.                      if(marke==FALSE) zz=z;
  457.                      meld=FALSE; s=ss; z=zz; y=MIY; ZSDisplay();
  458.                      if(s==se && z==ze) {
  459.                         sprintf(buffer, "%s", FehlerText[1]);
  460.                         meld = TRUE;
  461.                      }
  462.                   }
  463.                   else if(qual & QUAL_ALT) {          /* s19 Textende */
  464.                      s=se; z=ze; y=MIY; zpe=spe=0;
  465.                      FastText();
  466.                   }
  467.                   else {
  468.                      YZPlus(); spe=zpe=0; /* Crsr down */
  469.                   }
  470.                   break;
  471.                case 65:
  472.                   if(qual & QUAL_CTRL) {          /* f6 Seite rückwärts */
  473.                      y=MIY;
  474.                      if(z==0) {
  475.                         if(--s<0) {
  476.                            s=0; marke=55;
  477.                         }
  478.                      }
  479.                      z=zpe=spe=0; ss=s; if(blo==2) blo=6;
  480.                      FastText(); meld=FALSE;
  481.                      z=0; s=ss; y=MIY; ZSDisplay();
  482.                      if(marke==55 || (s==0 && z==0)) {
  483.                         marke=meld=TRUE;
  484.                         sprintf(buffer, "%s", FehlerText[0]);
  485.                      }
  486.                   }
  487.                   else if(qual & QUAL_ALT) {          /* a1 Textanfang */
  488.                      s=z=zpe=spe=0; y=MIY; if(blo==2) blo=6;
  489.                      SText();
  490.                      ZSDisplay();
  491.                      sprintf(buffer, "%s", FehlerText[0]);
  492.                      meld=TRUE;
  493.                   }
  494.                   else {
  495.                      YZMinus(); spe=zpe=0;    /* Crsr Up */
  496.                   }
  497.                   break;
  498.                case 84:            /* Shift up */
  499.                   spe=zpe=0;
  500.                   if(y==MIY) {
  501.                      CrsrHoch(); topentry=s*(SEITE+1)+z; InitSlider(&VertSlider);
  502.                   }
  503.                   else
  504.                      CrsrTop();
  505.                   break;
  506.                case 83:            /* Shift down */
  507.                   spe=zpe=0;
  508.                   if(y==MAY) {
  509.                      y=MIY;
  510.                      FastText();
  511.                      topentry=s*(SEITE+1)+z; InitSlider(&VertSlider);
  512.                   }
  513.                   else
  514.                      CrsrBot();
  515.                   break;
  516.                case 32:
  517.                   switch(KeyBuffer[2]) {
  518.                      case 64:                        /* Shift right */
  519.                         ss=x; zz=SL(s,z);
  520.                         x=zz-SC(s,z,zz)+1; if(x>MAX) x=MAX;
  521.                         if(x-MAX1>=off) {
  522.                            if(ss==MAX1-1+off) {
  523.                               off+=OFF1; if(x-MAX1>=off) x=MAX1-1+off;
  524.                               SText(); meld=FALSE;
  525.                            }
  526.                            else x=MAX1-1+off;
  527.                         }
  528.                         if(x<=off) { off=(x/MAX1)*OFF1; SText(); }
  529.                         meld=FALSE;
  530.                         break;
  531.                      case 65:                       /* Shift left */
  532.                         if(x==off+1 && off) {
  533.                            x-=OFF1; off-=OFF1; SText(); meld=FALSE;
  534.                         }
  535.                         else x=off+1;
  536.                         break;
  537.                   }
  538.                   break;
  539.                case 63:                          /* HELP */
  540.                   Hilfe();
  541.                   break;
  542.                case 90:                             /* BACKTAB */
  543.                   FOREVER {
  544.                      XMinus();
  545.                      if(meld == TRUE || tab[x-off-1]=='1') break;
  546.                   }
  547.                   break;
  548.             }
  549.             break;
  550.          case 9:                                   /* TAB */
  551.             if(qual & QUAL_CTRL) {                /* CTRL - TAB */
  552.                if(blo>2) BlockSchieben(3);
  553.                else {
  554.                   FOREVER {
  555.                      if(x==MIX) break;
  556.                      BSpace();
  557.                      if(tab[x-off-1]=='1') break;
  558.                   }
  559.                }
  560.             }
  561.             else {
  562.                FOREVER {
  563.                   if(qual & QUAL_ALT) {              /* ALT - TAB */
  564.                      if(blo>2) { BlockSchieben(2); break; }
  565.                      else {
  566.                         sprintf(buffer, " ");
  567.                         StilAn(); Move(RP, (x-off)*8-8, y*8-2);
  568.                         Text(RP, buffer, 1);
  569.                         Buchstabe(buffer[0]);
  570.                      }
  571.                   }
  572.                   XPlus();
  573.                   if(meld == TRUE || tab[x-off-1]=='1') break;
  574.                }
  575.             }
  576.             break;
  577.          case 13:                                 /* Return */
  578.             if(qual & QUAL_SHIFT) {     /* l12 Zeile einfügen */
  579.                ss=x; x=MIX; CarRet(); x=ss;
  580.                YZMinus(); BelAend(s,z,kbufcode,strlen(kbuf),0);
  581.                strcpy(a[s] [z], kbuf);
  582.                if(kbufcode) SonderDruck(y, SL(s,z), 0);
  583.                else         NormalDruck(y, SL(s,z), 0);
  584.             }
  585.             else
  586.                CarRet();
  587.             spe=zpe=0; break;
  588.          case 8:                                  /* Backspace */
  589.             if(qual & QUAL_ALT)             /* Wort links des Crsr löschen */
  590.                CDel(1);
  591.             else if(qual & QUAL_CTRL)     /* Alles links vom Crsr löschen */
  592.                CDel(2);
  593.             else if(qual & QUAL_SHIFT)    /* Alle Spaces rechts vom Crsr löschen */
  594.                CDel(3);
  595.             else
  596.                BSpace();
  597.             sicher = FALSE;
  598.             break;
  599.          case 127:                                /* Delete */
  600.             if(qual & QUAL_SHIFT) {           /* j10 Zeile löschen */
  601.                strcpy(kbuf, a[s] [z]);
  602.                kbufcode = SC(s,z,SL(s,z));
  603.                ZeileLoeschen();
  604.                spe=zpe= FALSE;
  605.             }
  606.             else if (qual & QUAL_CTRL)      /* k11 Rest der Zeile löschen */
  607.                RestLoeschen();
  608.             else if (qual & QUAL_ALT)      /* Wort rechts des Crsr löschen */
  609.                CDel(0);
  610.             else
  611.                Del();
  612.             sicher = FALSE;
  613.             break;
  614.          case 5:
  615.             Einfuegen();                    /* Ctrl-e Einfügen An/Aus */
  616.             break;
  617.          case 20:                           /* Ctrl-t Textlänge anzeigen */
  618.             Textlaenge();
  619.             break;
  620.          case 2:                            /* Ctrl-b Block markieren */
  621.             if(blo<3) BlockMarkieren();
  622.             break;
  623.          case 4:                           /* Ctrl-d Markierung löschen */
  624.             if(blo!=0) MarkierungLoeschen();
  625.             break;
  626.          case 24:                           /* Ctrl-x Block löschen */
  627.             if(blo==3) BlockLoeschen(bas,baz,bes,bez); spe=zpe=0;
  628.             break;
  629.          case 3:                            /* Ctrl-c Block kopieren */
  630.             if(blo==3) BlockEinfuegen(bas,baz,bes,bez); spe=zpe=0;
  631.             break;
  632.          case 17:                           /* Ctrl-q Abspeichern u. Schluss */
  633.             if(auto_frage(FrageText[3])==TRUE) {
  634.                if(Speichern(titel, 0,0,se,ze)==TRUE) {
  635.                   Schluss();
  636.                   exit(RETURN_OK);
  637.                }
  638.             }
  639.             break;
  640.          case 7:                            /* Ctrl-g Gehe zu ... */
  641.             meld=TRUE; spe=zpe=0;
  642.             Gehezu(0);
  643.             break;
  644.          case 12:                           /* Ctrl-l Gehe zur x. Zeile */
  645.             meld=TRUE; spe=zpe=0;
  646.             Gehezu(1);
  647.             break;
  648.          case 14:                           /* Ctrl-n Normal */
  649.             Schriftart(0);
  650.             break;
  651.          case 15:                            /* Ctrl-o Fett  */
  652.             Schriftart(2);
  653.             break;
  654.          case 11:                           /* Ctrl-k Kursiv */
  655.             Schriftart(4);
  656.             break;
  657.          case 21:                           /* Ctrl-u Unterstrichen */
  658.             Schriftart(1);
  659.             break;
  660.          case 18:                           /* Ctrl-r Brief An/Aus */
  661.             Brief();
  662.             break;
  663.          case 1:                            /* Ctrl-y Auto An/Aus */
  664.             Auto();
  665.             break;
  666.          case 16:                           /* Ctrl-p Backup An/Aus */
  667.             Backup(); meld=TRUE;
  668.             break;
  669.          case 27:                               /* ESC  Ende */
  670.             if(sicher == TRUE) {
  671.                Schluss();
  672.                exit(RETURN_OK);
  673.             }
  674.             if(auto_frage(FrageText[0])==TRUE) {
  675.                Schluss();
  676.                exit(RETURN_OK);
  677.             }
  678.             break;
  679.          default:
  680.             marke = FALSE;
  681.       }
  682.       if(meld == TRUE)  Meldung();
  683.       if(meld == FALSE) ZSDisplay();
  684.       meld = FALSE;
  685.    }
  686. }
  687. Hilfe()
  688. {
  689.    UBYTE c;
  690.    int len, ss=s, zz=z, yy=y;
  691.  
  692.    SetAPen(RP, 0);
  693.    RectFill(RP, 0, 32, RRAND, YKOD+2);
  694.    SetAPen(RP, 1);
  695.    StilAus();
  696.    for(len=0; len<=MAY-MIY; len++) {
  697.       Move(RP, 0, (len+MIY)*8-2);
  698.       Text(RP, HilfeText[len], strlen(HilfeText[len]));
  699.    }
  700.    StilAn();
  701.    while(!ConsoleGetKey()) ;
  702.    s=ss; z=zz; y=yy;
  703.    SText(); meld=FALSE;
  704.    ZSDisplay();
  705. }
  706. Iconify(modus)
  707. int modus;
  708. {
  709.    static int oldheight = 0, oldtopedge = 0 ;
  710.  
  711.    if(!modus || modus>=5) {
  712.       if(modus>=5) {
  713.          ErstBel(0,0);
  714.          if(!LadeConfig("TxP.Config")) LadeConfig("s:TxP.Config");
  715.          ein = (ein) ? FALSE:TRUE; modus=0;
  716.       }
  717.       else {
  718.          oldheight  = Fenster->Height;
  719.          oldtopedge = Fenster->TopEdge;
  720.       }
  721.       if(Fenster->MenuStrip)  ClearMenuStrip(Fenster, &Menus[0]);
  722.       if(Fenster)             CloseWindow(Fenster);
  723.       if(Scheibe)             CloseScreen(Scheibe);
  724.       nw.Height      = 10;
  725.       nw.Width       = 36 + strlen(titel)*8;
  726.       if(nw.Width<172) nw.Width=172;
  727.       if(iconx < 0) {
  728.          nw.LeftEdge = 636 - nw.Width;
  729.       }
  730.       else {
  731.          if(iconx+nw.Width>640) nw.LeftEdge = 0;
  732.          else nw.LeftEdge = iconx;
  733.       }
  734.       if(icony<0 || icony>189) nw.TopEdge = 1;
  735.       else nw.TopEdge = icony;
  736.       nw.Title = NULL;
  737.       strcpy(Title, titel); strcat(Title, "                ");
  738.       nw.IDCMPFlags  = ICONIDCMP;
  739.       nw.Flags       = ICONFLAGS;
  740.       nw.Type        = WBENCHSCREEN;
  741.       nw.Screen      = NULL;
  742.       MyFSReq.userscreen = NULL;
  743.    }
  744.    else {
  745.       if(modus==1) {
  746.          icony = Fenster->TopEdge;
  747.          CloseWindow(Fenster);
  748.       }
  749.       if(!oldheight)   oldheight=199;
  750.       if(!oldtopedge)  oldtopedge=1;
  751.       nw.LeftEdge    = 0;
  752.       nw.TopEdge     = oldtopedge;
  753.       nw.Height      = oldheight;
  754.       nw.Width       = 640;
  755.       nw.IDCMPFlags  = IDCMPFLAGS;
  756.       nw.Flags       = FLAGS;
  757.       nw.Title       = NULL;
  758.       nw.Type        = CUSTOMSCREEN;
  759.       if(!(Scheibe = (struct Screen *) OpenScreen(&NeuScheibe))) {
  760.          printf("Can't open screen!\n");
  761.          Schluss(); exit(FALSE);
  762.       }
  763.       nw.Screen = (struct Screen *)Scheibe;
  764.       MyFSReq.userscreen   = (struct Screen *)Scheibe;
  765.    }
  766.    if(!(Fenster = (struct Window *)OpenWindow(&nw))) {
  767.       printf("Can't open window!\n");
  768.       Schluss(); exit(FALSE);
  769.    }
  770.    RP=Fenster->RPort;
  771.    if(modus) {
  772.       strcpy(Title, VERSION);
  773.       SetWindowTitles(Fenster, Title, Scheibe);
  774.       SetMenuStrip(Fenster, &Menus[0]); MenueUeberwachung(0);
  775.       AddGList(Fenster, &VertSlider, 0, -1, NULL);
  776.       RefreshGList(&VertSlider, Fenster, NULL, -1);
  777.       if(modus==2) {
  778.          ErstBel(0,0);
  779.          if(!LadeConfig("TxP.Config")) LadeConfig("s:TxP.Config");
  780.          Einfuegen();
  781.       }
  782.       TitelZeile(); ZSDisplay();
  783.       Tabulator(TRUE,FALSE,FALSE); MenueUeberwachung(3); NamenSetzen(titel);
  784.    }
  785.    else SetWindowTitles(Fenster, Title, (char *)-1);
  786.    icfy=modus;
  787. }
  788.