home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / texmf / source / driver / show / amiga / am_requ.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-26  |  44.8 KB  |  1,825 lines

  1. /*
  2. **    This file generated by localize 2.9 (AmigaDOS 2.1) from am_requ.c
  3. */
  4. /* *** am_requ.c *** */
  5.  
  6. #ifdef AMIGA
  7.  
  8.  
  9. #include "defines.h"
  10.  
  11. #include <sprof.h>
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16.  
  17. #include <intuition/intuition.h>
  18. #include <libraries/dos.h>
  19. #include <libraries/asl.h>
  20. #include <dos/dostags.h>
  21.  
  22. #ifdef AZTEC_C
  23. #  include <functions.h>
  24. #endif
  25.  
  26. #include "globals.h"
  27.  
  28. #include <clib/intuition_protos.h>
  29. #include <clib/dos_protos.h>
  30. #include <clib/graphics_protos.h>
  31. #include <clib/gadtools_protos.h>
  32. #include <clib/asl_protos.h>
  33. #include <clib/exec_protos.h>
  34.  
  35. #include <pragmas/intuition_pragmas.h>
  36. #include <pragmas/dos_pragmas.h>
  37. #include <pragmas/graphics_pragmas.h>
  38. #include <pragmas/gadtools_pragmas.h>
  39. #include <pragmas/asl_pragmas.h>
  40. #include <pragmas/exec_pragmas.h>
  41.  
  42.  
  43.  
  44. #include "amscreen.h"
  45. #include "version.h"
  46. #include "gad_def.h"
  47. #include "searchwin.h"
  48.  
  49. #include "showdvi.i"
  50. #include "amscreen.i"
  51. #include "gadget.i"
  52. #include "am_requ.i"
  53. #include "globals.i"
  54. #include "dvihand.i"
  55. #include "search.i"
  56. #include "searchwin.i"
  57.  
  58. /*
  59.  * Fuer die locale-Library:
  60.  *
  61.  * Hier duerfen *nur* die MSG_#? Nummern eingebunden werden!
  62.  * Achtung:
  63.  * Es muss/sollte 'multiple-include' erlaubt sein!
  64.  */
  65. #include "local.i"
  66.  
  67. #undef  CATCOMP_ARRAY
  68. #undef  CATCOMP_BLOCK
  69. #undef  CATCOMP_STRINGS
  70. #define CATCOMP_NUMBERS
  71. #include "localstr.h"
  72.  
  73.  
  74.  
  75. /* locale Funktionen */
  76. static int ReadHelpTxtPages    Args((void));
  77. static void AboutWinToggleText    Args((void));
  78. #if !defined(REQ_LIBRARY)
  79. static void draw_active        Args((long x,
  80.                               long y));
  81. #endif
  82.  
  83. /* externe Variablen */
  84. extern struct TextFont        *font8,
  85.                 *font11;
  86. extern UBYTE            sig_aboutwin;
  87.  
  88. extern char            PubScreenName[];
  89. extern char            MyPubScreenName[];
  90.  
  91. /* lokale Variablen */
  92. static struct Window *AboutRequesterWin = NULL;
  93. static struct TextAttr AbWintxtAttr;        /* TxtAttr fuer das AboutWindow */
  94.  
  95. static short help_counter;
  96. static struct IntuiText VersionText;
  97.  
  98.  
  99. #include "am_requ.h"
  100.  
  101.  
  102. /* da kommt der gesamte Hilfstext rein ... */
  103. static          short         HelpTxtPages;
  104. static          short       *HelpTxtPagesLines;    /* Anzahl Zeilen pro Seite */
  105. static struct MyTextStruct **HelpTxt = NULL;
  106.  
  107. static struct TagItem       okBevelGadTags[] = { {GT_VisualInfo, NULL}, {TAG_DONE, 0L} };
  108. static struct TagItem       helpBevelGadTags[] = { {GT_VisualInfo, NULL}, {TAG_DONE, 0L} };
  109.  
  110. static        short       LineNumber;
  111. static        char         *ErrorMsg;
  112.  
  113.  
  114. void CenterWindow(WORD *LeftEdge, WORD *TopEdge, WORD Width, WORD Height)
  115. {
  116.   WORD vis_width, vis_height;
  117.  
  118.   vis_width  = screen->Width+1;
  119.   vis_height = screen->Height+1;
  120.  
  121.   if (is_os2) {
  122.     struct ViewPort *vp;
  123.     ULONG modeID;
  124.     struct DimensionInfo DimInfo;
  125.     
  126.     vp = &(screen->ViewPort);
  127.     if ((modeID = GetVPModeID(vp)) != INVALID_ID) {
  128.       GetDisplayInfoData(NULL, (UBYTE *)&DimInfo, sizeof(DimInfo), DTAG_DIMS, modeID);
  129.       vis_width  = DimInfo.TxtOScan.MaxX + 1;
  130.       vis_height = DimInfo.TxtOScan.MaxY + 1;
  131.     }
  132.   }
  133.  
  134.   if (screen->Width <= vis_width) {
  135.     *LeftEdge = ((screen->Width - Width) >> 1);
  136.   }
  137.   else {
  138.     *LeftEdge = abs(screen->LeftEdge) + ((vis_width - Width) >> 1);
  139.   }
  140.  
  141.   if (screen->Height <= vis_height) {
  142.     *TopEdge = ((screen->Height - Height) >> 1);
  143.   }
  144.   else {
  145.     *TopEdge = abs(screen->TopEdge) + ((vis_height - Height) >> 1);
  146.   }
  147. }
  148.  
  149. /* (von stefan st.)
  150.                                 GetDisplayInfoData(0, (UBYTE *)&di, sizeof(struct DimensionInfo), DTAG_DIMS, vpmid);
  151.                                 rect = &di.TxtOScan;
  152.                                 left = -(scr->LeftEdge) + (min((rect->MaxX - rect->MinX + 1), scr->Width) - mywindowtag[P_WA_Width].ti_Data) / 2;
  153.                                 top = -(scr->TopEdge) + (min((rect->MaxY - rect->MinY + 1), scr->Height) - mywindowtag[P_WA_Height].ti_Data) / 2;
  154.                                 zoompos[0] = mywindowtag[P_WA_Left].ti_Data = (left < 0) ? 0 : left;
  155.                                 zoompos[1] = mywindowtag[P_WA_Top].ti_Data = (top < 0) ? 0 : top;
  156. */
  157.  
  158. static int ReadHelpTxtPages(void)
  159. {
  160.   char *ptr, *p, *pp, line[128], pattern[40];
  161.   int len, found, anz = 0, zeilen, page, TxtLine;
  162.   int xpos, ypos;
  163.   struct MyTextStruct **HTxtArr = NULL;
  164.   struct MyTextStruct *HTxtPage;
  165.   FILE *fp;
  166.   LineNumber = 0;
  167.   ErrorMsg = NULL;
  168.  
  169.   fp = OpenConfigFile("ShowDVI.help", MODE_READ);
  170.  
  171.   if (fp == NULL) {
  172.     Warning(MSG_CANT_OPEN_HELP_FILE, "ShowDVI.help");
  173.   }
  174.   else {
  175.     /* so nun auf die Suche nach dem #helpwindow-Eintrag */
  176.     do {
  177.       ptr = fgets(line, 127, fp);
  178.       LineNumber++;
  179.       found = (strncmp(line, "#helpwindow", 11) == 0);
  180.     } while (ptr != NULL && !found);
  181.     
  182.     if (found) {
  183.       if (sscanf(line+11, "%d", &anz) == 1) {
  184.         /* allociere ein Array von Pointer */
  185.         HTxtArr = xmalloc(anz*sizeof(struct MyTextStruct *));
  186.         HelpTxtPagesLines = xmalloc(anz*sizeof(short));
  187.  
  188.     /*========= ueber alle Seiten ==========*/
  189.         for (page=0; page<anz; page++) {
  190.           sprintf(pattern, "#help %d,", page);
  191.           len = strlen(pattern);
  192.       do {
  193.         ptr = fgets(line, 127, fp);
  194.         LineNumber++;
  195.         found = (strncmp(line, pattern, len) == 0);
  196.       } while (ptr != NULL && !found);
  197.  
  198.       if (found) {
  199.         if (sscanf(line+len, "%d", &zeilen) == 1) {
  200.             /* allociere die Eintraege fuer die Zeilen */
  201.           HTxtPage = xmalloc(zeilen*sizeof(struct MyTextStruct));
  202.           HTxtArr[page] = HTxtPage;
  203.           HelpTxtPagesLines[page] = zeilen;
  204.  
  205.           /*=========== ueber alle Zeilen einer Seite ============*/
  206.           for (TxtLine=0; TxtLine<zeilen && ptr != NULL; TxtLine++) {
  207.             /* lese die einzelnen Zeilen hintereinander */
  208.             ptr = fgets(line, 127, fp);
  209.             LineNumber++;
  210.             if (ptr != NULL) {
  211.               if (sscanf(line, "%d %d", &xpos, &ypos) == 2) {
  212.                 p = strchr(line, '\"');
  213.                 if (p != NULL) {
  214.                   /* und nun die " weg.. */
  215.                   p++;    /* vorders AnfZeichen */
  216.                   if ((pp = strrchr(p, '\"')) != NULL) *pp = '\0';    /* hinteres */
  217.                   HTxtPage[TxtLine].xKoo          = xpos;
  218.                   HTxtPage[TxtLine].yKoo          = ypos;
  219.                   HTxtPage[TxtLine].txt.FrontPen  = 1;
  220.                   HTxtPage[TxtLine].txt.BackPen   = 0;
  221.                   HTxtPage[TxtLine].txt.DrawMode  = JAM1;
  222.                   HTxtPage[TxtLine].txt.LeftEdge  = 0;
  223.                   HTxtPage[TxtLine].txt.ITextFont = &AbWintxtAttr;
  224.                   HTxtPage[TxtLine].txt.IText     = strdup(p);
  225.                   if (TxtLine < zeilen-1) {
  226.                     /* noch nicht die letzte Zeile */
  227.                     HTxtPage[TxtLine].txt.NextText = &(HTxtPage[TxtLine+1].txt);
  228.                   }
  229.                   else {
  230.                     HTxtPage[TxtLine].txt.NextText = NULL;
  231.                   }
  232.                 }
  233.               }
  234.           else {
  235.                 /* kann xpos, ypos nicht lesen */
  236.                 ErrorMsg = "x/y-pos";
  237.                 return FALSE;
  238.                 /* Fatal(20, "Can't read x/y-pos! (%d, %d)", page, TxtLine); */
  239.               }
  240.             }
  241.           }
  242.           if (TxtLine != zeilen) {
  243.             /* habe nicht alle Zeilen lesen koennen */
  244.             ErrorMsg = "too few lines";
  245.             return FALSE;
  246.             /* Fatal(20, "Can't read all lines! (%d, %d)", page, TxtLine); */
  247.           }
  248.         }
  249.         else {
  250.           /* kann Zeilenanzahl nicht lesen! */
  251.           ErrorMsg = "no line number";
  252.           return FALSE;
  253.           /* Fatal(20, "Can't read line number! (%d)", page); */
  254.         }
  255.       }
  256.       else {
  257.         /* Kann #help %d, nicht finden */
  258.         ErrorMsg = "no #help";
  259.         return FALSE;
  260.         /* Fatal(20, "Can't find #help line!"); */
  261.       }
  262.         } /* for page */
  263.       }
  264.       else {
  265.         /* kann Anzahl Seiten nicht lesen! */
  266.         ErrorMsg = "no page number";
  267.         return FALSE;
  268.         /* Fatal(20, "Can't read page number!"); */
  269.       }
  270.     }
  271.     else {
  272.       /* kann #helpwin nicht finden */
  273.       ErrorMsg = "no #helpwin";
  274.       return FALSE;
  275.       /* Fatal(20, "Can't fint #helpwin entry!"); */
  276.     }
  277.     
  278.     fclose(fp);
  279.   }
  280.   HelpTxt = HTxtArr;
  281.   HelpTxtPages = anz;
  282.   return TRUE;
  283. }
  284.  
  285.  
  286. void AboutWinUp(void)
  287. {
  288.   struct RastPort *rp;
  289.   long i, x, y;
  290.   /* long YSize; */
  291.   short TextHeight, TextWidth;
  292.   struct NewWindow new_win; 
  293.  
  294.   if (is_about) {
  295.     return;        /* ignore such strange things */
  296.   }
  297.  
  298.   if (AboutRequesterWin != NULL) {
  299.     /* Window ist schon da, aber is_about ist FALSE?? */
  300.     Fatal(20,MSG_CONFUSED_ABOUT_REQ);
  301.   }
  302.  
  303. #if 0    /* das sollte nun auch gehen... */
  304. #if !defined(REQ_LIBRARY)
  305.   if (is_colre) {
  306.     remove_col_request();
  307.   }
  308. #endif
  309. #endif
  310.  
  311.   set_about;
  312.   help_counter = 0;
  313.  
  314. #if 0
  315.   if (win2 != NULL) {
  316.     AskFont(win2->RPort, &AbWintxtAttr);
  317.   }
  318.   YSize = AbWintxtAttr.ta_YSize;
  319.   /* soll ich's so machen und den System-Default Font nehmen.... das ist aber meinstens */
  320.   /* nur topaz 8 Font. Mein topaz 11 sieht besser aus! */
  321. #endif
  322.   /* ich verwende nun doch meine alten Sachen */
  323.   
  324.   if (TRUE /*(is_lace && YSize > 15) || (!is_lace && YSize > 12)*/) {
  325.     if (is_lace && font11 != NULL) {
  326.       /* struct Assignment! */
  327.       AbWintxtAttr = txtAttr11;    /* nehme topaz 11 bei interlace */
  328.     }
  329.     else {
  330.       /* struct Assignment! */
  331.       AbWintxtAttr = txtAttr8;    /* nehme topaz 8 bei noninterlace */
  332.     }
  333.   }
  334.  
  335.   about_ok_gadg.TopEdge   = ABOUT_OK_Y+win2->BorderTop;
  336.   about_ok_gadg.Height    = ABOUT_OK_HEIGHT;
  337.   about_help_gadg.TopEdge = ABOUT_OK_Y+win2->BorderTop;
  338.   about_help_gadg.Height  = ABOUT_OK_HEIGHT;
  339.   about_border_ok_pairs[5]= ABOUT_OK_HEIGHT+1;
  340.   about_border_ok_pairs[7]= ABOUT_OK_HEIGHT+1;
  341.   about_border_no_pairs[5]= ABOUT_OK_HEIGHT-1;
  342.   about_border_no_pairs[7]= ABOUT_OK_HEIGHT-1;
  343.   
  344.  
  345.   about_help_text.LeftEdge = 7;
  346.   about_help_text.IText = (UBYTE*)ABOUT_HELP_STRING;
  347.  
  348.  
  349.   if (is_os2) {
  350.     /* es werden die Bevel Boxes gezeichnet! */
  351.     about_ok_gadg.GadgetRender = NULL;
  352.     about_help_gadg.GadgetRender = NULL;
  353.   }
  354.  
  355.  
  356.   new_win.Width  = ABOUT_WIDTH;
  357.   new_win.Height = ABOUT_HEIGHT+win2->BorderTop;
  358.  
  359.   CenterWindow(&(new_win.LeftEdge), &(new_win.TopEdge), new_win.Width, new_win.Height);
  360.  
  361.   
  362.   new_win.DetailPen = 0;
  363.   new_win.BlockPen = 1; 
  364.   new_win.Title = GetTeXString(MSG_SHOWDVI_ABOUT_WINDOW);
  365.   new_win.Flags = WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_ACTIVATE | WFLG_NOCAREREFRESH | WFLG_RMBTRAP;
  366.   new_win.IDCMPFlags = IDCMP_GADGETUP | IDCMP_VANILLAKEY | IDCMP_CLOSEWINDOW;
  367.   new_win.Type = CUSTOMSCREEN;
  368.   if (!is_os2 && !is_ownscr) {
  369.     new_win.Type = WBENCHSCREEN;
  370.   }
  371.   new_win.FirstGadget = &about_ok_gadg;
  372.   new_win.CheckMark = NULL;
  373.   new_win.Screen = screen;
  374.   new_win.BitMap = NULL;
  375.   AboutRequesterWin = (struct Window *)OpenWindow(&new_win);
  376.  
  377.   if (AboutRequesterWin == NULL) {
  378.     Fatal(20, MSG_CANT_OPEN_ABOUT_REQ);
  379.   }
  380.  
  381.   rp = AboutRequesterWin->RPort;
  382.  
  383.   if (is_os2) {
  384.     okBevelGadTags[0].ti_Data = (ULONG)SDVI_VI;
  385.     DrawBevelBoxA(rp, about_ok_gadg.LeftEdge, about_ok_gadg.TopEdge,
  386.     about_ok_gadg.Width, about_ok_gadg.Height, okBevelGadTags);
  387.     helpBevelGadTags[0].ti_Data = (ULONG)SDVI_VI;
  388.     DrawBevelBoxA(rp, about_help_gadg.LeftEdge, about_help_gadg.TopEdge,
  389.     about_help_gadg.Width, about_help_gadg.Height, helpBevelGadTags);
  390.   }
  391.  
  392.  
  393.   /* hier kommt nun die Initialisierung der IText Structuren je nach Fontgroesse... */
  394.   /* YSize = AboutReqText[0].txt.ITextFont->ta_YSize; */
  395.   /* Mit diesen Werten kann die gewuenschte Anzahl Zeilen ausgegeben werden */
  396.   if (is_lace) {
  397.     TextHeight = 15;
  398.   }
  399.   else {
  400.     TextHeight = 9;
  401.   }
  402.   
  403.   /* TextHeight = YSize + abs(((is_lace) ? 4 : 1) - (YSize - 8)); */
  404.  
  405.   TextWidth = 8;
  406.  
  407.   for (i=0; i<ABOUTREQNUM; i++) {
  408.     AboutReqText[i].txt.LeftEdge = (AboutReqText[i].xKoo * TextWidth) / 10;
  409.     AboutReqText[i].txt.TopEdge = (AboutReqText[i].yKoo * TextHeight) / 10;
  410.     if (i<ABOUTREQNUM-1) {
  411.       AboutReqText[i].txt.NextText = &(AboutReqText[i+1].txt);
  412.     }
  413.     if (i == 3) {    // Versionsstring kommt auf die Zeile mit dem 'X'
  414.       y = AboutReqText[i].txt.TopEdge;
  415.       x = (455 * TextWidth) / 10;
  416.     }
  417.   }
  418.  
  419.   AboutReqText[ABOUTREQNUM-1].txt.NextText = &VersionText;
  420.   VersionText.FrontPen  = 1;
  421.   VersionText.BackPen   = 0;
  422.   VersionText.DrawMode  = JAM1;
  423.   VersionText.LeftEdge  = x;
  424.   VersionText.TopEdge   = y;
  425.   VersionText.ITextFont = &AbWintxtAttr;
  426.   VersionText.IText     = "V" SHOWDVI_VERSION;
  427.   VersionText.NextText  = NULL;
  428.  
  429.   /* Ausgabe des 'about' Textes... */
  430.   PrintIText(rp,&(AboutReqText[0].txt),AboutRequesterWin->BorderLeft, AboutRequesterWin->BorderTop);
  431.   
  432.   sig_aboutwin = AboutRequesterWin->UserPort->mp_SigBit;
  433.  
  434.   /* lese (einmal) die Helpseiten ein */
  435.   if (HelpTxt == NULL) {
  436.     if (!ReadHelpTxtPages()) {        /* lies die Seiten vom File ein */
  437.       FatalStr(20, "Error in File \"%s\"\n  (Line %d, %s)", "ShowDVI.help", LineNumber, ErrorMsg);
  438.     }
  439.   }
  440.   
  441.   /* aber jedesmal muessen die Koordinaten korrigiert werden (lace/nicht lace) */
  442.   if (HelpTxt != NULL) {
  443.     int k;
  444.     /* TextWidth = 8; */
  445.     for (k=0; k<HelpTxtPages; k++) {
  446.       /* über alle Seiten */
  447.       /* Die Texthoehe wird nun strikt festgelegt */
  448.       /* YSize = HelpTxt[k][0].txt.ITextFont->ta_YSize; */
  449.       /* TextHeight = YSize + abs(((is_lace) ? 4 : 1) - (YSize - 8)); */
  450.       i = 0;
  451.       do {
  452.         /* ueber alle Zeilen */
  453.         HelpTxt[k][i].txt.LeftEdge = (HelpTxt[k][i].xKoo * TextWidth) / 10;
  454.         HelpTxt[k][i].txt.TopEdge  = (HelpTxt[k][i].yKoo * TextHeight) / 10;
  455.         i++;
  456.       } while (HelpTxt[k][i-1].txt.NextText != NULL);
  457.     }
  458.   }
  459.  
  460. }
  461.  
  462.  
  463.  
  464. static void AboutWinToggleText(void)
  465. {
  466.   struct RastPort *rp;
  467.   char str[20];
  468.  
  469.   if (AboutRequesterWin == NULL) return;
  470.  
  471.   rp = AboutRequesterWin->RPort;
  472.   SetAPen(rp,0);
  473.   RectFill(rp,AboutRequesterWin->BorderLeft + 1,
  474.         AboutRequesterWin->BorderTop + 1,
  475.           AboutRequesterWin->Width - AboutRequesterWin->BorderLeft - 1,
  476.           about_ok_gadg.TopEdge-4);
  477.   SetAPen(rp,1);
  478.  
  479.   help_counter++;
  480.   if (help_counter > HelpTxtPages) help_counter = 0;
  481.  
  482.   Move(rp, about_help_gadg.LeftEdge+about_help_gadg.Width+20, about_help_gadg.TopEdge+12);
  483.  
  484.   if (help_counter > 0) {
  485.     sprintf(str, "%2d/%d ", help_counter, HelpTxtPages);
  486.     Text(rp, str, strlen(str));
  487.  
  488.     if (HelpTxt != NULL) {
  489.       PrintIText(rp,&(HelpTxt[help_counter-1][0].txt),AboutRequesterWin->BorderLeft, 
  490.       AboutRequesterWin->BorderTop);
  491.     }
  492.     if (help_counter == HelpTxtPages) {
  493.       /* auf letzter HELP Seite */
  494.       about_help_text.LeftEdge = 3;
  495.       about_help_text.IText = (UBYTE*)ABOUT_ABOUT_STRING;
  496.     }
  497.     else {
  498.       /* es gibt noch mehr HELP Seiten */
  499.       about_help_text.LeftEdge = 7;
  500.       about_help_text.IText = (UBYTE*)ABOUT_MORE_STRING;
  501.     }
  502.   } 
  503.   else {
  504.     Text(rp, "       ", 7);
  505.  
  506.     PrintIText(rp,&(AboutReqText[0].txt),AboutRequesterWin->BorderLeft, 
  507.           AboutRequesterWin->BorderTop);
  508.     about_help_text.LeftEdge = 7;
  509.     about_help_text.IText = (UBYTE*)ABOUT_HELP_STRING;
  510.   }
  511.   RefreshGadgets(&about_help_gadg,AboutRequesterWin,NULL);
  512. }
  513.  
  514.  
  515.  
  516. long AboutWinMsg(void)
  517. {
  518.   struct IntuiMessage *msg;
  519.   long ex = 0;
  520.   ULONG msg_class, gid;
  521.   int i, k;
  522.   char c;
  523.  
  524.   if (AboutRequesterWin == NULL || !is_about) {
  525.     Fatal(20,MSG_CONFUSED_ABOUT_REQ);
  526.   }
  527.   
  528.   
  529.   while((msg = (struct IntuiMessage *)GetMsg(AboutRequesterWin->UserPort))!=NULL) {
  530.     msg_class = msg->Class;
  531.     switch (msg_class) {
  532.       case IDCMP_CLOSEWINDOW:
  533.             ReplyMsg(&(msg->ExecMessage));
  534.           AboutWinDown();
  535.           return ex; /* WEG  HIER, damit wir kein GetMsg von einem nicht mehr vorhandenen Window machen! */
  536.         break;
  537.       case IDCMP_VANILLAKEY:
  538.         c = msg->Code;
  539.             ReplyMsg(&(msg->ExecMessage));
  540.             if (c >= '0' && c <= '9') {
  541.               const int num = c - '1';
  542.               if (num < HelpTxtPages) {
  543.                 if (num == -1) {
  544.                   help_counter = HelpTxtPages;
  545.                 }
  546.                 else {
  547.                   help_counter = num;
  548.                 }
  549.                 AboutWinToggleText();
  550.               }
  551.             }
  552.             else {
  553.               switch (c) {
  554.                 case 8  :
  555.                 case 127:
  556.                 case 'b':
  557.                 case 'B':
  558.                 case '-':    if (help_counter <= 1) {
  559.                        help_counter = HelpTxtPages-1;/* cyklisch durch.. */
  560.                         }
  561.                         else {
  562.                           help_counter -= 2;
  563.                         }
  564.                         AboutWinToggleText();
  565.                         break;
  566.  
  567.             case ' ':
  568.             case '+':
  569.                 case 'h':
  570.                 case 'H':
  571.                 case 'm':
  572.                 case 'M':    if (help_counter == HelpTxtPages) {
  573.                        help_counter = 0;    /* cyklisch durch.. */
  574.                         }
  575.                         AboutWinToggleText();
  576.                         break;
  577.  
  578.                 case 'a':
  579.                 case 'A':    if (help_counter != 0) {
  580.                           help_counter = HelpTxtPages;    /* damit man wirklich auf about kommt */
  581.                           AboutWinToggleText();
  582.                         }
  583.                         break;
  584.  
  585.                 case 'Q':   /* Bei 'Q' wird der Speicher freigegeben */
  586.                 for (i=0; i<HelpTxtPages; i++) {
  587.                   for (k=0; k<HelpTxtPagesLines[i]; k++) {
  588.                     xfree(HelpTxt[i][k].txt.IText);    /* String   */
  589.                   }
  590.                   xfree(HelpTxt[i]);            /* Struktur */
  591.                 }
  592.                 xfree(HelpTxt);                /* Array of pages   */
  593.                 xfree(HelpTxtPagesLines);        /* Array of numbers */
  594.                 HelpTxt = NULL;
  595.                 HelpTxtPagesLines = NULL;
  596.                 HelpTxtPages = 0;
  597.                 case 'o':
  598.                 case 'O':
  599.                 case 'q':
  600.             case 27 :    /* ESC */
  601.                 case 13 :    AboutWinDown();
  602.                   return ex; /* WEG  HIER, damit wir kein GetMsg von einem nicht mehr vorhandenen Window machen! */
  603.  
  604.                 case  3 :         /* ^C */
  605.                 CXBRK();        /* lattice ^C funktion */
  606.                         break;
  607.               }
  608.             }
  609.         break;
  610.       case IDCMP_GADGETUP:
  611.         gid = ((struct Gadget *)msg->IAddress)->GadgetID;
  612.             ReplyMsg(&(msg->ExecMessage));
  613.         switch (gid) {
  614.             case ABOUT_OK_GAD_NR:
  615.                   AboutWinDown();
  616.                   return ex; /* WEG  HIER, damit wir kein GetMsg von einem nicht mehr vorhandenen Window machen! */
  617.             case ABOUT_HELP_GAD_NR:
  618.                     AboutWinToggleText();
  619.                   break;
  620.         }
  621.         break;
  622.       default:
  623.             ReplyMsg(&(msg->ExecMessage));
  624.         FatalStr(20, "Unknown Intuimessage!");
  625.         break;
  626.     }
  627.   }
  628.   
  629.   return ex;
  630. }
  631.  
  632.  
  633. void AboutWinDown(void)
  634. {
  635.   struct Message *msg;
  636.  
  637.   if (is_about && AboutRequesterWin != NULL) {
  638.     unset_about;
  639.     help_counter = 0;
  640.  
  641.     Forbid();
  642.     do {
  643.       msg = GetMsg(AboutRequesterWin->UserPort);
  644.       if (msg != NULL) ReplyMsg(msg);
  645.     } while (msg != NULL);
  646.     ModifyIDCMP(AboutRequesterWin, 0);
  647.     Permit();
  648.  
  649.     CloseWindow(AboutRequesterWin);            /* Requester Window loeschen */
  650.     AboutRequesterWin = NULL;                /* wichtig */
  651.   }
  652. }
  653.  
  654.  
  655.  
  656. /*************************************************************************/
  657.  
  658. #if !defined(REQ_LIBRARY)
  659.  
  660. static void draw_active(long x, long y)
  661. {
  662.   register struct RastPort *rp = &(screen->RastPort);
  663.  
  664.   Move(rp,x,y);
  665.   Draw(rp,x+CREQ_COL_WIDTH+3,y);
  666.   Draw(rp,x+CREQ_COL_WIDTH+3,y+CREQ_COL_HEIGHT+3);
  667.   Draw(rp,x,y+CREQ_COL_HEIGHT+3);
  668.   Draw(rp,x,y);
  669.  
  670.   Move(rp,x-1,y+2);
  671.   Draw(rp,x-1,y-1);
  672.   Draw(rp,x+2,y-1);
  673.  
  674.   Move(rp,x+CREQ_COL_WIDTH+1+3,y+2);
  675.   Draw(rp,x+CREQ_COL_WIDTH+1+3,y-1);
  676.   Draw(rp,x+CREQ_COL_WIDTH-2+3,y-1);
  677.  
  678.   Move(rp,x-1,y+CREQ_COL_HEIGHT-2+3);
  679.   Draw(rp,x-1,y+CREQ_COL_HEIGHT+1+3);
  680.   Draw(rp,x+2,y+CREQ_COL_HEIGHT+1+3);
  681.  
  682.   Move(rp,x+CREQ_COL_WIDTH+1+3,y+CREQ_COL_HEIGHT-2+3);
  683.   Draw(rp,x+CREQ_COL_WIDTH+1+3,y+CREQ_COL_HEIGHT+1+3);
  684.   Draw(rp,x+CREQ_COL_WIDTH-2+3,y+CREQ_COL_HEIGHT+1+3);
  685. }
  686.  
  687. void set_0_active(void)
  688. {
  689.   register struct RastPort *rp = &(screen->RastPort);
  690.   register long x = ((x_win_i_width-CREQ_WIDTH)/2) + WIN_X_KOO+CREQ_COL_0_X-2,
  691.             y = ((x_win_i_height-CREQ_HEIGHT)/2) + WIN_Y_KOO+CREQ_COL_0_Y-2;
  692.  
  693.   /* zeichnen */
  694.   SetAPen(rp,1);
  695.   draw_active(x,y);
  696.  
  697.   /* loeschen */
  698.   x = ((x_win_i_width-CREQ_WIDTH)/2) + WIN_X_KOO+CREQ_COL_1_X-2,
  699.   y = ((x_win_i_height-CREQ_HEIGHT)/2) + WIN_Y_KOO+CREQ_COL_1_Y-2;
  700.   SetAPen(rp,0);
  701.   draw_active(x,y);
  702.   SetAPen(rp,1);
  703.   current_col.col_number_t = 0;
  704. }
  705.  
  706. void set_1_active(void)
  707. {
  708.   register struct RastPort *rp = &(screen->RastPort);
  709.   register long x = ((x_win_i_width-CREQ_WIDTH)/2) + WIN_X_KOO+CREQ_COL_1_X-2,
  710.             y = ((x_win_i_height-CREQ_HEIGHT)/2) + WIN_Y_KOO+CREQ_COL_1_Y-2;
  711.  
  712.   /* zeichnen */
  713.   SetAPen(rp,1);
  714.   draw_active(x,y);
  715.  
  716.   /* loeschen */
  717.   x = ((x_win_i_width-CREQ_WIDTH)/2) + WIN_X_KOO+CREQ_COL_0_X-2,
  718.   y = ((x_win_i_height-CREQ_HEIGHT)/2) + WIN_Y_KOO+CREQ_COL_0_Y-2;
  719.   SetAPen(rp,0);
  720.   draw_active(x,y);
  721.   SetAPen(rp,1);
  722.   current_col.col_number_t = 1;
  723. }
  724.  
  725. void set_col_0(void)
  726. {
  727.   cprop_r_info.HorizPot = (USHORT)(current_col.red_t0 * 4095);
  728.   cprop_g_info.HorizPot = (USHORT)(current_col.green_t0 * 4095);
  729.   cprop_b_info.HorizPot = (USHORT)(current_col.blue_t0 * 4095);
  730. }
  731.  
  732. void set_col_1(void)
  733. {
  734.   cprop_r_info.HorizPot = (USHORT)(current_col.red_t1 * 4095);
  735.   cprop_g_info.HorizPot = (USHORT)(current_col.green_t1 * 4095);
  736.   cprop_b_info.HorizPot = (USHORT)(current_col.blue_t1 * 4095);
  737. }
  738.  
  739.  
  740. void show_col_request(void)
  741. {
  742.   register long y = (x_win_i_height - CREQ_HEIGHT) / 2,
  743.              x = (x_win_i_width - CREQ_WIDTH) / 2;
  744.  
  745.   if (is_colre) {
  746.     return;
  747.   }
  748.   if (is_about) {
  749.     AboutWinDown();
  750.   }
  751.  
  752.   current_col.red_t0   = current_col.red_0;
  753.   current_col.green_t0 = current_col.green_0;
  754.   current_col.blue_t0  = current_col.blue_0;
  755.   current_col.red_t1   = current_col.red_1;
  756.   current_col.green_t1 = current_col.green_1;
  757.   current_col.blue_t1  = current_col.blue_1;  
  758.  
  759.   color_request.TopEdge = y;
  760.   color_request.LeftEdge = x;
  761.  
  762.   set_col_0();
  763.  
  764.   PROFILE_OFF();
  765.   Request(&color_request,win2);
  766.   PROFILE_ON();
  767.  
  768.   set_colre;                /* Requester am Bildschirm */
  769.   x += WIN_X_KOO + CREQ_COL_1_X+1;
  770.   y += WIN_Y_KOO + CREQ_COL_1_Y+1;
  771.   SetAPen(&(screen->RastPort),1);
  772.   RectFill(&(screen->RastPort), x, y, x+CREQ_COL_WIDTH-3, y+CREQ_COL_HEIGHT-3);
  773.  
  774.   set_0_active();
  775. }
  776.  
  777. void refresh_props(void)
  778. {
  779.   RefreshGadgets(&color_blue_gadg,win2,&color_request);
  780. }
  781.  
  782.  
  783. void remove_col_request(void)
  784. {
  785.   if (is_colre && win2 != NULL) {
  786.     unset_colre;
  787.     EndRequest(&color_request,win2);
  788.   }
  789. }
  790.  
  791. #else    /* !REQ_LIBRARY */
  792.  
  793. #include     <stdarg.h>
  794. #include    <libraries/reqbase.h>
  795. #include     <clib/req_protos.h>
  796. #include    <pragmas/req.h>
  797.  
  798. extern struct ReqLib        *ReqBase;
  799.  
  800. void show_col_request(void)
  801. {
  802.   long newcolor;
  803.  
  804.   /* Fatal(10,"Huhu. bäää... %s Program ist tot!","Mein");  ** TEST */
  805.  
  806.   if (is_colre) {
  807.     return;
  808.   }
  809.   if (is_about) {
  810.     AboutWinDown();
  811.   }
  812.  
  813.   if (ReqBase == NULL) {
  814.     Warning(MSG_NEED_REQ_LIB);   
  815.     return;
  816.   }
  817.  
  818.   set_colre;
  819.   sleep_pointer();
  820.  
  821.   PROFILE_OFF();
  822.   newcolor = ColorRequester(1L);
  823.   PROFILE_ON();
  824.  
  825.   if (newcolor != -1) {
  826.      struct ColorMap *cmap = screen->ViewPort.ColorMap;
  827.      short *coltab;
  828.  
  829.      coltab = (short *)cmap->ColorTable;
  830.      
  831.      current_col.red_0   = (coltab[0] & 0x0F00) >> 8;
  832.      current_col.green_0 = (coltab[0] & 0x00F0) >> 4;
  833.      current_col.blue_0  =  coltab[0] & 0x000F;
  834.      current_col.red_1   = (coltab[1] & 0x0F00) >> 8;
  835.      current_col.green_1 = (coltab[1] & 0x00F0) >> 4;
  836.      current_col.blue_1  =  coltab[1] & 0x000F;
  837.      current_col.red_2   = (coltab[2] & 0x0F00) >> 8;
  838.      current_col.green_2 = (coltab[2] & 0x00F0) >> 4;
  839.      current_col.blue_2  =  coltab[2] & 0x000F;
  840.      current_col.red_3   = (coltab[3] & 0x0F00) >> 8;
  841.      current_col.green_3 = (coltab[3] & 0x00F0) >> 4;
  842.      current_col.blue_3  =  coltab[3] & 0x000F;
  843.      
  844.      /* wenn Farbe ueber Col-Req geaendert, dann nicht mehr clonen! */
  845.      unset_clwbcol;
  846.   }
  847.   
  848.   clear_pointer();
  849.   unset_colre;
  850. }
  851.  
  852. #endif    /* !REQ_LIBRARY */
  853.  
  854.  
  855. void __stdargs ok(char *format, ...)
  856. {
  857.   volatile va_list ap;
  858.  
  859.   va_start(ap,format);
  860.   MySimpleRequest(1, NULL, NULL, NULL, NULL, format, va_arg(ap, long), va_arg(ap, long), va_arg(ap, long));
  861.   va_end(ap);
  862. }
  863.  
  864. int __stdargs MySimpleRequest(int NrBut, char *Lbut, char *Rbut, char *Mbut, char *title, char *format,...)
  865. {
  866.   volatile va_list ap;
  867.   int ret = FALSE;
  868.   
  869.   if (title == NULL) title = GetTeXString(MSG_SHOWDVI_REQUEST);
  870.   if (Lbut == NULL)  Lbut = GetTeXString(MSG_OK);
  871.   if (Rbut == NULL)  Rbut = GetTeXString(MSG_CANCEL);
  872.   if (Mbut == NULL)  Mbut = GetTeXString(MSG_OK);
  873.  
  874.   va_start(ap,format);
  875.  
  876.   if (is_os2) {
  877.     struct EasyStruct MyES;
  878.     
  879.  
  880.     strcpy(m_string, Lbut);
  881.     if (NrBut > 2) {
  882.       strcat(m_string, "|");
  883.       strcat(m_string, Mbut);
  884.     }
  885.     if (NrBut > 1) {
  886.       strcat(m_string, "|");
  887.       strcat(m_string, Rbut);
  888.     }
  889.  
  890.     MyES.es_StructSize = sizeof(MyES);
  891.     MyES.es_Flags = 0;
  892.     MyES.es_Title = title;
  893.     MyES.es_TextFormat = format;
  894.     MyES.es_GadgetFormat = m_string;
  895.     
  896.     PROFILE_OFF();
  897.     ret = EasyRequestArgs(win2, &MyES, NULL, ap);
  898.     PROFILE_ON();
  899.   }
  900. #if defined(REQ_LIBRARY)
  901.   else {
  902.     if (ReqBase == NULL) {
  903.       Message(MSG_NEED_REQ_LIB);
  904.     }
  905.     else {
  906.       struct TRStructure trs;
  907.       
  908.       if (NrBut <= 1) {
  909.         Lbut = Mbut = NULL;
  910.         Rbut = GetTeXString(MSG_OK);
  911.       }
  912.       if (NrBut <= 2) {
  913.         Mbut = NULL;
  914.       }
  915.  
  916.       trs.Text     = format;
  917.       trs.Controls = ap;
  918.       trs.Window = 0;
  919.       trs.MiddleText = Mbut;
  920.       trs.PositiveText = Lbut;
  921.       trs.NegativeText = Rbut;
  922.       trs.Title = title;
  923.       trs.KeyMask = (short)0xFFFF;
  924.       trs.textcolor = 1;
  925.       trs.detailcolor = 1;
  926.       trs.blockcolor = 1;
  927.       trs.versionnumber = REQVERSION;
  928.       trs.Timeout = 0;         /* you could put a timeout here if you wanted */
  929.       trs.AbortMask = 0;      /* If you wanted to abort this requester from another */
  930.                 /* process, pass the mask for Signal() in this element. */
  931.                 /* Then just Signal() the process that brought up the requester */
  932.       trs.rfu1 = 0;
  933.       ret = TextRequest(&trs);
  934.     }
  935.   }
  936. #endif
  937.   va_end(ap);
  938.   
  939.   return ret;
  940. }
  941.  
  942.  
  943.  
  944. /* Struktur fuer den Fatal-Requester */
  945. static struct EasyStruct FatalES = {
  946.     sizeof (struct EasyStruct),
  947.     0,
  948.     NULL,
  949.     NULL,
  950.     NULL
  951. };
  952.  
  953. /* show the message in an easy-request... */
  954. void FatalMessage(int ret, char *msg)
  955. {
  956.   char *TxtFmt;
  957.   
  958.   FatalES.es_Title = GetTeXString(MSG_SHOWDVI_FATAL_MESSAGE);
  959.   FatalES.es_GadgetFormat = GetTeXString(MSG_OK);
  960.  
  961.   if (ret < 6)        TxtFmt = GetTeXString(MSG_FATAL_WRONG);
  962.   else if (ret ==  9) TxtFmt = GetTeXString(MSG_FATAL_CHIPMEM);
  963.   else if (ret == 10) TxtFmt = GetTeXString(MSG_FATAL_MEMORY);
  964.   else if (ret < 16)  TxtFmt = GetTeXString(MSG_FATAL_INTERNAL);
  965.   else              TxtFmt = GetTeXString(MSG_FATAL_FATAL);
  966.  
  967.   if (is_os2) {
  968.     FatalES.es_TextFormat = TxtFmt;
  969.     /* der Return-Code ist unwichtig, da das Programm ohnehin nur beendet werden soll */
  970.     PROFILE_OFF();
  971.     (void)EasyRequestArgs(win2, &FatalES, NULL, &msg);
  972.     PROFILE_ON();
  973.   }
  974. #if defined(REQ_LIBRARY)
  975.   else {
  976.     if (ReqBase != NULL) {
  977.       struct TRStructure trs;
  978.  
  979.       /* hier auf keinen Fall ein Fatal(), da sonst Endlosschleife!! */
  980.       trs.Text     = TxtFmt;
  981.       trs.Controls = (char *)&msg;    /* dies funktioniert sogar! */
  982.       trs.Window       = 0;
  983.       trs.MiddleText   = NULL;
  984.       trs.PositiveText = GetTeXString(MSG_OK);
  985.       trs.NegativeText = NULL;
  986.       trs.Title = GetTeXString(MSG_SHOWDVI_FATAL_MESSAGE);
  987.       trs.KeyMask = (short)0xFFFF;
  988.       trs.textcolor = 1;
  989.       trs.detailcolor = 1;
  990.       trs.blockcolor = 1;
  991.       trs.versionnumber = REQVERSION;
  992.       trs.Timeout = 60;         /* you could put a timeout here if you wanted */
  993.       trs.AbortMask = 0;          /* If you wanted to abort this requester from another */
  994.                     /* process, pass the mask for Signal() in this element. */
  995.                     /* Then just Signal() the process that brought up the requester */
  996.       trs.rfu1 = 0;
  997.       (void)TextRequest(&trs);
  998.     }
  999.   }
  1000. #endif
  1001. }
  1002.  
  1003.  
  1004. /* Struktur fuer die Exit-Abfrage */
  1005. static struct EasyStruct ExitES = {
  1006.     sizeof (struct EasyStruct),
  1007.     0,
  1008.     NULL,
  1009.     NULL,
  1010.     NULL
  1011. };
  1012.  
  1013.  
  1014. long real_prog_end(void)
  1015.   long ret = FALSE;
  1016.   
  1017.   ExitES.es_Title     = GetTeXString(MSG_SHOWDVI_MESSAGE);
  1018.   ExitES.es_TextFormat     = GetTeXString(MSG_REALLY_QUIT);
  1019.   ExitES.es_GadgetFormat = GetTeXString(MSG_YES_NO);
  1020.  
  1021.   if (can_i_exit()) {
  1022.     if (is_quickex) {
  1023.       ret = TRUE;
  1024.     }
  1025.     else {
  1026.       if (is_os2) {
  1027.         PROFILE_OFF();
  1028.         ret = EasyRequestArgs(win2, &ExitES, NULL, NULL);
  1029.         PROFILE_ON();
  1030.       }
  1031.       else {
  1032.         ret = (long)AutoRequest(win2,&end_body_text,&end_positive_text,&end_negative_text,0,0,270,70);
  1033.       }
  1034.     }
  1035.   }
  1036.  
  1037.   /* weg mit MENUVERIFY!! */
  1038.   if (ret &&!is_osmenu) MyModifyIDCMP(0, IDCMP_MENUVERIFY);
  1039.  
  1040.   return ret;
  1041. }
  1042.  
  1043.  
  1044. #endif
  1045.  
  1046.  
  1047.  
  1048.  
  1049. /*======================================================================================*/
  1050. /*        F I L E R E Q E S T E R  --  F U N K T I O N E N            */
  1051. /*======================================================================================*/
  1052.  
  1053.  
  1054.  
  1055. #if defined(ARP_FILEREQ)
  1056.   static long __stdargs ArpFileFuncReq    (LONGBITS mask, CPTR object);
  1057.   static long         ArpLoadFileReq    (void);
  1058.   static void         ArpInitFileReq    (void);
  1059.   static void        ArpFreeFileReq    (void);
  1060.   static int         ArpShowFileReq  (char *str);
  1061. #endif
  1062.  
  1063. #if defined(REQ_FILEREQ)
  1064.   static long         ReqLoadFileReq    (void);
  1065.   static void         ReqInitFileReq    (void);
  1066.   static void        ReqFreeFileReq    (void);
  1067. #endif
  1068.  
  1069. #if defined(ASL_FILEREQ)
  1070.   static long         AslLoadFileReq    (void);
  1071.   static void         AslInitFileReq    (void);
  1072.   static void        AslFreeFileReq    (void);
  1073. /*
  1074.   static ULONG __stdargs AslFileFuncReq (ULONG Mask, struct AnchorPath *anchor, 
  1075.                         struct FileRequester *req);
  1076. */
  1077. #endif
  1078.  
  1079.  
  1080.  
  1081. void InitFileReq(void)
  1082. {
  1083. #if defined(ASL_FILEREQ)
  1084.   AslInitFileReq();
  1085. #endif
  1086. #if defined(REQ_FILEREQ)
  1087.   ReqInitFileReq();
  1088. #endif
  1089. #if defined(ARP_FILEREQ)
  1090.   ArpInitFileReq();
  1091. #endif
  1092. }
  1093.  
  1094. long LoadFileReq(void)
  1095. {
  1096. #if defined(ASL_FILEREQ)
  1097.   return AslLoadFileReq();
  1098. #endif
  1099. #if defined(REQ_FILEREQ)
  1100.   return ReqLoadFileReq();
  1101. #endif
  1102. #if defined(ARP_FILEREQ)
  1103.   return ArpLoadFileReq();
  1104. #endif
  1105. }
  1106.  
  1107. void FreeFileReq(void)
  1108. {
  1109. #if defined(ASL_FILEREQ)
  1110.   AslFreeFileReq();
  1111. #endif
  1112. #if defined(REQ_FILEREQ)
  1113.   ReqFreeFileReq();
  1114. #endif
  1115. #if defined(ARP_FILEREQ)
  1116.   ArpFreeFileReq();
  1117. #endif
  1118. }
  1119.  
  1120.  
  1121.  
  1122.  
  1123. #if defined(ARP_FILEREQ) /* ------------------------------------------------------ */
  1124.  
  1125. #undef FCHARS
  1126. #undef DSIZE
  1127. #include "small_arp.h"
  1128.  
  1129. static struct ARPFileRequester    *file_req;
  1130.  
  1131.  
  1132. static long __stdargs ArpFileFuncReq(LONGBITS mask, CPTR object)
  1133. {
  1134.   struct AnchorPath *info = (struct AnchorPath *)object;
  1135.   struct FileInfoBlock *fib;
  1136.   char *hptr;
  1137.  
  1138.   if (mask != FRF_DoWildFunc || info == NULL) {
  1139.     return 0L;
  1140.   }
  1141.  
  1142.   fib = &(info->ap_Info);
  1143.  
  1144.   if (fib->fib_EntryType > 0) return 0L;    /* Dirs immer */
  1145.   hptr = strrchr(fib->fib_FileName,'.');
  1146.   if (hptr == NULL) return 1L;            /* kein Punkt ?? */
  1147.   if (stricmp(hptr,".dvi")) return 1L;        /* kein .dvi ?? */
  1148.  
  1149.   return 0L;
  1150. }
  1151.  
  1152.  
  1153. static long ArpLoadFileReq(void)
  1154. {
  1155.   char fr_file[108], *ptr, fname[108], c;
  1156.   long ret;
  1157.   int i, ac;
  1158.  
  1159.   if (is_arp) {
  1160.     ac = 0;    /* importand */
  1161.     strcpy(file_req->fr_Dir,
  1162.         (char *)((struct StringInfo *)(dir_Gad.SpecialInfo))->Buffer);
  1163.     strcpy(file_req->fr_File,
  1164.         (char *)((struct StringInfo *)(fil_Gad.SpecialInfo))->Buffer);
  1165.  
  1166.     ptr = strrchr(file_req->fr_Dir,'/');
  1167.     if (ptr != NULL && *(ptr+1) == '\0') {    /* / at the end */
  1168.       *ptr = '\0';
  1169.     }
  1170.  
  1171.     ptr = strrchr(file_req->fr_File,'.');
  1172.     if (ptr == NULL || strcmp(ptr,".dvi") != 0) {
  1173.       strcat(file_req->fr_File,".dvi");
  1174.     }
  1175.  
  1176.     if (ArpShowFileReq(fr_file)) {
  1177.       strcpy(fname,file_req->fr_Dir);
  1178.       TackOn(fname,file_req->fr_File);
  1179.       ptr = strrchr(fname,'.');
  1180.       if (ptr == NULL || strcmp(ptr,".dvi") != 0 ||
  1181.           (ac = access(fname,4)) != 0 ) {
  1182.     ptr = (char *)((struct StringInfo *)(dir_Gad.SpecialInfo))->Buffer;
  1183.         strcpy(ptr, file_req->fr_Dir);
  1184.         i = strlen(ptr);
  1185.         if (i > 0)  {     /* haenge slash an */
  1186.           c = ptr[i-1];
  1187.           if (c != ':' && c != '/' )  {
  1188.              ptr[i] = '/';
  1189.              ptr[i+1] = (char)0;
  1190.           }
  1191.         }
  1192.         strcpy((char *)((struct StringInfo *)(fil_Gad.SpecialInfo))->Buffer,
  1193.         file_req->fr_File);
  1194.         RefreshGadgets(&dir_Gad,win2,NULL);
  1195.         if (strlen(fname) > 30) {
  1196.           strcpy(fname,file_req->fr_File);
  1197.         }
  1198.         if (ac == 0) {
  1199.           sprintf(m_string,GetTeXString(MSG_FILE_ISNT_DVI_FILE),fname);
  1200.         }
  1201.         else {
  1202.           sprintf(m_string,GetTeXString(MSG_CANT_FOUND_FILE),fname);
  1203.         }
  1204.         Message(m_string);
  1205.         beep();
  1206.         ret = 5L;
  1207.       }
  1208.       else {
  1209.         strcpy(filename,fname);
  1210.         OpenNewDVI(fname, FALSE);
  1211.         ret = 4L;            /* neues File, Name geaendert. */
  1212.       }
  1213.     }
  1214.     else {
  1215.       ret = 5L;
  1216.     }
  1217.   }
  1218.   else {
  1219.     Message("I need the ARP-Library!");
  1220.     beep();
  1221.     ret = 5L;
  1222.   }
  1223.   return ret;
  1224. }
  1225.  
  1226.  
  1227. static void ArpInitFileReq(void)
  1228. {
  1229.   void (*func)();
  1230.  
  1231.   if (!is_arp) {
  1232.     return;
  1233.   }
  1234.  
  1235.   func = (void *)&ArpFileFuncReq;
  1236.  
  1237.   file_req = ArpAllocFreq();
  1238.   if (file_req == NULL) {
  1239.     Fatal(10,MSG_CANT_ALLOC_FREQ);
  1240.   }
  1241.   file_req->fr_Hail = GetTeXString(MSG_LOAD_NEW_DVI);
  1242.   file_req->fr_FuncFlags |= FRF_DoWildFunc;
  1243.   file_req->fr_Function = func;
  1244. }
  1245.  
  1246.  
  1247. #define FR_HEIGHT    100
  1248. #define FR_WIDTH    200
  1249.  
  1250.  
  1251.  
  1252. static int ArpShowFileReq(char *str)
  1253. {
  1254.   char *hptr;
  1255.   register int x=(x_scr_width-FR_WIDTH-20)/2,
  1256.            y=(x_scr_height-FR_HEIGHT-20)/2;
  1257.  
  1258. /*
  1259.   if (x+FR_WIDTH > x_scr_width) x = x_scr_width-FR_WIDTH;
  1260.   if (y+FR_HEIGHT > x_scr_height) y = x_scr_height-FR_HEIGHT;
  1261. */
  1262.  
  1263.   file_req->fr_Window = win2;
  1264.   file_req->fr_LeftEdge = x;
  1265.   file_req->fr_TopEdge = y;
  1266.  
  1267.   PROFILE_OFF();
  1268.   hptr = FileRequest(file_req);
  1269.   PROFILE_ON();
  1270.  
  1271.   if (hptr == NULL)
  1272.     return (FALSE);
  1273.  
  1274.   strcpy(str,hptr);
  1275.   return (TRUE);
  1276. }
  1277.  
  1278.  
  1279. static void ArpFreeFileReq(void)
  1280. {
  1281.   return;
  1282. }
  1283.  
  1284.  
  1285. #endif /* ARP_FILEREQ  ------------------------------------------------------------- */
  1286.  
  1287.  
  1288.  
  1289.  
  1290. #if defined(REQ_FILEREQ)   /* ------------------------------------------------------ */
  1291.  
  1292.  
  1293. static struct ReqFileRequester    MyFileReqStruct;
  1294. static short IsReqStarted = FALSE;
  1295. static char ReqFileName[FCHARS];
  1296. static char ReqDirName[DSIZE];
  1297.  
  1298. static long ReqLoadFileReq(void)
  1299. {
  1300.   char answerarray[DSIZE+FCHARS];
  1301.   long ret;
  1302.   char *ptr;
  1303.  
  1304.  
  1305.  
  1306.   if (ReqBase != NULL) {
  1307.  
  1308.     answerarray[0] = 0;
  1309.  
  1310.  
  1311.  
  1312.     /* Initialize the 'PathName' field so that the file requester will */
  1313.     /* construct a complete path name for me.  It will also put the two */
  1314.     /* parts of the answer (directory and file name) into the directory */
  1315.     /* file name which I also decided to supply it with.  Since the */
  1316.     /* directory and file name arrays are present, it will use their */
  1317.     /* initial contents as the initial file and directory.  If they aren't */
  1318.     /* present it will leave both blank to start. */
  1319.  
  1320. #if 0
  1321.     strcpy(&(ReqDirName[0]),(char *)((struct StringInfo *)(dir_Gad.SpecialInfo))->Buffer);
  1322.     strcpy(&(ReqFileName[0]), (char *)((struct StringInfo *)(fil_Gad.SpecialInfo))->Buffer);
  1323. #else
  1324.     if (is_dir(filename)) {
  1325.       strcpy(ReqDirName, filename);
  1326.       ReqFileName[0] = '\0';
  1327.     }
  1328.     else {
  1329.       strcpy(ReqFileName, FilePart(filename));
  1330.       ptr = strrchr(filename, '/');
  1331.       if (ptr == NULL) ptr = strchr(filename, ':');
  1332.       if (ptr == NULL) ReqDirName[0] = '\0';
  1333.       else {
  1334.         int n = ptr - filename;
  1335.         if (*ptr == ':') n++;        // Doppelpunkt kommt mit
  1336.         strncpy(ReqDirName, filename, n);
  1337.         ReqDirName[n] = '\0';
  1338.       }
  1339.     }
  1340. #endif
  1341.   
  1342.     /* printf("Dir: '%s', File: '%s'\n", ReqDirName, ReqFileName); */
  1343.  
  1344.     MyFileReqStruct.PathName = answerarray;
  1345.     MyFileReqStruct.Dir = ReqDirName;
  1346.     MyFileReqStruct.File = ReqFileName;
  1347.  
  1348.     /* The directory caching of this file requester is one of its nice */
  1349.     /* features, so I decided to show it off.  It is completely optional */
  1350.     /* though, so if you don't want it, don't set this flag.  If you do */
  1351.     /* want it, don't forget to call PurgeFiles() when you are done. */
  1352.     MyFileReqStruct.Flags = FRQCACHINGM | FRQHIDEWILDSM | FRQABSOLUTEXYM;
  1353.  
  1354.     /* Initialize a few colour fields.  Not strictly necessary, but */
  1355.     /* personally, I like having my files a different colour from my */
  1356.     /* directories. */
  1357.     if (is_col4) {
  1358.       MyFileReqStruct.dirnamescolor = 2;
  1359.       MyFileReqStruct.devicenamescolor = 1;
  1360.     }
  1361.     else {
  1362.       MyFileReqStruct.dirnamescolor = 1;
  1363.       MyFileReqStruct.devicenamescolor = 1;
  1364.     }
  1365.  
  1366.     MyFileReqStruct.numlines = 30;
  1367.  
  1368.     /* I could also make it larger, pass it a file and/or directory */
  1369.     /* name, set the window title, set various flags and customize */
  1370.     /* in many other ways, but I wanted to show that it can be easily */
  1371.     /* used without having to fill in a lot of fields. */
  1372.  
  1373.     MyFileReqStruct.VersionNumber = REQVERSION;
  1374.     MyFileReqStruct.Title = GetTeXString(MSG_LOAD_NEW_DVI);
  1375.     strcpy(MyFileReqStruct.Show, "*.dvi");
  1376.  
  1377.     IsReqStarted = TRUE;
  1378.  
  1379.         PROFILE_OFF();
  1380.     if (FileRequester(&MyFileReqStruct)) {
  1381.   
  1382.             PROFILE_ON();
  1383.  
  1384.         /* printf("Result: '%s', Dir: '%s', File: '%s'\n",
  1385.                   MyFileReqStruct.PathName,
  1386.                   MyFileReqStruct.Dir,
  1387.                   MyFileReqStruct.File); */
  1388.  
  1389.         ptr = strrchr(answerarray, '.');
  1390.         if (ptr == NULL || stricmp(ptr, ".dvi") != 0) {
  1391.           strcat(answerarray, ".dvi");
  1392.         }
  1393.  
  1394.         if (access(answerarray, 4) != 0) {
  1395.           Message(MSG_CANT_FOUND_FILE, answerarray);
  1396.           beep();
  1397.           ret = 5L;
  1398.         }
  1399.         else {
  1400.           if (stricmp(filename, &(answerarray[0])) == 0) {
  1401.             OpenNewDVI(&(answerarray[0]), FALSE);
  1402.             ret = 3L;            /* neues File, Name *nicht* geaendert. */
  1403.           }
  1404.           else {
  1405.             strcpy(filename, &(answerarray[0]));
  1406.             OpenNewDVI(&(answerarray[0]), FALSE);
  1407.             ret = 4L;            /* neues File, Name geaendert. */
  1408.           }
  1409.         }
  1410.     }
  1411.     else {
  1412.         PROFILE_ON();
  1413.         ret = 5L;
  1414.     }
  1415.     
  1416.   }
  1417.   else {
  1418.     Message(MSG_NEED_REQ_LIB);
  1419.     ret = 5L;
  1420.   }
  1421.  
  1422.   return ret;
  1423. }
  1424.  
  1425. static void ReqInitFileReq(void)
  1426. {
  1427.   return;
  1428. }
  1429.  
  1430. static void ReqFreeFileReq(void)
  1431. {
  1432.   if (ReqBase && IsReqStarted) {
  1433.     PurgeFiles(&MyFileReqStruct);    /* Only necessary if the FRQCACHINGM flag */
  1434.     IsReqStarted = FALSE;
  1435.   }
  1436. }
  1437.  
  1438.  
  1439. #endif /* REQ_FILEREQ  ------------------------------------------------------------- */
  1440.  
  1441.  
  1442. #if defined(ASL_FILEREQ)  /* ------------------------------------------------------- */
  1443.  
  1444.  
  1445. #include <libraries/asl.h>
  1446. #include <clib/asl_protos.h>
  1447. #include <pragmas/asl_pragmas.h>
  1448.  
  1449. extern struct Library         * AslBase;
  1450. static struct FileRequester     * AslRequestPtr = NULL;
  1451. static char             * AslFileTitle  = NULL;
  1452. static char               AslFileName[FCHARS+1];
  1453. static char               AslDirName[DSIZE+1];
  1454.  
  1455.  
  1456. static long AslLoadFileReq(void)
  1457. {
  1458.   long ret = 5;
  1459.   char * ptr;
  1460.   char answerarray[FCHARS+DSIZE+1];
  1461.  
  1462.   if (AslBase != NULL && AslRequestPtr != NULL) {
  1463.     if (is_dir(filename)) {
  1464.       strcpy(AslDirName, filename);
  1465.       AslFileName[0] = '\0';
  1466.     }
  1467.     else {
  1468.       strcpy(AslFileName, FilePart(filename));
  1469.       ptr = strrchr(filename, '/');
  1470.       if (ptr == NULL) ptr = strchr(filename, ':');
  1471.       if (ptr == NULL) AslDirName[0] = '\0';
  1472.       else {
  1473.         int n = ptr - filename;
  1474.         if (*ptr == ':') n++;        // Doppelpunkt kommt mit
  1475.         strncpy(AslDirName, filename, n);
  1476.         AslDirName[n] = '\0';
  1477.       }
  1478.     }
  1479.  
  1480.     PROFILE_OFF();
  1481.     if (AslRequestTags(AslRequestPtr, ASLFR_Window, win2, 
  1482.                       ASLFR_PrivateIDCMP, TRUE, 
  1483.                       ASLFR_TitleText, AslFileTitle, 
  1484.                       ASLFR_InitialFile, AslFileName,
  1485.                       ASLFR_InitialDrawer, AslDirName,
  1486.                       TAG_DONE)) {
  1487.  
  1488.       PROFILE_ON();
  1489.       if (AslRequestPtr->rf_File[0] == 0) return 5;    // leere Eingabe
  1490.  
  1491.       strncpy(answerarray, AslRequestPtr->rf_Dir, sizeof(answerarray)-1);
  1492.       AddPart(answerarray, AslRequestPtr->rf_File, sizeof(answerarray)-1);
  1493.  
  1494.       if (access(answerarray, 4) != 0) {
  1495.         ptr = strrchr(answerarray, '.');
  1496.         if (ptr == NULL || stricmp(ptr, ".dvi") != 0) {
  1497.           strcat(answerarray, ".dvi");
  1498.         }
  1499.       }
  1500.  
  1501.       if (access(answerarray, 4) != 0) {
  1502.         Message(MSG_CANT_FOUND_FILE, answerarray);
  1503.         beep();
  1504.         ret = 5L;
  1505.       }
  1506.       else {
  1507.         if (stricmp(filename, &(answerarray[0])) == 0) {
  1508.           OpenNewDVI(&(answerarray[0]), FALSE);
  1509.           ret = 3L;            /* neues File, Name *nicht* geaendert. */
  1510.         }
  1511.         else {
  1512.           strcpy(filename, &(answerarray[0]));
  1513.           OpenNewDVI(&(answerarray[0]), FALSE);
  1514.           ret = 4L;            /* neues File, Name geaendert. */
  1515.         }
  1516.       }
  1517.     }
  1518.     else {
  1519.       PROFILE_ON();
  1520.     }
  1521.   }
  1522.   return ret;
  1523. }
  1524.  
  1525.  
  1526. static void AslInitFileReq(void)
  1527. {
  1528.   AslFileTitle = GetTeXString(MSG_LOAD_NEW_DVI);
  1529.   if (AslBase != NULL && AslFileTitle) {
  1530.     AslRequestPtr = AllocAslRequestTags(ASL_FileRequest, ASLFR_SleepWindow, TRUE, 
  1531.                              ASLFR_InitialPattern, "#?.dvi", 
  1532.                              ASLFR_DoPatterns, TRUE,
  1533.                              TAG_DONE);
  1534.     if (AslRequestPtr == NULL) {
  1535.       Warning(MSG_CANT_ALLOC_ASLREQ);
  1536.     }
  1537.   }
  1538. }
  1539.  
  1540.  
  1541. static void AslFreeFileReq(void)
  1542. {
  1543.   if (AslBase != NULL && AslRequestPtr != NULL) {
  1544.     FreeAslRequest(AslRequestPtr);
  1545.     AslRequestPtr = NULL;
  1546.   }
  1547. }
  1548.  
  1549. #endif /* ASL_FILEREQ  ------------------------------------------------------------- */
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555. int MyGetString(char *title, char *result)
  1556. {
  1557. #if defined(REQ_LIBRARY)
  1558.   struct GetStringStruct gss;
  1559.  
  1560.   if (ReqBase != NULL) {
  1561.     memset(&gss, 0, sizeof(gss));
  1562.     gss.titlebar      = title;
  1563.     gss.stringbuffer  = result;
  1564.     gss.stringsize    = 100;
  1565.     gss.visiblesize   = 30;
  1566.     gss.versionnumber = REQVERSION;
  1567.     PROFILE_OFF();
  1568.     if (NewGetString(&gss)) {
  1569.       PROFILE_ON();
  1570.       return TRUE;
  1571.     }
  1572.     else {
  1573.       PROFILE_ON();
  1574.       return FALSE;
  1575.     }
  1576.   }
  1577.   else {
  1578.     Warning(MSG_NEED_REQ_LIB);
  1579.     return FALSE;
  1580.   }
  1581. #else
  1582.   return FALSE;
  1583. #endif
  1584. }
  1585.  
  1586. int MyGetLong(char *title, long min, long max, long defval, long *result)
  1587. {
  1588. #if defined(REQ_LIBRARY)
  1589.   struct GetLongStruct    gls;
  1590.  
  1591.   if (ReqBase != NULL) {
  1592.     gls.titlebar   = title;
  1593.     gls.defaultval = defval;
  1594.     gls.minlimit   = min;
  1595.     gls.maxlimit   = max;
  1596.     gls.window     = NULL;
  1597.     gls.versionnumber = REQVERSION;
  1598.     if (defval == -12321) {    /* magic number for 'no default' */
  1599.       gls.flags    = GLNODEFAULTM;
  1600.     }
  1601.     else {
  1602.       gls.flags    = 0;
  1603.     }
  1604.     gls.rfu2       = 0;
  1605.     PROFILE_OFF();
  1606.     if (GetLong(&gls)) {
  1607.       PROFILE_ON();
  1608.       *result = gls.result;
  1609.       return TRUE;
  1610.     }
  1611.     else {
  1612.       PROFILE_ON();
  1613.       return FALSE;
  1614.     }
  1615.   }
  1616.   else {
  1617.     return FALSE;
  1618.   }
  1619. #else
  1620.   return FALSE;
  1621. #endif
  1622. }
  1623.  
  1624.  
  1625. void Okay1(char *text)
  1626. {
  1627.   (void)MySimpleRequest(1, NULL, NULL, NULL, NULL, text);
  1628. }
  1629.  
  1630.  
  1631. int Okay2(char *text)
  1632. {
  1633.   return MySimpleRequest(2, NULL, NULL, NULL, NULL, text);
  1634. }
  1635.  
  1636.  
  1637. void ChangeFormatFile(void)
  1638. {
  1639.   char con[100];
  1640.   int ret;
  1641.  
  1642.   if (is_os2) {
  1643.     ret = GetVar("TEXFORMAT", con, 90, GVF_GLOBAL_ONLY);
  1644.     if (ret == -1) { 
  1645.       strcpy(con, "plain");
  1646.     }
  1647.     if (MyGetString(GetTeXString(MSG_FORMAT_FILE_NAME), con)) {
  1648.       if (!SetVar("TEXFORMAT", con, -1, GVF_GLOBAL_ONLY)) {
  1649.         Warning(MSG_CANT_SET_VARIABLE, "TEXFORMAT");
  1650.       }
  1651.     }
  1652.   }
  1653. }
  1654.  
  1655.  
  1656.  
  1657.  
  1658. static struct TagItem StartComTags[] = {
  1659.     {SYS_Input,     NULL },
  1660.     {SYS_Output,    NULL },
  1661.     {SYS_Asynch,    TRUE },
  1662.     {SYS_UserShell, TRUE },
  1663.     {NP_Priority,   0    },
  1664.     {NP_StackSize,  4096 },
  1665.     {NP_WindowPtr,  NULL },
  1666.     {TAG_DONE,      NULL } };
  1667.  
  1668. int start_command(char *title, char *name, char *PubScr)
  1669. {
  1670.   char con[150];
  1671.   BPTR fh;
  1672.   int ret = 0;
  1673.   
  1674.   if (is_os2) {
  1675.     sprintf(con, "CON:%d/%d/%d/%d/%s/AUTO/CLOSE/WAIT/SCREEN %s",
  1676.         win2->LeftEdge+win2->BorderLeft+3, win2->TopEdge+win2->BorderTop+3,
  1677.         win2->Width-win2->BorderLeft-win2->BorderRight-22,
  1678.         (is_lace) ? 200 : 120, title, ((PubScr != NULL) ? PubScr : GetCurrentPubScr()));
  1679.     if (fh = Open(con, MODE_NEWFILE)) {
  1680.       StartComTags[0].ti_Data = fh;
  1681.       StartComTags[6].ti_Data = (ULONG)win2;    /* das Fenster *muss* dann aber auch offen bleiben! */
  1682.       if (SystemTagList(name, StartComTags)) {
  1683.         Close(fh);
  1684.         ret = 1;
  1685.       }
  1686.     }
  1687.     else {
  1688.       ret = 2;
  1689.     }
  1690.   }
  1691.   return ret;
  1692. }
  1693.  
  1694.  
  1695. /*
  1696.  * GetScreenMode()
  1697.  *
  1698.  * Ruft den Screenmode Requester der asl-Library auf (V38)
  1699.  *
  1700.  * Das Argument DisplayID wird sowohl als Initial-Wert, als auch 
  1701.  * als Rueckgabe-Wert verwendet.
  1702.  * Das Window (zweite Argument) wird eingeschlaefert, solange der
  1703.  * Requester oben ist. Auch win2 wird eingeschlaefert.
  1704.  *
  1705.  * Rueckgabewert FALSE bedeutet, dass etwas fehlgeschlagen ist.
  1706.  * Dann ist das Argument unveraendert.
  1707.  *
  1708.  */
  1709.  
  1710. static struct TagItem ScrModeTags[] = 
  1711.  { { ASLSM_Screen, NULL        },
  1712.    { ASLSM_InitialDisplayID, 0L    },
  1713.    { ASLSM_Window, NULL        },
  1714.    { ASLSM_SleepWindow, TRUE    },
  1715.    { ASLSM_PrivateIDCMP, FALSE    },
  1716.    { TAG_DONE, TRUE        }
  1717.  };
  1718.  
  1719. int GetScreenMode(ULONG * DisplayID, struct Window * w)
  1720. {
  1721.   int ret = FALSE;
  1722.   struct ScreenModeRequester * requester;
  1723.   
  1724.   if (AslBase == NULL || AslBase->lib_Version < 38) return ret;    // V38 benoetigt
  1725.  
  1726.   ScrModeTags[0].ti_Data = (ULONG)screen;
  1727.   ScrModeTags[1].ti_Data = *DisplayID;
  1728.   ScrModeTags[2].ti_Data = (long)w;
  1729.   
  1730.   requester = AllocAslRequest(ASL_ScreenModeRequest, ScrModeTags);
  1731.   if (requester != NULL) {
  1732.     sleep_pointer();
  1733.     PROFILE_OFF();
  1734.     if (AslRequest(requester, ScrModeTags)) {
  1735.       PROFILE_ON();
  1736.       *DisplayID = requester->sm_DisplayID;
  1737.       ret = TRUE;
  1738.     }
  1739.     else {
  1740.       PROFILE_ON();
  1741.     }
  1742.     FreeAslRequest(requester);
  1743.     clear_pointer();
  1744.   }
  1745.   return ret;
  1746. }
  1747.  
  1748.  
  1749. /************************/
  1750.  
  1751. int StartSearch(enum SearchOpt opt)
  1752. {
  1753.   int ret = 5;
  1754.   ULONG ret_sigs;
  1755.   enum SearchActions sr = SEARCHWIN_ACTION_NONE;
  1756.   char SBuf[100] = "";
  1757.  
  1758.   if (is_dvif) {
  1759.   
  1760.     sleep_pointer();
  1761.   
  1762.     if (opt == SO_StartSearchAgain) {
  1763.       char * ptr = GetCurSearchString();
  1764.  
  1765.       if (ptr) {
  1766.       InitBMSearch(ptr);
  1767.     SearchStartPage = current_page_phy;
  1768.     InSearchMode = TRUE;
  1769.     ret = 6;
  1770.       }
  1771.       else {
  1772.         ret = 5;
  1773.       }
  1774.       
  1775.       clear_pointer();
  1776.       
  1777.       return ret;
  1778.     }
  1779.  
  1780.     OpenSearchWin();
  1781.  
  1782. #if 0    
  1783.     do {
  1784.       ret_sigs = Wait((1<<sig_searchwin) | SIGBREAKF_CTRL_C);
  1785.  
  1786.       if (ret_sigs & SIGBREAKF_CTRL_C) {
  1787.         CXBRK();        /* CTRL C  --  Prog. Ende     */
  1788.         return 5;        /* oder falls es nicht geht...     */
  1789.       }
  1790.  
  1791.       sr = DoSearchWin(SBuf, sizeof(SBuf)-1);
  1792.       
  1793.     } while (sr == SEARCHWIN_ACTION_NONE);
  1794.     
  1795.     switch (sr) {
  1796.       case SEARCHWIN_ACTION_CLOSE:
  1797.       case SEARCHWIN_ACTION_CANCEL:
  1798.         ret = 5;
  1799.           break;
  1800.       case SEARCHWIN_ACTION_SEARCH:
  1801.         // das Fenster bleibt noch auf!
  1802.         if (*SBuf != '\0') {
  1803.         InitBMSearch(SBuf);
  1804.       SearchStartPage = current_page_phy;
  1805.       InSearchMode = TRUE;
  1806.       ret = 6;
  1807.     }
  1808.     else {
  1809.       ret = 5;
  1810.     }
  1811.     break;
  1812.       default:
  1813.         ret = 5;    // eigentlich ein Fatal() wert..
  1814.     }
  1815. #endif
  1816.     
  1817.     clear_pointer();
  1818.   }
  1819.  
  1820.  
  1821.   return ret;
  1822. }
  1823.  
  1824.