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.

178 lines
3.9 KiB

  1. /**************************************************/
  2. /* */
  3. /* */
  4. /* Rotate Bitmap in Edit Window */
  5. /* (Dialog) */
  6. /* */
  7. /* */
  8. /* Copyright (c) 1997-1999 Microsoft Corporation. */
  9. /**************************************************/
  10. #include "stdafx.h"
  11. #include "eudcedit.h"
  12. #include "rotatdlg.h"
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char BASED_CODE THIS_FILE[] = __FILE__;
  16. #endif
  17. /****************************************/
  18. /* */
  19. /* Default Constructor */
  20. /* */
  21. /****************************************/
  22. CRotateDlg::CRotateDlg( CWnd* pParent)
  23. : CDialog(CRotateDlg::IDD, pParent)
  24. {
  25. //{{AFX_DATA_INIT(CRotateDlg)
  26. //}}AFX_DATA_INIT
  27. }
  28. /****************************************/
  29. /* */
  30. /* MESSAGE "WM_INITDIALOG" */
  31. /* */
  32. /****************************************/
  33. BOOL
  34. CRotateDlg::OnInitDialog()
  35. {
  36. CString DlgTitle;
  37. CDialog::OnInitDialog();
  38. // Implement "?" in this dialogbox.
  39. LONG WindowStyle = GetWindowLong( this->GetSafeHwnd(), GWL_EXSTYLE);
  40. WindowStyle |= WS_EX_CONTEXTHELP;
  41. SetWindowLong( this->GetSafeHwnd(), GWL_EXSTYLE, WindowStyle);
  42. // Set Dialog title name.
  43. DlgTitle.LoadString(IDS_ROTATE_DLGTITLE);
  44. this->SetWindowText( DlgTitle);
  45. RadioItem = FLIP_HOR;
  46. this->SendDlgItemMessage( IDC_FLIPHOR, BM_SETCHECK,(WPARAM)1,(LPARAM)0);
  47. return TRUE;
  48. }
  49. /****************************************/
  50. /* */
  51. /* COMMAND "IDOK" */
  52. /* */
  53. /****************************************/
  54. void
  55. CRotateDlg::OnOK()
  56. {
  57. if( RadioItem == NOTSEL){
  58. MessageBeep((UINT)-1);
  59. return;
  60. }
  61. CDialog::OnOK();
  62. }
  63. /****************************************/
  64. /* */
  65. /* COMMAND "FLIP HORIZONTAL" */
  66. /* */
  67. /****************************************/
  68. void
  69. CRotateDlg::OnFliphor()
  70. {
  71. RadioItem = FLIP_HOR;
  72. }
  73. /****************************************/
  74. /* */
  75. /* COMMAND "FLIP VERTICAL" */
  76. /* */
  77. /****************************************/
  78. void
  79. CRotateDlg::OnFlipver()
  80. {
  81. RadioItem = FLIP_VER;
  82. }
  83. /****************************************/
  84. /* */
  85. /* COMMAND "ROTATE 90" */
  86. /* */
  87. /****************************************/
  88. void CRotateDlg::OnRotate90()
  89. {
  90. RadioItem = ROTATE_9;
  91. }
  92. /****************************************/
  93. /* */
  94. /* COMMAND "ROTATE 180" */
  95. /* */
  96. /****************************************/
  97. void
  98. CRotateDlg::OnRotate180()
  99. {
  100. RadioItem = ROTATE_18;
  101. }
  102. /****************************************/
  103. /* */
  104. /* COMMAND "ROTATE 270" */
  105. /* */
  106. /****************************************/
  107. void CRotateDlg::OnRotate270()
  108. {
  109. RadioItem = ROTATE_27;
  110. }
  111. static DWORD aIds[] =
  112. {
  113. // IDC_ROTATE_GROUP, IDH_EUDC_OUTCAUTION,
  114. IDC_FLIPHOR, IDH_EUDC_FLIPH,
  115. IDC_ICON_HOR, IDH_EUDC_FLIPH,
  116. IDC_FLIPVER, IDH_EUDC_FLIPV,
  117. IDC_ICON_VER, IDH_EUDC_FLIPV,
  118. IDC_ROTATE90, IDH_EUDC_ROTA90,
  119. IDC_ICON_R90, IDH_EUDC_ROTA90,
  120. IDC_ROTATE180, IDH_EUDC_ROTA180,
  121. IDC_ICON_R180, IDH_EUDC_ROTA180,
  122. IDC_ROTATE270, IDH_EUDC_ROTA270,
  123. IDC_ICON_R270, IDH_EUDC_ROTA270,
  124. IDC_UPRIGHT, IDH_EUDC_EXAMPLE,
  125. // IDOK, IDH_EUDC_OK,
  126. // IDCANCEL, IDH_EUDC_CANCEL,
  127. 0,0
  128. };
  129. /****************************************/
  130. /* */
  131. /* Window procedure */
  132. /* */
  133. /****************************************/
  134. LRESULT
  135. CRotateDlg::WindowProc(
  136. UINT message,
  137. WPARAM wParam,
  138. LPARAM lParam)
  139. {
  140. if( message == WM_HELP){
  141. ::WinHelp((HWND)((LPHELPINFO)lParam)->hItemHandle,
  142. HelpPath, HELP_WM_HELP, (DWORD_PTR)(LPSTR)aIds);
  143. return(0);
  144. }
  145. if( message == WM_CONTEXTMENU){
  146. ::WinHelp((HWND)wParam, HelpPath,
  147. HELP_CONTEXTMENU, (DWORD_PTR)(LPSTR)aIds);
  148. return(0);
  149. }
  150. return CDialog::WindowProc(message, wParam, lParam);
  151. }
  152. BEGIN_MESSAGE_MAP(CRotateDlg, CDialog)
  153. //{{AFX_MSG_MAP(CRotateDlg)
  154. ON_BN_CLICKED(IDC_FLIPHOR, OnFliphor)
  155. ON_BN_CLICKED(IDC_FLIPVER, OnFlipver)
  156. ON_BN_CLICKED(IDC_ROTATE180, OnRotate180)
  157. ON_BN_CLICKED(IDC_ROTATE270, OnRotate270)
  158. ON_BN_CLICKED(IDC_ROTATE90, OnRotate90)
  159. //}}AFX_MSG_MAP
  160. END_MESSAGE_MAP()