home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / w / winsr173.zip / DIALOG2.C < prev    next >
C/C++ Source or Header  |  1992-07-20  |  60KB  |  1,678 lines

  1. /*
  2.  
  3.     various dialog-box code - more in DIALOG.C
  4.  
  5. */
  6.  
  7. #include "windows.h"
  8. #include "winfract.h"
  9. #include "dialog2.h"
  10. #include "fractint.h"
  11. #include "fractype.h"
  12. #include <math.h>
  13. #include <stdio.h>
  14. #include "profile.h"
  15.  
  16. extern HWND hwnd;                               /* handle to main window */
  17. extern char szHelpFileName[];                   /* Help file name*/
  18.  
  19. extern BOOL zoomflag;                /* TRUE is a zoom-box selected */
  20.  
  21. extern char *win_choices[];
  22. extern int win_numchoices, win_choicemade;
  23. int CurrentFractal;
  24.  
  25. extern HANDLE hDibInfo;        /* handle to the Device-independent bitmap */
  26. extern LPBITMAPINFO pDibInfo;        /* pointer to the DIB info */
  27.  
  28. extern int time_to_restart;                               /* time to restart?  */
  29. extern int time_to_reinit;                /* time to reinit? */
  30. extern int time_to_cycle;                               /* time to cycle? */
  31.  
  32. extern int xdots, ydots, colors, maxiter;
  33. extern int ytop, ybottom, xleft, xright;
  34. extern double xxmin, xxmax, yymin, yymax;
  35. extern int fractype;
  36. extern int calc_status;
  37. extern double param[4];
  38. extern int bailout;
  39.  
  40. extern int inside, outside, usr_biomorph, decomp, debugflag;
  41. extern int usr_stdcalcmode, usr_floatflag;
  42. extern    int    invert;     /* non-zero if inversion active */
  43. extern    double    inversion[3];    /* radius, xcenter, ycenter */
  44. extern int numtrigfn;
  45.  
  46. extern int LogFlag, fillcolor;
  47.  
  48. int win_temp1, win_temp2, win_temp3, win_temp4;
  49.  
  50. int numparams,numtrig;
  51. static char *trg[] = {"First Function","Second Function",
  52.               "Third Function","Fourth Function"};
  53. static int paramt[] = {ID_FRACPARTX1, ID_FRACPARTX2,
  54.                        ID_FRACPARTX3, ID_FRACPARTX4,
  55.                        ID_FRACPARTX5, ID_FRACPARTX6 };
  56. static int paramv[] = {ID_FRACPARAM1, ID_FRACPARAM2,
  57.                        ID_FRACPARAM3, ID_FRACPARAM4,
  58.                        ID_FRACPARAM5, ID_FRACPARAM6, };
  59.  
  60. extern int win_release;
  61. extern char far win_comment[];
  62.  
  63. extern char far DialogTitle[];
  64.  
  65. double far win_oldprompts[20];
  66.  
  67. /****************************************************************************
  68.  
  69.     FUNCTION: About(HWND, unsigned, WORD, LONG)
  70.  
  71.     PURPOSE:  Processes messages for "About" dialog box
  72.  
  73.     MESSAGES:
  74.  
  75.         WM_INITDIALOG - initialize dialog box
  76.         WM_COMMAND    - Input received
  77.  
  78. ****************************************************************************/
  79.  
  80. BOOL FAR PASCAL About(hDlg, message, wParam, lParam)
  81. HWND hDlg;
  82. unsigned message;
  83. WORD wParam;
  84. LONG lParam;
  85. {
  86.  
  87. float temp;
  88. char tempname[40];
  89. extern char far winfract_title_text[];
  90.  
  91.     switch (message) {
  92.  
  93.         case WM_INITDIALOG:
  94.             SetDlgItemText(hDlg, ID_VERSION,winfract_title_text);
  95.             SetDlgItemText(hDlg, ID_COMMENT,win_comment);
  96.             SetDlgItemText(hDlg, ID_COMMENT2,
  97.                 "(C) 1990-92  The Stone Soup Group");
  98.             return (TRUE);
  99.  
  100.         case WM_COMMAND:
  101.         if (wParam == IDOK
  102.                 || wParam == IDCANCEL) {
  103.                 EndDialog(hDlg, TRUE);
  104.                 return (TRUE);
  105.             }
  106.             break;
  107.     }
  108.     return (FALSE);
  109. }
  110.  
  111. /****************************************************************************
  112.  
  113.     FUNCTION: Status(HWND, unsigned, WORD, LONG)
  114.  
  115.     PURPOSE:  Processes messages for "Status" dialog box
  116.  
  117.     MESSAGES:
  118.  
  119.         WM_INITDIALOG - initialize dialog box
  120.         WM_COMMAND    - Input received
  121.  
  122. ****************************************************************************/
  123.  
  124. BOOL FAR PASCAL Status(hDlg, message, wParam, lParam)
  125. HWND hDlg;
  126. unsigned message;
  127. WORD wParam;
  128. LONG lParam;
  129. {
  130. char tempstring[100];
  131.     switch (message) {
  132.  
  133.         case WM_INITDIALOG:
  134.             sprintf(tempstring,"fractal type: ");
  135.             if (fractalspecific[fractype].name[0] != '*')
  136.                 strcat(tempstring, fractalspecific[fractype].name);
  137.             else
  138.                 strcat(tempstring, &fractalspecific[fractype].name[1]);
  139.             if (calc_status == 1)
  140.                 strcat(tempstring,"    (still being calculated)");
  141.             else if (calc_status == 2)
  142.                 strcat(tempstring,"    (interrupted, resumable)");
  143.             else if (calc_status == 3)
  144.                 strcat(tempstring,"    (interrupted, not resumable)");
  145.             else
  146.                 strcat(tempstring,"    (completed)");
  147.             /* ##### */
  148.             SetDlgItemText(hDlg, IDS_LINE1,tempstring);
  149.             if(fractalspecific[fractype].param[0][0] == 0)
  150.                 tempstring[0] = 0;
  151.             else
  152.                 sprintf(tempstring,"%-30.30s   %14.10f",
  153.                     fractalspecific[fractype].param[0], param[0]);
  154.             SetDlgItemText(hDlg, IDS_LINE2,tempstring);
  155.             if(fractalspecific[fractype].param[1][0] == 0)
  156.                 tempstring[0] = 0;
  157.             else
  158.                 sprintf(tempstring,"%-30.30s   %14.10f",
  159.                     fractalspecific[fractype].param[1], param[1]);
  160.             SetDlgItemText(hDlg, IDS_LINE3,tempstring);
  161.             if(fractalspecific[fractype].param[2][0] == 0)
  162.                 tempstring[0] = 0;
  163.             else
  164.                 sprintf(tempstring,"%-30.30s   %14.10f",
  165.                     fractalspecific[fractype].param[2], param[2]);
  166.             SetDlgItemText(hDlg, IDS_LINE4,tempstring);
  167.             if(fractalspecific[fractype].param[3][0] == 0)
  168.                 tempstring[0] = 0;
  169.             else
  170.                 sprintf(tempstring,"%-30.30s   %14.10f",
  171.                     fractalspecific[fractype].param[3], param[3]);
  172.             SetDlgItemText(hDlg, IDS_LINE5,tempstring);
  173.             sprintf(tempstring,"Xmin:        %25.16f", xxmin);
  174.             SetDlgItemText(hDlg, IDS_LINE6,tempstring);
  175.             sprintf(tempstring,"Xmax:        %25.16f", xxmax);
  176.             SetDlgItemText(hDlg, IDS_LINE7,tempstring);
  177.             sprintf(tempstring,"Ymin:        %25.16f", yymin);
  178.             SetDlgItemText(hDlg, IDS_LINE8,tempstring);
  179.             sprintf(tempstring,"Ymax:        %25.16f", yymax);
  180.             SetDlgItemText(hDlg, IDS_LINE9,tempstring);
  181.             return (TRUE);
  182.  
  183.         case WM_COMMAND:
  184.         if (wParam == IDOK
  185.                 || wParam == IDCANCEL) {
  186.                 EndDialog(hDlg, TRUE);
  187.                 return (TRUE);
  188.             }
  189.             break;
  190.     }
  191.     return (FALSE);
  192. }
  193.  
  194. /****************************************************************************
  195.  
  196.     FUNCTION: SelectFractal(HWND, unsigned, WORD, LONG)
  197.  
  198.     PURPOSE: Initializes window data and registers window class
  199.  
  200. ****************************************************************************/
  201.  
  202. BOOL FAR PASCAL SelectFractal(hDlg, message, wParam, lParam)
  203. HWND hDlg;
  204. unsigned message;
  205. WORD wParam;
  206. LONG lParam;
  207. {
  208.  
  209.     int i;
  210.     int index;
  211.  
  212.     switch (message) {
  213.  
  214.         case WM_INITDIALOG:
  215.             SetDlgItemText(hDlg, ID_LISTTITLE, DialogTitle);
  216.             for (i = 0; i < win_numchoices; i++) 
  217.                 SendDlgItemMessage(hDlg, IDM_FRACTAL, LB_ADDSTRING,
  218.                     NULL, (LONG) (LPSTR) win_choices[i]);
  219.             SendDlgItemMessage(hDlg, IDM_FRACTAL, LB_SETCURSEL,
  220.                 win_choicemade, 0L);
  221.             return (TRUE);
  222.  
  223.         case WM_COMMAND:
  224.             switch (wParam) {
  225.  
  226.                 case IDOK:
  227. okay:           
  228.                     index=SendDlgItemMessage(hDlg, IDM_FRACTAL,
  229.                         LB_GETCURSEL, 0, 0L);
  230.                     if (index == LB_ERR) {
  231.                         MessageBox(hDlg, "No Choice selected",
  232.                             "Select From a List", MB_OK | MB_ICONEXCLAMATION);
  233.                         break;
  234.                         }
  235.                     win_choicemade = index;
  236.                     EndDialog(hDlg, 1);
  237.                     break;
  238.                   
  239.                 case IDCANCEL:
  240.                     win_choicemade = -1;
  241.                     EndDialog(hDlg, 0);
  242.                     break;
  243.                     
  244.                 case IDM_FRACTAL:
  245.                     switch (HIWORD(lParam)) {
  246.                         case LBN_SELCHANGE:
  247.                             index = SendDlgItemMessage(hDlg, IDM_FRACTAL,
  248.                                 LB_GETCURSEL, 0, 0L);
  249.                             if (index == LB_ERR)
  250.                                 break;
  251.                             break;
  252.                          
  253.                        case LBN_DBLCLK:
  254.                             goto okay;
  255.  
  256.                     }
  257.             return (TRUE);
  258.                 }
  259.  
  260.         }
  261.     return (FALSE);
  262. }
  263.  
  264. /****************************************************************************
  265.  
  266.     FUNCTION: SelectFracParams(HWND, unsigned, WORD, LONG)
  267.  
  268.     PURPOSE: Initializes window data and registers window class
  269.  
  270. ****************************************************************************/
  271.  
  272. BOOL FAR PASCAL SelectFracParams(hDlg, message, wParam, lParam)
  273. HWND hDlg;
  274. unsigned message;
  275. WORD wParam;
  276. LONG lParam;
  277. {
  278.  
  279.     int i, j;
  280.     char temp[30];
  281.  
  282.     switch (message) {
  283.  
  284.         case WM_INITDIALOG:
  285.                 win_temp1 = CurrentFractal;
  286.             SetDlgItemText(hDlg, ID_FRACNAME,   fractalspecific[win_temp1].name);
  287.                 for (numparams = 0; numparams < 4; numparams++)
  288.                     if (fractalspecific[win_temp1].param[numparams][0] == 0)
  289.                         break;
  290.                 numtrig = (fractalspecific[win_temp1].flags >> 6) & 7;
  291.                 if (numparams+numtrig > 6) numparams = 6 - numtrig;
  292.                 for (i = 0; i < 6; i++) {
  293.                     temp[0] = 0;
  294.                     if (i < numparams)
  295.                         sprintf(temp,"%f",param[i]);
  296.                     SetDlgItemText(hDlg, paramv[i], temp);
  297.                     SetDlgItemText(hDlg, paramt[i],"(n/a)");
  298.                     if (i < numparams)
  299.                        SetDlgItemText(hDlg, paramt[i], fractalspecific[win_temp1].param[i]);
  300.                     }
  301.                for(i=0; i<numtrig; i++) {
  302.                     SetDlgItemText(hDlg, paramt[i+numparams], trg[i]);
  303.                     SetDlgItemText(hDlg, paramv[i+numparams],
  304.                         trigfn[trigndx[i]].name);
  305.                     }
  306.                 sprintf(temp,"%d",bailout);
  307.             SetDlgItemText(hDlg, ID_BAILOUT,   temp);
  308.                 sprintf(temp,"%.12f",xxmin);
  309.             SetDlgItemText(hDlg, ID_FRACXMIN,   temp);
  310.                 sprintf(temp,"%.12f",xxmax);
  311.             SetDlgItemText(hDlg, ID_FRACXMAX,   temp);
  312.                 sprintf(temp,"%.12f",yymin);
  313.             SetDlgItemText(hDlg, ID_FRACYMIN,   temp);
  314.                 sprintf(temp,"%.12f",yymax);
  315.             SetDlgItemText(hDlg, ID_FRACYMAX,   temp);
  316.                 return (TRUE);
  317.  
  318.         case WM_COMMAND:
  319.             switch (wParam) {
  320.  
  321.                 case IDOK:
  322.                     {
  323.                     for (i = 0; i < numtrig; i++) {
  324.                         GetDlgItemText(hDlg, paramv[i+numparams], temp, 10);
  325.                         temp[6] = 0;
  326.                         for (j = 0; j <= 6; j++)
  327.                             if(temp[j] == ' ') temp[j] = 0;
  328.                         strlwr(temp);
  329.                         for(j=0;j<numtrigfn;j++)
  330.                             if(strcmp(temp,trigfn[j].name)==0)
  331.                                 break;
  332.                         if (j >= numtrigfn) {
  333.                             char oops[80];
  334.                             sprintf(oops, "Trig param %d, '%s' is not a valid trig function\n", i+1, temp);
  335.                             strcat(oops, "Try sin, cos, tan, cotan, sinh, etc.");
  336.                             stopmsg(0,oops);
  337.                             break;
  338.                             }
  339.                         }
  340.                         if (i != numtrig) break;
  341.                     }
  342.                     for (i = 0; i < numparams; i++) {
  343.                         GetDlgItemText(hDlg, paramv[i], temp, 20);
  344.                         param[i] = atof(temp);
  345.                         }
  346.                     for (i = 0; i < numtrig; i++) {
  347.                         GetDlgItemText(hDlg, paramv[i+numparams], temp, 10);
  348.                         temp[6] = 0;
  349.                         for (j = 0; j <= 6; j++)
  350.                             if (temp[j] == 32) temp[j] = 0;
  351.                         set_trig_array(i, temp);
  352.                         }
  353.             GetDlgItemText(hDlg, ID_BAILOUT   , temp, 10);
  354.             bailout = atof(temp);
  355.             GetDlgItemText(hDlg, ID_FRACXMIN  , temp, 20);
  356.             xxmin = atof(temp);
  357.             GetDlgItemText(hDlg, ID_FRACXMAX  , temp, 20);
  358.             xxmax = atof(temp);
  359.             GetDlgItemText(hDlg, ID_FRACYMIN  , temp, 20);
  360.             yymin = atof(temp);
  361.             GetDlgItemText(hDlg, ID_FRACYMAX  , temp, 20);
  362.             yymax = atof(temp);
  363.                     invert = 0;
  364.                     inversion[0] = inversion[1] = inversion[2] = 0;
  365.                     fractype = CurrentFractal;
  366.                     EndDialog(hDlg, 1);
  367.                     break;
  368.                     
  369.                   
  370.                 case IDCANCEL:
  371.                     EndDialog(hDlg, 0);
  372.                     break;
  373.  
  374.                 }
  375.         
  376.         }
  377.     return (FALSE);
  378. }
  379.  
  380. /****************************************************************************
  381.  
  382.     FUNCTION: SelectImage(HWND, unsigned, WORD, LONG)
  383.  
  384.     PURPOSE: Initializes window data and registers window class
  385.  
  386. ****************************************************************************/
  387.  
  388. BOOL FAR PASCAL SelectImage(hDlg, message, wParam, lParam)
  389. HWND hDlg;
  390. unsigned message;
  391. WORD wParam;
  392. LONG lParam;
  393. {
  394.  
  395.     int i;
  396.     char temp[15];
  397.  
  398.     switch (message) {
  399.  
  400.         case WM_INITDIALOG:
  401.             win_temp1 = colors;
  402.             if (win_temp1 == 2)
  403.                 CheckDlgButton(hDlg, ID_ICOLORS1, 1);
  404.             else if (win_temp1 == 16)
  405.                 CheckDlgButton(hDlg, ID_ICOLORS2, 1);
  406.             else
  407.                 CheckDlgButton(hDlg, ID_ICOLORS3, 1);
  408.             sprintf(temp,"%d",xdots);
  409.         SetDlgItemText(hDlg, ID_ISIZEX, temp);
  410.             sprintf(temp,"%d",ydots);
  411.         SetDlgItemText(hDlg, ID_ISIZEY, temp);
  412.         i = ID_ISIZE7;
  413.         if (xdots ==  200 && ydots == 150) i = ID_ISIZE1;
  414.         if (xdots ==  320 && ydots == 200) i = ID_ISIZE2;
  415.         if (xdots ==  640 && ydots == 350) i = ID_ISIZE3;
  416.         if (xdots ==  640 && ydots == 480) i = ID_ISIZE4;
  417.         if (xdots ==  800 && ydots == 600) i = ID_ISIZE5;
  418.         if (xdots == 1024 && ydots == 768) i = ID_ISIZE6;
  419.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, i);
  420.             return (TRUE);
  421.  
  422.         case WM_COMMAND:
  423.             switch (wParam) {
  424.  
  425.                 case IDOK:
  426.                     /* retrieve and validate the results */
  427.             GetDlgItemText(hDlg, ID_ISIZEX, temp, 10);
  428.             xdots = atoi(temp);
  429.             if (xdots < 50) xdots = 50;
  430.             if (xdots > 2048) xdots = 2048;
  431.             GetDlgItemText(hDlg, ID_ISIZEY, temp, 10);
  432.             ydots = atoi(temp);
  433.             if (ydots < 50) ydots = 50;
  434.             if (ydots > 2048) ydots = 2048;
  435.                     colors = win_temp1;
  436.                     win_savedac();
  437.                     /* allocate and lock a pixel array for the bitmap */
  438.                     /* problem, here - can't just RETURN!!! */
  439.                     tryagain:
  440.                     if (!clear_screen(0)) {
  441.                         MessageBox(hDlg, "Not Enough Memory for that sized Image",
  442.                             NULL, MB_OK | MB_ICONHAND);
  443.                         xdots = ydots = 100;
  444.                         goto tryagain;
  445.                         };
  446.                     ytop    = 0;        /* reset the zoom-box */
  447.                     ybottom = ydots-1;
  448.                     xleft   = 0;
  449.                     xright  = xdots-1;
  450.                     set_win_offset();
  451.                     zoomflag = TRUE;
  452.                     time_to_restart = 1;
  453.  
  454.                     ProgStr = Winfract;
  455.                     SaveIntParam(ImageWidthStr, xdots);
  456.                     SaveIntParam(ImageHeightStr, ydots);
  457.  
  458.                     EndDialog(hDlg, 1);
  459.                     break;
  460.                   
  461.                 case IDCANCEL:
  462.                     EndDialog(hDlg, 0);
  463.                     break;
  464.  
  465.                 case ID_ISIZE1:
  466.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE1);
  467.             SetDlgItemInt(hDlg, ID_ISIZEX, 200, TRUE);
  468.             SetDlgItemInt(hDlg, ID_ISIZEY, 150, TRUE);
  469.                     break;
  470.  
  471.                 case ID_ISIZE2:
  472.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE2);
  473.             SetDlgItemInt(hDlg, ID_ISIZEX, 320, TRUE);
  474.             SetDlgItemInt(hDlg, ID_ISIZEY, 200, TRUE);
  475.                     break;
  476.  
  477.                 case ID_ISIZE3:
  478.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE3);
  479.             SetDlgItemInt(hDlg, ID_ISIZEX, 640, TRUE);
  480.             SetDlgItemInt(hDlg, ID_ISIZEY, 350, TRUE);
  481.                     break;
  482.  
  483.                 case ID_ISIZE4:
  484.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE4);
  485.             SetDlgItemInt(hDlg, ID_ISIZEX, 640, TRUE);
  486.             SetDlgItemInt(hDlg, ID_ISIZEY, 480, TRUE);
  487.                     break;
  488.  
  489.                 case ID_ISIZE5:
  490.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE5);
  491.             SetDlgItemInt(hDlg, ID_ISIZEX, 800, TRUE);
  492.             SetDlgItemInt(hDlg, ID_ISIZEY, 600, TRUE);
  493.                     break;
  494.  
  495.                 case ID_ISIZE6:
  496.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE6);
  497.             SetDlgItemInt(hDlg, ID_ISIZEX, 1024, TRUE);
  498.             SetDlgItemInt(hDlg, ID_ISIZEY, 768, TRUE);
  499.                     break;
  500.  
  501.                 case ID_ISIZE7:
  502.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE7);
  503.                     break;
  504.  
  505.                 case ID_ICOLORS1:
  506.             CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS1);
  507.                     win_temp1 = 2;
  508.                     break;
  509.  
  510.                 case ID_ICOLORS2:
  511.             CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS2);
  512.                     win_temp1 = 16;
  513.                     break;
  514.  
  515.                 case ID_ICOLORS3:
  516.             CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS3);
  517.                     win_temp1 = 256;
  518.                     break;
  519.  
  520.                 }
  521.         
  522.         }
  523.     return (FALSE);
  524. }
  525.  
  526. /****************************************************************************
  527.  
  528.     FUNCTION: SelectDoodads(HWND, unsigned, WORD, LONG)
  529.  
  530.     PURPOSE: Initializes window data and registers window class
  531.  
  532. ****************************************************************************/
  533.  
  534. BOOL FAR PASCAL SelectDoodads(hDlg, message, wParam, lParam)
  535. HWND hDlg;
  536. unsigned message;
  537. WORD wParam;
  538. LONG lParam;
  539. {
  540.  
  541.     char temp[80];
  542.  
  543.     switch (message) {
  544.  
  545.         case WM_INITDIALOG:
  546.             win_temp1 = usr_floatflag;
  547.             win_temp2 = 0;
  548.             if (usr_stdcalcmode == '2') win_temp2 = 1;
  549.             if (usr_stdcalcmode == 'g') win_temp2 = 2;
  550.             if (usr_stdcalcmode == 'b') win_temp2 = 3;
  551.             if (usr_stdcalcmode == 't') win_temp2 = 4;
  552.             win_temp3 = 0;
  553.             if (inside == -1)    win_temp3 = 1;
  554.             if (inside == -59)   win_temp3 = 2;
  555.             if (inside == -60)   win_temp3 = 3;
  556.             if (inside == -61)   win_temp3 = 4;
  557.             if (inside == -100)  win_temp3 = 5;
  558.             if (inside == -101)  win_temp3 = 6;
  559.             win_temp4 = 0;
  560.             if (outside < 0 && outside > -6) win_temp4 = 0 - outside;
  561.             CheckDlgButton(hDlg, ID_PASS1+win_temp2,1);
  562.             CheckDlgButton(hDlg, ID_INSIDEC+win_temp3, 1);
  563.             CheckDlgButton(hDlg, ID_OUTSIDEN+win_temp4, 1);
  564.             if (win_temp1)
  565.                 CheckDlgButton(hDlg, ID_MATHF, 1);
  566.             else
  567.                 CheckDlgButton(hDlg, ID_MATHF, 0);
  568.             sprintf(temp,"%d",maxiter);
  569.         SetDlgItemText(hDlg, ID_MAXIT, temp);
  570.             sprintf(temp,"%d",usr_biomorph);
  571.         SetDlgItemText(hDlg, ID_BIOMORPH, temp);
  572.             sprintf(temp,"%d",LogFlag);
  573.         SetDlgItemText(hDlg, ID_LOGP, temp);
  574.             sprintf(temp,"%d",decomp);
  575.         SetDlgItemText(hDlg, ID_DECOMP, temp);
  576.             sprintf(temp,"%d",fillcolor);
  577.         SetDlgItemText(hDlg, ID_FILLC, temp);
  578.             sprintf(temp,"%d",max(inside,0));
  579.         SetDlgItemText(hDlg, ID_INSIDE, temp);
  580.             sprintf(temp,"%d",max(outside,0));
  581.         SetDlgItemText(hDlg, ID_OUTSIDE, temp);
  582.             return (TRUE);
  583.  
  584.         case WM_COMMAND:
  585.             switch (wParam) {
  586.  
  587.                 case IDOK:
  588.                     /* retrieve and validate the results */
  589.                     usr_stdcalcmode = '1';
  590.                     if (win_temp2 == 1) usr_stdcalcmode = '2';
  591.                     if (win_temp2 == 2) usr_stdcalcmode = 'g';
  592.                     if (win_temp2 == 3) usr_stdcalcmode = 'b';
  593.                     if (win_temp2 == 4) usr_stdcalcmode = 't';
  594.                     usr_floatflag = win_temp1;
  595.                     GetDlgItemText(hDlg, ID_MAXIT, temp, 10);
  596.                     maxiter = atoi(temp);
  597.                     if (maxiter < 10) maxiter = 10;
  598.                     if (maxiter > 32000) maxiter = 32000;
  599.                     GetDlgItemText(hDlg, ID_LOGP, temp, 10);
  600.                     LogFlag = atoi(temp);
  601.                     GetDlgItemText(hDlg, ID_BIOMORPH, temp, 10);
  602.                     usr_biomorph = atoi(temp);
  603.                     if (usr_biomorph < 0) usr_biomorph = -1;
  604.                     if (usr_biomorph >= colors) usr_biomorph = colors-1;
  605.                     GetDlgItemText(hDlg, ID_DECOMP, temp, 10);
  606.                     decomp = atoi(temp);
  607.                     if (decomp < 0) decomp = 0;
  608.                     if (decomp > 256) decomp = 256;
  609.                     GetDlgItemText(hDlg, ID_FILLC, temp, 10);
  610.                     fillcolor = atoi(temp);
  611.                     GetDlgItemText(hDlg, ID_INSIDE, temp, 10);
  612.                     inside = atoi(temp);
  613.                     if (inside < 0) inside = 0;
  614.                     if (inside >= colors) inside = colors-1;
  615.                     if (win_temp3 == 1) inside = -1;
  616.                     if (win_temp3 == 2) inside = -59;
  617.                     if (win_temp3 == 3) inside = -60;
  618.                     if (win_temp3 == 4) inside = -61;
  619.                     if (win_temp3 == 5) inside = -100;
  620.                     if (win_temp3 == 6) inside = -101;
  621.                     GetDlgItemText(hDlg, ID_OUTSIDE, temp, 10);
  622.                     outside = atoi(temp);
  623.                     if (outside < 0) outside = -1;
  624.                     if (outside >= colors) outside = colors-1;
  625.                     if (win_temp4 > 0) outside = 0 - win_temp4;
  626.                     time_to_restart = 1;
  627.                     EndDialog(hDlg, 1);
  628.                     break;
  629.                   
  630.                 case IDCANCEL:
  631.                     EndDialog(hDlg, 0);
  632.                     break;
  633.  
  634.                 case ID_PASS1:
  635.                 case ID_PASS2:
  636.                 case ID_PASSS:
  637.                 case ID_PASSB:
  638.                 case ID_PASST:
  639.                     win_temp2 = wParam - ID_PASS1;
  640.                     CheckRadioButton(hDlg, ID_PASS1, ID_PASST, wParam);
  641.                     break;
  642.  
  643.                 case ID_INSIDEC:
  644.                 case ID_INSIDEM:
  645.                 case ID_INSIDEZ:
  646.                 case ID_INSIDE60:
  647.                 case ID_INSIDE61:
  648.                 case ID_INSIDEE:
  649.                 case ID_INSIDES:
  650.                     win_temp3 = wParam - ID_INSIDEC;
  651.                     CheckRadioButton(hDlg, ID_INSIDEC, ID_INSIDES, wParam);
  652.                     break;
  653.  
  654.                 case ID_OUTSIDEN:
  655.                 case ID_OUTSIDEIT:
  656.                 case ID_OUTSIDER:
  657.                 case ID_OUTSIDEIM:
  658.                 case ID_OUTSIDEM:
  659.                 case ID_OUTSIDES:
  660.                     win_temp4 = wParam - ID_OUTSIDEN;
  661.                     CheckRadioButton(hDlg, ID_OUTSIDEN, ID_OUTSIDES, wParam);
  662.                     break;
  663.  
  664.                 case ID_MATHF:
  665.                     if (win_temp1 == 0)
  666.                         win_temp1 = 1;
  667.                     else
  668.                         win_temp1 = 0;
  669.                     CheckDlgButton(hDlg, ID_MATHF, win_temp1);
  670.                     break;
  671.  
  672.                 }
  673.         
  674.         }
  675.     return (FALSE);
  676. }
  677.  
  678. /****************************************************************************
  679.  
  680.     FUNCTION: SelectExtended(HWND, unsigned, WORD, LONG)
  681.  
  682.     PURPOSE: Initializes window data and registers window class
  683.  
  684. ****************************************************************************/
  685.  
  686. BOOL FAR PASCAL SelectExtended(hDlg, message, wParam, lParam)
  687. HWND hDlg;
  688. unsigned message;
  689. WORD wParam;
  690. LONG lParam;
  691. {
  692.    char temp[80];
  693.    int i, j, k;
  694.    extern    int    finattract;    /* finite attractor switch */
  695.    extern    double    potparam[3];    /* three potential parameters*/
  696.    extern    int    pot16bit;
  697.    extern    int    usr_distest;    /* distance estimator option */
  698.    extern    int    distestwidth;
  699.    extern    int    rotate_lo,rotate_hi;
  700.  
  701.     switch (message) {
  702.  
  703.         case WM_INITDIALOG:
  704.             if (finattract)
  705.                 win_temp1 = 1;
  706.             else
  707.                 win_temp1 = 0;
  708.             CheckDlgButton(hDlg, ID_FINITE, win_temp1);
  709.             sprintf(temp,"%f",potparam[0]);
  710.         SetDlgItemText(hDlg, ID_POTENTMAX, temp);
  711.             sprintf(temp,"%f",potparam[1]);
  712.         SetDlgItemText(hDlg, ID_POTENTSLOPE, temp);
  713.             sprintf(temp,"%f",potparam[2]);
  714.         SetDlgItemText(hDlg, ID_POTENTBAIL, temp);
  715.             if (pot16bit)
  716.                 win_temp2 = 1;
  717.             else
  718.                 win_temp2 = 0;
  719.             CheckDlgButton(hDlg, ID_POTENT16, win_temp2);
  720.             sprintf(temp,"%i",usr_distest);
  721.         SetDlgItemText(hDlg, ID_DISTEST, temp);
  722.             sprintf(temp,"%i",distestwidth);
  723.         SetDlgItemText(hDlg, ID_DISTESTWID, temp);
  724.             for (i = 0; i < 3; i++) {
  725.                 sprintf(temp,"%.12f",inversion[i]);
  726.                 if (inversion[i] == AUTOINVERT)
  727.                 SetDlgItemText(hDlg, ID_INVERTRAD+i, "auto");
  728.                 else
  729.                 SetDlgItemText(hDlg, ID_INVERTRAD+i, temp);
  730.             }
  731.             sprintf(temp,"%i",rotate_lo);
  732.         SetDlgItemText(hDlg, ID_COLORMIN, temp);
  733.             sprintf(temp,"%i",rotate_hi);
  734.         SetDlgItemText(hDlg, ID_COLORMAX, temp);
  735.             win_oldprompts[0] = win_temp1;
  736.             win_oldprompts[1] = potparam[0];
  737.             win_oldprompts[2] = potparam[1];
  738.             win_oldprompts[3] = potparam[2];
  739.             win_oldprompts[4] = win_temp2;
  740.             win_oldprompts[5] = usr_distest;
  741.             win_oldprompts[6] = distestwidth;
  742.             win_oldprompts[7] = inversion[0];
  743.             win_oldprompts[8] = inversion[1];
  744.             win_oldprompts[9] = inversion[2];
  745.             return (TRUE);
  746.  
  747.         case WM_COMMAND:
  748.             switch (wParam) {
  749.  
  750.                 case IDOK:
  751.                     /* retrieve and validate the results */
  752.                     finattract = win_temp1;
  753.                     GetDlgItemText(hDlg, ID_POTENTMAX, temp, 10);
  754.                     potparam[0] = atof(temp);
  755.                     GetDlgItemText(hDlg, ID_POTENTSLOPE, temp, 10);
  756.                     potparam[1] = atof(temp);
  757.                     GetDlgItemText(hDlg, ID_POTENTBAIL, temp, 10);
  758.                     potparam[2] = atof(temp);
  759.                     pot16bit = win_temp2;
  760.                     GetDlgItemText(hDlg, ID_DISTEST, temp, 10);
  761.                     usr_distest = atoi(temp);
  762.                     GetDlgItemText(hDlg, ID_DISTESTWID, temp, 10);
  763.                     distestwidth = atoi(temp);
  764.                     for (i = 0; i < 3; i++) {
  765.                         GetDlgItemText(hDlg, ID_INVERTRAD+i, temp, 20);
  766.                         if (temp[0] == 'a' || temp[0] == 'A')
  767.                             inversion[i] = AUTOINVERT;
  768.                         else
  769.                             inversion[i] = atof(temp);
  770.                         }
  771.                     invert = (inversion[0] == 0.0) ? 0 : 3;
  772.                     GetDlgItemText(hDlg, ID_COLORMIN, temp, 10);
  773.                     rotate_lo = atoi(temp);
  774.                     GetDlgItemText(hDlg, ID_COLORMAX, temp, 10);
  775.                     rotate_hi = atoi(temp);
  776.                     if (rotate_lo < 0 || rotate_hi > 255 || rotate_lo > rotate_hi) {
  777.                         rotate_lo = 0;
  778.                         rotate_hi = 255;
  779.                         }
  780.                     time_to_restart = 0;
  781.                     if (
  782.                         win_oldprompts[0] != win_temp1   ||
  783.                         win_oldprompts[1] != potparam[0]  ||
  784.                         win_oldprompts[2] != potparam[1]  ||
  785.                         win_oldprompts[3] != potparam[2]  ||
  786.                         win_oldprompts[4] != win_temp2    ||
  787.                         win_oldprompts[5] != usr_distest  ||
  788.                         win_oldprompts[6] != distestwidth ||
  789.                         win_oldprompts[7] != inversion[0] ||
  790.                         win_oldprompts[8] != inversion[1] ||
  791.                         win_oldprompts[9] != inversion[2]
  792.                         ) time_to_restart = 1;
  793.                     EndDialog(hDlg, time_to_restart);
  794.                     break;
  795.                   
  796.                 case IDCANCEL:
  797.                     EndDialog(hDlg, 0);
  798.                     break;
  799.  
  800.                 case ID_FINITE:
  801.                     if (win_temp1 == 0)
  802.                         win_temp1 = 1;
  803.                     else
  804.                         win_temp1 = 0;
  805.                     CheckDlgButton(hDlg, ID_FINITE, win_temp1);
  806.                     break;
  807.  
  808.                 case ID_POTENT16:
  809.                     if (win_temp2 == 0)
  810.                         win_temp2 = 1;
  811.                     else
  812.                         win_temp2 = 0;
  813.                     CheckDlgButton(hDlg, ID_POTENT16, win_temp2);
  814.                     break;
  815.  
  816.                 }
  817.         
  818.         }
  819.     return (FALSE);
  820. }
  821.  
  822. /****************************************************************************
  823.  
  824.     FUNCTION: SelectSavePar(HWND, unsigned, WORD, LONG)
  825.  
  826.     PURPOSE: Initializes window data and registers window class
  827.  
  828. ****************************************************************************/
  829.  
  830. BOOL FAR PASCAL SelectSavePar(hDlg, message, wParam, lParam)
  831. HWND hDlg;
  832. unsigned message;
  833. WORD wParam;
  834. LONG lParam;
  835. {
  836.    char temp[80];
  837.    int i, j, k;
  838.    extern int  colorstate;     /* comments in cmdfiles */
  839.    extern char CommandFile[];
  840.    extern char CommandName[];
  841.    extern char CommandComment1[];
  842.    extern char CommandComment2[];
  843.    extern char colorfile[];
  844.    extern int  colorstate;
  845.    extern    int    usr_distest;    /* distance estimator option */
  846.    extern int  potflag;            /* continuous potential flag */
  847.    extern    double    potparam[3];    /* three potential parameters*/
  848.  
  849.     switch (message) {
  850.  
  851.         case WM_INITDIALOG:
  852.             win_temp1 = 1;
  853.             if (colorstate == 1)
  854.                 win_temp1 = 1;
  855.             if (colorstate == 2)
  856.                 win_temp1 = 2;
  857.             win_temp2 = colors - 1;
  858.             if (maxiter < win_temp2) win_temp2 = maxiter;
  859.             if (inside  > 0 && inside    > win_temp2) win_temp2 = inside;
  860.             if (outside > 0 && outside   > win_temp2) win_temp2 = outside;
  861.             if (usr_distest < 0 && 0-usr_distest > win_temp2) win_temp2 = 0-usr_distest;
  862.             if (decomp > win_temp2) win_temp2 = decomp - 1;
  863.             if (potflag && potparam[0] >= win_temp2) win_temp2 = potparam[0];
  864.             if (++win_temp2 > 256) win_temp2 = 256;
  865.         SetDlgItemText(hDlg, ID_PFILE, CommandFile);
  866.         SetDlgItemText(hDlg, ID_PENTRY, CommandName);
  867.         if (CommandName[0] == 0)
  868.             SetDlgItemText(hDlg, ID_PENTRY, "test");
  869.         SetDlgItemText(hDlg, ID_PCOM1, CommandComment1);
  870.         SetDlgItemText(hDlg, ID_PCOM2, CommandComment2);
  871.             CheckDlgButton(hDlg, ID_PCOL1+win_temp1, 1);
  872.             sprintf(temp,"%i",win_temp2);
  873.         SetDlgItemText(hDlg, ID_PCNUM, temp);
  874.         if (colorstate == 2)
  875.             SetDlgItemText(hDlg, ID_PCFILE, colorfile);
  876.             return (TRUE);
  877.  
  878.         case WM_COMMAND:
  879.             switch (wParam) {
  880.  
  881.                 case IDOK:
  882.                     /* retrieve and validate the results */
  883.                     GetDlgItemText(hDlg, ID_PFILE, CommandFile,     50);
  884.                     GetDlgItemText(hDlg, ID_PENTRY, CommandName,    50);
  885.                     GetDlgItemText(hDlg, ID_PCOM1, CommandComment1, 50);
  886.                     GetDlgItemText(hDlg, ID_PCOM2, CommandComment2, 50);
  887.                     GetDlgItemText(hDlg, ID_PCFILE, colorfile,      50);
  888.                     EndDialog(hDlg, 1);
  889.                     break;
  890.                   
  891.                 case IDCANCEL:
  892.                     EndDialog(hDlg, 0);
  893.                     break;
  894.  
  895.                 case ID_PCOL1:
  896.                 case ID_PCOL2:
  897.                 case ID_PCOL3:
  898.                     win_temp1 = wParam - ID_PCOL1;
  899.                     CheckRadioButton(hDlg, ID_PCOL1, ID_PCOL3, wParam);
  900.                 }
  901.         
  902.         }
  903.     return (FALSE);
  904. }
  905.  
  906. /****************************************************************************
  907.  
  908.     FUNCTION: SelectCycle(HWND, unsigned, WORD, LONG)
  909.  
  910.     PURPOSE: Initializes window data and registers window class
  911.  
  912. ****************************************************************************/
  913.  
  914.  
  915. int win_cycledir = -1, win_cyclerand = 0, win_cyclefreq = 0, win_cycledelay = 0;
  916. int win_tempcycle, win_tempcycledir, win_tempcyclerand, win_tempcyclefreq;
  917.  
  918. BOOL FAR PASCAL SelectCycle(hDlg, message, wParam, lParam)
  919. HWND hDlg;
  920. unsigned message;
  921. WORD wParam;
  922. LONG lParam;
  923. {
  924.     switch (message) {
  925.  
  926.         case WM_INITDIALOG:
  927.             win_tempcycle = time_to_cycle;
  928.             win_tempcycledir = win_cycledir;
  929.             win_tempcyclerand = win_cyclerand;
  930.             win_tempcyclefreq = win_cyclefreq;
  931.             if (win_tempcycle == 0)
  932.                 CheckDlgButton(hDlg, ID_CYCLEOFF, 1);
  933.             else
  934.                 CheckDlgButton(hDlg, ID_CYCLEON, 1);
  935.             if (win_tempcycledir == -1)
  936.                 CheckDlgButton(hDlg, ID_CYCLEOUT, 1);
  937.             else
  938.                 CheckDlgButton(hDlg, ID_CYCLEIN, 1);
  939.             if (win_tempcyclerand == 0)
  940.                 CheckDlgButton(hDlg, ID_CYCLESTAT, 1);
  941.             else
  942.                 CheckDlgButton(hDlg, ID_CYCLECHG, 1);
  943.             if (win_tempcyclefreq == 0)
  944.                 CheckDlgButton(hDlg, ID_CYCLELOW, 1);
  945.             else if (win_tempcyclefreq == 1)
  946.                 CheckDlgButton(hDlg, ID_CYCLEMED, 1);
  947.             else
  948.                 CheckDlgButton(hDlg, ID_CYCLEHIGH, 1);
  949.             return (TRUE);
  950.  
  951.         case WM_COMMAND:
  952.             switch (wParam) {
  953.  
  954.                 case IDOK:
  955.                     /* retrieve and validate the results */
  956.                     time_to_cycle = win_tempcycle;
  957.                     win_cycledir = win_tempcycledir;
  958.                     win_cyclerand = win_tempcyclerand;
  959.                     win_cyclefreq = win_tempcyclefreq;
  960.                     EndDialog(hDlg, 1);
  961.                     break;
  962.                   
  963.                 case IDCANCEL:
  964.                     EndDialog(hDlg, 0);
  965.                     break;
  966.  
  967.                 case ID_CYCLEOFF:
  968.                     win_tempcycle = 0;
  969.                     CheckRadioButton(hDlg, ID_CYCLEOFF, ID_CYCLEON, ID_CYCLEOFF);
  970.                     break;
  971.  
  972.                 case ID_CYCLEON:
  973.                     win_tempcycle = 1;
  974.                     CheckRadioButton(hDlg, ID_CYCLEOFF, ID_CYCLEON, ID_CYCLEON);
  975.                     break;
  976.  
  977.                 case ID_CYCLEOUT:
  978.                     win_tempcycledir = -1;
  979.                     CheckRadioButton(hDlg, ID_CYCLEOUT, ID_CYCLEIN, ID_CYCLEOUT);
  980.                     break;
  981.  
  982.                 case ID_CYCLEIN:
  983.                     win_tempcycledir = 1;
  984.                     CheckRadioButton(hDlg, ID_CYCLEOUT, ID_CYCLEIN, ID_CYCLEIN);
  985.                     break;
  986.  
  987.                 case ID_CYCLESTAT:
  988.                     win_tempcyclerand = 0;
  989.                     CheckRadioButton(hDlg, ID_CYCLESTAT, ID_CYCLECHG, ID_CYCLESTAT);
  990.                     break;
  991.  
  992.                 case ID_CYCLECHG:
  993.                     win_tempcyclerand = 1;
  994.                     CheckRadioButton(hDlg, ID_CYCLESTAT, ID_CYCLECHG, ID_CYCLECHG);
  995.                     break;
  996.  
  997.                 case ID_CYCLELOW:
  998.                     win_tempcyclefreq = 0;
  999.                     CheckRadioButton(hDlg, ID_CYCLELOW, ID_CYCLEHIGH, ID_CYCLELOW);
  1000.                     break;
  1001.  
  1002.                 case ID_CYCLEMED:
  1003.                     win_tempcyclefreq = 1;
  1004.                     CheckRadioButton(hDlg, ID_CYCLELOW, ID_CYCLEHIGH, ID_CYCLEMED);
  1005.                     break;
  1006.  
  1007.                 case ID_CYCLEHIGH:
  1008.                     win_tempcyclefreq = 2;
  1009.                     CheckRadioButton(hDlg, ID_CYCLELOW, ID_CYCLEHIGH, ID_CYCLEHIGH);
  1010.                     break;
  1011.  
  1012.                 }
  1013.         
  1014.         }
  1015.     return (FALSE);
  1016. }
  1017.  
  1018. FARPROC lpSelectFullScreen;
  1019.  
  1020. extern HANDLE hInst;
  1021.  
  1022. int win_fullscreen_count;
  1023. char * far win_fullscreen_prompts[20];
  1024. char *win_fullscreen_heading;
  1025. static struct fullscreenvalues win_fullscreen_values[20];
  1026.  
  1027. int xxx_fullscreen_prompt(    /* full-screen prompting routine */
  1028.     char *hdg,        /* heading, lines separated by \n */
  1029.     int numprompts,     /* there are this many prompts (max) */
  1030.     char * far *prompts,    /* array of prompting pointers */
  1031.     struct fullscreenvalues values[], /* array of values */
  1032.     int options,        /* future use bits in case we need them */
  1033.     int fkeymask        /* bit n on if Fn to cause return */
  1034.     )
  1035. {
  1036. int i;
  1037. int Return;
  1038.  
  1039. win_fullscreen_count = numprompts;
  1040. win_fullscreen_heading = hdg;
  1041. win_fullscreen_count = numprompts;
  1042. for (i = 0; i < win_fullscreen_count; i++) {
  1043.    win_fullscreen_prompts[i] = prompts[i]; 
  1044.    win_fullscreen_values[i]  = values[i];
  1045.    }
  1046.  
  1047. lpSelectFullScreen = MakeProcInstance(SelectFullScreen, hInst);
  1048. Return = DialogBox(hInst, "SelectFullScreen", hwnd, lpSelectFullScreen);
  1049. FreeProcInstance(lpSelectFullScreen);
  1050.  
  1051. if (Return) {
  1052.     for (i = 0; i < win_fullscreen_count; i++) {
  1053.         values[i] = win_fullscreen_values[i];
  1054.     }
  1055.     return(0);
  1056.     }
  1057.  
  1058. return(-1);
  1059. }
  1060.  
  1061. BOOL FAR PASCAL SelectFullScreen(hDlg, message, wParam, lParam)
  1062. HWND hDlg;
  1063. unsigned message;
  1064. WORD wParam;
  1065. LONG lParam;
  1066. {
  1067.  
  1068.     int i;
  1069.     char temp[80];
  1070.  
  1071.     switch (message) {
  1072.  
  1073.         case WM_INITDIALOG:
  1074.             SetDlgItemText(hDlg, ID_PROMPT00,win_fullscreen_heading);
  1075.             for (i = 0; i < win_fullscreen_count; i++) {
  1076.                 SetDlgItemText(hDlg, ID_PROMPT01+i,win_fullscreen_prompts[i]);
  1077.                 if (win_fullscreen_values[i].type == 'd' ||
  1078.                     win_fullscreen_values[i].type == 'f')
  1079.                     sprintf(temp,"%10.5f",win_fullscreen_values[i].uval.dval);
  1080.                 else if(win_fullscreen_values[i].type == 'i')
  1081.                     sprintf(temp,"%d",win_fullscreen_values[i].uval.ival);
  1082.                 else if(win_fullscreen_values[i].type == 's')
  1083.                 {
  1084.                     strncpy(temp,win_fullscreen_values[i].uval.sval,16);
  1085.                     temp[15] = 0;
  1086.                 }
  1087.                 else if(win_fullscreen_values[i].type == 'l')
  1088.                     strcpy(temp,win_fullscreen_values[i].uval.ch.list[win_fullscreen_values[i].uval.ch.val]);
  1089.                 else
  1090.                     strcpy(temp,win_fullscreen_values[i].uval.sval);
  1091.                 SetDlgItemText(hDlg, ID_ANSWER01+i,temp);
  1092.                 }
  1093.             return (TRUE);
  1094.  
  1095.         case WM_COMMAND:
  1096.             switch (wParam) {
  1097.  
  1098.                 case IDOK:
  1099.                     for (i = 0; i < win_fullscreen_count; i++) {
  1100.                         GetDlgItemText(hDlg, ID_ANSWER01+i , temp, 20);
  1101.                         if (win_fullscreen_values[i].type == 'd' ||
  1102.                             win_fullscreen_values[i].type == 'f')
  1103.                             win_fullscreen_values[i].uval.dval = atof(temp);
  1104.                         else if(win_fullscreen_values[i].type == 'i')
  1105.                             win_fullscreen_values[i].uval.ival = atoi(temp);
  1106.                         else if(win_fullscreen_values[i].type == 's')
  1107.                             strncpy(win_fullscreen_values[i].uval.sval,temp,16);
  1108.                         else if(win_fullscreen_values[i].type == 'l')
  1109.                             strcpy(win_fullscreen_values[i].uval.ch.list[win_fullscreen_values[i].uval.ch.val],temp);
  1110.                         else
  1111.                             strcpy(win_fullscreen_values[i].uval.sval,temp);
  1112.                     }
  1113.                     EndDialog(hDlg, 1);
  1114.                     break;
  1115.                   
  1116.                 case IDCANCEL:
  1117.                     EndDialog(hDlg, 0);
  1118.                     break;
  1119.  
  1120.                 }
  1121.         
  1122.         }
  1123.     return (FALSE);
  1124. }
  1125.  
  1126.  
  1127. extern int init3d[];
  1128. extern int win_3dspherical;
  1129. extern char preview, showbox;
  1130. extern int previewfactor, glassestype, whichimage;
  1131. extern int xtrans, ytrans, transparent[2], RANDOMIZE;
  1132. extern int red_crop_left, red_crop_right;
  1133. extern int blue_crop_left, blue_crop_right;
  1134. extern int red_bright, blue_bright;
  1135. extern    int RAY;
  1136. extern    int BRIEF;
  1137. extern    int Ambient;
  1138. extern    char ray_name[];
  1139. extern int Targa_Overlay;
  1140. extern int Targa_Out;
  1141. extern    int    overlay3d;        /* 3D overlay flag: 0 = OFF */
  1142. extern int xadjust;
  1143. extern int eyeseparation;
  1144.  
  1145. static int far win_answers[20];
  1146.  
  1147. BOOL FAR PASCAL Select3D(hDlg, message, wParam, lParam)
  1148. HWND hDlg;
  1149. unsigned message;
  1150. WORD wParam;
  1151. LONG lParam;
  1152. {
  1153.  
  1154.     int i;
  1155.     char temp[80];
  1156.  
  1157.     switch (message) {
  1158.  
  1159.         case WM_INITDIALOG:
  1160.             win_answers[0] = preview;
  1161.             win_answers[1] = showbox;
  1162.             win_answers[2] = SPHERE;
  1163.             win_answers[3] = previewfactor;
  1164.             win_answers[4] = glassestype;
  1165.             win_answers[5] = FILLTYPE+1;
  1166.             win_answers[6] = RAY;
  1167.             win_answers[7] = BRIEF;
  1168.             win_answers[8] = Targa_Out;
  1169.             CheckDlgButton(hDlg, ID_PREVIEW, win_answers[0]);
  1170.             CheckDlgButton(hDlg, ID_SHOWBOX, win_answers[1]);
  1171.             CheckDlgButton(hDlg, ID_SPHERICAL, win_answers[2]);
  1172.             CheckDlgButton(hDlg, ID_RAYB, win_answers[7]);
  1173. /*
  1174.             CheckDlgButton(hDlg, ID_TARGA, win_answers[8]);
  1175. */
  1176.             sprintf(temp,"%d",win_answers[3]);
  1177.         SetDlgItemText(hDlg, ID_PREVIEWFACTOR, temp);
  1178.             CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1179.                 ID_STEREO1+win_answers[4]);
  1180.             CheckRadioButton(hDlg, ID_FILL1, ID_FILL8,
  1181.                 ID_FILL1+win_answers[5]);
  1182.             CheckRadioButton(hDlg, ID_RAY0, ID_RAY6,
  1183.                 ID_RAY0+win_answers[6]);
  1184.             check_writefile(ray_name,".ray");
  1185.         SetDlgItemText(hDlg, ID_RAYN, ray_name);
  1186.             return (TRUE);
  1187.  
  1188.         case WM_COMMAND:
  1189.             switch (wParam) {
  1190.  
  1191.                 case IDOK:
  1192.                     if(win_answers[2] != SPHERE) {
  1193.                         SPHERE = win_answers[2];
  1194.                         set_3d_defaults();
  1195.                         }
  1196.                     preview = win_answers[0];
  1197.                     showbox = win_answers[1];
  1198.                     SPHERE  = win_answers[2];
  1199.                     RAY     = win_answers[6];
  1200.                     BRIEF   = win_answers[7];
  1201.                     Targa_Out = win_answers[8];
  1202.                     GetDlgItemText(hDlg, ID_PREVIEWFACTOR, temp, 10);
  1203.                     GetDlgItemText(hDlg, ID_RAYN, temp, 30);
  1204.                     strcpy(ray_name, temp);
  1205.                     previewfactor = atoi(temp);
  1206.                     glassestype = win_answers[4];
  1207.                     FILLTYPE = win_answers[5]-1;
  1208.                     win_3dspherical = SPHERE;
  1209.                     if(previewfactor < 8)
  1210.                        previewfactor = 8;
  1211.                     if(previewfactor > 128)
  1212.                        previewfactor = 128;
  1213.                     if(glassestype < 0)
  1214.                        glassestype = 0;
  1215.                     if(glassestype > 3)
  1216.                        glassestype = 3;
  1217.                     whichimage = 0;
  1218.                     if(glassestype)
  1219.                        whichimage = 1;
  1220.                     if (Targa_Out && overlay3d)
  1221.                        Targa_Overlay = 1;
  1222.                     EndDialog(hDlg, 1);
  1223.                     break;
  1224.                     
  1225.                 case ID_PREVIEW:
  1226.                 case ID_SHOWBOX:
  1227.                 case ID_SPHERICAL:
  1228.                     i = wParam - ID_PREVIEW;
  1229.                     win_answers[i] = 1 - win_answers[i];
  1230.                     CheckDlgButton(hDlg, ID_PREVIEW + i, win_answers[i]);
  1231.                     break;
  1232.  
  1233.                 case ID_FILL1:
  1234.                 case ID_FILL2:
  1235.                 case ID_FILL3:
  1236.                 case ID_FILL4:
  1237.                 case ID_FILL5:
  1238.                 case ID_FILL6:
  1239.                 case ID_FILL7:
  1240.                 case ID_FILL8:
  1241.                     i = wParam - ID_FILL1;
  1242.                     win_answers[5] = i;
  1243.                     CheckRadioButton(hDlg, ID_FILL1, ID_FILL8,
  1244.                         ID_FILL1+win_answers[5]);
  1245.                     break;
  1246.  
  1247.                 case ID_STEREO1:
  1248.                 case ID_STEREO2:
  1249.                 case ID_STEREO3:
  1250.                 case ID_STEREO4:
  1251.                     i = wParam - ID_STEREO1;
  1252.                     win_answers[4] = i;
  1253.                     CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1254.                         ID_STEREO1+win_answers[4]);
  1255.                     break;
  1256.  
  1257.                 case ID_RAY0:
  1258.                 case ID_RAY1:
  1259.                 case ID_RAY2:
  1260.                 case ID_RAY3:
  1261.                 case ID_RAY4:
  1262.                 case ID_RAY5:
  1263.                 case ID_RAY6:
  1264.                     i = wParam - ID_RAY0;
  1265.                     win_answers[6] = i;
  1266.                     CheckRadioButton(hDlg, ID_RAY0, ID_RAY6,
  1267.                         ID_RAY0+win_answers[6]);
  1268.                     break;
  1269.  
  1270.                 case ID_RAYB:
  1271.                     win_answers[7] = 1 - win_answers[7];
  1272.                     CheckDlgButton(hDlg, ID_RAYB, win_answers[7]);
  1273.                     break;
  1274.  
  1275.                 case ID_TARGA:
  1276.                     win_answers[8] = 1 - win_answers[8];
  1277.                     CheckDlgButton(hDlg, ID_TARGA, win_answers[8]);
  1278.                     break;
  1279.  
  1280.                 case IDCANCEL:
  1281.                     EndDialog(hDlg, 0);
  1282.                     break;
  1283.  
  1284.                 }
  1285.         
  1286.         }
  1287.     return (FALSE);
  1288. }
  1289.  
  1290. BOOL FAR PASCAL Select3DPlanar(hDlg, message, wParam, lParam)
  1291. HWND hDlg;
  1292. unsigned message;
  1293. WORD wParam;
  1294. LONG lParam;
  1295. {
  1296.  
  1297.     int i;
  1298.     char temp[80];
  1299.  
  1300.     switch (message) {
  1301.  
  1302.         case WM_INITDIALOG:
  1303.             win_answers[0] = XROT;
  1304.             win_answers[1] = YROT;
  1305.             win_answers[2] = ZROT;
  1306.             win_answers[3] = XSCALE;
  1307.             win_answers[4] = YSCALE;
  1308.             win_answers[5] = ROUGH;
  1309.             win_answers[6] = WATERLINE;
  1310.             win_answers[7] = ZVIEWER;
  1311.             win_answers[8] = XSHIFT;
  1312.             win_answers[9] = YSHIFT;
  1313.             win_answers[10] = xtrans;
  1314.             win_answers[11] = ytrans;
  1315.             win_answers[12] = transparent[0];
  1316.             win_answers[13] = transparent[1];
  1317.             win_answers[14] = RANDOMIZE;
  1318.             for (i = 0; i < 15; i++) {
  1319.                 sprintf(temp,"%d", win_answers[i]);
  1320.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1321.                 }
  1322.             return (TRUE);
  1323.  
  1324.         case WM_COMMAND:
  1325.             switch (wParam) {
  1326.  
  1327.                 case IDOK:
  1328.                     for (i = 0; i < 15; i++) {
  1329.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1330.                         win_answers[i] = atof(temp);
  1331.                         }
  1332.                     XROT =           win_answers[0];
  1333.                     YROT =           win_answers[1];
  1334.                     ZROT =           win_answers[2];
  1335.                     XSCALE =         win_answers[3];
  1336.                     YSCALE =         win_answers[4];
  1337.                     ROUGH =          win_answers[5];
  1338.                     WATERLINE =      win_answers[6];
  1339.                     ZVIEWER =        win_answers[7];
  1340.                     XSHIFT =         win_answers[8];
  1341.                     YSHIFT =         win_answers[9];
  1342.                     xtrans =         win_answers[10];
  1343.                     ytrans =         win_answers[11];
  1344.                     transparent[0] = win_answers[12];
  1345.                     transparent[1] = win_answers[13];
  1346.                     RANDOMIZE =      win_answers[14];
  1347.                     if (RANDOMIZE >= 7) RANDOMIZE = 7;
  1348.                     if (RANDOMIZE <= 0) RANDOMIZE = 0;
  1349.                     EndDialog(hDlg, 1);
  1350.                     break;
  1351.                   
  1352.                 case IDCANCEL:
  1353.                     EndDialog(hDlg, 0);
  1354.                     break;
  1355.  
  1356.                 }
  1357.         
  1358.         }
  1359.     return (FALSE);
  1360. }
  1361.  
  1362.  
  1363. BOOL FAR PASCAL SelectIFS3D(hDlg, message, wParam, lParam)
  1364. HWND hDlg;
  1365. unsigned message;
  1366. WORD wParam;
  1367. LONG lParam;
  1368. {
  1369.  
  1370.     int i, numanswers;
  1371.     char temp[80];
  1372.  
  1373.     numanswers = 5;
  1374.  
  1375.     switch (message) {
  1376.  
  1377.         case WM_INITDIALOG:
  1378.             win_answers[0] = XROT;
  1379.             win_answers[1] = YROT;
  1380.             win_answers[2] = ZROT;
  1381.             win_answers[3] = ZVIEWER;
  1382.             win_answers[4] = XSHIFT;
  1383.             win_answers[5] = YSHIFT;
  1384.             win_answers[6] = glassestype;
  1385.             for (i = 0; i <= numanswers; i++) {
  1386.                 sprintf(temp,"%d", win_answers[i]);
  1387.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1388.                 }
  1389.             CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1390.                 ID_STEREO1+win_answers[6]);
  1391.             return (TRUE);
  1392.  
  1393.         case WM_COMMAND:
  1394.             switch (wParam) {
  1395.  
  1396.                 case ID_STEREO1:
  1397.                 case ID_STEREO2:
  1398.                 case ID_STEREO3:
  1399.                 case ID_STEREO4:
  1400.                     i = wParam - ID_STEREO1;
  1401.                     win_answers[6] = i;
  1402.                     CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1403.                         ID_STEREO1+win_answers[6]);
  1404.                     break;
  1405.  
  1406.                 case IDOK:
  1407.                     for (i = 0; i <= numanswers; i++) {
  1408.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1409.                         win_answers[i] = atof(temp);
  1410.                         }
  1411.                     XROT =           win_answers[0];
  1412.                     YROT =           win_answers[1];
  1413.                     ZROT =           win_answers[2];
  1414.                     ZVIEWER =        win_answers[3];
  1415.                     XSHIFT =         win_answers[4];
  1416.                     YSHIFT =         win_answers[5];
  1417.                     glassestype =    win_answers[6];
  1418.                     EndDialog(hDlg, 1);
  1419.                     break;
  1420.                   
  1421.                 case IDCANCEL:
  1422.                     EndDialog(hDlg, 0);
  1423.                     break;
  1424.  
  1425.                 }
  1426.         
  1427.         }
  1428.     return (FALSE);
  1429. }
  1430.  
  1431. char win_funnyglasses_map_name[41];
  1432.  
  1433. BOOL FAR PASCAL SelectFunnyGlasses(hDlg, message, wParam, lParam)
  1434. HWND hDlg;
  1435. unsigned message;
  1436. WORD wParam;
  1437. LONG lParam;
  1438. {
  1439.  
  1440.     int i, numanswers;
  1441.     char temp[80];
  1442.  
  1443.     numanswers = 7;
  1444.  
  1445.     switch (message) {
  1446.  
  1447.         case WM_INITDIALOG:
  1448.  
  1449.         /* defaults */
  1450.             if(ZVIEWER == 0)
  1451.                ZVIEWER = 150;
  1452.             if(eyeseparation == 0) {
  1453.                if(fractype==IFS3D || fractype==LLORENZ3D || fractype==FPLORENZ3D) {
  1454.                    eyeseparation =  2;
  1455.               xadjust       = -2;
  1456.                   }
  1457.                else {
  1458.               eyeseparation =  3;
  1459.               xadjust       =  0;
  1460.                   }
  1461.                }
  1462.  
  1463.             win_funnyglasses_map_name[0] = 0;
  1464.             if(glassestype == 1)
  1465.                 strcpy(win_funnyglasses_map_name,"glasses1.map");
  1466.             else if(glassestype == 2) {
  1467.                 if(FILLTYPE == -1)
  1468.                      strcpy(win_funnyglasses_map_name,"grid.map");
  1469.                 else
  1470.                 strcpy(win_funnyglasses_map_name,"glasses2.map");
  1471.                 }
  1472.  
  1473.             win_answers[0] = eyeseparation;
  1474.             win_answers[1] = xadjust;
  1475.             win_answers[2] = red_crop_left;
  1476.             win_answers[3] = red_crop_right;
  1477.             win_answers[4] = blue_crop_left;
  1478.             win_answers[5] = blue_crop_right;
  1479.             win_answers[6] = red_bright;
  1480.             win_answers[7] = blue_bright;
  1481.             for (i = 0; i < numanswers+1;i++) {
  1482.                 sprintf(temp,"%d", win_answers[i]);
  1483.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1484.                 }
  1485.             SetDlgItemText(hDlg, ID_ANS9,win_funnyglasses_map_name);
  1486.             return (TRUE);
  1487.  
  1488.         case WM_COMMAND:
  1489.             switch (wParam) {
  1490.  
  1491.                 case IDOK:
  1492.                     for (i = 0; i < numanswers+1; i++) {
  1493.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1494.                         win_answers[i] = atof(temp);
  1495.                         }
  1496.                     GetDlgItemText(hDlg, ID_ANS9, temp, 40);
  1497.                     strcpy(win_funnyglasses_map_name, temp);
  1498.                     eyeseparation   =  win_answers[0];
  1499.                     xadjust         =  win_answers[1];
  1500.                     red_crop_left   =  win_answers[2];
  1501.                     red_crop_right  =  win_answers[3];
  1502.                     blue_crop_left  =  win_answers[4];
  1503.                     blue_crop_right =  win_answers[5];
  1504.                     red_bright      =  win_answers[6];
  1505.                     blue_bright     =  win_answers[7];
  1506.                     EndDialog(hDlg, 1);
  1507.                     break;
  1508.                   
  1509.                 case IDCANCEL:
  1510.                     EndDialog(hDlg, 0);
  1511.                     break;
  1512.  
  1513.                 }
  1514.         
  1515.         }
  1516.     return (FALSE);
  1517. }
  1518.  
  1519. BOOL FAR PASCAL SelectLightSource(hDlg, message, wParam, lParam)
  1520. HWND hDlg;
  1521. unsigned message;
  1522. WORD wParam;
  1523. LONG lParam;
  1524. {
  1525.  
  1526.     int i, numanswers;
  1527.     char temp[80];
  1528.  
  1529.     numanswers = 5;
  1530.  
  1531.     switch (message) {
  1532.  
  1533.         case WM_INITDIALOG:
  1534.             win_answers[0] = XLIGHT;
  1535.             win_answers[1] = YLIGHT;
  1536.             win_answers[2] = ZLIGHT;
  1537.             win_answers[3] = LIGHTAVG;
  1538.             win_answers[4] = Ambient;
  1539.             for (i = 0; i < numanswers+1;i++) {
  1540.                 sprintf(temp,"%d", win_answers[i]);
  1541.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1542.                 }
  1543.             return (TRUE);
  1544.  
  1545.         case WM_COMMAND:
  1546.             switch (wParam) {
  1547.  
  1548.                 case IDOK:
  1549.                     for (i = 0; i < numanswers+1; i++) {
  1550.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1551.                         win_answers[i] = atof(temp);
  1552.                         }
  1553.                     XLIGHT   =  win_answers[0];
  1554.                     YLIGHT   =  win_answers[1];
  1555.                     ZLIGHT   =  win_answers[2];
  1556.                     LIGHTAVG =  win_answers[3];
  1557.                     Ambient  =  win_answers[4];
  1558.                     EndDialog(hDlg, 1);
  1559.                     break;
  1560.                   
  1561.                 case IDCANCEL:
  1562.                     EndDialog(hDlg, 0);
  1563.                     break;
  1564.  
  1565.                 }
  1566.         
  1567.         }
  1568.     return (FALSE);
  1569. }
  1570.  
  1571. BOOL FAR PASCAL Select3DSpherical(hDlg, message, wParam, lParam)
  1572. HWND hDlg;
  1573. unsigned message;
  1574. WORD wParam;
  1575. LONG lParam;
  1576. {
  1577.  
  1578.     int i;
  1579.     char temp[80];
  1580.  
  1581.     switch (message) {
  1582.  
  1583.         case WM_INITDIALOG:
  1584.             win_answers[0] = XROT;
  1585.             win_answers[1] = YROT;
  1586.             win_answers[2] = ZROT;
  1587.             win_answers[3] = XSCALE;
  1588.             win_answers[4] = YSCALE;
  1589.             win_answers[5] = ROUGH;
  1590.             win_answers[6] = WATERLINE;
  1591.             win_answers[7] = ZVIEWER;
  1592.             win_answers[8] = XSHIFT;
  1593.             win_answers[9] = YSHIFT;
  1594.             win_answers[10] = xtrans;
  1595.             win_answers[11] = ytrans;
  1596.             win_answers[12] = transparent[0];
  1597.             win_answers[13] = transparent[1];
  1598.             win_answers[14] = RANDOMIZE;
  1599.             for (i = 0; i < 15; i++) {
  1600.                 sprintf(temp,"%d", win_answers[i]);
  1601.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1602.                 }
  1603.             return (TRUE);
  1604.  
  1605.         case WM_COMMAND:
  1606.             switch (wParam) {
  1607.  
  1608.                 case IDOK:
  1609.                     for (i = 0; i < 15; i++) {
  1610.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 10);
  1611.                         win_answers[i] = atof(temp);
  1612.                         }
  1613.                     XROT =           win_answers[0];
  1614.                     YROT =           win_answers[1];
  1615.                     ZROT =           win_answers[2];
  1616.                     XSCALE =         win_answers[3];
  1617.                     YSCALE =         win_answers[4];
  1618.                     ROUGH =          win_answers[5];
  1619.                     WATERLINE =      win_answers[6];
  1620.                     ZVIEWER =        win_answers[7];
  1621.                     XSHIFT =         win_answers[8];
  1622.                     YSHIFT =         win_answers[9];
  1623.                     xtrans =         win_answers[10];
  1624.                     ytrans =         win_answers[11];
  1625.                     transparent[0] = win_answers[12];
  1626.                     transparent[1] = win_answers[13];
  1627.                     RANDOMIZE =      win_answers[14];
  1628.                     if (RANDOMIZE >= 7) RANDOMIZE = 7;
  1629.                     if (RANDOMIZE <= 0) RANDOMIZE = 0;
  1630.                     EndDialog(hDlg, 1);
  1631.                     break;
  1632.                   
  1633.                 case IDCANCEL:
  1634.                     EndDialog(hDlg, 0);
  1635.                     break;
  1636.  
  1637.                 }
  1638.         
  1639.         }
  1640.     return (FALSE);
  1641. }
  1642.  
  1643. BOOL FAR PASCAL SelectStarfield(hDlg, message, wParam, lParam)
  1644. HWND hDlg;
  1645. unsigned message;
  1646. WORD wParam;
  1647. LONG lParam;
  1648. {
  1649. extern double starfield_values[4];
  1650.  
  1651.    switch (message) {
  1652.  
  1653.         case WM_INITDIALOG:
  1654.             SetDlgItemInt(hDlg, ID_NUMSTARS,   (int)starfield_values[0], FALSE);
  1655.             SetDlgItemInt(hDlg, ID_CLUMPINESS, (int)starfield_values[1], FALSE);
  1656.             SetDlgItemInt(hDlg, ID_DIMRATIO,   (int)starfield_values[2], FALSE);
  1657.             return (TRUE);
  1658.  
  1659.         case WM_COMMAND:
  1660.             switch (wParam) {
  1661.  
  1662.                 case IDOK:
  1663.                     starfield_values[0] = GetDlgItemInt(hDlg, ID_NUMSTARS,   NULL, FALSE);
  1664.                     starfield_values[1] = GetDlgItemInt(hDlg, ID_CLUMPINESS, NULL, FALSE);
  1665.                     starfield_values[2] = GetDlgItemInt(hDlg, ID_DIMRATIO,   NULL, FALSE);
  1666.                     EndDialog(hDlg, 1);
  1667.                     break;
  1668.                   
  1669.                 case IDCANCEL:
  1670.                     EndDialog(hDlg, 0);
  1671.                     break;
  1672.  
  1673.                 }
  1674.         
  1675.         }
  1676.     return (FALSE);
  1677. }
  1678.