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

📄 poppad.c

📁 Netscape NSPR库源码
💻 C
📖 第 1 页 / 共 2 页
字号:
                         wEnable = hDlgModeless == NULL ?                                        MF_ENABLED : MF_GRAYED ;                         EnableMenuItem (wParam, IDM_FIND,    wEnable) ;                         EnableMenuItem (wParam, IDM_NEXT,    wEnable) ;                         EnableMenuItem (wParam, IDM_REPLACE, wEnable) ;                         break ;                    }               return 0 ;          case WM_COMMAND :                              // Messages from edit control               if (LOWORD (lParam) && wParam == EDITID)                    {                    switch (HIWORD (lParam))                         {                         case EN_UPDATE:                              bNeedSave = TRUE ;                              return 0 ;                         case EN_ERRSPACE:                         case EN_MAXTEXT:                              MessageBox (hwnd, "Edit control out of space.",                                        szAppName, MB_OK | MB_ICONSTOP) ;                              return 0 ;                         }                    break ;                    }               switch (wParam)                    {                              // Messages from File menu                    case IDM_NEW:                         if (bNeedSave && IDCANCEL ==                                   AskAboutSave (hwnd, szTitleName))                              return 0 ;                         SetWindowText (hwndEdit, "\0") ;                         szFileName [0]  = '\0' ;                         szTitleName [0] = '\0' ;                         DoCaption (hwnd, szTitleName) ;                         bNeedSave = FALSE ;                         return 0 ;                    case IDM_OPEN:                         if (bNeedSave && IDCANCEL ==                                   AskAboutSave (hwnd, szTitleName))                              return 0 ;                         if (PopFileOpenDlg (hwnd, szFileName, szTitleName))                              {                              if (!PopFileRead (hwndEdit, szFileName))                                   {                                   OkMessage (hwnd, "Could not read file %s!",                                                    szTitleName) ;                                   szFileName  [0] = '\0' ;                                   szTitleName [0] = '\0' ;                                   }                              }                         DoCaption (hwnd, szTitleName) ;                         bNeedSave = FALSE ;                         return 0 ;                    case IDM_SAVE:                         if (szFileName [0])                              {                              if (PopFileWrite (hwndEdit, szFileName))                                   {                                   bNeedSave = FALSE ;                                   return 1 ;                                   }                              else                                   OkMessage (hwnd, "Could not write file %s",                                                    szTitleName) ;                              return 0 ;                              }                                                  // fall through                    case IDM_SAVEAS:                         if (PopFileSaveDlg (hwnd, szFileName, szTitleName))                              {                              DoCaption (hwnd, szTitleName) ;                              if (PopFileWrite (hwndEdit, szFileName))                                   {                                   bNeedSave = FALSE ;                                   return 1 ;                                   }                              else                                   OkMessage (hwnd, "Could not write file %s",                                                    szTitleName) ;                              }                         return 0 ;                    case IDM_PRINT:                         if (!PopPrntPrintFile (hInst, hwnd, hwndEdit,                                                szTitleName))                              OkMessage (hwnd, "Could not print file %s",                                         szTitleName) ;                         return 0 ;                    case IDM_EXIT:                         SendMessage (hwnd, WM_CLOSE, 0, 0L) ;                         return 0 ;                              // Messages from Edit menu                    case IDM_UNDO:                         SendMessage (hwndEdit, WM_UNDO, 0, 0L) ;                         return 0 ;                    case IDM_CUT:                         SendMessage (hwndEdit, WM_CUT, 0, 0L) ;                         return 0 ;                    case IDM_COPY:                         SendMessage (hwndEdit, WM_COPY, 0, 0L) ;                         return 0 ;                    case IDM_PASTE:                         SendMessage (hwndEdit, WM_PASTE, 0, 0L) ;                         return 0 ;                    case IDM_DEL:                         SendMessage (hwndEdit, WM_CLEAR, 0, 0L) ;                         return 0 ;                    case IDM_SELALL:                         SendMessage (hwndEdit, EM_SETSEL, 0,                                        MAKELONG (0, 32767)) ;                         return 0 ;                              // Messages from Search menu                    case IDM_FIND:                         iOffset = HIWORD (                              SendMessage (hwndEdit, EM_GETSEL, 0, 0L)) ;                         hDlgModeless = PopFindFindDlg (hwnd) ;                         return 0 ;                    case IDM_NEXT:                         iOffset = HIWORD (                              SendMessage (hwndEdit, EM_GETSEL, 0, 0L)) ;                         if (PopFindValidFind ())                              PopFindNextText (hwndEdit, &iOffset) ;                         else                              hDlgModeless = PopFindFindDlg (hwnd) ;                         return 0 ;                    case IDM_REPLACE:                         iOffset = HIWORD (                              SendMessage (hwndEdit, EM_GETSEL, 0, 0L)) ;                         hDlgModeless = PopFindReplaceDlg (hwnd) ;                         return 0 ;                    case IDM_FONT:                         if (PopFontChooseFont (hwnd))                              PopFontSetFont (hwndEdit) ;                         return 0 ;                              // Messages from Help menu                    case IDM_HELP:                         OkMessage (hwnd, "Help not yet implemented!", NULL) ;                         return 0 ;                    case IDM_ABOUT:                         DialogBox (hInst, "AboutBox", hwnd, lpfnAboutDlgProc);                         return 0 ;                    }               break ;          case WM_CLOSE:               if (!bNeedSave || IDCANCEL != AskAboutSave (hwnd, szTitleName))                    DestroyWindow (hwnd) ;               return 0 ;          case WM_QUERYENDSESSION:               if (!bNeedSave || IDCANCEL != AskAboutSave (hwnd, szTitleName))                    return 1L ;               return 0 ;          case WM_DESTROY:               PopFontDeinitialize () ;               PostQuitMessage (0) ;               quitSwitch = 1;               return 0 ;          default:                         // Process "Find-Replace" messages               if (message == messageFindReplace)                    {                    lpfr = (LPFINDREPLACE) lParam ;                    if (lpfr->Flags & FR_DIALOGTERM)                         hDlgModeless = NULL ;                    if (lpfr->Flags & FR_FINDNEXT)                         if (!PopFindFindText (hwndEdit, &iOffset, lpfr))                              OkMessage (hwnd, "Text not found!", NULL) ;                    if (lpfr->Flags & FR_REPLACE ||                        lpfr->Flags & FR_REPLACEALL)                         if (!PopFindReplaceText (hwndEdit, &iOffset, lpfr))                              OkMessage (hwnd, "Text not found!", NULL) ;                    if (lpfr->Flags & FR_REPLACEALL)                         while (PopFindReplaceText (hwndEdit, &iOffset, lpfr));                    return 0 ;                    }               break ;          }     return DefWindowProc (hwnd, message, wParam, lParam) ;     }BOOL FAR PASCAL _export AboutDlgProc (HWND hDlg, UINT message, UINT wParam,                                                               LONG lParam)     {     switch (message)          {          case WM_INITDIALOG:               return TRUE ;          case WM_COMMAND:               switch (wParam)                    {                    case IDOK:                         EndDialog (hDlg, 0) ;                         return TRUE ;                    }               break ;          }     return FALSE ;     }/*** TimerThread() -- The Main function of the timer pop thread***/static void PR_CALLBACK TimerThread( void *arg){    do {        PadEvent   *ev;                /*        ** Should we quit now?        */        if ( quitSwitch )            break;        /*        ** Create and Post the event the event        */        PL_ENTER_EVENT_QUEUE_MONITOR( padQueue );        ev = (PadEvent *) PR_NEW( PadEvent );        PL_InitEvent( &ev->plEvent, NULL,                 (PLHandleEventProc)HandlePadEvent,                 (PLDestroyEventProc)DestroyPadEvent );        PL_PostEvent( padQueue, &ev->plEvent );        PL_EXIT_EVENT_QUEUE_MONITOR( padQueue );                    PR_Sleep( ThreadSleepTime );    } while(1);    return;}    /*** HandlePadEvent() -- gets called because of PostEvent*/static void PR_CALLBACK HandlePadEvent( PadEvent *padEvent ){    if ( timerCount++ == 0 )    {        char *cp;                for ( cp = startMessage; *cp != 0 ; cp++ )        {            SendMessage( hwndEdit, WM_CHAR, *cp, MAKELONG( *cp, 1 ));        }    }    /*     ** Send a WM_CHAR event the edit Window    */    if ((timerCount % 10) == 0)    {        SendMessage( hwndEdit, WM_CHAR, '+', MAKELONG( '+', 1 ));    }    else if ((timerCount % 5) == 0)    {        SendMessage( hwndEdit, WM_CHAR, '_', MAKELONG( '_', 1 ));    }    else    {        SendMessage( hwndEdit, WM_CHAR, '.', MAKELONG( '.', 1 ));    }        if ( (timerCount % 50) == 0)    {        SendMessage( hwndEdit, WM_CHAR, '\n', MAKELONG( '\n', 1 ));    }    /*    ** PL_RevokeEvents() is broken. Test to fix it.    */    {        static long revokeCounter = 0;        if (revokeCounter++ > 10 )        {            PR_Sleep( ThreadSleepTime * 10 );            SendMessage( hwndEdit, WM_CHAR, '*', MAKELONG( '\n', 1 ));            PL_RevokeEvents( padQueue, NULL );            revokeCounter = 0;        }    }    return;}/*** DestroyPadEvent() -- Called after HandlePadEvent()*/static void PR_CALLBACK DestroyPadEvent( PadEvent *padevent ){   PR_Free( padevent );   return;}    

⌨️ 快捷键说明

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