libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cmGr.h 34KB

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