Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.6 KiB

  1. #include "perfmon.h"
  2. #include "bookmark.h" // External declarations for this file
  3. #include "log.h" // for LogWriteBookmark
  4. #include "utils.h" // for WindowCenter
  5. #include "pmhelpid.h" // Help IDs
  6. void static OnInitDialog (HDLG hDlg)
  7. {
  8. dwCurrentDlgID = HC_PM_idDlgOptionBookMark ;
  9. EditSetLimit (DialogControl (hDlg, IDD_BOOKMARKCOMMENT),
  10. BookmarkCommentLen-1) ;
  11. WindowCenter (hDlg) ;
  12. }
  13. void static OnOK (HDLG hDlg)
  14. {
  15. TCHAR szComment [BookmarkCommentLen + 1] ;
  16. DialogText (hDlg, IDD_BOOKMARKCOMMENT, szComment) ;
  17. LogWriteBookmark (hWndLog, szComment) ;
  18. EndDialog (hDlg, 1) ;
  19. }
  20. //==========================================================================//
  21. // Exported Functions //
  22. //==========================================================================//
  23. INT_PTR
  24. FAR
  25. WINAPI
  26. BookmarkDlgProc (
  27. HWND hDlg,
  28. unsigned iMessage,
  29. WPARAM wParam,
  30. LPARAM lParam
  31. )
  32. {
  33. BOOL bHandled ;
  34. bHandled = TRUE ;
  35. switch (iMessage)
  36. {
  37. case WM_INITDIALOG:
  38. OnInitDialog (hDlg) ;
  39. return (TRUE) ;
  40. case WM_CLOSE:
  41. dwCurrentDlgID = 0 ;
  42. EndDialog (hDlg, 0) ;
  43. break ;
  44. case WM_COMMAND:
  45. switch(wParam)
  46. {
  47. case IDD_OK:
  48. dwCurrentDlgID = 0 ;
  49. OnOK (hDlg) ;
  50. break ;
  51. case IDD_CANCEL:
  52. dwCurrentDlgID = 0 ;
  53. EndDialog (hDlg, 0) ;
  54. break ;
  55. case IDD_BOOKMARKHELP:
  56. CallWinHelp (dwCurrentDlgID, hDlg) ;
  57. break ;
  58. default:
  59. bHandled = FALSE ;
  60. break;
  61. }
  62. break;
  63. default:
  64. bHandled = FALSE ;
  65. break ;
  66. } // switch
  67. return (bHandled) ;
  68. } // BookmarkDlgProc
  69. BOOL
  70. AddBookmark (
  71. HWND hWndParent
  72. )
  73. { // AddBookmark
  74. return (DialogBox (hInstance, idDlgAddBookmark, hWndParent, BookmarkDlgProc) ? TRUE : FALSE) ;
  75. } // AddBookmark
  76. void
  77. BookmarkAppend (
  78. PPBOOKMARK ppBookmarkFirst,
  79. PBOOKMARK pBookmarkNew
  80. )
  81. { // BookmarkAppend
  82. PBOOKMARK pBookmark ;
  83. if (!*ppBookmarkFirst)
  84. *ppBookmarkFirst = pBookmarkNew ;
  85. else
  86. { // else
  87. for (pBookmark = *ppBookmarkFirst ;
  88. pBookmark->pBookmarkNext ;
  89. pBookmark = pBookmark->pBookmarkNext)
  90. /* nothing */ ;
  91. pBookmark->pBookmarkNext = pBookmarkNew ;
  92. } // else
  93. } // BookmarkAppend