⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.c

📁 frasr200的win 版本源码(18.21),使用make文件,使用的vc版本较低,在我的环境下编译有问题! 很不错的分形程序代码!
💻 C
📖 第 1 页 / 共 5 页
字号:
                    invert = 0;
                    inversion[0] = inversion[1] = inversion[2] = 0;
                    fractype = CurrentFractal;
                    EndDialog(hDlg, 1);
                    break;
                    
                  
                case IDCANCEL:
                    EndDialog(hDlg, 0);
                    break;

                }
        
        }
    return (FALSE);
}


BOOL FAR PASCAL SelectImage(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{

    int i;
    char temp[15];

    switch (message) {

        case WM_INITDIALOG:
            win_temp1 = colors;
            if (win_temp1 == 2)
                CheckDlgButton(hDlg, ID_ICOLORS1, 1);
            else if (win_temp1 == 16)
                CheckDlgButton(hDlg, ID_ICOLORS2, 1);
            else
                CheckDlgButton(hDlg, ID_ICOLORS3, 1);
            sprintf(temp,"%d",xdots);
	    SetDlgItemText(hDlg, ID_ISIZEX, temp);
            sprintf(temp,"%d",ydots);
	    SetDlgItemText(hDlg, ID_ISIZEY, temp);
	    i = ID_ISIZE7;
	    if (xdots ==  200 && ydots == 150) i = ID_ISIZE1;
	    if (xdots ==  320 && ydots == 200) i = ID_ISIZE2;
	    if (xdots ==  640 && ydots == 350) i = ID_ISIZE3;
	    if (xdots ==  640 && ydots == 480) i = ID_ISIZE4;
	    if (xdots ==  800 && ydots == 600) i = ID_ISIZE5;
	    if (xdots == 1024 && ydots == 768) i = ID_ISIZE6;
            CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, i);
            return (TRUE);

        case WM_COMMAND:
            switch (wParam) {

                case IDOK:
                    /* retrieve and validate the results */
		    GetDlgItemText(hDlg, ID_ISIZEX, temp, 10);
		    xdots = atoi(temp);
		    if (xdots < 50) xdots = 50;
		    if (xdots > 2048) xdots = 2048;
		    GetDlgItemText(hDlg, ID_ISIZEY, temp, 10);
		    ydots = atoi(temp);
		    if (ydots < 50) ydots = 50;
		    if (ydots > 2048) ydots = 2048;
                    colors = win_temp1;
                    win_savedac();
                    /* allocate and lock a pixel array for the bitmap */
                    /* problem, here - can't just RETURN!!! */
                    tryagain:
                    if (!clear_screen(0)) {
                        MessageBox(hDlg, "Not Enough Memory for that sized Image",
                            NULL, MB_OK | MB_ICONHAND);
                        xdots = ydots = 100;
                        goto tryagain;
                        };
                    ytop    = 0;		/* reset the zoom-box */
                    ybottom = ydots-1;
                    xleft   = 0;
                    xright  = xdots-1;
                    set_win_offset();
                    zoomflag = TRUE;
                    time_to_restart = 1;

                    ProgStr = Winfract;
                    SaveIntParam(ImageWidthStr, xdots);
                    SaveIntParam(ImageHeightStr, ydots);

                    EndDialog(hDlg, 1);
                    break;
                  
                case IDCANCEL:
                    EndDialog(hDlg, 0);
                    break;

                case ID_ISIZE1:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE1);
		    SetDlgItemInt(hDlg, ID_ISIZEX, 200, TRUE);
		    SetDlgItemInt(hDlg, ID_ISIZEY, 150, TRUE);
                    break;

                case ID_ISIZE2:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE2);
		    SetDlgItemInt(hDlg, ID_ISIZEX, 320, TRUE);
		    SetDlgItemInt(hDlg, ID_ISIZEY, 200, TRUE);
                    break;

                case ID_ISIZE3:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE3);
		    SetDlgItemInt(hDlg, ID_ISIZEX, 640, TRUE);
		    SetDlgItemInt(hDlg, ID_ISIZEY, 350, TRUE);
                    break;

                case ID_ISIZE4:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE4);
		    SetDlgItemInt(hDlg, ID_ISIZEX, 640, TRUE);
		    SetDlgItemInt(hDlg, ID_ISIZEY, 480, TRUE);
                    break;

                case ID_ISIZE5:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE5);
		    SetDlgItemInt(hDlg, ID_ISIZEX, 800, TRUE);
		    SetDlgItemInt(hDlg, ID_ISIZEY, 600, TRUE);
                    break;

                case ID_ISIZE6:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE6);
		    SetDlgItemInt(hDlg, ID_ISIZEX, 1024, TRUE);
		    SetDlgItemInt(hDlg, ID_ISIZEY, 768, TRUE);
                    break;

                case ID_ISIZE7:
		    CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE7);
                    break;

                case ID_ICOLORS1:
		    CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS1);
                    win_temp1 = 2;
                    break;

                case ID_ICOLORS2:
		    CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS2);
                    win_temp1 = 16;
                    break;

                case ID_ICOLORS3:
		    CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS3);
                    win_temp1 = 256;
                    break;

                }
        
        }
    return (FALSE);
}


BOOL FAR PASCAL SelectDoodads(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{

    char temp[80];

    switch (message) {

        case WM_INITDIALOG:
            win_temp1 = usr_floatflag;
            win_temp2 = 0;
            if (usr_stdcalcmode == '2') win_temp2 = 1;
            if (usr_stdcalcmode == 'g') win_temp2 = 2;
            if (usr_stdcalcmode == 'b') win_temp2 = 3;
            if (usr_stdcalcmode == 't') win_temp2 = 4;
            win_temp3 = 0;
            if (inside == -1)    win_temp3 = 1;
            if (inside == -59)   win_temp3 = 2;
            if (inside == -60)   win_temp3 = 3;
            if (inside == -61)   win_temp3 = 4;
            if (inside == -100)  win_temp3 = 5;
            if (inside == -101)  win_temp3 = 6;
            win_temp4 = 0;
            if (outside < 0 && outside > -6) win_temp4 = 0 - outside;
            CheckDlgButton(hDlg, ID_PASS1+win_temp2,1);
            CheckDlgButton(hDlg, ID_INSIDEC+win_temp3, 1);
            CheckDlgButton(hDlg, ID_OUTSIDEN+win_temp4, 1);
            if (win_temp1)
                CheckDlgButton(hDlg, ID_MATHF, 1);
            else
                CheckDlgButton(hDlg, ID_MATHF, 0);
            sprintf(temp,"%d",maxiter);
	    SetDlgItemText(hDlg, ID_MAXIT, temp);
            sprintf(temp,"%d",usr_biomorph);
	    SetDlgItemText(hDlg, ID_BIOMORPH, temp);
            sprintf(temp,"%d",LogFlag);
	    SetDlgItemText(hDlg, ID_LOGP, temp);
            sprintf(temp,"%d",decomp);
	    SetDlgItemText(hDlg, ID_DECOMP, temp);
            sprintf(temp,"%d",fillcolor);
	    SetDlgItemText(hDlg, ID_FILLC, temp);
            sprintf(temp,"%d",max(inside,0));
	    SetDlgItemText(hDlg, ID_INSIDE, temp);
            sprintf(temp,"%d",max(outside,0));
	    SetDlgItemText(hDlg, ID_OUTSIDE, temp);
            return (TRUE);

        case WM_COMMAND:
            switch (wParam) {

                case IDOK:
                    /* retrieve and validate the results */
                    usr_stdcalcmode = '1';
                    if (win_temp2 == 1) usr_stdcalcmode = '2';
                    if (win_temp2 == 2) usr_stdcalcmode = 'g';
                    if (win_temp2 == 3) usr_stdcalcmode = 'b';
                    if (win_temp2 == 4) usr_stdcalcmode = 't';
                    usr_floatflag = win_temp1;
                    GetDlgItemText(hDlg, ID_MAXIT, temp, 10);
                    maxiter = atoi(temp);
                    if (maxiter < 10) maxiter = 10;
                    if (maxiter > 32000) maxiter = 32000;
                    GetDlgItemText(hDlg, ID_LOGP, temp, 10);
                    LogFlag = atoi(temp);
                    GetDlgItemText(hDlg, ID_BIOMORPH, temp, 10);
                    usr_biomorph = atoi(temp);
                    if (usr_biomorph < 0) usr_biomorph = -1;
                    if (usr_biomorph >= colors) usr_biomorph = colors-1;
                    GetDlgItemText(hDlg, ID_DECOMP, temp, 10);
                    decomp = atoi(temp);
                    if (decomp < 0) decomp = 0;
                    if (decomp > 256) decomp = 256;
                    GetDlgItemText(hDlg, ID_FILLC, temp, 10);
                    fillcolor = atoi(temp);
                    GetDlgItemText(hDlg, ID_INSIDE, temp, 10);
                    inside = atoi(temp);
                    if (inside < 0) inside = 0;
                    if (inside >= colors) inside = colors-1;
                    if (win_temp3 == 1) inside = -1;
                    if (win_temp3 == 2) inside = -59;
                    if (win_temp3 == 3) inside = -60;
                    if (win_temp3 == 4) inside = -61;
                    if (win_temp3 == 5) inside = -100;
                    if (win_temp3 == 6) inside = -101;
                    GetDlgItemText(hDlg, ID_OUTSIDE, temp, 10);
                    outside = atoi(temp);
                    if (outside < 0) outside = -1;
                    if (outside >= colors) outside = colors-1;
                    if (win_temp4 > 0) outside = 0 - win_temp4;
                    time_to_restart = 1;
                    EndDialog(hDlg, 1);
                    break;
                  
                case IDCANCEL:
                    EndDialog(hDlg, 0);
                    break;

                case ID_PASS1:
                case ID_PASS2:
                case ID_PASSS:
                case ID_PASSB:
                case ID_PASST:
                    win_temp2 = wParam - ID_PASS1;
                    CheckRadioButton(hDlg, ID_PASS1, ID_PASST, wParam);
                    break;

                case ID_INSIDEC:
                case ID_INSIDEM:
                case ID_INSIDEZ:
                case ID_INSIDE60:
                case ID_INSIDE61:
                case ID_INSIDEE:
                case ID_INSIDES:
                    win_temp3 = wParam - ID_INSIDEC;
                    CheckRadioButton(hDlg, ID_INSIDEC, ID_INSIDES, wParam);
                    break;

                case ID_OUTSIDEN:
                case ID_OUTSIDEIT:
                case ID_OUTSIDER:
                case ID_OUTSIDEIM:
                case ID_OUTSIDEM:
                case ID_OUTSIDES:
                    win_temp4 = wParam - ID_OUTSIDEN;
                    CheckRadioButton(hDlg, ID_OUTSIDEN, ID_OUTSIDES, wParam);
                    break;

                case ID_MATHF:
                    if (win_temp1 == 0)
                        win_temp1 = 1;
                    else
                        win_temp1 = 0;
                    CheckDlgButton(hDlg, ID_MATHF, win_temp1);
                    break;

                }
        
        }
    return (FALSE);
}


BOOL FAR PASCAL SelectExtended(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
   char temp[80];
   int i, j, k;
   extern	int	finattract;	/* finite attractor switch */
   extern	double	potparam[3];	/* three potential parameters*/
   extern	int	pot16bit;
   extern	int	usr_distest;	/* distance estimator option */
   extern	int	distestwidth;
   extern	int	rotate_lo,rotate_hi;

    switch (message) {

        case WM_INITDIALOG:
            if (finattract)
                win_temp1 = 1;
            else
                win_temp1 = 0;
            CheckDlgButton(hDlg, ID_FINITE, win_temp1);
            sprintf(temp,"%f",potparam[0]);
	    SetDlgItemText(hDlg, ID_POTENTMAX, temp);
            sprintf(temp,"%f",potparam[1]);
	    SetDlgItemText(hDlg, ID_POTENTSLOPE, temp);
            sprintf(temp,"%f",potparam[2]);
	    SetDlgItemText(hDlg, ID_POTENTBAIL, temp);
            if (pot16bit)
                win_temp2 = 1;
            else
                win_temp2 = 0;
            CheckDlgButton(hDlg, ID_POTENT16, win_temp2);
            sprintf(temp,"%i",usr_distest);
	    SetDlgItemText(hDlg, ID_DISTEST, temp);
            sprintf(temp,"%i",distestwidth);
	    SetDlgItemText(hDlg, ID_DISTESTWID, temp);
            for (i = 0; i < 3; i++) {
                sprintf(temp,"%.12f",inversion[i]);
                if (inversion[i] == AUTOINVERT)
	            SetDlgItemText(hDlg, ID_INVERTRAD+i, "auto");
                else
	            SetDlgItemText(hDlg, ID_INVERTRAD+i, temp);
	        }
            sprintf(temp,"%i",rotate_lo);
	    SetDlgItemText(hDlg, ID_COLORMIN, temp);
            sprintf(temp,"%i",rotate_hi);
	    SetDlgItemText(hDlg, ID_COLORMAX, temp);
            win_oldprompts[0] = win_temp1;
            win_oldprompts[1] = potparam[0];
            win_oldprompts[2] = potparam[1];
            win_oldprompts[3] = potparam[2];
            win_oldprompts[4] = win_temp2;
            win_oldprompts[5] = usr_distest;
            win_oldprompts[6] = distestwidth;
            win_oldprompts[7] = inversion[0];
            win_oldprompts[8] = inversion[1];
            win_oldprompts[9] = inversion[2];
            return (TRUE);

        case WM_COMMAND:
            switch (wParam) {

                case IDOK:
                    /* retrieve and validate the results */
                    finattract = win_temp1;
                    GetDlgItemText(hDlg, ID_POTENTMAX, temp, 10);
                    potparam[0] = atof(temp);
                    GetDlgItemText(hDlg, ID_POTENTSLOPE, temp, 10);
                    potparam[1] = atof(temp);
                    GetDlgItemText(hDlg, ID_POTENTBAIL, temp, 10);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -