Leaked source code of windows server 2003
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.

280 lines
6.6 KiB

  1. class TestConfigureInterface // abstract class
  2. {
  3. public:
  4. // pop-up dialog to configure brush
  5. virtual BOOL ChangeSettings(HWND hwnd) = 0;
  6. // re-initialize the brush to a default value
  7. virtual VOID Initialize() = 0;
  8. };
  9. class TestDialogInterface
  10. {
  11. public:
  12. // WM_INITDIALOG
  13. virtual VOID InitDialog(HWND hwnd) = 0;
  14. // IDC_OK only
  15. virtual BOOL SaveValues(HWND hwnd) = 0;
  16. // WM_ else...
  17. virtual BOOL ProcessDialog(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) = 0;
  18. };
  19. class TestTransform : public TestConfigureInterface,
  20. public TestDialogInterface
  21. {
  22. public:
  23. TestTransform()
  24. {
  25. static MatrixOrder matrixPrependSave = PrependOrder;
  26. matrixPrepend = &matrixPrependSave;
  27. matrix = NULL;
  28. }
  29. ~TestTransform()
  30. {
  31. delete matrix;
  32. }
  33. // Configuration interface methods
  34. virtual BOOL ChangeSettings(HWND hwnd);
  35. virtual VOID Initialize();
  36. virtual VOID Initialize(Matrix** matrix);
  37. // Dialog maintenance methods
  38. virtual VOID InitDialog(HWND hwnd);
  39. virtual BOOL SaveValues(HWND hwnd);
  40. virtual BOOL ProcessDialog(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  41. protected:
  42. VOID EnableDialogButtons(HWND hwnd, BOOL enable);
  43. VOID UpdateTransformPicture(HWND hwnd, INT idc, Matrix* matrix);
  44. private:
  45. Matrix** origMatrix;
  46. Matrix* matrix;
  47. MatrixOrder* matrixPrepend;
  48. };
  49. class TestMatrixOperation : public TestConfigureInterface,
  50. public TestDialogInterface
  51. {
  52. public:
  53. TestMatrixOperation()
  54. {
  55. x = y = 0.0f;
  56. count = 0;
  57. }
  58. ~TestMatrixOperation()
  59. {
  60. }
  61. // Configuration interface methods
  62. virtual BOOL ChangeSettings(HWND hwnd);
  63. virtual VOID Initialize();
  64. virtual VOID Initialize(TCHAR* dialogTitle,
  65. TCHAR* subTitle,
  66. TCHAR* descStr,
  67. INT count);
  68. // Dialog maintenance methods
  69. virtual VOID InitDialog(HWND hwnd);
  70. virtual BOOL SaveValues(HWND hwnd);
  71. virtual BOOL ProcessDialog(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  72. REAL GetX()
  73. {
  74. return x;
  75. };
  76. REAL GetY()
  77. {
  78. return y;
  79. };
  80. private:
  81. TCHAR* dialogTitle;
  82. TCHAR* subTitle;
  83. TCHAR* descStr;
  84. INT count;
  85. REAL x, y;
  86. };
  87. // !! hacky stack based on DynArray types...
  88. template <class T> class Stack : public DynArray<T>
  89. {
  90. public:
  91. typedef DynArray<T*> TArray;
  92. VOID Push(T& t)
  93. {
  94. Add(t);
  95. }
  96. T& Pop()
  97. {
  98. INT count = GetCount();
  99. if (count)
  100. {
  101. T& t = Last();
  102. AdjustCount(-1);
  103. return t;
  104. }
  105. else
  106. {
  107. ASSERT(FALSE);
  108. return GetPosition(0); // !! hackish...
  109. }
  110. }
  111. T& GetPosition(INT pos)
  112. {
  113. return GetDataBuffer()[pos];
  114. }
  115. };
  116. class TestShape;
  117. typedef Stack<TestShape*> ShapeStack;
  118. // menu positions in window menu bar
  119. const INT MenuFilePosition = 0;
  120. const INT MenuShapePosition = 1;
  121. const INT MenuBrushPosition = 2;
  122. const INT MenuPenPosition = 3;
  123. const INT MenuOtherPosition = 4;
  124. #define SetMenuCheckPos(w,x,y,z) SetMenuCheck(w,x,y,z,FALSE)
  125. #define SetMenuCheckCmd(w,x,y,z) SetMenuCheck(w,x,y,z,TRUE)
  126. extern VOID SetMenuCheck(HWND hwnd,
  127. INT menuPos,
  128. UINT idm,
  129. BOOL checked,
  130. BOOL byCmd);
  131. extern Brush* blackBrush;
  132. extern Brush* backBrush;
  133. extern Pen* blackPen;
  134. extern Color* blackColor;
  135. #define MAX_LOADSTRING 100
  136. extern VOID NotImplementedBox();
  137. extern VOID WarningBox(TCHAR* string);
  138. extern HINSTANCE hInst;
  139. extern TCHAR szTitle[MAX_LOADSTRING];
  140. extern TCHAR szWindowClass[MAX_LOADSTRING];
  141. extern VOID WarningBeep();
  142. extern VOID SetDialogLong(HWND hwnd, UINT idc, UINT value, BOOL enable = TRUE);
  143. extern UINT GetDialogLong(HWND hwnd, UINT idc);
  144. extern VOID SetDialogReal(HWND hwnd, UINT idc, REAL value);
  145. extern REAL GetDialogReal(HWND hwnd, UINT idc);
  146. extern VOID SetDialogText(HWND hwnd, UINT idc, LPTSTR text, BOOL enable = TRUE);
  147. extern VOID GetDialogText(HWND hwnd, UINT idc, LPTSTR text, INT maxSize);
  148. extern VOID SetDialogCombo(HWND hwnd, UINT idc, const TCHAR* strings[], INT count, INT cursel);
  149. extern INT GetDialogCombo(HWND hwnd, UINT idc);
  150. extern VOID SetDialogCheck(HWND hwnd, UINT idc, BOOL checked);
  151. extern BOOL GetDialogCheck(HWND hwnd, UINT idc);
  152. extern VOID SetDialogRealList(HWND hwnd, UINT idc, REAL* blend, INT count);
  153. extern VOID GetDialogRealList(HWND hwnd, UINT idc, REAL** blend, INT *count);
  154. extern VOID EnableDialogControl(HWND hwnd, INT idc, BOOL enable);
  155. extern VOID UpdateColorPicture(HWND hwnd, INT idc, ARGB argb);
  156. extern VOID UpdateRGBColor(HWND hwnd, INT idcPic, ARGB& argb);
  157. // Foward declarations of functions included in this code module:
  158. ATOM MyRegisterClass(HINSTANCE hInstance);
  159. HWND InitInstance(HINSTANCE, int, LPVOID);
  160. LRESULT CALLBACK WndTestDrawProc(HWND, UINT, WPARAM, LPARAM);
  161. extern INT_PTR CALLBACK AllDialogBox(
  162. HWND hwnd,
  163. UINT msg,
  164. WPARAM wParam,
  165. LPARAM lParam
  166. );
  167. enum FormatType
  168. {
  169. CPPFile,
  170. JavaFile,
  171. VMLFile
  172. };
  173. extern const TCHAR* tabStr;
  174. const INT numFormats = 3;
  175. extern const TCHAR* formatList[numFormats];
  176. extern const FormatType formatValue[numFormats];
  177. const INT numShapes = 9;
  178. extern const TCHAR* shapeList[numShapes];
  179. extern const INT shapeValue[numShapes];
  180. extern const INT inverseShapeValue[numShapes];
  181. const INT numBrushes = 7;
  182. extern const TCHAR* brushList[numBrushes];
  183. extern const INT brushValue[numBrushes];
  184. extern const INT inverseBrushValue[numBrushes];
  185. const int numCaps = 6;
  186. extern const TCHAR* capList[numCaps];
  187. extern const TCHAR* capStr[numCaps];
  188. extern const LineCap capValue[numCaps];
  189. const int numDashCaps = 3;
  190. extern const TCHAR* dashCapList[numDashCaps];
  191. extern const TCHAR* dashCapStr[numDashCaps];
  192. extern const DashCap dashCapValue[numDashCaps];
  193. const INT numJoin = 3;
  194. extern const TCHAR* joinList[numJoin];
  195. extern const TCHAR* joinStr[numJoin];
  196. extern const LineJoin joinValue[numJoin];
  197. const INT numDash = 5;
  198. extern const TCHAR* dashList[numDash];
  199. extern const TCHAR* dashStr[numDash];
  200. extern const DashStyle dashValue[numDash];
  201. const INT numWrap = 6;
  202. extern const TCHAR* wrapList[numWrap];
  203. extern const TCHAR* wrapStr[numWrap];
  204. extern const WrapMode wrapValue[numWrap];
  205. const INT numHatch = 6;
  206. extern const TCHAR* hatchList[numHatch];
  207. extern const TCHAR* hatchStr[numHatch];
  208. extern const HatchStyle hatchValue[numHatch];
  209. // Shapes:
  210. // Line(s), Arc(s), Bezier(s), Rect(s), Ellipse(s), Pie(s), Polygon(s),
  211. // Curve(s), Path(s), ClosedCurve(s)
  212. enum ShapeTypes
  213. {
  214. LineType = 0,
  215. ArcType = 1,
  216. BezierType = 2,
  217. RectType = 3,
  218. EllipseType = 4,
  219. PieType = 5,
  220. PolygonType = 6,
  221. CurveType = 7,
  222. ClosedCurveType = 8
  223. };
  224. const INT pointRadius = 4;
  225. typedef DynArray<Point> PointArray;
  226. typedef DynArray<ARGB> ARGBArray;