rsence-pre 2.1.0.1.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. data/.yardopts +10 -0
  2. data/INSTALL.rdoc +330 -0
  3. data/LICENSE.txt +622 -0
  4. data/README.rdoc +98 -0
  5. data/VERSION +1 -0
  6. data/bin/rsence +25 -0
  7. data/bin/rsence-pre +25 -0
  8. data/conf/default_conf.yaml +346 -0
  9. data/conf/default_strings.yaml +76 -0
  10. data/conf/rsence_command_strings.yaml +444 -0
  11. data/docs/ExampleGuiPlugin.rdoc +193 -0
  12. data/docs/JavascriptBundles.rdoc +0 -0
  13. data/docs/PluginBundleInfo.rdoc +173 -0
  14. data/docs/PluginBundles.rdoc +96 -0
  15. data/docs/Values.rdoc +163 -0
  16. data/js/comm/autosync/autosync.js +17 -0
  17. data/js/comm/autosync/js.inc +0 -0
  18. data/js/comm/comm.js +203 -0
  19. data/js/comm/js.inc +0 -0
  20. data/js/comm/jsloader/js.inc +0 -0
  21. data/js/comm/jsloader/jsloader.js +112 -0
  22. data/js/comm/queue/js.inc +0 -0
  23. data/js/comm/queue/queue.js +184 -0
  24. data/js/comm/session/js.inc +0 -0
  25. data/js/comm/session/session.js +52 -0
  26. data/js/comm/sessionwatcher/js.inc +0 -0
  27. data/js/comm/sessionwatcher/sessionwatcher.js +44 -0
  28. data/js/comm/transporter/js.inc +0 -0
  29. data/js/comm/transporter/transporter.js +261 -0
  30. data/js/comm/urlresponder/js.inc +0 -0
  31. data/js/comm/urlresponder/urlresponder.js +149 -0
  32. data/js/comm/values/js.inc +0 -0
  33. data/js/comm/values/values.js +433 -0
  34. data/js/controls/button/button.js +72 -0
  35. data/js/controls/button/js.inc +0 -0
  36. data/js/controls/button/themes/bright/button.css +89 -0
  37. data/js/controls/button/themes/bright/button.html +7 -0
  38. data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
  39. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  40. data/js/controls/button/themes/default/button.css +89 -0
  41. data/js/controls/button/themes/default/button.html +7 -0
  42. data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
  43. data/js/controls/button/themes/default/button_parts1.png +0 -0
  44. data/js/controls/checkbox/checkbox.js +49 -0
  45. data/js/controls/checkbox/js.inc +0 -0
  46. data/js/controls/checkbox/themes/default/checkbox.css +69 -0
  47. data/js/controls/checkbox/themes/default/checkbox.html +5 -0
  48. data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
  49. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  50. data/js/controls/dialogs/alert_sheet/alert_sheet.js +63 -0
  51. data/js/controls/dialogs/alert_sheet/js.inc +0 -0
  52. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +37 -0
  53. data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
  54. data/js/controls/dialogs/sheet/js.inc +0 -0
  55. data/js/controls/dialogs/sheet/sheet.js +84 -0
  56. data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
  57. data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
  58. data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
  59. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  60. data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
  61. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  62. data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
  63. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  64. data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
  65. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  66. data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
  67. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  68. data/js/controls/imageview/imageview.js +109 -0
  69. data/js/controls/imageview/js.inc +0 -0
  70. data/js/controls/imageview/themes/default/blank.gif +0 -0
  71. data/js/controls/passwordcontrol/js.inc +0 -0
  72. data/js/controls/passwordcontrol/passwordcontrol.js +23 -0
  73. data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
  74. data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
  75. data/js/controls/progress/progressbar/js.inc +0 -0
  76. data/js/controls/progress/progressbar/progressbar.js +40 -0
  77. data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
  78. data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
  79. data/js/controls/progress/progressindicator/js.inc +0 -0
  80. data/js/controls/progress/progressindicator/progressindicator.js +44 -0
  81. data/js/controls/radiobutton/js.inc +0 -0
  82. data/js/controls/radiobutton/radiobutton.js +43 -0
  83. data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
  84. data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
  85. data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
  86. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  87. data/js/controls/sliders/slider/js.inc +0 -0
  88. data/js/controls/sliders/slider/slider.js +357 -0
  89. data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
  90. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  91. data/js/controls/sliders/slider/themes/default/slider.css +108 -0
  92. data/js/controls/sliders/slider/themes/default/slider.html +5 -0
  93. data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
  94. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  95. data/js/controls/sliders/vslider/js.inc +0 -0
  96. data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
  97. data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
  98. data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
  99. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  100. data/js/controls/sliders/vslider/vslider.js +41 -0
  101. data/js/controls/stepper/js.inc +0 -0
  102. data/js/controls/stepper/stepper.js +213 -0
  103. data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
  104. data/js/controls/stepper/themes/default/stepper.css +14 -0
  105. data/js/controls/stepper/themes/default/stepper.html +2 -0
  106. data/js/controls/stepper/themes/default/stepper.png +0 -0
  107. data/js/controls/stringview/js.inc +0 -0
  108. data/js/controls/stringview/stringview.js +49 -0
  109. data/js/controls/stringview/themes/default/stringview.css +8 -0
  110. data/js/controls/stringview/themes/default/stringview.html +1 -0
  111. data/js/controls/tab/js.inc +0 -0
  112. data/js/controls/tab/tab.js +280 -0
  113. data/js/controls/tab/themes/bright/tab.css +76 -0
  114. data/js/controls/tab/themes/bright/tab.html +6 -0
  115. data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
  116. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  117. data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
  118. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  119. data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
  120. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  121. data/js/controls/tab/themes/default/tab.css +77 -0
  122. data/js/controls/tab/themes/default/tab.html +6 -0
  123. data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
  124. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  125. data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
  126. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  127. data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
  128. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  129. data/js/controls/textarea/js.inc +0 -0
  130. data/js/controls/textarea/textarea.js +24 -0
  131. data/js/controls/textarea/themes/default/textarea.css +21 -0
  132. data/js/controls/textarea/themes/default/textarea.html +18 -0
  133. data/js/controls/textcontrol/js.inc +0 -0
  134. data/js/controls/textcontrol/textcontrol.js +374 -0
  135. data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
  136. data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
  137. data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
  138. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  139. data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
  140. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  141. data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
  142. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  143. data/js/controls/uploader/js.inc +0 -0
  144. data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
  145. data/js/controls/uploader/themes/default/uploader.css +108 -0
  146. data/js/controls/uploader/themes/default/uploader.html +27 -0
  147. data/js/controls/uploader/uploader.js +154 -0
  148. data/js/controls/validatorview/js.inc +0 -0
  149. data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
  150. data/js/controls/validatorview/themes/default/validator.png +0 -0
  151. data/js/controls/validatorview/themes/default/validatorview.css +0 -0
  152. data/js/controls/validatorview/themes/default/validatorview.html +0 -0
  153. data/js/controls/validatorview/validatorview.js +62 -0
  154. data/js/controls/window/js.inc +0 -0
  155. data/js/controls/window/themes/default/window.css +219 -0
  156. data/js/controls/window/themes/default/window.html +17 -0
  157. data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
  158. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  159. data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
  160. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  161. data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
  162. data/js/controls/window/themes/default/window_buttons.png +0 -0
  163. data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
  164. data/js/controls/window/themes/default/window_parts1.png +0 -0
  165. data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
  166. data/js/controls/window/themes/default/window_parts2.png +0 -0
  167. data/js/controls/window/window.js +286 -0
  168. data/js/core/class/class.js +318 -0
  169. data/js/core/class/js.inc +0 -0
  170. data/js/core/elem/elem.js +1383 -0
  171. data/js/core/elem/js.inc +0 -0
  172. data/js/core/event/event.js +153 -0
  173. data/js/core/event/js.inc +0 -0
  174. data/js/core/iefix/ie_css_element.htc +5 -0
  175. data/js/core/iefix/ie_css_style.htc +5 -0
  176. data/js/core/iefix/iefix.js +359 -0
  177. data/js/core/iefix/js.inc +0 -0
  178. data/js/core/rsence_ns/js.inc +0 -0
  179. data/js/core/rsence_ns/rsence_ns.js +21 -0
  180. data/js/datetime/calendar/calendar.js +198 -0
  181. data/js/datetime/calendar/js.inc +0 -0
  182. data/js/datetime/calendar/themes/default/calendar.css +108 -0
  183. data/js/datetime/calendar/themes/default/calendar.html +9 -0
  184. data/js/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
  185. data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  186. data/js/datetime/datetimevalue/datetimevalue.js +247 -0
  187. data/js/datetime/datetimevalue/js.inc +0 -0
  188. data/js/datetime/timesheet/js.inc +0 -0
  189. data/js/datetime/timesheet/themes/default/timesheet.css +30 -0
  190. data/js/datetime/timesheet/themes/default/timesheet.html +2 -0
  191. data/js/datetime/timesheet/timesheet.js +183 -0
  192. data/js/datetime/timesheet_item/js.inc +0 -0
  193. data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
  194. data/js/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
  195. data/js/datetime/timesheet_item/timesheet_item.js +248 -0
  196. data/js/datetime/timesheet_item_edit/js.inc +0 -0
  197. data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
  198. data/js/foundation/application/application.js +208 -0
  199. data/js/foundation/application/js.inc +0 -0
  200. data/js/foundation/control/control.js +339 -0
  201. data/js/foundation/control/controldefaults/controldefaults.js +56 -0
  202. data/js/foundation/control/controldefaults/js.inc +0 -0
  203. data/js/foundation/control/dummyvalue/dummyvalue.js +51 -0
  204. data/js/foundation/control/dummyvalue/js.inc +0 -0
  205. data/js/foundation/control/dyncontrol/dyncontrol.js +500 -0
  206. data/js/foundation/control/dyncontrol/js.inc +0 -0
  207. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
  208. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
  209. data/js/foundation/control/eventresponder/eventresponder.js +750 -0
  210. data/js/foundation/control/eventresponder/js.inc +0 -0
  211. data/js/foundation/control/js.inc +0 -0
  212. data/js/foundation/control/valuematrix/js.inc +0 -0
  213. data/js/foundation/control/valuematrix/valuematrix.js +135 -0
  214. data/js/foundation/control/valueresponder/js.inc +0 -0
  215. data/js/foundation/control/valueresponder/valueresponder.js +79 -0
  216. data/js/foundation/eventmanager/eventmanager.js +991 -0
  217. data/js/foundation/eventmanager/js.inc +0 -0
  218. data/js/foundation/geom/point/js.inc +0 -0
  219. data/js/foundation/geom/point/point.js +202 -0
  220. data/js/foundation/geom/rect/js.inc +0 -0
  221. data/js/foundation/geom/rect/rect.js +651 -0
  222. data/js/foundation/json_renderer/js.inc +0 -0
  223. data/js/foundation/json_renderer/json_renderer.js +246 -0
  224. data/js/foundation/system/js.inc +0 -0
  225. data/js/foundation/system/system.js +381 -0
  226. data/js/foundation/thememanager/js.inc +0 -0
  227. data/js/foundation/thememanager/thememanager.js +393 -0
  228. data/js/foundation/value/js.inc +0 -0
  229. data/js/foundation/value/value.js +183 -0
  230. data/js/foundation/view/js.inc +0 -0
  231. data/js/foundation/view/markupview/js.inc +0 -0
  232. data/js/foundation/view/markupview/markupview.js +114 -0
  233. data/js/foundation/view/morphanimation/js.inc +0 -0
  234. data/js/foundation/view/morphanimation/morphanimation.js +237 -0
  235. data/js/foundation/view/view.js +1812 -0
  236. data/js/foundation/view/viewdefaults/js.inc +0 -0
  237. data/js/foundation/view/viewdefaults/viewdefaults.js +26 -0
  238. data/js/lists/checkboxlist/checkboxlist.js +171 -0
  239. data/js/lists/checkboxlist/js.inc +0 -0
  240. data/js/lists/listitems/js.inc +0 -0
  241. data/js/lists/listitems/listitems.js +88 -0
  242. data/js/lists/propertylist/js.inc +0 -0
  243. data/js/lists/propertylist/propertylist.js +326 -0
  244. data/js/lists/radiobuttonlist/js.inc +0 -0
  245. data/js/lists/radiobuttonlist/radiobuttonlist.js +116 -0
  246. data/js/util/reloadapp/js.inc +0 -0
  247. data/js/util/reloadapp/reloadapp.js +152 -0
  248. data/js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
  249. data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
  250. data/js/util/sha/js.inc +0 -0
  251. data/js/util/sha/sha.js +426 -0
  252. data/js/views/centerview/centerview.js +75 -0
  253. data/js/views/centerview/js.inc +0 -0
  254. data/js/views/inlineview/inlineview.js +15 -0
  255. data/js/views/inlineview/js.inc +0 -0
  256. data/js/views/scrollview/js.inc +0 -0
  257. data/js/views/scrollview/scrollview.js +40 -0
  258. data/lib/conf/argv.rb +850 -0
  259. data/lib/conf/default.rb +219 -0
  260. data/lib/daemon/daemon.rb +387 -0
  261. data/lib/daemon/sigcomm.rb +64 -0
  262. data/lib/http/broker.rb +150 -0
  263. data/lib/http/rackup.rb +91 -0
  264. data/lib/http/request.rb +66 -0
  265. data/lib/http/response.rb +65 -0
  266. data/lib/plugins/dependencies.rb +285 -0
  267. data/lib/plugins/gui_plugin.rb +160 -0
  268. data/lib/plugins/guiparser.rb +123 -0
  269. data/lib/plugins/plugin.rb +438 -0
  270. data/lib/plugins/plugin_base.rb +162 -0
  271. data/lib/plugins/plugin_plugins.rb +81 -0
  272. data/lib/plugins/plugin_sqlite_db.rb +98 -0
  273. data/lib/plugins/pluginmanager.rb +635 -0
  274. data/lib/plugins/plugins.rb +169 -0
  275. data/lib/plugins/servlet.rb +108 -0
  276. data/lib/rsence.rb +32 -0
  277. data/lib/session/msg.rb +327 -0
  278. data/lib/session/sessionmanager.rb +522 -0
  279. data/lib/session/sessionstorage.rb +340 -0
  280. data/lib/transporter/transporter.rb +263 -0
  281. data/lib/util/gzstring.rb +9 -0
  282. data/lib/util/ruby19_fixes.rb +18 -0
  283. data/lib/values/hvalue.rb +378 -0
  284. data/lib/values/valuemanager.rb +172 -0
  285. data/plugins/client_pkg/client_pkg.rb +157 -0
  286. data/plugins/client_pkg/info.yaml +25 -0
  287. data/plugins/client_pkg/lib/client_pkg_build.rb +561 -0
  288. data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
  289. data/plugins/client_pkg/lib/client_pkg_serve.rb +218 -0
  290. data/plugins/index_html/img/loading.gif +0 -0
  291. data/plugins/index_html/img/riassence.gif +0 -0
  292. data/plugins/index_html/index_html.rb +120 -0
  293. data/plugins/index_html/info.yaml +18 -0
  294. data/plugins/index_html/tmpl/index.html +15 -0
  295. data/plugins/main/info.yaml +18 -0
  296. data/plugins/main/js/main.js +84 -0
  297. data/plugins/main/main.rb +255 -0
  298. data/plugins/main/values.yaml +8 -0
  299. data/plugins/ticket/info.yaml +21 -0
  300. data/plugins/ticket/lib/common.rb +392 -0
  301. data/plugins/ticket/lib/favicon.rb +39 -0
  302. data/plugins/ticket/lib/file.rb +58 -0
  303. data/plugins/ticket/lib/img.rb +50 -0
  304. data/plugins/ticket/lib/objblob.rb +66 -0
  305. data/plugins/ticket/lib/rsrc.rb +34 -0
  306. data/plugins/ticket/lib/upload.rb +236 -0
  307. data/plugins/ticket/ticket.rb +333 -0
  308. data/setup/welcome/gui/welcome.yaml +92 -0
  309. data/setup/welcome/info.yaml +13 -0
  310. data/setup/welcome/text/welcome.html +9 -0
  311. data/setup/welcome/values.yaml +9 -0
  312. data/setup/welcome/welcome.rb +54 -0
  313. metadata +407 -0
@@ -0,0 +1,651 @@
1
+ /* RSence
2
+ * Copyright 2006 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+ /*** = Description
10
+ ** A Rect object represents a rectangle. Rects are used throughout the
11
+ ** Components to define the frames of windows, views, bitmaps even the
12
+ ** screen itself. A HRect is defined by its four sides, expressed as the public
13
+ ** data members left, top, right, and bottom.
14
+ **
15
+ ** If you change a component's rect, you should call its HView.drawRect method.
16
+ **
17
+ ** = Instance Variables
18
+ ** +type+:: '[HRect]'
19
+ ** +top+:: The position of the rect's top side (from parent top)
20
+ ** +left+:: The position of the rect's left side (from parent left)
21
+ ** +bottom+:: The position of the rect's bottom side (from parent top)
22
+ ** +right+:: The position of the rect's right side (from parent left)
23
+ ** +leftTop+:: A HPoint representing the coordinate of the rect's left top corner
24
+ ** +leftBottom+:: A HPoint representing the coordinate of the rect's left bottom corner
25
+ ** +rightTop+:: A HPoint representing the coordinate of the rect's right top corner
26
+ ** +rightBottom+:: A HPoint representing the coordinate of the rect's right bottom corner
27
+ ** +width+:: The width of the rect.
28
+ ** +height+:: The height of the rect.
29
+ ***/
30
+ var//RSence.Foundation.Geom
31
+ HRect = HClass.extend({
32
+ /** = Description
33
+ * Initializes a Rect as four sides, as two diametrically opposed corners,
34
+ * or as a copy of some other Rect object. A rectangle that's not assigned
35
+ * any initial values is invalid, until a specific assignment is made, either
36
+ * through a set() function or by setting the object's data members directly.
37
+ *
38
+ * = Parameters
39
+ * using a HRect instance:
40
+ * +rect+:: Another HRect.
41
+ *
42
+ * using two HPoint instances:
43
+ * +leftTop+:: Coordinates of the left top corner.
44
+ * +rightBottom+:: Coordinates of the right bottom corner.
45
+ *
46
+ * using separate numeric coordinates:
47
+ * +left+:: The coordinate of left side.
48
+ * +top+:: The coordinate of top side.
49
+ * +right+:: The coordinate of right side.
50
+ * +bottom+:: The coordinate of bottom side.
51
+ *
52
+ * = Usage
53
+ * var myLeftTopPoint = new HPoint(100,200);
54
+ * var myBottomRightPoint = new HPoint(300,400);
55
+ * var myRectFromOppositeCornerPoints = new HRect( myLeftTopPoint, myBottomRightPoint );
56
+ * var myRectFromSideCoordinates = new HRect(100,200,300,400);
57
+ * var myRectFromAnotherRect = new HRect( myRectFromEdgeCoordinates );
58
+ *
59
+ **/
60
+ constructor: function() {
61
+ this.viewIds = [];
62
+ var _args=arguments;
63
+
64
+ if (_args.length === 0) {
65
+ this._constructorDefault();
66
+ } else if (_args.length === 4) {
67
+ this._constructorSides(_args[0],_args[1],_args[2],_args[3]);
68
+ }
69
+ else if (_args.length === 2) {
70
+ this._constructorPoint(_args[0],_args[1]);
71
+ }
72
+ else if (_args.length === 1) {
73
+ if(_args[0] instanceof Array){
74
+ this._constructorSides(_args[0][0],_args[0][1],_args[0][2],_args[0][3]);
75
+ }
76
+ else{
77
+ this._constructorRect(_args[0]);
78
+ }
79
+ }
80
+ else {
81
+ throw "Invalid number of arguments.";
82
+ }
83
+ this.updateSecondaryValues();
84
+ },
85
+ _constructorDefault: function() {
86
+ this.top = 0;
87
+ this.left = 0;
88
+ this.bottom = -1;
89
+ this.right = -1;
90
+ },
91
+ _constructorSides: function(_left, _top, _right, _bottom) {
92
+ this.top = _top;
93
+ this.left = _left;
94
+ this.bottom = _bottom;
95
+ this.right = _right;
96
+ },
97
+ _constructorPoint: function(_leftTop, _rightBottom) {
98
+ this.top = _leftTop.y;
99
+ this.left = _leftTop.x;
100
+ this.bottom = _rightBottom.y;
101
+ this.right = _rightBottom.x;
102
+ },
103
+ _constructorRect: function(_rect) {
104
+ this.top = _rect.top;
105
+ this.left = _rect.left;
106
+ this.bottom = _rect.bottom;
107
+ this.right = _rect.right;
108
+ },
109
+
110
+ _updateFlexibleDimensions: function(){
111
+ var
112
+ _this = this,
113
+ _viewIds = _this.viewIds,
114
+ _parentElemId,
115
+ _parentSize,
116
+ _parentWidth,
117
+ _parentHeight,
118
+ _viewId,
119
+ _view,
120
+ i = 0;
121
+ for(;i<_viewIds.length;i++){
122
+ _viewId = _viewIds[i];
123
+ _view = HSystem.views[_viewId];
124
+ if(_view.flexRight || _view.flexBottom){
125
+ ELEM.flushLoop();
126
+ _parentElemId = _view.parent.elemId;
127
+ _parentSize = _view.parentSize();
128
+ _parentWidth = _parentSize[0];
129
+ if(_view.flexRight){
130
+ _this.right = _parentWidth - _view.flexRightOffset;
131
+ }
132
+ if(!_view.flexLeft){
133
+ _this.left = _this.right - _this.width;
134
+ }
135
+ _parentHeight = _parentSize[1];
136
+ if(_view.flexBottom){
137
+ _this.bottom = _parentWidth - _view.flexBottomOffset - _this.top;
138
+ }
139
+ if(!_view.flexTop){
140
+ _this.top = _this.bottom - _this.height;
141
+ }
142
+ _this.updateSecondaryValues();
143
+ }
144
+ }
145
+ },
146
+
147
+ /** = Description
148
+ * You should call this on the instance to update secondary values, like
149
+ * width and height, if you change a primary (left/top/right/bottom) value
150
+ * straight through the property.
151
+ *
152
+ * Do not change properties other than the primaries through properties.
153
+ *
154
+ * Use the accompanied methods instead.
155
+ *
156
+ **/
157
+ updateSecondaryValues: function() {
158
+
159
+ // this._updateFlexibleDimensions();
160
+
161
+ /**
162
+ * isValid is true if the Rect's right side is greater than or equal to its left
163
+ * and its bottom is greater than or equal to its top, and false otherwise.
164
+ * An invalid rectangle can't be used to define an interface area (such as
165
+ * the frame of a view or window).
166
+ **/
167
+ this.isValid = ( this.right >= this.left && this.bottom >= this.top );
168
+
169
+ /**
170
+ *
171
+ * The Point-returning functions return the coordinates of one of the
172
+ * rectangle's four corners.
173
+ **/
174
+ this.leftTop = new HPoint(this.left, this.top);
175
+ this.leftBottom = new HPoint(this.left, this.bottom);
176
+ this.rightTop = new HPoint(this.right, this.top);
177
+ this.rightBottom = new HPoint(this.right, this.bottom);
178
+
179
+ /**
180
+ * The width and height of a Rect's rectangle, as returned through these
181
+ * properties.
182
+ **/
183
+ this.width = (this.right - this.left);
184
+ this.height = (this.bottom - this.top);
185
+ },
186
+
187
+ /** = Description
188
+ * Sets the object's rectangle by defining the coordinates of all four
189
+ * sides.
190
+ *
191
+ * The other set...() functions move one of the rectangle's corners to the
192
+ * Point argument; the other corners and sides are modified concomittantly.
193
+ *
194
+ * None of these methods prevents you from creating an invalid rectangle.
195
+ *
196
+ * = Parameters
197
+ * +_left+:: The coordinate of the left side.
198
+ * +_top+:: The coordinate of the top side.
199
+ * +_right+:: The coordinate of the right side.
200
+ * +_bottom+:: The coordinate of the bottom side.
201
+ *
202
+ **/
203
+ set: function() {
204
+ var _args=arguments;
205
+
206
+ if (_args.length === 0) {
207
+ this._constructorDefault();
208
+ } else if (_args.length === 4) {
209
+ this._constructorSides(_args[0],_args[1],_args[2],_args[3]);
210
+ }
211
+ else if (_args.length === 2) {
212
+ this._constructorPoint(_args[0],_args[1]);
213
+ }
214
+ else if (_args.length === 1) {
215
+ this._constructorRect(_args[0]);
216
+ }
217
+ else {
218
+ throw "Invalid number of arguments.";
219
+ }
220
+ this.updateSecondaryValues();
221
+ },
222
+
223
+ /** = Description
224
+ * Moves the rect's left side to a new coordinate.
225
+ *
226
+ * = Parameters
227
+ * +_left+:: The new left side coordinate (in px)
228
+ *
229
+ **/
230
+ setLeft: function(_left){
231
+ this.left = _left;
232
+ this.updateSecondaryValues();
233
+ },
234
+
235
+ /** = Description
236
+ * Moves the rect's right side to a new coordinate.
237
+ *
238
+ * = Parameters
239
+ * +_right+:: The new right side coordinate (in px)
240
+ *
241
+ **/
242
+ setRight: function(_right){
243
+ this.right = _right;
244
+ this.updateSecondaryValues();
245
+ },
246
+
247
+ /** = Description
248
+ * Moves the rect's top side to a new coordinate.
249
+ *
250
+ * = Parameters
251
+ * +_top+:: The new top side coordinate (in px)
252
+ *
253
+ **/
254
+ setTop: function(_top){
255
+ this.top = _top;
256
+ this.updateSecondaryValues();
257
+ },
258
+
259
+ /** = Description
260
+ * Moves the rect's bottom side to a new coordinate.
261
+ *
262
+ * = Parameters
263
+ * +_bottom+:: The new bottom side coordinate (in px)
264
+ *
265
+ **/
266
+ setBottom: function(_bottom){
267
+ this.bottom = _bottom;
268
+ this.updateSecondaryValues();
269
+ },
270
+
271
+ /** = Description
272
+ * Moves the rects left and top sides to a new point. Affects the position,
273
+ * width and height.
274
+ *
275
+ * = Parameters
276
+ * +_point+:: A HPoint instance to mode the sides to.
277
+ *
278
+ **/
279
+ setLeftTop: function(_point) {
280
+ this.left=_point.x;
281
+ this.top=_point.y;
282
+ this.updateSecondaryValues();
283
+ },
284
+
285
+ /** = Description
286
+ * Moves the rects left and bottom sides to a new point. Affects the left
287
+ * position, width and height.
288
+ *
289
+ * = Parameters
290
+ * +_point+:: A HPoint instance to mode the sides to.
291
+ *
292
+ **/
293
+ setLeftBottom: function(_point) {
294
+ this.left=_point.x;
295
+ this.bottom=_point.y;
296
+ this.updateSecondaryValues();
297
+ },
298
+
299
+ /** = Description
300
+ * Moves the rects right and top sides to a new point. Affects the top
301
+ * position, width and height.
302
+ *
303
+ * = Parameters
304
+ * +_point+:: A HPoint instance to mode the sides to.
305
+ *
306
+ **/
307
+ setRightTop: function(_point) {
308
+ this.right=_point.x;
309
+ this.top=_point.y;
310
+ this.updateSecondaryValues();
311
+ },
312
+
313
+ /** = Description
314
+ * Moves the rects right and bottom sides to a new point. Affects the width
315
+ * and height. Does not affect the position.
316
+ *
317
+ * = Parameters
318
+ * +_point+:: A HPoint instance to mode the sides to.
319
+ *
320
+ **/
321
+ setRightBottom: function(_point) {
322
+ this.right=_point.x;
323
+ this.bottom=_point.y;
324
+ this.updateSecondaryValues();
325
+ },
326
+
327
+ /** = Description
328
+ * Moves the rects right side to a new coordinate. Does not affect the position.
329
+ *
330
+ * = Parameters
331
+ * +_width+:: A numeric value representing the new target width of the rect.
332
+ *
333
+ **/
334
+ setWidth: function(_width){
335
+ this.right = this.left + _width;
336
+ this.updateSecondaryValues();
337
+ },
338
+
339
+ /** = Description
340
+ * Moves the rects bottom side to a new coordinate. Does not affect the position.
341
+ *
342
+ * = Parameters
343
+ * +_height+:: A numeric value representing the new target height of the rect.
344
+ *
345
+ **/
346
+ setHeight: function(_height){
347
+ this.bottom = this.top + _height;
348
+ this.updateSecondaryValues();
349
+ },
350
+
351
+ /** = Description
352
+ * Moves the rects right and bottom sides to new coordinates. Does not affect the position.
353
+ *
354
+ * = Parameters
355
+ * by separate numeric values:
356
+ * +_width+:: A numeric value representing the new target width of the rect.
357
+ * +_height+:: A numeric value representing the new target height of the rect.
358
+ *
359
+ * by HPoint used as "HSize":
360
+ * +_point.x+:: A numeric value representing the new target width of the rect.
361
+ * +_point.y+:: A numeric value representing the new target height of the rect.
362
+ *
363
+ **/
364
+ setSize: function(){
365
+ var _args=arguments;
366
+ // Using width and height:
367
+ if (_args.length === 2) {
368
+ _width = _args[0];
369
+ _height = _args[1];
370
+ }
371
+ // Using a point:
372
+ else if (_args.length === 1) {
373
+ _width = _args.x;
374
+ _height = _args.y;
375
+ }
376
+ this.right = this.left + _width;
377
+ this.bottom = this.top + _height;
378
+ this.updateSecondaryValues();
379
+ },
380
+
381
+ /** = Description
382
+ * Returns true if the Rect has any area even a corner or part
383
+ * of a side in common with rect, and false if it doesn't.
384
+ *
385
+ * = Parameters
386
+ * +_rect+:: A HRect instance to intersect this rect with
387
+ *
388
+ * = Returns
389
+ * A Boolean (true/false) depending on the result.
390
+ *
391
+ **/
392
+ intersects: function(_rect) {
393
+ return (
394
+ ((_rect.left >= this.left && _rect.left <= this.right) ||
395
+ (_rect.right >= this.left && _rect.right <= this.right)) &&
396
+ ((_rect.top >= this.top && _rect.top <= this.bottom) ||
397
+ (_rect.bottom >= this.top && _rect.bottom <= this.bottom)));
398
+ },
399
+
400
+ /** = Description
401
+ * Returns true if point or rect lies entirely within the Rect's
402
+ * rectangle (and false if not). A rectangle contains the points that lie
403
+ * along its edges; for example, two identical rectangles contain each other.
404
+ *
405
+ * Also works with HPoint instances.
406
+ *
407
+ * = Parameters
408
+ * +_obj+:: A HRect or HPoint to check the containment with.
409
+ *
410
+ * = Returns
411
+ * A Boolean (true/false) depending on the result.
412
+ *
413
+ **/
414
+ contains: function(_obj) {
415
+ if(_obj instanceof HPoint) {
416
+ return this._containsPoint(_obj);
417
+ }
418
+ else if(_obj instanceof HRect) {
419
+ return this._containsRect(_obj);
420
+ }
421
+ else {
422
+ throw "Wrong argument type.";
423
+ }
424
+ },
425
+ _containsPoint: function(_point) {
426
+ return ( _point.x >= this.left && _point.x <= this.right &&
427
+ _point.y >= this.top && _point.y <= this.bottom );
428
+ },
429
+ _containsRect: function(_rect) {
430
+ return ( _rect.left >= this.left && _rect.right <= this.right &&
431
+ _rect.top >= this.top && _rect.bottom <= this.bottom );
432
+ },
433
+
434
+ /** = Description
435
+ * Insets the sides of the Rect's rectangle by x units (left and
436
+ * right sides) and y units (top and bottom). Positive inset values shrink
437
+ * the rectangle; negative values expand it. Note that both sides of each
438
+ * pair moves the full amount. For example, if you inset a Rect by (4,4), the
439
+ * left side moves (to the right) four units and the right side moves (to the
440
+ * left) four units (and similarly with the top and bottom).
441
+ *
442
+ * = Parameters
443
+ * using a HPoint:
444
+ * +point+:: A HPoint to inset by.
445
+ *
446
+ * using separate x and y coordinates:
447
+ * +x+:: x Coordinate
448
+ * +y+:: y Coordinate
449
+ *
450
+ **/
451
+ insetBy: function() {
452
+ var _args=arguments;
453
+ if (_args.length === 1) {
454
+ this._insetByPoint(_args[0]);
455
+ } else if (_args.length === 2) {
456
+ this._insetByXY(_args[0],_args[1]);
457
+ } else {
458
+ throw "Invalid number of arguments.";
459
+ }
460
+ this.updateSecondaryValues();
461
+ },
462
+ _insetByPoint: function(_point) {
463
+ this._insetByXY(_point.x, _point.y);
464
+ },
465
+ _insetByXY: function(x, y) {
466
+ this.left += x;
467
+ this.top += y;
468
+ this.right -= x;
469
+ this.bottom -= y;
470
+ },
471
+
472
+ /** = Description
473
+ * Moves the Rect horizontally by x units and vertically by y
474
+ * units. The rectangle's size doesn't change.
475
+ *
476
+ * = Parameters
477
+ * using a HPoint:
478
+ * +point+:: A HPoint to offset by.
479
+ *
480
+ * using separate x and y coordinates
481
+ * +x+:: X coordinate
482
+ * +y+:: Y coordinate
483
+ *
484
+ **/
485
+ offsetBy: function() {
486
+ var _args=arguments;
487
+ if (_args.length === 1) {
488
+ this._offsetByPoint(_args[0]);
489
+ } else if (_args.length === 2) {
490
+ this._offsetByXY(_args[0],_args[1]);
491
+ } else {
492
+ throw "Invalid number of arguments.";
493
+ }
494
+ this.updateSecondaryValues();
495
+ },
496
+ _offsetByPoint: function(_point) {
497
+ this._offsetByXY(_point.x, _point.y);
498
+ },
499
+ _offsetByXY: function(x, y) {
500
+ this.left += x;
501
+ this.top += y;
502
+ this.right += x;
503
+ this.bottom += y;
504
+ },
505
+
506
+ /** = Description
507
+ * Moves the Rect to the location (x,y).
508
+ *
509
+ * = Parameters
510
+ * using a HPoint:
511
+ * +point+:: A HPoint to offset to.
512
+ *
513
+ * using separate x and y coordinates):
514
+ * +x+:: X coordinate
515
+ * +y+:: Y coordinate
516
+ *
517
+ **/
518
+ offsetTo: function() {
519
+ var _args=arguments;
520
+ if (_args.length === 1) {
521
+ this._offsetToPoint(_args[0]);
522
+ } else if (_args.length === 2) {
523
+ this._offsetToXY(_args[0],_args[1]);
524
+ } else {
525
+ throw "Invalid number of arguments.";
526
+ }
527
+ this.updateSecondaryValues();
528
+ },
529
+ _offsetToPoint: function(_point) {
530
+ this._offsetToXY(_point.x, _point.y);
531
+ },
532
+ _offsetToXY: function(x, y) {
533
+ this.right += x-this.left;
534
+ this.left = x;
535
+ this.bottom += y-this.top;
536
+ this.top = y;
537
+ },
538
+
539
+ /** = Description
540
+ * Returns true if the two objects' rectangles exactly coincide.
541
+ *
542
+ * = Parameters
543
+ * +_rect+:: A HRect instance to compare to.
544
+ *
545
+ * = Returns
546
+ * A Boolean (true/false) depending on the result.
547
+ *
548
+ **/
549
+ equals: function(_rect) {
550
+ return (this.left === _rect.left && this.top === _rect.top &&
551
+ this.right === _rect.right && this.bottom === _rect.bottom);
552
+ },
553
+
554
+ /** = Description
555
+ * Creates and returns a new Rect that's the intersection of this Rect and
556
+ * the specified Rect. The new Rect encloses the area that the two Rects have
557
+ * in common. If the two Rects don't intersect, the new Rect will be invalid.
558
+ *
559
+ * = Parameters
560
+ * +_rect+:: A HRect instance to compare to.
561
+ *
562
+ * = Returns
563
+ * A new HRect instance.
564
+ *
565
+ **/
566
+ intersection: function(_rect) {
567
+ return new HRect(
568
+ Math.max(this.left, _rect.left), Math.max(this.top, _rect.top),
569
+ Math.min(this.right, _rect.right), Math.min(this.bottom, _rect.bottom)
570
+ );
571
+ },
572
+
573
+ /** = Description
574
+ * Creates and returns a new Rect that minimally but completely encloses the
575
+ * area defined by this Rect and the specified Rect.
576
+ *
577
+ * = Parameters
578
+ * +_rect+:: A HRect instance to compare to.
579
+ *
580
+ * = Returns
581
+ * A new HRect instance.
582
+ *
583
+ **/
584
+ union: function(_rect) {
585
+ return new HRect(
586
+ Math.min(this.left, _rect.left), Math.min(this.top, _rect.top),
587
+ Math.max(this.right, _rect.right), Math.max(this.bottom, _rect.bottom)
588
+ );
589
+ },
590
+
591
+ // HValue and HView support
592
+ valueObj: null,
593
+
594
+ /** = Description
595
+ * Bind function
596
+ *
597
+ * = Parameters
598
+ * +_view+:: view
599
+ *
600
+ **/
601
+ bind: function(_view){
602
+ if(this.viewIds.indexOf( _view.viewId ) === -1){
603
+ this.viewIds.push( _view.viewId );
604
+ }
605
+ this._updateFlexibleDimensions();
606
+ },
607
+
608
+ /** = Description
609
+ * Release function
610
+ **/
611
+ release: function(_view){
612
+ var _viewIdx = this.viewIds.indexOf(_view.viewId);
613
+ if(_viewIdx !== -1){
614
+ this.viewIds.splice( _viewIdx, 1 );
615
+ }
616
+ },
617
+
618
+ /** = Description
619
+ * Sets valueObj for this component given as parameter.
620
+ *
621
+ * = Parameters
622
+ * +_valueObj+:: valueObj to use
623
+ *
624
+ **/
625
+ setValueObj: function(_valueObj){
626
+ this.valueObj = _valueObj;
627
+ },
628
+
629
+ /** = Description
630
+ * setValue function
631
+ *
632
+ * = Parameters
633
+ * +_value+:: value
634
+ * +_srcViewId+:: srcViewId
635
+ *
636
+ **/
637
+ setValue: function(_value,_srcViewId){
638
+ if(this.valueObj){
639
+ this.valueObj.set(_value);
640
+ }
641
+ this.set(_value[0],_value[1],_value[2],_value[3]);
642
+ var i=0, _viewId;
643
+ for(;i<this.viewIds.length;i++){
644
+ _viewId = this.viewIds[i];
645
+ HSystem.views[_viewId].drawRect();
646
+ }
647
+ }
648
+
649
+ });
650
+
651
+
File without changes