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

📄 winfract.c

📁 frasr200的win 版本源码(18.21),使用make文件,使用的vc版本较低,在我的环境下编译有问题! 很不错的分形程序代码!
💻 C
📖 第 1 页 / 共 5 页
字号:
                    yymin = jyymin;  yymax = jyymax;
                    xx3rd = jxx3rd;  yy3rd = jyy3rd;
                    }
                else {
                    double ccreal,ccimag;
                    ccreal = (fractalspecific[fractype].xmax - fractalspecific[fractype].xmin) / 2;
                    ccimag = (fractalspecific[fractype].ymax - fractalspecific[fractype].ymin) / 2;
                    xxmin = xx3rd = param[0] - ccreal;
                    xxmax = param[0] + ccreal;
                    yymin = yy3rd = param[1] - ccimag;
                    yymax = param[1] + ccimag;
                    }
                frommandel = 0;
                param[0] = 0;
                param[1] = 0;
                calc_status = 0;
                }
            else {
                buzzer(2); /* can't switch */
                break;
                }

            ytop    = 0;
            ybottom = ydots-1;
            xleft   = 0;
            xright  = xdots-1;

            time_to_restart  = 1;
            time_to_cycle = 0;
            calc_status = 0;
            }
            break;

        case WM_CREATE:

            /* the scroll bars are hard-coded to 100 possible values */
            xposition = yposition = 0;      /* initial scroll-bar positions */
            SetScrollRange(hWnd,SB_HORZ,0,100,FALSE);
            SetScrollRange(hWnd,SB_VERT,0,100,FALSE);
            SetScrollPos(hWnd,SB_HORZ,xposition,TRUE);
            SetScrollPos(hWnd,SB_VERT,yposition,TRUE);
            InitializeParameters(hWnd);
            break;

        case WM_SIZE:
            win_kill_all_zooming();
            xpagesize = LOWORD(lParam);		/* remember the window size */
            ypagesize = HIWORD(lParam);
	    set_win_offset();
            if(!ReSizing && !IsIconic(hWnd))
	       ReSizeWindow(hWnd);
            break;

        case WM_MOVE:
            SaveWindowPosition(hWnd, WinfractPosStr);
            break;

        case WM_HSCROLL:
            win_kill_all_zooming();
            switch (wParam) {
               case SB_LINEDOWN:       xposition += 1; break;
               case SB_LINEUP:         xposition -= 1; break;
               case SB_PAGEDOWN:       xposition += 10; break;
               case SB_PAGEUP:         xposition -= 10; break;
               case SB_THUMBPOSITION:  xposition = LOWORD(lParam);
               default:                break;
               }
            if (xposition > 100) xposition = 100;
            if (xposition <     0) xposition = 0;
            if (xposition != GetScrollPos(hWnd,SB_HORZ)) {
               SetScrollPos(hWnd,SB_HORZ,xposition,TRUE);
               InvalidateRect(hWnd,NULL,TRUE);
               }
            set_win_offset();
           break;
        case WM_VSCROLL:
            win_kill_all_zooming();
            switch (wParam) {
               case SB_LINEDOWN:       yposition += 1; break;
               case SB_LINEUP:         yposition -= 1; break;
               case SB_PAGEDOWN:       yposition += 10; break;
               case SB_PAGEUP:         yposition -= 10; break;
               case SB_THUMBPOSITION:  yposition = LOWORD(lParam);
               default:                break;
               }
            if (yposition > 100) yposition = 100;
            if (yposition <     0) yposition = 0;
            if (yposition != GetScrollPos(hWnd,SB_VERT)) {
               SetScrollPos(hWnd,SB_VERT,yposition,TRUE);
               InvalidateRect(hWnd,NULL,TRUE);
               }
            set_win_offset();
            break;

        case WM_CLOSE:
            message = WM_COMMAND;
            wParam  = IDM_EXIT;
            goto GlobalExit;

        case WM_PAINT:
            if (screen_to_be_cleared && last_written_y < 0) {
                 /* an empty window */
                 screen_to_be_cleared = 0;
                 GetUpdateRect(hWnd, &tempRect, TRUE);
                 hDC = BeginPaint(hWnd,&ps);
                 if (last_written_y == -2)
                     last_written_y = -1;
                 else
                     BitBlt(hDC, 0, 0, xdots, ydots,
                         NULL, 0, 0, BLACKNESS);
                 ValidateRect(hWnd, &tempRect);
                 EndPaint(hWnd,&ps);
                 break;
                 }
            if(IsIconic(hWnd)) {
               int x, y;
               LPSTR icon;
               long lx, ly, dlx, dly;
               DWORD tSize, tWidth, tHeight;

               if((icon = GlobalLock(hIconBitmap)) == NULL)
                  break;

               dlx = ((long)xdots << 8) / IconWidth;
               dly = ((long)ydots << 8) / IconHeight;
               for(ly = y = 0; y < IconHeight; y++, ly += dly)
               {
                  for(lx = x = 0; x < IconWidth; x++, lx += dlx)
                  {
                     unsigned ix, iy;
                     unsigned char color;

                     ix = lx >> 8;
                     iy = ly >> 8;
                     color = getcolor(ix, iy);

                     ix = IconWidth - y - 1;
                     ix = (ix * IconWidth) + x;
                     iy = ix & pixels_per_bytem1;
                     ix = ix >> pixelshift_per_byte;
                     icon[ix] = (icon[ix] & win_notmask[iy]) +
                               (color << win_bitshift[iy]);
                  }
               }

               hDC = BeginPaint(hWnd, &ps);

               SelectPalette (hDC, hPal, 0);
               RealizePalette(hDC);

               tSize   = pDibInfo->bmiHeader.biSizeImage;
               tHeight = pDibInfo->bmiHeader.biHeight;
               tWidth  = pDibInfo->bmiHeader.biWidth;

               pDibInfo->bmiHeader.biSizeImage = IconSize;
               pDibInfo->bmiHeader.biHeight    = IconHeight;
               pDibInfo->bmiHeader.biWidth     = IconWidth;

               SetDIBitsToDevice(hDC,
                       2, 2,
                       IconWidth, IconHeight,
                       0, 0,
                       0, IconHeight,
                       icon, (LPBITMAPINFO)pDibInfo,
                       DIB_PAL_COLORS);

               pDibInfo->bmiHeader.biSizeImage = tSize;
               pDibInfo->bmiHeader.biHeight    = tHeight;
               pDibInfo->bmiHeader.biWidth     = tWidth;

               GlobalUnlock(hIconBitmap);

               EndPaint(hWnd, &ps);
               break;
            }
            screen_to_be_cleared = 0;
            GetUpdateRect(hWnd, &tempRect, FALSE);
            if (Zooming)
                PaintMathTools();
            if (bTrack || bMove || bMoving)
                UpdateSelection(hWnd, DragPoint, &Rect, Shape);
            hDC = BeginPaint(hWnd,&ps);
            if (last_written_y >= 0) {
              int top, bottom, left, right, xcount, ycount;
              /* bit-blit the invalidated bitmap area */
              int fromleft, fromtop, fromright, frombottom;
              long firstpixel;
              top    = tempRect.top;
              bottom = tempRect.bottom;
              left   = tempRect.left;
              right  = tempRect.right;
              if (bottom >  ydots) bottom = ydots;
              if (right  >= xdots) right  = xdots-1;
              if (top    >  ydots) top    = ydots;
              if (left   >= xdots) left   = xdots;
              xcount = right  - left + 1;
              ycount = bottom - top;
              fromleft  = left  + win_xoffset;
              fromtop   = win_ydots - bottom - win_yoffset;
              if (left < xdots && top < ydots) {
                  SelectPalette (hDC, hPal, 0);
                  RealizePalette(hDC);
                  SetMapMode(hDC,MM_TEXT);
                  SetDIBitsToDevice(hDC,
                       left, top,
                       xcount, ycount,
                       fromleft, fromtop,
                       0, ydots,
                       (LPSTR)pixels, (LPBITMAPINFO)pDibInfo,
                       DIB_PAL_COLORS);
                  }
              }
            ValidateRect(hWnd, &tempRect);
            EndPaint(hWnd,&ps);
            if (bTrack || bMove || bMoving)
                UpdateSelection(hWnd, DragPoint, &Rect, Shape);
            if (Zooming)
                PaintMathTools();
            last_time = time(NULL);  /* reset the "end-paint" time */
            break;

        case WM_DESTROY:
            win_kill_all_zooming();
            if (win_systempaletteused)
                win_stop_cycling();
            SaveParameters(hWnd);
            /* delete the handle to the logical palette if it has any
               color entries and quit. */
            if (pLogPal->palNumEntries)
                DeleteObject (hPal);
            time_to_quit = 1;
            time_to_cycle = 0;
            WinHelp(hWnd,szHelpFileName,HELP_QUIT,0L);
            GlobalFree(hIconBitmap);
            PostQuitMessage(0);
            hWndCopy = hWnd;
            break;

        case WM_ACTIVATE:
            if (!wParam) {  /* app. is being de-activated */
                if (win_systempaletteused)
                    win_stop_cycling();
                break;
                }

        case WM_QUERYNEWPALETTE:
            /* If palette realization causes a palette change,
             * we need to do a full redraw.
             */
             if (last_written_y >= 0) {
                 hDC = GetDC (hWnd);
                 SelectPalette (hDC, hPal, 0);
                 i = RealizePalette(hDC);
                 ReleaseDC (hWnd, hDC);
                 if (i) {
                     InvalidateRect (hWnd, (LPRECT) (NULL), 1);
                     return 1;
                     }
                 else
                     return FALSE;
                 }
             else
                 return FALSE;

        case WM_PALETTECHANGED:
            if (wParam != hWnd){
                if (last_written_y >= 0) {
                    hDC = GetDC (hWnd);
                    SelectPalette (hDC, hPal, 0);
                    i = RealizePalette (hDC);
                    if (i)
                        UpdateColors (hDC);
                    else
                        InvalidateRect (hWnd, (LPRECT) (NULL), 1);
                    ReleaseDC (hWnd, hDC);
                    }
                }
            break;

        case WM_COMMAND:

GlobalExit:            
            switch (wParam) {

              /* Help menu items */

               case IDM_HELP_INDEX:
               case IDF_HELP_INDEX:
                   WinHelp(hWnd,szHelpFileName,HELP_INDEX,0L);
                   break;

               case IDM_HELP_FRACTINT:
               case IDF_HELP_FRACTINT:
                   fractint_help();
                   break;

               case IDM_HELP_KEYBOARD:
		   WinHelp(hWnd,szHelpFileName,HELP_KEY,(DWORD)(LPSTR)"keys");
                   break;

               case IDM_HELP_HELP:
		   WinHelp(hWnd,"WINHELP.HLP",HELP_INDEX,0L);
                   break;

                case IDM_ABOUT:
                    lpProcAbout = MakeProcInstance(About, hInst);
                    DialogBox(hInst, "AboutBox", hWnd, lpProcAbout);
                    FreeProcInstance(lpProcAbout);
                    break;

                /* View menu items */

                case IDF_STATUS:
                    if (winfract_menustyle) {	/* Fractint prompts */
                        tab_display();
                        break;
                        }
                case IDS_STATUS:
                    lpProcStatus = MakeProcInstance(Status, hInst);
                    DialogBox(hInst, "ShowStatus", hWnd, lpProcStatus);
                    FreeProcInstance(lpProcStatus);
                    break;
            
                case IDF_FRACTINTSTYLE:
                    winfract_menustyle = TRUE;
		    hMenu = GetMenu(hWnd);
		    CheckMenuItem(hMenu, IDF_FRACTINTSTYLE, MF_CHECKED);
		    CheckMenuItem(hMenu, IDF_WINFRACTSTYLE, MF_UNCHECKED);
                    SaveParamSwitch(FractintMenusStr, winfract_menustyle);
                    break;
            
                case IDF_WINFRACTSTYLE:
                    winfract_menustyle = FALSE;
		    hMenu = GetMenu(hWnd);
		    CheckMenuItem(hMenu, IDF_FRACTINTSTYLE, MF_UNCHECKED);
		    CheckMenuItem(hMenu, IDF_WINFRACTSTYLE, MF_CHECKED);
                    SaveParamSwitch(FractintMenusStr, winfract_menustyle);
                    break;
            
               /* Color-Cycling (and Zooming) hotkeys */
               
               case IDF_HOTCYCLERAND:

⌨️ 快捷键说明

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