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

📄 ccide.c

📁 CC386 is a general-purpose 32-bit C compiler. It is not an optimizing compiler but given that the co
💻 C
📖 第 1 页 / 共 5 页
字号:
            if (projectList && making)
                mf_state = MF_ENABLED;
            else
                mf_state = MF_GRAYED;
            EnableMenuItem(hMenuMain, IDM_STOPBUILD, mf_state);

            if (IsWindow(win))
                EnableMenuItem(hMenuMain, IDM_UNDO, SendMessage(win, EM_CANUNDO,
                    0, 0) ? MF_ENABLED : MF_GRAYED);

            mf_state = uState == notDebugging ? MF_ENABLED : MF_GRAYED;
            EnableMenuItem(hMenuMain, IDM_STARTDEBUGGING, mf_state);
            mf_state = uState != notDebugging ? MF_ENABLED : MF_GRAYED;
            EnableMenuItem(hMenuMain, IDM_STOPDEBUGGING, mf_state);
            EnableMenuItem(hMenuMain, IDM_RUN, mf_state);
            EnableMenuItem(hMenuMain, IDM_VIEWASM, mf_state);
            EnableMenuItem(hMenuMain, IDM_VIEWDUMP, mf_state);
            EnableMenuItem(hMenuMain, IDM_VIEWREGISTER, mf_state);
            EnableMenuItem(hMenuMain, IDM_VIEWSTACK, mf_state);
            EnableMenuItem(hMenuMain, IDM_VIEWWATCH, mf_state);
            EnableMenuItem(hMenuMain, IDM_VIEWTHREAD, mf_state);
            mf_state = uState == Running ? MF_ENABLED : MF_GRAYED;
            EnableMenuItem(hMenuMain, IDM_STOP, mf_state);
            //         mf_state = uState == atBreakpoint || uState == atException ? MF_ENABLED : MF_GRAYED ;
            //         EnableMenuItem(hMenuMain,IDM_HBREAK, mf_state ) ;

            mf_state = htmlLib ? MF_ENABLED : MF_GRAYED;
            EnableMenuItem(hMenuMain, IDM_WINHELP, mf_state);
            return 0;

        case WM_SIZE:
            switch (wParam)
            {
            case SIZEFULLSCREEN:
                IntToProfile(psShow, SW_SHOWMAXIMIZED);
                break;
            case SIZEICONIC:
                //                    IntToProfile(psShow,SW_SHOWMINIMIZED) ;
                break;
            case SIZENORMAL:
                IntToProfile(psShow, SW_SHOWNORMAL);
                break;
            }
            rf.left = rf.top = 0;
            rf.right = LOWORD(lParam);
            rf.bottom = HIWORD(lParam);
            GetWindowRect(hwndStatus, &rs);
            rf.top = rf.bottom - rs.bottom + rs.top;
            MoveWindow(hwndStatus, rf.left, rf.top, rf.right - rf.left,
                rf.bottom - rf.top, 1);
            parts[0] = rf.right - 340;
            parts[1] = rf.right - 260;
            parts[2] = rf.right - 180;
            parts[3] = rf.right - 100;
            parts[4] = rf.right - 20;
            SendMessage(hwndStatus, SB_SETPARTS, 5, (LPARAM) &parts[0]);
            SendMessage(hwndStatus, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)
                "    ");

            rv = DefFrameProc(hwnd, hwndClient, iMessage, wParam, lParam);
            dmgrSizeFrame();
            return rv;
        case WM_TIMER:
            if (uState != notDebugging || making)
                return 0;
            KillTimer(hwnd, timerid);
            PostMessage(hwnd, WM_CLOSE, 0, 0);
            break;
        case WM_CLOSE:
            if (uState != notDebugging)
            {
                if (ExtendedMessageBox("Exit Debugging", MB_YESNO, 
                    "This will abort your debug session.  Do you wish to exit?")
                    != IDYES)
                    return 0;
                abortDebug();
                // It takes time for the debuggee to end, we can't close until
                // it is done unless we want to put the system into an abnormal
                // state.  We will keep trying with a timer until the debuggee
                // ends and then we will close out the window.
                timerid = SetTimer(hwnd, 2, 500, 0);
                return 0;
            }
            if (making)
            {
                if (ExtendedMessageBox("Exit Build", MB_YESNO, 
                    "This will abort your build.  Do you wish to exit?") !=
                    IDYES)
                    return 0;
                SendMessage(hwnd, WM_COMMAND, IDM_STOPBUILD, 0);
                timerid = SetTimer(hwnd, 2, 500, 0);
                return 0;
            }
            if (QuerySaveAll() == IDCANCEL)
                return 0;
            MRUToProfile(0);
            MRUToProfile(1);
            MRDToProfile();
            SaveDocksToRegistry();
            dmgrSetRundown();
            if (hwndProject)
            // MUST be after files are saved for tags to be updated
                DestroyWindow(hwndProject);
            break;
        default:
            if (iMessage == iFindMessage)
            {
                if (IsWindow(win = (HWND)SendMessage(hwndClient,
                    WM_MDIGETACTIVE, 0, 0)))
                    SendMessage(win, iMessage, wParam, lParam);
                return 0;
            }
            break;
    }
    return DefFrameProc(hwnd, hwndClient, iMessage, wParam, lParam);
}

//-------------------------------------------------------------------------

void doSplash(void)
{
    static char buf[256];
    SPLASH splash;

    sprintf(buf, "Version %s", CCIDE_STRING_VERSION);
    splash.hWndOwner = NULL; /* Window owner                  */
    splash.hInstance = hInstance; /* Instance of application       */
    splash.hInstanceRes = hInstance; /* Instance of application (res) */
    splash.lpszResource = "BITMAP_SPLASH"; /* Bitmap resource               */
    splash.uTime = 10000; /* Timeout in milliseconds       */
    splash.bCentered = TRUE; /* Centered-on-screen flag       */
    splash.bTopmost = TRUE; /* Topmost flag                  */
    splash.bWait = FALSE; /* Wait-end flag                 */
    splash.bAbout = FALSE; /* About box */
    splash.iPosX = 0; /* X position                    */
    splash.iPosY = 0; /* Y position                    */
    splash.lpszVersion = buf;

    SplashScreen(&splash);
}

//-------------------------------------------------------------------------

void doAbout(void)
{
    static char buf[256];
    SPLASH splash;

    sprintf(buf, "Version %s", CCIDE_STRING_VERSION);
    splash.hWndOwner = NULL; /* Window owner                  */
    splash.hInstance = hInstance; /* Instance of application       */
    splash.hInstanceRes = hInstance; /* Instance of application (res) */
    splash.lpszResource = "BITMAP_SPLASH"; /* Bitmap resource               */
    splash.bCentered = TRUE; /* Centered-on-screen flag       */
    splash.bTopmost = FALSE; /* Topmost flag                  */
    splash.bWait = TRUE; /* Wait-end flag                 */
    splash.bAbout = TRUE; /* About box */
    splash.iPosX = 0; /* X position                    */
    splash.iPosY = 0; /* Y position                    */
    splash.lpszVersion = buf;
    splash.lpszButtonTitle = "Close";
    splash.bPos.left = 120;
    splash.bPos.top = 180;
    splash.bPos.right = 220;
    splash.bPos.bottom = 210;

    SplashScreen(&splash);
}

//-------------------------------------------------------------------------

LRESULT CALLBACK CursorHookProc(int code, int wParam, int lParam)
{
    CWPRETSTRUCT *s = (CWPRETSTRUCT*)lParam;
    if (s->message == WM_SETCURSOR)
    {
        if (programBusy > 0)
            SetCursor(hCursHourglass);
    }
    return CallNextHookEx(hCursHook, code, wParam, lParam);
}

//-------------------------------------------------------------------------

int IsBusyMessage(MSG *msg)
{
    int rv = 0;
    if (programBusy <= 0)
        return 0;
    switch (msg->message)
    {
        case WM_LBUTTONDOWN:
        case WM_LBUTTONUP:
        case WM_MBUTTONDOWN:
        case WM_MBUTTONUP:
        case WM_RBUTTONDOWN:
        case WM_RBUTTONUP:
        case WM_LBUTTONDBLCLK:
        case WM_MBUTTONDBLCLK:
        case WM_RBUTTONDBLCLK:
        case WM_KEYUP:
        case WM_KEYDOWN:
        case WM_CHAR:
            rv = 1;
            break;
    }
    return rv;
}

//-------------------------------------------------------------------------

int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpszCmdLine,
    int nCmdShow)
{
    HANDLE hsub;
    DWORD val;
    MSG msg;
    RECT r;
    int argc = _argc;
    char **argv = _argv;
    WINDOWPLACEMENT wp;
    hInstance = hInst;
    _control87(MCW_EM, MCW_EM); 
        // so we don't get problems reading unused FP reg values
    InitCommonControls();
    editLib = LoadLibrary("riched32.dll"); /* Version 1.0 */
    CreateCurrentUser();
    hCursArrow = LoadCursor(0, IDC_ARROW);
    hCursHourglass = LoadCursor(0, IDC_WAIT);
    //   if (!FindWindow(szFrameClassName,0)) {
    {
        WNDCLASS wc;
        memset(&wc, 0, sizeof(wc));
        wc.style = 0;
        wc.lpfnWndProc = &WndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hInstance;
        wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(1));
        wc.hCursor = LoadCursor(0, IDC_ARROW);
        wc.hbrBackground = 0; // COLOR_APPWORKSPACE + 1 ;
        wc.lpszMenuName = 0;
        wc.lpszClassName = szFrameClassName;
        RegisterClass(&wc);

        RegisterXeditWindow();
        RegisterextTreeWindow();
        RegisterControlWindow(hInstance);
        RegisterFrameWindow(hInstance);
        RegisterToolBarWindow(hInstance);
        RegisterGripWindow(hInstance);
        RegisterHistoryComboWindow();

        RegisterDrawWindow();
        RegisterProjectWindow();
        RegisterColorWindow();
        RegisterErrorWindow();
        RegisterASMWindow();
        RegisterStackWindow();
        RegisterThreadWindow();
        RegisterRegisterWindow();
        RegisterDumpWindow();
        RegisterTabWindow();
        RegisterWatchWindow();
        RegisterSourceTabWindow();
    }
    //   SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_LOWEST) ;
    restoreColors();
    strcpy(szInstallPath, (char*)ProfileToString("InstallPath", "C:\\cc386"));

    hMenuMain = LoadMenu(hInstance, "MAINMENU");
    hsub = GetSubMenu(hMenuMain, WINDOW_MENU_OFFSET);
    WindowItemCount = GetMenuItemCount(hsub);
    hAccel = LoadAccelerators(hInstance, "MAINACCELERATORS");

    projectSem = CreateSemaphore(0, 1, 1, 0);

    if (!RestorePlacementFromRegistry(&wp))
    {
        wp.rcNormalPosition.left = wp.rcNormalPosition.right = CW_USEDEFAULT;
        wp.rcNormalPosition.top = wp.rcNormalPosition.bottom = CW_USEDEFAULT;
    }
    else
    {
        wp.rcNormalPosition.right -= wp.rcNormalPosition.left;
        wp.rcNormalPosition.bottom -= wp.rcNormalPosition.top;
    }
    hwndFrame = CreateWindowEx(0, szFrameClassName, "CC386 IDE",
        WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
        wp.rcNormalPosition.left, wp.rcNormalPosition.top,
        wp.rcNormalPosition.right, wp.rcNormalPosition.bottom, 0, hMenuMain,
        hInstance, 0);
    InvalidateRect(hwndFrame, 0, 0);
    readytodraw = !(ProfileToInt(psShow, SW_SHOWNORMAL) == SW_MAXIMIZE);
    ShowWindow(hwndFrame, ProfileToInt(psShow, SW_SHOWNORMAL));
    readytodraw = TRUE;
    UpdateWindow(hwndFrame);
    doSplash();

    iFindMessage = RegisterWindowMessage("commdlg_FindReplace");
    ProfileToMRU(0);
    ProfileToMRU(1);
    ProfileToMRD();
    MRUToMenu(0);
    MRUToMenu(1);

    InitHelp();
    #ifdef HBREAK
        hbpInit();
    #endif 
    //   argv = CmdLineToC(&argc,lpszCmdLine) ;
    if (argv)
    {
        if (parse_args(&argc, argv, 1) && argc > 1)
        {
            int i;
            char cwd[256];
            int munged = FALSE;
            if (!szProjectName[0])
            {
                munged = TRUE;
                GetCurrentDirectory(256, szProjectName);
                strcat(szProjectName, "\\x.x");
            }
            StringToProfile("FILEDIR", getcwd(cwd, 256));
            for (i = 1; i < argc; i++)
            {
                DWINFO info;
                char *p = strrchr(argv[i], '\\');
                struct stat statbuf;
                if (p)
                    strcpy(info.dwTitle, p + 1);
                else
                    strcpy(info.dwTitle, argv[i]);
                strcpy(info.dwName, argv[i]);
                abspath(info.dwName);
                info.dwLineNo =  - 1;
                info.logMRU = TRUE;
                if (stat(info.dwName, &statbuf) !=  - 1)
                    CreateDrawWindow(&info);
                else
                    ExtendedMessageBox("File Open Error", MB_SETFOREGROUND |
                        MB_SYSTEMMODAL, "File not found: %s", info.dwName);
            }
            if (munged)
                szProjectName[0] = 0;

        }
    }
    hCursHook = SetWindowsHookEx(WH_CALLWNDPROCRET, (HOOKPROC)CursorHookProc, 0,
        GetCurrentThreadId());
    while (GetMessage(&msg, 0, 0, 0))
    {
        if (!IsBusyMessage(&msg))
        {
            if (!TranslateMDISysAccel(hwndClient, &msg))
            {
                if (!TranslateAccelerator(hwndFrame, hAccel, &msg))
                {
                    if (!IsWindow(hwndFind) || !IsDialogMessage(hwndFind, &msg))
                    {
                        if (!IsWindow(hwndBookmark) || !IsDialogMessage
                            (hwndBookmark, &msg))
                        {
                            TranslateMessage(&msg);
                            DispatchMessage(&msg);
                        } 
                    }
                }
            }
        }
    }
    saveColors();
    FreeLibrary(editLib);
    RundownHelp();
    return msg.wParam;
}

⌨️ 快捷键说明

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