home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma91.dms / ma91.adf / KonwersjaLib.lha / Przykîad / Konwerter.c < prev    next >
C/C++ Source or Header  |  1997-07-08  |  16KB  |  614 lines

  1. #include <proto/exec.h>
  2. #include <exec/memory.h>
  3. #include <proto/dos.h>
  4. #include <libraries/dos.h>
  5. #include <proto/asl.h>
  6. #include <libraries/asl.h>
  7. #include <proto/intuition.h>
  8. #include <intuition/intuition.h>
  9. #include <intuition/gadgetclass.h>
  10. #include <proto/gadtools.h>
  11. #include <libraries/gadtools.h>
  12. #include <proto/graphics.h>
  13. #include <proto/konwersja.h>
  14. #include <libraries/konwersja.h>
  15. #include <string.h>
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18.  
  19. #define GD_Standardy 0
  20. #define GD_Wczytaj   1
  21. #define GD_Zapisz    2
  22. #define GD_CRLF      3
  23. #define GD_DodajEOF  4
  24.  
  25. void StworzSrodowisko (void);
  26. void ZamknijSrodowisko (void);
  27. void OtworzBiblioteki (void);
  28. int PrzygotujEkran (void);
  29. int DodajStandardy (void);
  30. int OtworzOkno (void);
  31. void OdswierzOkno (void);
  32. void Renderuj (void);
  33. void ZwolnijEkran (void);
  34. void ZamknijOkno (void);
  35. void UsunStandardy (void);
  36. void ZamknijBiblioteki (void);
  37. void WczytajPlik (void);
  38. void ZapiszPlik (void);
  39.  
  40. void Informacja (UBYTE *);
  41. void PiszStandard (UBYTE *, UWORD);
  42. void PiszPlik (UBYTE *);
  43.  
  44. BOOL __stdargs __saveds funkcja (ULONG calosc, ULONG gotowe, APTR);
  45.  
  46. struct Library *AslBase = NULL;
  47. struct Library *GadToolsBase = NULL;
  48. struct GfxBase *GfxBase = NULL;
  49. struct IntuitionBase *IntuitionBase = NULL;
  50. struct KonBase *KonBase = NULL;
  51. struct FileRequester *requester = NULL;
  52. struct TextFont *font = NULL;
  53. APTR visualinfo = NULL;
  54. struct Screen *ekran = NULL;
  55. struct Window *okno = NULL;
  56. struct Gadget *gadzety = NULL;
  57. struct Gadget *gad_zapisz, *gad_eof;
  58. struct MinList Standardy;
  59.  
  60. UWORD zoomdata[] =
  61. {
  62.   0, 0, 200, 10
  63. };
  64.  
  65. struct TextAttr topaz8 =
  66. {
  67.   (STRPTR) "topaz.font", 8, 0, FPF_ROMFONT
  68. };
  69.  
  70. struct IntuiText napisy[] =
  71. {
  72.   1, 0, JAM1, 242, 14, &topaz8, (UBYTE *) "Plik:", &napisy[1],
  73.   1, 0, JAM1, 277, 30, &topaz8, (UBYTE *) "Standard úródîowy:", &napisy[2],
  74.   1, 0, JAM1, 277, 61, &topaz8, (UBYTE *) "Standard docelowy:", NULL
  75. };
  76.  
  77. UWORD kod;
  78. WORD zrodlowy, docelowy = -1;
  79. UBYTE flagi = NULL;
  80. ULONG rozmiar = (ULONG) NULL;
  81. UBYTE *bufor = (UBYTE *) NULL;
  82.  
  83. void StworzSrodowisko (void)
  84. {
  85.   OtworzBiblioteki ();
  86.  
  87.   if (!(PrzygotujEkran ()))
  88.     ZamknijSrodowisko ();
  89.  
  90.   if (!(DodajStandardy ()))
  91.     ZamknijSrodowisko ();
  92.  
  93.   if (!(OtworzOkno ()))
  94.     ZamknijSrodowisko ();
  95. }
  96.  
  97. void ZamknijSrodowisko (void)
  98. {
  99.   ZamknijOkno ();
  100.   ZwolnijEkran ();
  101.   UsunStandardy ();
  102.   ZamknijBiblioteki ();
  103.  
  104.   if (rozmiar && bufor)
  105.     FreeMem (bufor, rozmiar);
  106.   exit (0);
  107. }
  108.  
  109. void OtworzBiblioteki (void)
  110. {
  111.   if (!(AslBase = (struct Library *) OpenLibrary ("asl.library", 37)))
  112.     ZamknijSrodowisko ();
  113.  
  114.   if (!(GadToolsBase = (struct Library *) OpenLibrary ("gadtools.library", 37)))
  115.     ZamknijSrodowisko ();
  116.  
  117.   if (!(GfxBase = (struct GfxBase *) OpenLibrary ("graphics.library", 37)))
  118.     ZamknijSrodowisko ();
  119.  
  120.   if (!(IntuitionBase = (struct IntuitionBase *) OpenLibrary ("intuition.library", 37)))
  121.     ZamknijSrodowisko ();
  122.  
  123.   if (!(KonBase = (struct KonBase *) OpenLibrary (KONNAME, KONVERSION)))
  124.     ZamknijSrodowisko ();
  125.  
  126.   if (!(requester = (struct FileRequester *) AllocAslRequestTags (ASL_FileRequest, TAG_DONE)))
  127.     ZamknijSrodowisko ();
  128. }
  129.  
  130. int PrzygotujEkran (void)
  131. {
  132.   if (!(font = OpenFont (&topaz8)))
  133.     return (0);
  134.  
  135.   if (!(ekran = LockPubScreen ((UBYTE *) NULL)))
  136.     return (0);
  137.  
  138.   if (!(visualinfo = GetVisualInfo (ekran, TAG_DONE)))
  139.     return (0);
  140.  
  141.   return (1);
  142. }
  143.  
  144.  
  145. int DodajStandardy (void)
  146. {
  147.  
  148.   struct Standard *s;
  149.   struct Node *n;
  150.  
  151.   NewList ((struct List *) &Standardy);
  152.  
  153.   for (s = (struct Standard *) (KonBase->kon_Standardy.mlh_Head);
  154.        s->stan_Node.mln_Succ;
  155.        s = (struct Standard *) (s->stan_Node.mln_Succ)
  156.     )
  157.     {
  158.       if (!(n = AllocMem (sizeof (*n), MEMF_PUBLIC | MEMF_CLEAR)))
  159.         return (0);
  160.  
  161.       n->ln_Name = (UBYTE *) s->stan_Nazwa;
  162.  
  163.       AddTail ((struct List *) &Standardy, (struct Node *) n);
  164.     }
  165.  
  166. }
  167.  
  168. int OtworzOkno (void)
  169. {
  170.   struct NewGadget ng;
  171.   struct Gadget *g;
  172.   UWORD offx, offy;
  173.  
  174.   offx = ekran->WBorLeft;
  175.   offy = ekran->WBorTop + ekran->RastPort.TxHeight + 1;
  176.  
  177.   if (!(g = CreateContext (&gadzety)))
  178.     return (0);
  179.  
  180.   ng.ng_LeftEdge = offx + 71;
  181.   ng.ng_TopEdge = offy + 22;
  182.   ng.ng_Width = 92;
  183.   ng.ng_Height = 68;
  184.   ng.ng_GadgetText = (UBYTE *) "Konwertuj na standard:";
  185.   ng.ng_TextAttr = &topaz8;
  186.   ng.ng_GadgetID = GD_Standardy;
  187.   ng.ng_Flags = PLACETEXT_ABOVE;
  188.   ng.ng_VisualInfo = visualinfo;
  189.  
  190.   g = CreateGadget (LISTVIEW_KIND, g, &ng, GTLV_Labels, &Standardy, TAG_DONE);
  191.  
  192.   ng.ng_LeftEdge = offx + 35;
  193.   ng.ng_TopEdge = offy + 95;
  194.   ng.ng_Width = 70;
  195.   ng.ng_Height = 14;
  196.   ng.ng_GadgetText = (UBYTE *) "Wczytaj";
  197.   ng.ng_GadgetID = GD_Wczytaj;
  198.   ng.ng_Flags = PLACETEXT_IN;
  199.  
  200.   g = CreateGadget (BUTTON_KIND, g, &ng, TAG_DONE);
  201.  
  202.   ng.ng_LeftEdge = offx + 130;
  203.   ng.ng_GadgetText = (UBYTE *) "Zapisz";
  204.   ng.ng_GadgetID = GD_Zapisz;
  205.  
  206.   gad_zapisz = g = CreateGadget (BUTTON_KIND, g, &ng, GA_Disabled, 1, TAG_DONE);
  207.  
  208.   ng.ng_LeftEdge = offx + 248;
  209.   ng.ng_TopEdge = offy + 100;
  210.   ng.ng_GadgetText = (UBYTE *) "LF <-> CR+LF";
  211.   ng.ng_GadgetID = GD_CRLF;
  212.   ng.ng_Flags = PLACETEXT_RIGHT;
  213.  
  214.   g = CreateGadget (CHECKBOX_KIND, g, &ng, TAG_DONE);
  215.  
  216.   ng.ng_TopEdge = offy + 115;
  217.   ng.ng_GadgetText = (UBYTE *) "Dodaj EOF";
  218.   ng.ng_GadgetID = GD_DodajEOF;
  219.  
  220.   gad_eof = g = CreateGadget (CHECKBOX_KIND, g, &ng, GA_Disabled, 1, TAG_DONE);
  221.  
  222.   if (!g)
  223.     return (0);
  224.  
  225.   if (!(okno = OpenWindowTags (NULL,
  226.                                WA_Left, 10,
  227.                                WA_Top, 15,
  228.                                WA_Width, 484,
  229.                                WA_Height, 168 + offy,
  230.                                WA_IDCMP, LISTVIEWIDCMP | BUTTONIDCMP | CHECKBOXIDCMP | IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY | IDCMP_NEWSIZE,
  231.                                WA_Flags, WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_SMART_REFRESH | WFLG_SMART_REFRESH | WFLG_ACTIVATE | WFLG_RMBTRAP,
  232.                                WA_Gadgets, NULL,
  233.                                WA_Title, (UBYTE *) "Konwerter 1.0",
  234.                                WA_ScreenTitle, NULL,
  235.                                WA_PubScreen, ekran,
  236.                                WA_Zoom, zoomdata,
  237.                                TAG_DONE)))
  238.     return (0);
  239.  
  240.   SetFont (okno->RPort, font);
  241.   OdswierzOkno ();
  242.  
  243.   return (1);
  244. }
  245.  
  246. void OdswierzOkno (void)
  247. {
  248.   Renderuj ();
  249.  
  250.   AddGList (okno, gadzety, -1, -1, NULL);
  251.   RefreshGList (gadzety, okno, NULL, -1);
  252.  
  253.   GT_RefreshWindow (okno, NULL);
  254. }
  255.  
  256. void Renderuj (void)
  257. {
  258.   UWORD offx, offy;
  259.   UWORD pattern[] =
  260.   {
  261.     0xaaaa, 0x5555
  262.   };
  263.  
  264.   offx = okno->BorderLeft;
  265.   offy = okno->BorderTop;
  266.  
  267.   SetAPen (okno->RPort, 2);
  268.   okno->RPort->AreaPtrn = (UWORD *) & pattern;
  269.   okno->RPort->AreaPtSz = 1;
  270.  
  271.   RectFill (okno->RPort, offx, offy, 484 - offx, 168 + offy - 3);
  272.  
  273.   okno->RPort->AreaPtrn = (UWORD *) NULL;
  274.   okno->RPort->AreaPtSz = NULL;
  275.  
  276.   SetAPen (okno->RPort, 0);
  277.  
  278.   RectFill (okno->RPort, offx + 14, offy + 6, offx + (14 + 208) - 1, offy + (6 + 109) - 1);
  279.   RectFill (okno->RPort, offx + 235, offy + 6, offx + (235 + 227) - 1, offy + (6 + 85) - 1);
  280.   RectFill (okno->RPort, offx + 14, offy + 120, offx + (14 + 208) - 1, offy + (120 + 11) - 1);
  281.   RectFill (okno->RPort, offx + 235, offy + 96, offx + (235 + 227) - 1, offy + (96 + 35) - 1);
  282.   RectFill (okno->RPort, offx + 14, offy + 136, offx + (14 + 448) - 1, offy + (136 + 24) - 1);
  283.  
  284.   DrawBevelBox (okno->RPort, offx + 14, offy + 6, 208, 109, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  285.   DrawBevelBox (okno->RPort, offx + 235, offy + 6, 227, 85, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  286.   DrawBevelBox (okno->RPort, offx + 289, offy + 11, 164, 14, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  287.   DrawBevelBox (okno->RPort, offx + 301, offy + 41, 95, 14, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  288.   DrawBevelBox (okno->RPort, offx + 301, offy + 72, 95, 14, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  289.   DrawBevelBox (okno->RPort, offx + 14, offy + 120, 208, 11, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  290.   DrawBevelBox (okno->RPort, offx + 235, offy + 96, 227, 35, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  291.   DrawBevelBox (okno->RPort, offx + 14, offy + 136, 448, 24, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  292.   DrawBevelBox (okno->RPort, offx + 27, offy + 141, 422, 14, GT_VisualInfo, visualinfo, GTBB_Recessed, TRUE, TAG_DONE);
  293.  
  294.   PrintIText (okno->RPort, napisy, offx, offy);
  295. }
  296.  
  297. void ZwolnijEkran (void)
  298. {
  299.   if (visualinfo)
  300.     FreeVisualInfo (visualinfo);
  301.  
  302.   if (ekran)
  303.     UnlockPubScreen (NULL, ekran);
  304.  
  305.   if (font)
  306.     CloseFont (font);
  307. }
  308.  
  309. void ZamknijOkno (void)
  310. {
  311.   if (okno)
  312.     CloseWindow (okno);
  313.  
  314.   if (gadzety)
  315.     FreeGadgets (gadzety);
  316. }
  317.  
  318. void UsunStandardy (void)
  319. {
  320.   struct Node *n;
  321.  
  322.   while (n = (struct Node *) RemTail ((struct List *) &Standardy))
  323.     FreeMem (n, sizeof (*n));
  324. }
  325.  
  326. void ZamknijBiblioteki (void)
  327. {
  328.   if (requester)
  329.     FreeAslRequest ((struct FileRequester *) requester);
  330.  
  331.   if (KonBase)
  332.     CloseLibrary ((struct Library *) KonBase);
  333.   if (IntuitionBase)
  334.     CloseLibrary ((struct Library *) IntuitionBase);
  335.   if (GfxBase)
  336.     CloseLibrary ((struct Library *) GfxBase);
  337.   if (GadToolsBase)
  338.     CloseLibrary ((struct Library *) GadToolsBase);
  339.   if (AslBase)
  340.     CloseLibrary ((struct Library *) AslBase);
  341. }
  342.  
  343. void WczytajPlik (void)
  344. {
  345.   struct Requester req;
  346.   UBYTE nazwapliku[255];
  347.   BPTR plik;
  348.  
  349.   InitRequester (&req);
  350.   Request (&req, okno);
  351.   SetWindowPointer (okno,
  352.                     WA_BusyPointer, 1,
  353.                     WA_PointerDelay, 1,
  354.                     TAG_DONE);
  355.  
  356.   if (!(AslRequestTags ((struct FileRequester *) requester,
  357.                         ASLFR_Window, okno,
  358.                       ASLFR_TitleText, (STRPTR) "Wybierz plik do konwersji",
  359.                         ASLFR_PositiveText, (STRPTR) "Wczytaj",
  360.                         ASLFR_NegativeText, (STRPTR) "Zaniechaj",
  361.                         TAG_DONE)))
  362.     goto przywroc_wskaznik;
  363.  
  364.   strcpy (nazwapliku, requester->fr_Drawer);
  365.   AddPart (nazwapliku, requester->fr_File, 255);
  366.  
  367.   if (rozmiar && bufor)
  368.     {
  369.       FreeMem (bufor, rozmiar);
  370.       rozmiar = (ULONG) NULL;
  371.       bufor = (UBYTE *) NULL;
  372.     }
  373.  
  374.   Informacja ("Îadujë plik...");
  375.  
  376.   if (!(plik = Open (nazwapliku, MODE_OLDFILE)))
  377.     {
  378.       Informacja ("Bîâd otwarcia pliku úródîowego!");
  379.       goto przywroc_wskaznik;
  380.     }
  381.  
  382.   Seek (plik, NULL, OFFSET_END);
  383.   rozmiar = Seek (plik, NULL, OFFSET_BEGINNING);
  384.   if (!rozmiar)
  385.     {
  386.       Informacja ("Plik úródîowy jest pusty!");
  387.       goto zamknij;
  388.     }
  389.  
  390.   if (!(bufor = AllocMem (rozmiar, MEMF_PUBLIC)))
  391.     {
  392.       Informacja ("Brak pamiëci!");
  393.     }
  394.  
  395.   Read (plik, bufor, rozmiar);
  396.  
  397.   PiszStandard (NULL, 61);
  398.   Informacja ("Rozpoznajë standard wczytanego pliku...");
  399.  
  400.   if ((zrodlowy = RozpoznajStandard (bufor, rozmiar)) < 0)
  401.     {
  402.       Informacja ("Standard nie zostaî rozpoznany");
  403.       FreeMem (bufor, rozmiar);
  404.       rozmiar = (ULONG) NULL;
  405.       bufor = (UBYTE *) NULL;
  406.     }
  407.   else
  408.     {
  409.       PiszPlik (FilePart (nazwapliku));
  410.       PiszStandard (PobierzStandard (zrodlowy)->stan_Nazwa, 61);
  411.       Informacja ("Standard zostaî rozpoznany");
  412.       GT_SetGadgetAttrs (gad_zapisz, okno, NULL, GA_Disabled, 0, TAG_DONE);
  413.     }
  414.  
  415. zamknij:
  416.   Close (plik);
  417.  
  418. przywroc_wskaznik:
  419.   SetWindowPointer (okno, TAG_DONE);
  420.   EndRequest (&req, okno);
  421. }
  422.  
  423. void ZapiszPlik (void)
  424. {
  425.   struct Requester req;
  426.   UBYTE nazwapliku[256];
  427.   BPTR plik;
  428.   UBYTE *nb;
  429.   ULONG nr;
  430.  
  431.   if (docelowy == zrodlowy)
  432.     {
  433.       Informacja ("Standardy: úródîowy i docelowy sâ takie same!");
  434.       return;
  435.     }
  436.  
  437.   if (docelowy < 0)
  438.     {
  439.       Informacja ("Wybierz standard docelowy!!!");
  440.       return;
  441.     }
  442.  
  443.   InitRequester (&req);
  444.   req.Flags = NOISYREQ;
  445.  
  446.   Request (&req, okno);
  447.   SetWindowPointer (okno,
  448.                     WA_BusyPointer, 1,
  449.                     WA_PointerDelay, 1,
  450.                     TAG_DONE);
  451.  
  452.   if (!(AslRequestTags ((struct FileRequester *) requester,
  453.                         ASLFR_Window, okno,
  454.                         ASLFR_TitleText, (UBYTE *) "Zapisz plik jako",
  455.                         ASLFR_PositiveText, "Zapisz",
  456.                         ASLFR_NegativeText, "Zaniechaj",
  457.                         TAG_DONE)))
  458.     goto przywroc_wskaznik;
  459.  
  460.   strcpy (nazwapliku, requester->fr_Drawer);
  461.   AddPart (nazwapliku, requester->fr_File, 255);
  462.  
  463.   if (!(plik = Open (nazwapliku, MODE_NEWFILE)))
  464.     {
  465.       Informacja ("Bîâd otwarcia pliku docelowego!");
  466.       goto przywroc_wskaznik;
  467.     }
  468.  
  469.   switch (Konwertuj (bufor, rozmiar, &nb, &nr, MEMF_PUBLIC, zrodlowy, docelowy, flagi, funkcja, NULL))
  470.     {
  471.     case KONBLAD_OK:
  472.       Informacja ("Konwertujë - 100%");
  473.       Write (plik, nb, nr);
  474.       Close (plik);
  475.       FreeMem (nb, nr);
  476.       Informacja ("Zapisaîem plik");
  477.       break;
  478.  
  479.     case KONBLAD_KONWERSJA_PRZERWANA:
  480.       Informacja ("Konwersja przerwana");
  481.       break;
  482.  
  483.     case KONBLAD_BRAK_PAMIECI:
  484.       Informacja ("Brak pamiëci");
  485.       break;
  486.     }
  487.  
  488.   FreeMem (bufor, rozmiar);
  489.   rozmiar = (ULONG) NULL;
  490.   bufor = (UBYTE *) NULL;
  491.  
  492.   PiszPlik (NULL);
  493.   PiszStandard (NULL, 61);
  494.  
  495.   GT_SetGadgetAttrs (gad_zapisz, okno, NULL, GA_Disabled, 1, TAG_DONE);
  496.  
  497. przywroc_wskaznik:
  498.   SetWindowPointer (okno, TAG_DONE);
  499.   EndRequest (&req, okno);
  500. }
  501.  
  502. void Informacja (UBYTE * tekst)
  503. {
  504.   SetAPen (okno->RPort, 0);
  505.   RectFill (okno->RPort, 40, 155, 440, 163);
  506.  
  507.   SetAPen (okno->RPort, 1);
  508.   Move (okno->RPort, 40, 161);
  509.   Text (okno->RPort, tekst, strlen (tekst));
  510. }
  511.  
  512. void PiszStandard (UBYTE * tekst, UWORD posy)
  513. {
  514.   SetAPen (okno->RPort, 0);
  515.   RectFill (okno->RPort, 321, posy - 6, 385, posy + 2);
  516.   SetAPen (okno->RPort, 1);
  517.   Move (okno->RPort, 321, posy);
  518.   Text (okno->RPort, tekst, strlen (tekst));
  519. }
  520.  
  521. void PiszPlik (UBYTE * tekst)
  522. {
  523.   UWORD ile_liter;
  524.  
  525.   SetAPen (okno->RPort, 0);
  526.   RectFill (okno->RPort, 303, 25, 447, 33);
  527.  
  528.   SetAPen (okno->RPort, 1);
  529.   Move (okno->RPort, 303, 31);
  530.   ile_liter = strlen (tekst);
  531.   Text (okno->RPort, tekst, (ile_liter) < 18 ? ile_liter : 18);
  532. }
  533.  
  534. BOOL __stdargs __saveds funkcja (ULONG calosc, ULONG gotowe, APTR atrapa)
  535. {
  536.   struct IntuiMessage *msg;
  537.   UBYTE dane[20];
  538.  
  539.   while (msg = GT_GetIMsg (okno->UserPort))
  540.     {
  541.       if (msg->Code == 27)
  542.         return (0);
  543.     }
  544.  
  545.   sprintf ((UBYTE *) & dane, "Konwertujë - %d%%", ((gotowe * 100) / calosc));
  546.  
  547.   Informacja ((UBYTE *) & dane);
  548.  
  549.   return (1);
  550. }
  551.  
  552. main ()
  553. {
  554.   struct IntuiMessage *msg;
  555.   LONG klasa;
  556.   WORD kod;
  557.   struct Gadget *g;
  558.   ULONG stan = 1;
  559.   UWORD zoom = 0;
  560.  
  561.   StworzSrodowisko ();
  562.  
  563.   for (;;)
  564.     {
  565.       WaitPort (okno->UserPort);
  566.       while (msg = GT_GetIMsg (okno->UserPort))
  567.         {
  568.           klasa = msg->Class;
  569.           kod = msg->Code;
  570.           g = (struct Gadget *) msg->IAddress;
  571.           GT_ReplyIMsg (msg);
  572.  
  573.           switch (klasa)
  574.             {
  575.             case IDCMP_CLOSEWINDOW:
  576.               ZamknijSrodowisko ();
  577.  
  578.             case IDCMP_NEWSIZE:
  579.               if (zoom ^= 1)
  580.                 RemoveGList (okno, gadzety, -1);
  581.               else
  582.                 OdswierzOkno ();
  583.               break;
  584.  
  585.             case IDCMP_GADGETUP:
  586.               switch (g->GadgetID)
  587.                 {
  588.                 case GD_Standardy:
  589.                   docelowy = kod;
  590.                   PiszStandard (PobierzStandard (docelowy)->stan_Nazwa, 92);
  591.                   break;
  592.  
  593.                 case GD_Wczytaj:
  594.                   WczytajPlik ();
  595.                   break;
  596.  
  597.                 case GD_Zapisz:
  598.                   ZapiszPlik ();
  599.                   break;
  600.  
  601.                 case GD_CRLF:
  602.                   flagi ^= KONWF_ZMIENNL;
  603.                   stan ^= 1;
  604.                   GT_SetGadgetAttrs (gad_eof, okno, NULL, GA_Disabled, stan, TAG_END);
  605.                   break;
  606.  
  607.                 case GD_DodajEOF:
  608.                   flagi ^= KONWF_DODAJEOF;
  609.                 }
  610.             }
  611.         }
  612.     }
  613. }
  614.