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