libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmGr.h 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. #ifndef cmGr_h
  2. #define cmGr_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kAliceBlueGrId = 0xf0f8ff,
  9. kAntiqueWhiteGrId = 0xfaebd7,
  10. kAquaGrId = 0x00ffff,
  11. kAquamarineGrId = 0x7fffd4,
  12. kAzureGrId = 0xf0ffff,
  13. kBeigeGrId = 0xf5f5dc,
  14. kBisqueGrId = 0xffe4c4,
  15. kBlackGrId = 0x000000,
  16. kBlanchedAlmondGrId = 0xffebcd,
  17. kBlueGrId = 0x0000ff,
  18. kBlueVioletGrId = 0x8a2be2,
  19. kBrownGrId = 0xa52a2a,
  20. kBurlyWoodGrId = 0xdeb887,
  21. kCadetBlueGrId = 0x5f9ea0,
  22. kChartreuseGrId = 0x7fff00,
  23. kChocolateGrId = 0xd2691e,
  24. kCoralGrId = 0xff7f50,
  25. kCornflowerBlueGrId = 0x6495ed,
  26. kCornsilkGrId = 0xfff8dc,
  27. kCrimsonGrId = 0xdc143c,
  28. kCyanGrId = 0x00ffff,
  29. kDarkBlueGrId = 0x00008b,
  30. kDarkCyanGrId = 0x008b8b,
  31. kDarkGoldenRodGrId = 0xb8860b,
  32. kDarkGrayGrId = 0xa9a9a9,
  33. kDarkGreyGrId = 0xa9a9a9,
  34. kDarkGreenGrId = 0x006400,
  35. kDarkKhakiGrId = 0xbdb76b,
  36. kDarkMagentaGrId = 0x8b008b,
  37. kDarkOliveGreenGrId = 0x556b2f,
  38. kDarkorangeGrId = 0xff8c00,
  39. kDarkOrchidGrId = 0x9932cc,
  40. kDarkRedGrId = 0x8b0000,
  41. kDarkSalmonGrId = 0xe9967a,
  42. kDarkSeaGreenGrId = 0x8fbc8f,
  43. kDarkSlateBlueGrId = 0x483d8b,
  44. kDarkSlateGrayGrId = 0x2f4f4f,
  45. kDarkSlateGreyGrId = 0x2f4f4f,
  46. kDarkTurquoiseGrId = 0x00ced1,
  47. kDarkVioletGrId = 0x9400d3,
  48. kDeepPinkGrId = 0xff1493,
  49. kDeepSkyBlueGrId = 0x00bfff,
  50. kDimGrayGrId = 0x696969,
  51. kDimGreyGrId = 0x696969,
  52. kDodgerBlueGrId = 0x1e90ff,
  53. kFireBrickGrId = 0xb22222,
  54. kFloralWhiteGrId = 0xfffaf0,
  55. kForestGreenGrId = 0x228b22,
  56. kFuchsiaGrId = 0xff00ff,
  57. kGainsboroGrId = 0xdcdcdc,
  58. kGhostWhiteGrId = 0xf8f8ff,
  59. kGoldGrId = 0xffd700,
  60. kGoldenRodGrId = 0xdaa520,
  61. kGrayGrId = 0x808080,
  62. kGreyGrId = 0x808080,
  63. kGreenGrId = 0x008000,
  64. kGreenYellowGrId = 0xadff2f,
  65. kHoneyDewGrId = 0xf0fff0,
  66. kHotPinkGrId = 0xff69b4,
  67. kIndianRedGrId = 0xcd5c5c,
  68. kIndigoGrId = 0x4b0082,
  69. kIvoryGrId = 0xfffff0,
  70. kKhakiGrId = 0xf0e68c,
  71. kLavenderGrId = 0xe6e6fa,
  72. kLavenderBlushGrId = 0xfff0f5,
  73. kLawnGreenGrId = 0x7cfc00,
  74. kLemonChiffonGrId = 0xfffacd,
  75. kLightBlueGrId = 0xadd8e6,
  76. kLightCoralGrId = 0xf08080,
  77. kLightCyanGrId = 0xe0ffff,
  78. kLightGoldenRodYellowGrId = 0xfafad2,
  79. kLightGrayGrId = 0xd3d3d3,
  80. kLightGreyGrId = 0xd3d3d3,
  81. kLightGreenGrId = 0x90ee90,
  82. kLightPinkGrId = 0xffb6c1,
  83. kLightSalmonGrId = 0xffa07a,
  84. kLightSeaGreenGrId = 0x20b2aa,
  85. kLightSkyBlueGrId = 0x87cefa,
  86. kLightSlateGrayGrId = 0x778899,
  87. kLightSlateGreyGrId = 0x778899,
  88. kLightSteelBlueGrId = 0xb0c4de,
  89. kLightYellowGrId = 0xffffe0,
  90. kLimeGrId = 0x00ff00,
  91. kLimeGreenGrId = 0x32cd32,
  92. kLinenGrId = 0xfaf0e6,
  93. kMagentaGrId = 0xff00ff,
  94. kMaroonGrId = 0x800000,
  95. kMediumAquaMarineGrId = 0x66cdaa,
  96. kMediumBlueGrId = 0x0000cd,
  97. kMediumOrchidGrId = 0xba55d3,
  98. kMediumPurpleGrId = 0x9370d8,
  99. kMediumSeaGreenGrId = 0x3cb371,
  100. kMediumSlateBlueGrId = 0x7b68ee,
  101. kMediumSpringGreenGrId = 0x00fa9a,
  102. kMediumTurquoiseGrId = 0x48d1cc,
  103. kMediumVioletRedGrId = 0xc71585,
  104. kMidnightBlueGrId = 0x191970,
  105. kMintCreamGrId = 0xf5fffa,
  106. kMistyRoseGrId = 0xffe4e1,
  107. kMoccasinGrId = 0xffe4b5,
  108. kNavajoWhiteGrId = 0xffdead,
  109. kNavyGrId = 0x000080,
  110. kOldLaceGrId = 0xfdf5e6,
  111. kOliveGrId = 0x808000,
  112. kOliveDrabGrId = 0x6b8e23,
  113. kOrangeGrId = 0xffa500,
  114. kOrangeRedGrId = 0xff4500,
  115. kOrchidGrId = 0xda70d6,
  116. kPaleGoldenRodGrId = 0xeee8aa,
  117. kPaleGreenGrId = 0x98fb98,
  118. kPaleTurquoiseGrId = 0xafeeee,
  119. kPaleVioletRedGrId = 0xd87093,
  120. kPapayaWhipGrId = 0xffefd5,
  121. kPeachPuffGrId = 0xffdab9,
  122. kPeruGrId = 0xcd853f,
  123. kPinkGrId = 0xffc0cb,
  124. kPlumGrId = 0xdda0dd,
  125. kPowderBlueGrId = 0xb0e0e6,
  126. kPurpleGrId = 0x800080,
  127. kRedGrId = 0xff0000,
  128. kRosyBrownGrId = 0xbc8f8f,
  129. kRoyalBlueGrId = 0x4169e1,
  130. kSaddleBrownGrId = 0x8b4513,
  131. kSalmonGrId = 0xfa8072,
  132. kSandyBrownGrId = 0xf4a460,
  133. kSeaGreenGrId = 0x2e8b57,
  134. kSeaShellGrId = 0xfff5ee,
  135. kSiennaGrId = 0xa0522d,
  136. kSilverGrId = 0xc0c0c0,
  137. kSkyBlueGrId = 0x87ceeb,
  138. kSlateBlueGrId = 0x6a5acd,
  139. kSlateGrayGrId = 0x708090,
  140. kSlateGreyGrId = 0x708090,
  141. kSnowGrId = 0xfffafa,
  142. kSpringGreenGrId = 0x00ff7f,
  143. kSteelBlueGrId = 0x4682b4,
  144. kTanGrId = 0xd2b48c,
  145. kTealGrId = 0x008080,
  146. kThistleGrId = 0xd8bfd8,
  147. kTomatoGrId = 0xff6347,
  148. kTurquoiseGrId = 0x40e0d0,
  149. kVioletGrId = 0xee82ee,
  150. kWheatGrId = 0xf5deb3,
  151. kWhiteGrId = 0xffffff,
  152. kWhiteSmokeGrId = 0xf5f5f5,
  153. kYellowGrId = 0xffff00,
  154. kYellowGreenGrId = 0x9acd32
  155. };
  156. typedef enum
  157. {
  158. kHomeGrId = 5, // 5
  159. kPageUpGrId, // 6
  160. kEndGrId, // 7
  161. kBackSpaceGrId = 8, // 8
  162. kTabGrId = 9, // 9
  163. kPageDownGrId, // 10
  164. kLeftGrId, // 11
  165. kUpGrId, // 12
  166. kEnterGrId = 13, // 13
  167. kRightGrId, // 14
  168. kDownGrId, // 15
  169. kInsertGrId, // 16
  170. kPrintGrId, // 17
  171. kScrollLockGrId, // 18
  172. kPauseGrId, // 19
  173. kMenuGrId, // 20
  174. kLShiftGrId, // 21
  175. kRShiftGrId, // 22
  176. kLCtrlGrId, // 23
  177. kRCtrlGrId, // 24
  178. kLAltGrId, // 25
  179. kRAltGrId, // 26
  180. kEscapeGrId = 27, // 27
  181. kLSuperGrId, // 28
  182. kRSuperGrId, // 29
  183. kNumLockGrId, // 30
  184. kCapsLockGrId, // 31
  185. kSpaceGrId = 32, // 32 Min. printable ASCII
  186. kExclMarkGrId, // 33
  187. kDQuoteGrId, // 34
  188. kPoundGrId, // 35
  189. kDollarGrId, // 36
  190. kPercentGrId, // 37
  191. kAmpersandGrId, // 38
  192. kApostropheGrId, // 39
  193. kLParenGrId, // 40
  194. kRParenGrId, // 41
  195. kAsteriskGrId, // 42
  196. kPlusGrId, // 43
  197. kCommaGrId, // 44
  198. kHyphenGrId, // 45
  199. kPeriodGrId, // 46
  200. kForwardSlashGrId, // 47
  201. k0GrId, // 48
  202. k1GrId, // 49
  203. k2GrId, // 50
  204. k3GrId, // 51
  205. k4GrId, // 52
  206. k5GrId, // 53
  207. k6GrId, // 54
  208. k7GrId, // 55
  209. k8GrId, // 56
  210. k9GrId, // 57
  211. kColonGrId, // 58
  212. kSemiColonGrId, // 59
  213. kLesserGrId, // 60
  214. kEqualGrId, // 61
  215. kGreaterGrId, // 62
  216. kQMarkGrId, // 63
  217. kAtGrId, // 64
  218. kA_GrId, // 65
  219. kB_GrId, // 66
  220. kC_GrId, // 67
  221. kD_GrId, // 68
  222. kE_GrId, // 69
  223. kF_GrId, // 70
  224. kG_GrId, // 71
  225. kH_GrId, // 72
  226. kI_GrId, // 73
  227. kJ_GrId, // 74
  228. kK_GrId, // 75
  229. kL_GrId, // 76
  230. kM_GrId, // 77
  231. kN_GrId, // 78
  232. kO_GrId, // 79
  233. kP_GrId, // 80
  234. kQ_GrId, // 81
  235. kR_GrId, // 82
  236. kS_GrId, // 83
  237. kT_GrId, // 84
  238. kU_GrId, // 85
  239. kV_GrId, // 86
  240. kW_GrId, // 87
  241. kX_GrId, // 88
  242. kY_GrId, // 89
  243. kZ_GrId, // 90
  244. kLBracketGrId, // 91
  245. kBackSlashGrId, // 92
  246. kRBracketGrId, // 93
  247. kCaretGrId, // 94
  248. kUnderScoreGrId, // 95
  249. kAccentGrId, // 96
  250. ka_GrId, // 97
  251. kb_GrId, // 98
  252. kc_GrId, // 99
  253. kd_GrId, // 100
  254. ke_GrId, // 101
  255. kf_GrId, // 102
  256. kg_GrId, // 103
  257. kh_GrId, // 104
  258. ki_GrId, // 105
  259. kj_GrId, // 106
  260. kk_GrId, // 107
  261. kl_GrId, // 108
  262. km_GrId, // 109
  263. kn_GrId, // 110
  264. ko_GrId, // 111
  265. kp_GrId, // 112
  266. kq_GrId, // 113
  267. kr_GrId, // 114
  268. ks_GrId, // 115
  269. kt_GrId, // 116
  270. ku_GrId, // 117
  271. kv_GrId, // 118
  272. kw_GrId, // 119
  273. kx_GrId, // 120
  274. ky_GrId, // 121
  275. kz_GrId, // 122
  276. kLBraceGrId, // 123
  277. kPipeGrId, // 124
  278. kRBraceGrId, // 125
  279. kTildeGrId, // 126
  280. kDeleteGrId, // 127
  281. kNP_MultGrId, // 128
  282. kNP_PlusGrId, // 129
  283. kNP_MinusGrId, // 130
  284. kNP_DecPtGrId, // 131
  285. kNP_DivGrId, // 132
  286. kNP_0GrId, // 133
  287. kNP_1GrId, // 134
  288. kNP_2GrId, // 135
  289. kNP_3GrId, // 136
  290. kNP_4GrId, // 137
  291. kNP_5GrId, // 138
  292. kNP_6GrId, // 139
  293. kNP_7GrId, // 140
  294. kNP_8GrId, // 141
  295. kNP_9GrId, // 142
  296. kNP_EqualGrId, // 143
  297. kNP_EnterGrId, // 144
  298. kFunc_1GrId, // 145
  299. kFunc_2GrId, // 146
  300. kFunc_3GrId, // 147
  301. kFunc_4GrId, // 148
  302. kFunc_5GrId, // 149
  303. kFunc_6GrId, // 150
  304. kFunc_7GrId, // 151
  305. kFunc_8GrId, // 152
  306. kFunc_9GrId, // 153
  307. kFunc_10GrId, // 154
  308. kFunc_11GrId, // 155
  309. kFunc_12GrId, // 156
  310. kBrightUpGrId, // 157
  311. kBrightDnGrId, // 158
  312. kAudio_PrevGrId, // 159
  313. kAudio_PlayGrId, // 160
  314. kAudio_NextGrId, // 161
  315. kAudio_MuteGrId, // 162
  316. kAudio_UpGrId, // 163
  317. kAudio_DnGrId, // 164
  318. kEjectGrId, // 165
  319. kInvalidKeyCodeGrId
  320. } cmGrKeyCodeId_t;
  321. enum
  322. {
  323. kMinAsciiGrId = kSpaceGrId,
  324. kMaxAsciiGrId = kDeleteGrId
  325. };
  326. enum
  327. {
  328. kOkGrRC,
  329. kLHeapFailGrRC,
  330. kAppErrGrRC,
  331. kRootObjCreateFailGrRC,
  332. kInvalidCoordsGrRC,
  333. kExtsErrGrRC
  334. };
  335. enum
  336. {
  337. kLeftGrFl = 0x01,
  338. kTopGrFl = 0x02,
  339. kRightGrFl = 0x04,
  340. kBottomGrFl = 0x08,
  341. };
  342. typedef enum
  343. {
  344. kLeftGrIdx = 0, // min-x
  345. kTopGrIdx = 1, // max-y
  346. kRightGrIdx = 2, // max-x
  347. kBottomGrIdx = 3, // min-y
  348. kAxisGrCnt = 4
  349. } cmGrAxisIdx_t;
  350. typedef cmHandle_t cmGrH_t;
  351. typedef cmHandle_t cmGrObjH_t;
  352. typedef cmHandle_t cmGrDcH_t;
  353. typedef unsigned cmGrRC_t;
  354. extern cmGrH_t cmGrNullHandle;
  355. extern cmGrObjH_t cmGrObjNullHandle;
  356. typedef cmReal_t cmGrV_t;
  357. //====================================================================================================
  358. // Calculate the width and height between two pixels.
  359. // This implies that the first and last pixel are inside the valid range.
  360. #define cmGrXtoW(x0,x1) (abs((x1)-(x0))+1)
  361. #define cmGrWtoX(x0,w) (((x0)+(w))-1)
  362. #define cmGrYtoH(y0,y1) (abs((y1)-(y0))+1)
  363. #define cmGrHtoY(y0,h) (((y0)+(h))-1)
  364. #define cmGrPIsXInRange(x,x0,w) ((x0)<=(x)&&(x)<=cmGrWtoX((x0),(w)))
  365. #define cmGrPIsYInRange(y,y0,h) ((y0)<=(y)&&(y)<=cmGrHtoY((y0),(h)))
  366. #define cmGrVIsXInRange(x,x0,w) ((x0)<=(x)&&(x)<=((x0)+(w)))
  367. #define cmGrVIsYInRange(y,y0,h) ((y0)<=(y)&&(y)<=((y0)+(h)))
  368. typedef struct
  369. {
  370. int x;
  371. int y;
  372. } cmGrPPt_t;
  373. #define cmGrPPtSet( p, xx, yy ) do{ (p)->x=(xx); (p)->y=(yy); }while(0)
  374. #define cmGrPPtIsEqual(p0,p1) ((p0)->x==(p1)->x && (p0)->y==(p1)->y)
  375. #define cmGrPPtPrint(lbl,p) printf("%s x=%i y=%i\n",(lbl),(p)->x,(p)->y)
  376. //====================================================================================================
  377. typedef struct
  378. {
  379. int w;
  380. int h;
  381. } cmGrPSz_t;
  382. #define cmGrPSzSet( s, ww, hh ) do{ (s)->w=(ww); (s)->h=(hh);}while(0)
  383. #define cmGrPSzSetD( s, x0, y0, x1, y1 ) cmGrPSzSet(cmGrXtoW(x0,x1),cmGrYtoH(y0,y1))
  384. #define cmGrPSzSetEmpty( s ) ((s)->w = (s)->h = 0)
  385. #define cmGrPSzSetNull( s ) ((s)->w = (s)->h = -1)
  386. #define cmGrPSzIsEmpty( s ) ((s)->w== 0 && (s)->h== 0)
  387. #define cmGrPSzIsNull( s ) ((s)->w==-1 && (s)->h==-1)
  388. #define cmGrPSzIsEqual(s0,s1) ((s0)->w==(s1)->w && (s0)->h==(s1)->h)
  389. #define cmGrPSzPrint(lbl,s) printf("%s w=%i h=%i\n",(lbl),(s)->w,(s)->h)
  390. //====================================================================================================
  391. typedef struct
  392. {
  393. cmGrPPt_t loc;
  394. cmGrPSz_t sz;
  395. } cmGrPExt_t;
  396. #define cmGrPExtSet( e, x, y, w, h ) do{ cmGrPPtSet(&(e)->loc,(x),(y)); cmGrPSzSet(&(e)->sz,(w),(h)); }while(0)
  397. #define cmGrPExtSetD(e, x0, y0, x1, y1) cmGrPExtSet(e,cmMin(x0,x1),cmMin(y0,y1),cmGrXtoW(x0,x1),cmGrYtoH(y0,y1))
  398. #define cmGrPExtL(e) ((e)->loc.x)
  399. #define cmGrPExtT(e) ((e)->loc.y)
  400. #define cmGrPExtR(e) (cmGrWtoX((e)->loc.x,(e)->sz.w))
  401. #define cmGrPExtB(e) (cmGrHtoY((e)->loc.y,(e)->sz.h))
  402. #define cmGrPExtW(e) ((e)->sz.w)
  403. #define cmGrPExtH(e) ((e)->sz.h)
  404. #define cmGrPExtSetL(e,v) ((e)->loc.x = (v))
  405. #define cmGrPExtSetT(e,v) ((e)->loc.y = (v))
  406. #define cmGrPExtSetR(e,v) cmGrPExtSetW(e,cmGrXtoW((e)->loc.x,(v)))
  407. #define cmGrPExtSetB(e,v) cmGrPExtSetH(e,cmGrYtoH((e)->loc.y,(v)))
  408. #define cmGrPExtSetW(e,v) ((e)->sz.w = (v))
  409. #define cmGrPExtSetH(e,v) ((e)->sz.h = (v))
  410. #define cmGrPExtCtrX(e) ((e)->loc.x + (e)->sz.w / 2)
  411. #define cmGrPExtCtrY(e) ((e)->loc.y + (e)->sz.h / 2)
  412. #define cmGrPExtCtr(e,pt) do{ (pt)->x=cmGrPExtCtrX(e); (pt)->y=cmGrPExtCtrY(e); }while(0)
  413. #define cmGrPExtSetEmpty( e ) do{ cmGrPSzSetEmpty(&(e)->sz); cmGrPPtSet(&(e)->loc,0,0); }while(0)
  414. #define cmGrPExtSetNull( e ) do{ cmGrPSzSetNull( &(e)->sz); cmGrPPtSet(&(e)->loc,0,0); }while(0)
  415. #define cmGrPExtIsEmpty( e ) cmGrPSzIsEmpty( &(e)->sz )
  416. #define cmGrPExtIsNull( e ) cmGrPSzIsNull( &(e)->sz )
  417. #define cmGrPExtIsNullOrEmpty(e) (cmGrPExtIsNull(e)||cmGrPExtIsEmpty(e))
  418. #define cmGrPExtIsNotEmpty(e) (!cmGrPExtIsEmpty(e))
  419. #define cmGrPExtIsNotNull(e) (!cmGrPExtIsNull(e))
  420. #define cmGrPExtIsNotNullOrEmpty(e) (cmGrPExtIsNotNull(e)||cmGrPExtIsNoEmpty(e))
  421. #define cmGrPExtIsEqual( e0, e1 ) (cmGrPPtIsEqual(&(e0)->loc,&(e1)->loc) && cmGrPSzIsEqual(&(e0)->sz, &(e1)->sz))
  422. #define cmGrPExtIsXyInside( e, xx, yy) (cmGrPIsXInRange((xx),(e)->loc.x,(e)->sz.w) && cmGrPIsYInRange((yy), (e)->loc.y, (e)->sz.h) )
  423. #define cmGrPExtIsPtInside( e, pt ) (cmGrPExtIsXyInside((e),(pt)->x,(pt)->y))
  424. #define cmGrPExtIsExtInside(e0, e1) (cmGrPExtIsPtInside((e0),&((e1)->loc)) && cmGrPExtIsXyInside((e0), cmGrWtoX((e1)->loc.x,(e1)->sz.w), cmGrHtoY((e1)->loc.y,(e1)->sz.h)))
  425. #define cmGrPExtExpand(e,l,t,r,b) do{(e)->loc.x+=(l); (e)->loc.y+=(t); (e)->sz.w+=(abs(l)+abs(r)); (e)->sz.h+=(abs(t)+abs(b));}while(0)
  426. #define cmGrPExtRpt(e,rpt) cmRptPrintf(rpt,"x:%i y:%i w:%i h:%i",(e)->loc.x,(e)->loc.y,(e)->sz.w,(e)->sz.h)
  427. #define cmGrPExtPrint(lbl,e) printf("%s %i %i %i %i\n",lbl,(e)->loc.x,(e)->loc.y,(e)->sz.w,(e)->sz.h)
  428. void cmGrPExtIntersect( cmGrPExt_t* r, const cmGrPExt_t* e0, const cmGrPExt_t* e1 );
  429. //====================================================================================================
  430. typedef struct
  431. {
  432. cmGrV_t x;
  433. cmGrV_t y;
  434. } cmGrVPt_t;
  435. #define cmGrVPtSet( p, xx, yy ) do{ (p)->x=(xx); (p)->y=(yy); }while(0)
  436. #define cmGrVPtIsEqual(p0,p1) ((p0)->x==(p1)->x && (p0)->y==(p1)->y)
  437. #define cmGrVPtIsNotEqual(p0,p1) (!cmGrVPtIsEqual(p0,p1))
  438. //====================================================================================================
  439. typedef struct
  440. {
  441. cmGrV_t w;
  442. cmGrV_t h;
  443. } cmGrVSz_t;
  444. #define cmGrVSzSet( s, ww, hh ) do{ (s)->w=(ww); (s)->h=(hh);}while(0)
  445. #define cmGrVSzSetD( s, x0, y0, x1, y1 ) cmGrVSzSet((x1)-(x0),(y1)-(y0))
  446. #define cmGrVSzSetEmpty( s ) ((s)->w = (s)->h = 0)
  447. #define cmGrVSzSetNull( s ) ((s)->w = (s)->h = -1)
  448. #define cmGrVSzIsEmpty( s ) ((s)->w== 0 && (s)->h== 0)
  449. #define cmGrVSzIsNull( s ) ((s)->w==-1 || (s)->h==-1)
  450. #define cmGrVSzIsEqual(s0,s1) ((s0)->w==(s1)->w && (s0)->h==(s1)->h)
  451. //====================================================================================================
  452. typedef struct
  453. {
  454. cmGrVPt_t loc;
  455. cmGrVSz_t sz;
  456. } cmGrVExt_t;
  457. #define cmGrVExtIsNorm( e ) ((e)->sz.w>=0 && (e)->sz.h>=0)
  458. #define cmGrVExtNorm( e ) do{ if( cmGrVExtIsNotNull(e) ){ if((e)->sz.w<0){(e)->loc.x += (e)->sz.w; (e)->sz.w*=-1;} if((e)->sz.h<0){(e)->loc.y += (e)->sz.h; (e)->sz.h*=-1;}} }while(0)
  459. #define cmGrVExtSet( e, x, y, w, h ) do{ cmGrVPtSet(&(e)->loc,(x),(y)); cmGrVSzSet(&(e)->sz,(w),(h)); cmGrVExtNorm(e); }while(0)
  460. #define cmGrVExtSetD(e, x0, y0, x1, y1) cmGrVExtSet((e),(x0),(y0),(x1)-(x0),(y1)-(y0))
  461. //
  462. // l,t minx,maxy
  463. // r,b maxx,miny
  464. //
  465. #define cmGrVExtMinX(e) ((e)->loc.x)
  466. #define cmGrVExtMinY(e) ((e)->loc.y)
  467. #define cmGrVExtMaxX(e) ((e)->loc.x + (e)->sz.w)
  468. #define cmGrVExtMaxY(e) ((e)->loc.y + (e)->sz.h)
  469. #define cmGrVExtW(e) ((e)->sz.w)
  470. #define cmGrVExtH(e) ((e)->sz.h)
  471. #define cmGrVExtSetMinX(e,v) ((e)->loc.x = (v))
  472. #define cmGrVExtSetMinY(e,v) ((e)->loc.y = (v))
  473. // Beware: setting maxx and maxy depends on the current value of minx and miny.
  474. // If both minx and maxx are being changed then be sure to set minx first.
  475. // If both miny and maxy are being changed then be sure to set miny first.
  476. #define cmGrVExtSetMaxX(e,v) ((e)->sz.w = (v) - cmGrVExtMinX(e))
  477. #define cmGrVExtSetMaxY(e,v) ((e)->sz.h = (v) - cmGrVExtMinY(e))
  478. #define cmGrVExtSetW(e,v) ((e)->sz.w = (v))
  479. #define cmGrVExtSetH(e,v) ((e)->sz.h = (v))
  480. #define cmGrVExtSetEmpty( e ) do{ cmGrVSzSetEmpty(&(e)->sz); cmGrVPtSet(&(e)->loc,0,0); }while(0)
  481. #define cmGrVExtSetNull( e ) do{ cmGrVSzSetNull(&(e)->sz); cmGrVPtSet(&(e)->loc,0,0); }while(0)
  482. #define cmGrVExtIsEmpty( e ) cmGrVSzIsEmpty(&(e)->sz)
  483. #define cmGrVExtIsNull( e ) cmGrVSzIsNull( &(e)->sz)
  484. #define cmGrVExtIsNullOrEmpty(e) (cmGrVExtIsNull(e)||cmGrVExtIsEmpty(e))
  485. #define cmGrVExtIsNotEmpty(e) (!cmGrVExtIsEmpty(e))
  486. #define cmGrVExtIsNotNull(e) (!cmGrVExtIsNull(e))
  487. #define cmGrVExtIsNotNullOrEmpty(e) (cmGrVExtIsNotNull(e)&&cmGrVExtIsNotEmpty(e))
  488. #define cmGrVExtIsEqual( e0, e1 ) (cmGrVPtIsEqual(&(e0)->loc,&(e1)->loc) && cmGrVSzIsEqual(&(e0)->sz, &(e1)->sz))
  489. #define cmGrVExtIsXyInside( e, xx, yy) (cmGrVIsXInRange((xx),(e)->loc.x,(e)->sz.w) && cmGrVIsYInRange((yy),(e)->loc.y,(e)->sz.h))
  490. #define cmGrVExtIsPtInside( e, pt ) (cmGrVExtIsXyInside((e),(pt)->x,(pt)->y))
  491. // e1 is inside e0
  492. #define cmGrVExtIsExtInside(e0, e1) (cmGrVExtIsXyInside((e0),cmGrVExtMinX(e1),cmGrVExtMinY(e1)) && cmGrVExtIsXyInside((e0), cmGrVExtMaxX(e1), cmGrVExtMaxY(e1)))
  493. #define cmGrVExtRpt(e,rpt) cmRptPrintf(rpt,"x:%f y:%f w:%f h:%f",(e)->loc.x,(e)->loc.y,(e)->sz.w,(e)->sz.h)
  494. #define cmGrVExtPrint(lbl,e) printf("%s %f %f %f %f\n",lbl,(e)->loc.x,(e)->loc.y,(e)->sz.w,(e)->sz.h)
  495. // Shift and expand e0 to contain e1. Return true if e0 actually changes.
  496. bool cmGrVExtExpandToContain( cmGrVExt_t* e0, const cmGrVExt_t* e1 );
  497. // Force e1 to be contained by e0 by shifting e1's location. This function
  498. // will never change the width or height of e1. Return true if e1 is changed.
  499. bool cmGrVExtContain( const cmGrVExt_t* e0, cmGrVExt_t* e1 );
  500. // Return the intersection of 'e0' with 'e1' in 'r'.
  501. void cmGrVExtIntersect( cmGrVExt_t* r, const cmGrVExt_t* e0, const cmGrVExt_t* e1 );
  502. //====================================================================================================
  503. #define cmGrRgbToColor( r, g, b ) (((r) << 16) + ((g) << 8) + (b))
  504. #define cmGrColorToR( c ) (((c) >> 16) & 0x000000ff)
  505. #define cmGrColorToG( c ) (((c) >> 8) & 0x000000ff)
  506. #define cmGrColorToB( c ) (((c) ) & 0x000000ff)
  507. typedef unsigned cmGrColor_t;
  508. enum { kGrDefaultColorMapIdx = 0, kGrDefaultColorMapId=0 };
  509. unsigned cmGrColorMapCount( cmGrH_t grH );
  510. unsigned cmGrColorMapId( cmGrH_t grH, unsigned mapIdx );
  511. const cmChar_t* cmGrColorMapLabel( cmGrH_t grH, unsigned id );
  512. unsigned cmGrColorMapRegister( cmGrH_t grH, cmChar_t* label, const cmGrColor_t* array, unsigned cnt );
  513. cmGrColor_t* cmGrColorMap( cmGrH_t grH, unsigned mapId );
  514. unsigned cmGrColorMapEleCount( cmGrH_t grH, unsigned mapId );
  515. //====================================================================================================
  516. typedef struct
  517. {
  518. cmCtx_t* ctx; // application context
  519. cmGrH_t grH; // graphics system handle to which this graphic object belongs
  520. cmGrObjH_t objH; // this graphics object handle
  521. void* cbArg; // user callback arg
  522. cmGrPPt_t msDnPPt; // mouse down phys point
  523. cmGrVPt_t msDnVPt; // mouse down virt point inside op->parent->wext
  524. cmGrVSz_t msDnVOffs; // virtual offset from mouse down point to msDnObj->vext
  525. cmGrObjH_t msDnObjH; // handle of object which recv'd mouse down
  526. cmGrVPt_t msVPt; // cur ms virtual point
  527. } cmGrObjFuncArgs_t;
  528. typedef cmGrRC_t (*cmGrCreateObjCb_t)( cmGrObjFuncArgs_t* args );
  529. typedef void (*cmGrDestroyObjCb_t)( cmGrObjFuncArgs_t* args );
  530. typedef bool (*cmGrRenderObjCb_t)( cmGrObjFuncArgs_t* args, cmGrDcH_t dcH );
  531. typedef int (*cmGrDistanceObjCb_t)( cmGrObjFuncArgs_t* args, int x, int y );
  532. typedef bool (*cmGrEventObjCb_t)( cmGrObjFuncArgs_t* args, unsigned flags, unsigned key, int px, int py );
  533. typedef void (*cmGrVExtObjCb_t)( cmGrObjFuncArgs_t* args, cmGrVExt_t* vext );
  534. typedef bool (*cmGrIsInsideObjCb_t)( cmGrObjFuncArgs_t* args, int px, int py, cmGrV_t vx, cmGrV_t vy );
  535. typedef struct cmGrObjFunc_str
  536. {
  537. // User defined constructor.
  538. cmGrCreateObjCb_t createCbFunc;
  539. void* createCbArg;
  540. // User defined destructor.
  541. cmGrDestroyObjCb_t destroyCbFunc;
  542. void* destroyCbArg;
  543. // Draw the object by calling back to the cmGrDrawXXX() functions
  544. cmGrRenderObjCb_t renderCbFunc;
  545. void* renderCbArg;
  546. // Return the physical distance from a physical view location to the object.
  547. // (NOT USED)
  548. cmGrDistanceObjCb_t distanceCbFunc;
  549. void* distanceCbArg;
  550. // Handle an event. gx,gy are in the same coord's as args.objH.vext (they are inside args.objH.parent.wext).
  551. // Return true if the event objects dirty flag should be set.
  552. cmGrEventObjCb_t eventCbFunc;
  553. void* eventCbArg;
  554. // Return the objects location and size inside op->parent->wext
  555. cmGrVExtObjCb_t vextCbFunc;
  556. void* vextCbArg;
  557. // Return true if the point is inside this obj. vx,vy is in the the same coord's as op->vext (i.e. vx,vy is inside op->parent->wext)
  558. // The simple answer to this call is cmGrVExtIsXyInside( *vext, vx, vy ).
  559. // Called to determine which object is under the mouse.
  560. cmGrIsInsideObjCb_t isInsideCbFunc;
  561. void* isInsideCbArg;
  562. } cmGrObjFunc_t;
  563. // Create a graphic object. This function calls the user defined (*create)() function.
  564. cmGrRC_t cmGrObjCreate( cmGrH_t h, cmGrObjH_t* hp, cmGrObjH_t parentH, cmGrObjFunc_t* f, unsigned id, unsigned flags, const cmGrVExt_t* wext );
  565. // Destroy a graphic object and all of it's children.
  566. // This function calls the user defined (*destroy)() function.
  567. cmGrRC_t cmGrObjDestroy( cmGrH_t h, cmGrObjH_t* hp );
  568. // Return true if 'oh' is a valid handle.
  569. cmGrRC_t cmGrObjIsValid( cmGrH_t h, cmGrObjH_t oh );
  570. // Return the user id associated with this object.
  571. unsigned cmGrObjId( cmGrObjH_t oh );
  572. void cmGrObjSetId( cmGrObjH_t oh, unsigned id );
  573. // Return the handle to the parent object.
  574. cmGrObjH_t cmGrObjParent( cmGrObjH_t oh );
  575. // An object world coord's are used to place child objects.
  576. cmGrRC_t cmGrObjSetWorldExt( cmGrH_t h, cmGrObjH_t oh, const cmGrVExt_t* vext );
  577. void cmGrObjWorldExt( cmGrObjH_t oh, cmGrVExt_t* vext );
  578. cmGrRC_t cmGrObjSetWorldLimitExt( cmGrH_t h, cmGrObjH_t oh, const cmGrVExt_t* vext, unsigned limitFlags );
  579. void cmGrObjWorldLimitExt( cmGrObjH_t oh, cmGrVExt_t* vext, unsigned* limitFlags );
  580. void cmGrObjSetCreateCb( cmGrObjH_t oh, cmGrCreateObjCb_t cbFunc, void* cbArg );
  581. void cmGrObjSetDestroyCb( cmGrObjH_t oh, cmGrDestroyObjCb_t cbFunc, void* cbArg );
  582. void cmGrObjSetRenderCb( cmGrObjH_t oh, cmGrRenderObjCb_t cbFunc, void* cbArg );
  583. void cmGrObjSetDistanceCb( cmGrObjH_t oh, cmGrDistanceObjCb_t cbFunc, void* cbArg );
  584. void cmGrObjSetEventCb( cmGrObjH_t oh, cmGrEventObjCb_t cbFunc, void* cbArg );
  585. void cmGrObjSetVExtCb( cmGrObjH_t oh, cmGrVExtObjCb_t cbFunc, void* cbArg );
  586. void cmGrObjSetIsInsideCb( cmGrObjH_t oh, cmGrIsInsideObjCb_t cbFunc, void* cbArg );
  587. cmGrCreateObjCb_t cmGrObjCreateCbFunc( cmGrObjH_t oh );
  588. cmGrDestroyObjCb_t cmGrObjDestroyCbFunc( cmGrObjH_t oh );
  589. cmGrRenderObjCb_t cmGrObjRenderCbFunc( cmGrObjH_t oh );
  590. cmGrDistanceObjCb_t cmGrObjDistanceCbFunc( cmGrObjH_t oh );
  591. cmGrEventObjCb_t cmGrObjEventCbFunc( cmGrObjH_t oh );
  592. cmGrVExtObjCb_t cmGrObjVExtCbFunc( cmGrObjH_t oh );
  593. cmGrIsInsideObjCb_t cmGrObjIsInsideCbFunc( cmGrObjH_t oh );
  594. void* cmGrObjCreateCbArg( cmGrObjH_t oh );
  595. void* cmGrObjDestroyCbArg( cmGrObjH_t oh );
  596. void* cmGrObjRenderCbArg( cmGrObjH_t oh );
  597. void* cmGrObjDistanceCbArg( cmGrObjH_t oh );
  598. void* cmGrObjEventCbArg( cmGrObjH_t oh );
  599. void* cmGrObjVExtCbArg( cmGrObjH_t oh );
  600. void* cmGrObjIsInsideCbArg( cmGrObjH_t oh );
  601. // Same as call to user defined (*vect)().
  602. void cmGrObjLocalVExt( cmGrH_t h, cmGrObjH_t oh, cmGrVExt_t* vext );
  603. // Given an objects id return it's handle.
  604. cmGrObjH_t cmGrObjIdToHandle( cmGrH_t h, unsigned id );
  605. // Move 'aoH' such that it is drawn above 'boH' in the z-order.
  606. // This means that 'boH' will be drawn before 'aoH'.
  607. void cmGrObjDrawAbove( cmGrObjH_t boH, cmGrObjH_t aoH );
  608. void cmGrObjReport( cmGrH_t h, cmGrObjH_t oh, cmRpt_t* rpt );
  609. void cmGrObjReportR( cmGrH_t h, cmGrObjH_t oh, cmRpt_t* rpt ); // print children
  610. //====================================================================================================
  611. // Drawing Functions - called by objects to draw themselves
  612. int cmGrX_VtoP( cmGrH_t hh, cmGrObjH_t oh, cmGrV_t y );
  613. int cmGrY_VtoP( cmGrH_t hh, cmGrObjH_t oh, cmGrV_t x );
  614. void cmGrXY_VtoP( cmGrH_t hh, cmGrObjH_t oh, cmGrV_t x, cmGrV_t y, cmGrPPt_t* rp );
  615. void cmGrXYWH_VtoP( cmGrH_t hh, cmGrObjH_t oh, cmGrV_t x, cmGrV_t y, cmGrV_t w, cmGrV_t h, cmGrPExt_t* pext );
  616. void cmGrVExt_VtoP( cmGrH_t hh, cmGrObjH_t oh, const cmGrVExt_t* vext, cmGrPExt_t* pext );
  617. void cmGrXY_PtoV( cmGrH_t hh, cmGrObjH_t oh, int x, int y, cmGrVPt_t* rp );
  618. void cmGrXYWH_PtoV( cmGrH_t hh, cmGrObjH_t oh, int x, int y, int w, int h, cmGrVExt_t* vext );
  619. void cmGrPExt_PtoV( cmGrH_t hh, cmGrObjH_t oh, const cmGrPExt_t* pext, cmGrVExt_t* vext );
  620. void cmGrDrawVLine( cmGrH_t hh, cmGrDcH_t dcH, cmGrObjH_t oh, cmGrV_t x0, cmGrV_t y0, cmGrV_t x1, cmGrV_t y1 );
  621. void cmGrDrawVRect( cmGrH_t hh, cmGrDcH_t dcH, cmGrObjH_t oh, cmGrV_t x, cmGrV_t y, cmGrV_t w, cmGrV_t h );
  622. //====================================================================================================
  623. // Callback identifiers
  624. typedef enum
  625. {
  626. kCreateCbGrId,
  627. kDestroyCbGrId,
  628. kLocalPtCbGrId,
  629. kGlobalPtCbGrId,
  630. kPhysExtCbGrId,
  631. kViewExtCbGrId,
  632. kSelectExtCbGrId,
  633. kFocusCbGrId,
  634. kKeyUpCbGrId,
  635. kKeyDnCbGrId
  636. } cmGrCbId_t;
  637. // Callback function associated with this canvas.
  638. typedef void (*cmGrCbFunc_t)( void* arg, cmGrH_t grH, cmGrCbId_t id, unsigned evtFlags, cmGrKeyCodeId_t keycode );
  639. // Configuration Flags
  640. enum
  641. {
  642. kExpandViewGrFl = 0x01, // expand the view to show new objects
  643. kSelectHorzGrFl = 0x02, // select along x-axis only
  644. kSelectVertGrFl = 0x04 // select along y-axis only
  645. };
  646. // 'wext' is optional.
  647. // 'id' is an arbitrary user definable identifier - although it is used
  648. // as the view index by cmGrPage().
  649. cmGrRC_t cmGrCreate(
  650. cmCtx_t* ctx,
  651. cmGrH_t* hp,
  652. unsigned id,
  653. unsigned cfgFlags,
  654. cmGrCbFunc_t cbFunc,
  655. void* cbArg,
  656. const cmGrVExt_t* wext ); // Optional internal world extents for this object
  657. // Destroy this canvas.
  658. cmGrRC_t cmGrDestroy( cmGrH_t* hp );
  659. // Remove all objects from the root object and restore the canvas to it's default state.
  660. cmGrRC_t cmGrClear( cmGrH_t h );
  661. // Get the root object handle
  662. cmGrObjH_t cmGrRootObjH( cmGrH_t h );
  663. // Get and set the configuration flags (e.g. kExpandViewGrFl | kSelectHorzGrFl | kSelectVertHorzGrFl )
  664. unsigned cmGrCfgFlags( cmGrH_t h );
  665. void cmGrSetCfgFlags( cmGrH_t h, unsigned cfgFlags );
  666. // Draw the objects on the canvas.
  667. cmGrRC_t cmGrDraw( cmGrH_t h, cmGrDcH_t dcH );
  668. // event flags
  669. enum
  670. {
  671. kMsDownGrFl = 0x0001,
  672. kMsUpGrFl = 0x0002,
  673. kMsMoveGrFl = 0x0004,
  674. kMsWheelGrFl= 0x0008,
  675. kMsDragGrFl = 0x0010,
  676. kMsClickGrFl= 0x0020,
  677. kKeyDnGrFl = 0x0040,
  678. kKeyUpGrFl = 0x0080,
  679. kMsEvtMask = 0x02f,
  680. kEvtMask = 0x00ff,
  681. kMsLBtnGrFl = 0x0100,
  682. kMsCBtnGrFl = 0x0200,
  683. kMsRBtnGrFl = 0x0400,
  684. kShiftKeyGrFl = 0x0800,
  685. kAltKeyGrFl = 0x1000,
  686. kCtlKeyGrFl = 0x2000,
  687. };
  688. // Receive a UI event.
  689. bool cmGrEvent( cmGrH_t h, unsigned flags, cmGrKeyCodeId_t key, int x, int y );
  690. // Return true if 'h' is valid.
  691. bool cmGrIsValid( cmGrH_t h );
  692. // Return the user defined 'id' set in cmGrCreate()
  693. unsigned cmGrId( cmGrH_t h );
  694. // Return the last mouse location in root object coordinates.
  695. const cmGrVPt_t* cmGrGlobalPt( cmGrH_t h );
  696. // Return the last mouse location in coordinates of the object the mouse was over.
  697. const cmGrVPt_t* cmGrLocalPt( cmGrH_t h );
  698. // The new view extents must fit inside the world extents.
  699. // Return true if the view extents actually changed.
  700. bool cmGrSetViewExtents( cmGrH_t hh, cmGrV_t minx, cmGrV_t miny, cmGrV_t maxx, cmGrV_t maxy );
  701. bool cmGrSetViewExtentsE(cmGrH_t h, const cmGrVExt_t* ext );
  702. void cmGrViewExtents( cmGrH_t h, cmGrVExt_t* exts );
  703. // View Location
  704. // Return true if the phys extents actually changed.
  705. bool cmGrSetPhysExtents( cmGrH_t hh, int x, int y, int w, int h );
  706. bool cmGrSetPhysExtentsE(cmGrH_t h, const cmGrPExt_t* ext );
  707. void cmGrPhysExtents( cmGrH_t h, cmGrPExt_t* exts );
  708. // Return some scroll bar values for this canvas.
  709. // tot=world pixels, vis=vis pixels, max=max scroll pos pos=cur scroll pos
  710. // All return values are optional.
  711. void cmGrScrollExtents( cmGrH_t h, cmGrPSz_t* tot, cmGrPSz_t* vis, cmGrPSz_t* max, cmGrPPt_t* pos );
  712. // Return true if the view location actually changed.
  713. bool cmGrSetScrollH( cmGrH_t h, int x );
  714. int cmGrScrollH( cmGrH_t h );
  715. bool cmGrSetScrollV( cmGrH_t h, int y );
  716. int cmGrScrollV( cmGrH_t h );
  717. // Get the current selection extents.
  718. // If the selection extents are not valid then the function returns false
  719. // and sets the return extents to their null state.
  720. bool cmGrSelectExtents( cmGrH_t h, cmGrVExt_t* vext, cmGrPExt_t* pext );
  721. // Both pts are optional
  722. void cmGrSetSelectPoints(cmGrH_t h, const cmGrVPt_t* pt0, const cmGrVPt_t* pt1 );
  723. void cmGrSelectPoints( cmGrH_t h, cmGrVPt_t* pt0, cmGrVPt_t* pt1 );
  724. enum { kZoomInGrFl=0x01, kXAxisGrFl=0x02, kYAxisGrFl=0x04, kSelectGrFl=0x08, kShowAllGrFl=0x10 };
  725. // 1) If kSelectGrFl is not set then the center 1/3 of the current view
  726. // becomes the new view.
  727. // 2) If kSelectGrFl is set then the selection area becomes the view.
  728. // 3) If kSelectGrFl is set but no selection area exists then
  729. // option 1) is selected used and using the selection point as center.
  730. void cmGrZoom( cmGrH_t h, unsigned flags );
  731. // Synchronize the 'syncGrH' horz. and/or verical, world,view,select extents to
  732. // this gr's extents. Changes to this gr's extents will be automatically
  733. // applied to 'syncGrH'.
  734. // If 'syncGrH' was used in a previous call to this function then flags will
  735. // modify the previously set flags value.
  736. // Clear the kHorzSyncFl and kVertSyncFl to disable the synchronization.
  737. // Set flags to 0 to prevent future sync calls.
  738. enum { kWorldSyncGrFl=0x01, kViewSyncGrFl=0x02, kSelectSyncGrFl=0x04, kHorzSyncGrFl=0x08, kVertSyncGrFl=0x10 };
  739. void cmGrSetSync( cmGrH_t h, cmGrH_t syncGrH, unsigned flags );
  740. void cmGrReport( cmGrH_t h, cmRpt_t* rpt );
  741. #ifdef __cplusplus
  742. }
  743. #endif
  744. #endif