rhodes 2.2.6 → 2.3.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (486) hide show
  1. data/CHANGELOG +20 -0
  2. data/README.md +46 -0
  3. data/Rakefile +85 -80
  4. data/bin/rhodes +2 -2
  5. data/bin/rhogen +1 -1
  6. data/doc/application.txt +277 -0
  7. data/doc/bb-css.txt +209 -0
  8. data/doc/build.txt +785 -0
  9. data/doc/configuration.txt +236 -0
  10. data/doc/connect-to-web-services.txt +282 -0
  11. data/doc/contributing.txt +64 -0
  12. data/doc/css-framework.txt +144 -0
  13. data/doc/device-caps.txt +1152 -0
  14. data/doc/extensions.txt +528 -0
  15. data/doc/files.txt +4 -0
  16. data/doc/generator.txt +141 -0
  17. data/doc/install.txt +35 -0
  18. data/doc/introduction.txt +88 -0
  19. data/doc/rhom.txt +826 -0
  20. data/doc/standard-css.txt +392 -0
  21. data/doc/synchronization.txt +542 -0
  22. data/doc/test-log-debug.txt +148 -0
  23. data/doc/tutorial.txt +136 -0
  24. data/doc/ui.txt +766 -0
  25. data/installer/EnvVarUpdate.nsh +328 -0
  26. data/installer/README.html +81 -0
  27. data/installer/RHOSYNC-LICENSE.txt +675 -0
  28. data/installer/icon.ico +0 -0
  29. data/installer/instant-rhodes.nsi +427 -0
  30. data/lib/build/jake.rb +15 -1
  31. data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/imageprovider.cpp +1 -1
  32. data/lib/extensions/barcode/ext/barcode/platform/bb/Barcode6.files +45 -0
  33. data/lib/extensions/barcode/ext/barcode/platform/bb/Rakefile +6 -0
  34. data/lib/extensions/barcode/ext/barcode/platform/bb/barcode6.jdp +92 -0
  35. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +7 -4
  36. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +2 -1
  37. data/lib/extensions/barcode/ext/barcode/platform/wm/src/wm_imageprovider.cpp +1 -1
  38. data/lib/extensions/digest-sha1/ext/build.bat +1 -0
  39. data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +335 -0
  40. data/lib/extensions/esri/ext/build +17 -0
  41. data/lib/extensions/esri/ext/build.bat +29 -0
  42. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.h +7 -0
  43. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.mm +58 -0
  44. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactoryRegister.mm +22 -0
  45. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.h +21 -0
  46. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.mm +32 -0
  47. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/InitESRI.c +5 -0
  48. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.h +143 -0
  49. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.m +919 -0
  50. data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +320 -0
  51. data/lib/extensions/esri/ext/esri/platform/iphone/ESRI_Prefix.pch +7 -0
  52. data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +76 -0
  53. data/lib/extensions/esri/ext.yml +3 -0
  54. data/lib/extensions/net-http/monitor.rb +265 -0
  55. data/lib/extensions/net-http/net/ftp.rb +981 -0
  56. data/lib/extensions/net-http/thread.rb +367 -0
  57. data/lib/extensions/rhocgi/cgi.rb +16 -0
  58. data/lib/extensions/rhospec/rhospec.rb +118 -0
  59. data/lib/framework/base64.rb +91 -0
  60. data/lib/framework/builtinME.rb +13 -10
  61. data/lib/framework/ostruct.rb +145 -0
  62. data/lib/framework/res/back_btn.wm.png +0 -0
  63. data/lib/framework/res/blue_pushpin.wm.png +0 -0
  64. data/lib/framework/res/blue_pushpin_small.wm.png +0 -0
  65. data/lib/framework/res/callout.wm.png +0 -0
  66. data/lib/framework/res/callout_link.wm.png +0 -0
  67. data/lib/framework/res/forward_btn.wm.png +0 -0
  68. data/lib/framework/res/home_btn.wm.png +0 -0
  69. data/lib/framework/res/options_btn.wm.png +0 -0
  70. data/lib/framework/res/refresh_btn.wm.png +0 -0
  71. data/lib/framework/rho/render.rb +5 -2
  72. data/lib/framework/rho/rho.rb +320 -50
  73. data/lib/framework/rho/rhoapplication.rb +48 -10
  74. data/lib/framework/rho/rhonativeviewmanager.rb +73 -0
  75. data/lib/framework/rho/rhosupport.rb +15 -1
  76. data/lib/framework/rho/rhotabbar.rb +29 -0
  77. data/lib/framework/rho/rhotoolbar.rb +17 -0
  78. data/lib/framework/rho/rhoutils.rb +22 -6
  79. data/lib/framework/rhodes.rb +1 -1
  80. data/lib/framework/rholang/rhomsg_de.rb +4 -3
  81. data/lib/framework/rholang/rhomsg_en.rb +1 -0
  82. data/lib/framework/rholang/rhomsg_es.rb +1 -0
  83. data/lib/framework/rholang/rhomsg_it.rb +1 -0
  84. data/lib/framework/rhom/rhom.rb +31 -10
  85. data/lib/framework/rhom/rhom_db_adapter.rb +33 -23
  86. data/lib/framework/rhom/rhom_object_factory.rb +465 -249
  87. data/lib/framework/rhom/rhom_source.rb +22 -7
  88. data/lib/framework/version.rb +1 -1
  89. data/lib/rhodes.rb +1 -1
  90. data/platform/android/Rhodes/AndroidManifest.xml +83 -20
  91. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +5 -0
  92. data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +2 -0
  93. data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +9 -5
  94. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesAppOptions.h +53 -0
  95. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +46 -56
  96. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_SplashScreen.h +10 -0
  97. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_mapview_MapView.h +93 -0
  98. data/platform/android/Rhodes/jni/include/rhodes/rhocryptimpl.h +38 -0
  99. data/platform/android/Rhodes/jni/include/rhodes.h +64 -8
  100. data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +6 -0
  101. data/platform/android/Rhodes/jni/src/alert.cpp +5 -11
  102. data/platform/android/Rhodes/jni/src/bluetooth.cpp +66 -29
  103. data/platform/android/Rhodes/jni/src/callbacks.cpp +24 -21
  104. data/platform/android/Rhodes/jni/src/camera.cpp +2 -6
  105. data/platform/android/Rhodes/jni/src/datetimepicker.cpp +13 -11
  106. data/platform/android/Rhodes/jni/src/event.cpp +9 -15
  107. data/platform/android/Rhodes/jni/src/fileapi.cpp +13 -27
  108. data/platform/android/Rhodes/jni/src/logconf.cpp +3 -3
  109. data/platform/android/Rhodes/jni/src/mapview.cpp +696 -16
  110. data/platform/android/Rhodes/jni/src/menu.cpp +3 -3
  111. data/platform/android/Rhodes/jni/src/nativebar.cpp +55 -4
  112. data/platform/android/Rhodes/jni/src/nativeview.cpp +33 -0
  113. data/platform/android/Rhodes/jni/src/phonebook.cpp +6 -11
  114. data/platform/android/Rhodes/jni/src/rhoconf.cpp +4 -4
  115. data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +87 -0
  116. data/platform/android/Rhodes/jni/src/rhodes.cpp +55 -34
  117. data/platform/android/Rhodes/jni/src/ringtones.cpp +2 -3
  118. data/platform/android/Rhodes/jni/src/signature.cpp +3 -5
  119. data/platform/android/Rhodes/jni/src/splashscreen.cpp +7 -0
  120. data/platform/android/Rhodes/jni/src/sslimpl.cpp +17 -20
  121. data/platform/android/Rhodes/jni/src/webview.cpp +13 -12
  122. data/platform/android/Rhodes/res/drawable/callout.png +0 -0
  123. data/platform/android/Rhodes/res/drawable/callout_link.png +0 -0
  124. data/platform/android/Rhodes/res/drawable/signature_cancel.png +0 -0
  125. data/platform/android/Rhodes/res/drawable/signature_clear.png +0 -0
  126. data/platform/android/Rhodes/res/drawable/signature_ok.png +0 -0
  127. data/platform/android/Rhodes/res/layout/datetime.xml +4 -0
  128. data/platform/android/Rhodes/res/layout/signature.xml +24 -17
  129. data/platform/android/Rhodes/res/layout/status_bar_ongoing_event_progress_bar.xml +102 -0
  130. data/platform/android/Rhodes/res/values/strings.xml +1 -1
  131. data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +6 -0
  132. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Base64.java +575 -0
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +83 -0
  134. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +21 -3
  135. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +23 -15
  136. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +2 -2
  137. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +151 -0
  138. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +2 -2
  139. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +372 -0
  140. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesAppOptions.java +11 -0
  141. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +58 -0
  142. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +705 -523
  143. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RingtoneManager.java +1 -1
  144. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +167 -85
  145. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +36 -1
  146. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +4 -2
  147. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +33 -20
  148. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +2 -6
  149. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +2 -24
  150. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +106 -36
  151. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +15 -58
  152. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +0 -7
  153. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +6 -4
  154. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/FileList.java +4 -3
  155. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +91 -27
  156. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePicker.java +6 -3
  157. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +275 -42
  158. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -1
  159. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +1 -3
  160. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
  161. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +1 -0
  162. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +120 -43
  163. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +518 -28
  164. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +2 -2
  165. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +434 -0
  166. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapTouch.java +20 -0
  167. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +296 -336
  168. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MultiTouchHandler.java +111 -0
  169. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/OneTouchHandler.java +77 -0
  170. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/TouchHandler.java +10 -0
  171. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +0 -1
  172. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +5 -1
  173. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +1 -1
  174. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +1 -1
  175. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +6 -11
  176. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +6 -4
  177. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +0 -7
  178. data/platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java +9 -4
  179. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +8 -8
  180. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +5 -1
  181. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +11 -7
  182. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +3 -5
  183. data/platform/android/build/RhodesSRC_build.files +32 -23
  184. data/platform/android/build/android.rake +28 -11
  185. data/platform/android/build/androidcommon.rb +2 -0
  186. data/platform/android/build/librhocommon_build.files +9 -5
  187. data/platform/android/build/librhodes_build.files +1 -0
  188. data/platform/android/build/libruby_build.files +1 -0
  189. data/platform/bb/Hsqldb/Hsqldb.jdp +0 -2
  190. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +10 -2
  191. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +37 -5
  192. data/platform/bb/Hsqldb/src/org/hsqldb/Column.java +5 -5
  193. data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -1
  194. data/platform/bb/Hsqldb/src/org/hsqldb/Function.java +73 -78
  195. data/platform/bb/Hsqldb/src/org/hsqldb/Library.java +288 -8
  196. data/platform/bb/RubyVM/RubyVM.jdp +3 -0
  197. data/platform/bb/RubyVM/src/com/rho/FilePath.java +13 -1
  198. data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -2
  199. data/platform/bb/RubyVM/src/com/rho/RhoAppAdapter.java +12 -0
  200. data/platform/bb/RubyVM/src/com/rho/RhoClassFactory.java +18 -1
  201. data/platform/bb/RubyVM/src/com/rho/RhoConf.java +128 -108
  202. data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +9 -10
  203. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +16 -1
  204. data/platform/bb/RubyVM/src/com/rho/RhoProfiler.java +1 -1
  205. data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +20 -0
  206. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -2
  207. data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +65 -46
  208. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +192 -50
  209. data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +8 -114
  210. data/platform/bb/RubyVM/src/com/rho/db/DBException.java +1 -1
  211. data/platform/bb/RubyVM/src/com/rho/db/IDBCallback.java +1 -1
  212. data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +5 -3
  213. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +5 -1
  214. data/platform/bb/RubyVM/src/com/rho/file/FileAccessBB.java +109 -0
  215. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +85 -0
  216. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +12 -4
  217. data/platform/bb/RubyVM/src/com/rho/net/NetResponse.java +5 -0
  218. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +37 -23
  219. data/platform/bb/RubyVM/src/com/rho/net/URI.java +84 -0
  220. data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
  221. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +119 -61
  222. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +61 -24
  223. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +108 -54
  224. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +121 -163
  225. data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +23 -0
  226. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyMutex.java +1 -1
  227. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRange.java +3 -1
  228. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRegexp.java +3 -1
  229. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +208 -25
  230. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +3 -1
  231. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +5 -1
  232. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +12 -5
  233. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyID.java +1 -0
  234. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +16 -0
  235. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule_Methods.java +5 -0
  236. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyValue.java +1 -1
  237. data/platform/bb/RubyVM/src/com/xruby/runtime/stdlib/RubyStringIO.java +4 -1
  238. data/platform/bb/{Hsqldb → RubyVM}/src/j2me/math/Number.java +33 -0
  239. data/platform/bb/build/RubyVM_build.files +3 -0
  240. data/platform/bb/build/bb.rake +140 -62
  241. data/platform/bb/build/hsqldb_build.files +0 -2
  242. data/platform/bb/build/rhodes_build.files +5 -0
  243. data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +43 -7
  244. data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +23 -2
  245. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +5 -0
  246. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +143 -0
  247. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +269 -0
  248. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +446 -0
  249. data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +3 -0
  250. data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +12 -2
  251. data/platform/bb/rhodes/platform/common/com/rho/db/SqliteCopyResult.java +2 -0
  252. data/platform/bb/rhodes/platform/common/com/rho/db/SqliteResult.java +2 -0
  253. data/platform/bb/rhodes/platform/common/com/rho/db/SqliteStorage.java +2 -0
  254. data/platform/bb/rhodes/resources/mappin.png +0 -0
  255. data/platform/bb/rhodes/rhodes.jdp +3 -0
  256. data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +21 -18
  257. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +150 -0
  258. data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +1 -0
  259. data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +63 -4
  260. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -5
  261. data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +242 -2
  262. data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +143 -0
  263. data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +269 -0
  264. data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +446 -0
  265. data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +1 -1
  266. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +71 -14
  267. data/platform/bb/rhodes/src/com/rho/net/bb/BBHttpConnection.java +4 -2
  268. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +28 -12
  269. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +100 -4
  270. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +3 -2
  271. data/platform/bb/rhodes/src/com/rho/rubyext/XMLParser.java +1 -1
  272. data/platform/bb/rhodes/src/rhomobile/NativeBar.java +32 -0
  273. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +9 -2
  274. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +174 -41
  275. data/platform/bb/rhodes/src/rhomobile/datetime/DateTimePicker.java +52 -3
  276. data/platform/bb/rhodes/src/rhomobile/datetime/DateTimeScreen.java +33 -1
  277. data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +2 -14
  278. data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +686 -0
  279. data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +14 -0
  280. data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +13 -0
  281. data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +174 -0
  282. data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +104 -330
  283. data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +79 -0
  284. data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +35 -12
  285. data/platform/bb/rhodes/src/rhomobile/mapview/MapViewParent.java +2 -1
  286. data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +336 -44
  287. data/platform/bb/rhodes/src/rhomobile/mapview/RhoMapField.java +3 -6
  288. data/platform/iphone/Classes/AppManager/AppManager.m +19 -4
  289. data/platform/iphone/Classes/DateTime.h +4 -0
  290. data/platform/iphone/Classes/DateTime.m +1 -1
  291. data/platform/iphone/Classes/DateTimePicker.m +8 -1
  292. data/platform/iphone/Classes/DateTimePickerDelegate.m +7 -1
  293. data/platform/iphone/Classes/Event/Event.m +2 -2
  294. data/platform/iphone/Classes/MapView/MapViewController.h +4 -1
  295. data/platform/iphone/Classes/MapView/MapViewController.m +6 -46
  296. data/platform/iphone/Classes/MapView/MapViewManager.h +26 -0
  297. data/platform/iphone/Classes/MapView/MapViewManager.m +172 -0
  298. data/platform/iphone/Classes/NativeBar.h +34 -0
  299. data/platform/iphone/Classes/NativeBar.m +131 -26
  300. data/platform/iphone/Classes/NativeView/NVDelegate.h +26 -0
  301. data/platform/iphone/Classes/NativeView/NVDelegate.m +40 -0
  302. data/platform/iphone/Classes/NativeView/NVViewController.h +24 -0
  303. data/platform/iphone/Classes/NativeView/NVViewController.m +90 -0
  304. data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +449 -0
  305. data/platform/iphone/Classes/{RhoNativeViewManagerOC.h → NativeView/RhoNativeViewManagerOC.h} +15 -0
  306. data/platform/iphone/Classes/RhoAlert.m +3 -3
  307. data/platform/iphone/Classes/RhoMainView.h +3 -0
  308. data/platform/iphone/Classes/Rhodes.h +6 -2
  309. data/platform/iphone/Classes/Rhodes.m +47 -79
  310. data/platform/iphone/Classes/Signature/SignatureViewController.m +1 -0
  311. data/platform/iphone/Classes/SimpleMainView.h +18 -1
  312. data/platform/iphone/Classes/SimpleMainView.m +180 -35
  313. data/platform/iphone/Classes/SplitView/LeftViewController.h +1 -1
  314. data/platform/iphone/Classes/SplitView/LeftViewController.m +13 -7
  315. data/platform/iphone/Classes/SplitView/RightViewController.h +1 -1
  316. data/platform/iphone/Classes/SplitView/RightViewController.m +26 -11
  317. data/platform/iphone/Classes/SplitView/SplittedMainView.h +1 -6
  318. data/platform/iphone/Classes/SplitView/SplittedMainView.m +14 -52
  319. data/platform/iphone/Classes/TabbedMainView.h +25 -3
  320. data/platform/iphone/Classes/TabbedMainView.m +340 -14
  321. data/platform/iphone/ESRI/BluePushpin.png +0 -0
  322. data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
  323. data/platform/iphone/ESRI/esri.png +0 -0
  324. data/platform/iphone/ESRI/esri@2x.png +0 -0
  325. data/platform/iphone/Info.plist +1 -1
  326. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +26 -3
  327. data/platform/iphone/rbuild/iphone.rake +100 -4
  328. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
  329. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +116 -12
  330. data/platform/shared/SyncClient/SyncClient.cpp +29 -3
  331. data/platform/shared/SyncClient/SyncClient.h +2 -1
  332. data/platform/shared/common/IRhoClassFactory.h +3 -0
  333. data/platform/shared/common/IRhoCrypt.h +16 -0
  334. data/platform/shared/common/IRhoThreadImpl.h +1 -0
  335. data/platform/shared/common/RhoAppAdapter.h +2 -0
  336. data/platform/shared/common/RhoConf.cpp +97 -46
  337. data/platform/shared/common/RhoConf.h +14 -13
  338. data/platform/shared/common/RhoFile.cpp +10 -0
  339. data/platform/shared/common/RhoFile.h +1 -0
  340. data/platform/shared/common/RhoMath.cpp +43 -0
  341. data/platform/shared/common/RhoMath.h +27 -0
  342. data/platform/shared/common/RhoNativeViewManager.h +27 -1
  343. data/platform/shared/common/RhoPort.h +11 -0
  344. data/platform/shared/common/RhoStd.h +5 -0
  345. data/platform/shared/common/RhoThread.cpp +1 -1
  346. data/platform/shared/common/RhoThread.h +1 -1
  347. data/platform/shared/common/RhodesApp.cpp +381 -139
  348. data/platform/shared/common/RhodesApp.h +24 -10
  349. data/platform/shared/common/RhodesAppBase.cpp +72 -1
  350. data/platform/shared/common/RhodesAppBase.h +5 -1
  351. data/platform/shared/common/SplashScreen.h +4 -4
  352. data/platform/shared/common/ThreadQueue.cpp +44 -17
  353. data/platform/shared/common/ThreadQueue.h +4 -0
  354. data/platform/shared/common/app_build_configs.c +0 -1
  355. data/platform/shared/common/iphone/RhoClassfactory.h +6 -0
  356. data/platform/shared/common/iphone/RhoCryptImpl.h +47 -0
  357. data/platform/shared/common/iphone/RhoCryptImpl.mm +286 -0
  358. data/platform/shared/common/map/ESRIMapEngine.cpp +921 -0
  359. data/platform/shared/common/map/ESRIMapEngine.h +255 -0
  360. data/platform/shared/common/map/GoogleMapEngine.cpp +160 -0
  361. data/platform/shared/common/map/GoogleMapEngine.h +52 -0
  362. data/platform/shared/common/map/MapEngine.cpp +304 -0
  363. data/platform/shared/common/map/MapEngine.h +214 -0
  364. data/platform/shared/db/DBAdapter.cpp +147 -18
  365. data/platform/shared/db/DBAdapter.h +38 -12
  366. data/platform/shared/db/DBAttrManager.cpp +4 -3
  367. data/platform/shared/db/DBAttrManager.h +7 -7
  368. data/platform/shared/db/res/db/syncdb.triggers +0 -5
  369. data/platform/shared/db/res/db/syncdb_java.triggers +21 -0
  370. data/platform/shared/json/JSONIterator.cpp +11 -1
  371. data/platform/shared/json/JSONIterator.h +1 -0
  372. data/platform/shared/logging/RhoLogConf.cpp +29 -12
  373. data/platform/shared/net/CURLNetRequest.cpp +80 -25
  374. data/platform/shared/net/CURLNetRequest.h +6 -2
  375. data/platform/shared/net/HttpServer.cpp +12 -6
  376. data/platform/shared/net/HttpServer.h +2 -1
  377. data/platform/shared/net/INetRequest.h +1 -0
  378. data/platform/shared/ruby/ext/alert/alert.i +5 -0
  379. data/platform/shared/ruby/ext/alert/alert_wrap.c +439 -108
  380. data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +42 -0
  381. data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +521 -120
  382. data/platform/shared/ruby/ext/nativebar/nativebar.i +16 -0
  383. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +623 -128
  384. data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +18 -0
  385. data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +2321 -0
  386. data/platform/shared/ruby/ext/rho/extensions.c +0 -1
  387. data/platform/shared/ruby/ext/rho/rhoruby.c +53 -0
  388. data/platform/shared/ruby/ext/rho/rhoruby.h +6 -0
  389. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +6 -3
  390. data/platform/shared/ruby/ext/syncengine/syncengine.i +9 -1
  391. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +61 -0
  392. data/platform/shared/ruby/ext/system/system.i +4 -0
  393. data/platform/shared/ruby/ext/system/system_wrap.c +33 -5
  394. data/platform/shared/rubyext/RhoAppAdapter.cpp +11 -1
  395. data/platform/shared/rubyext/System.cpp +9 -0
  396. data/platform/shared/rubyext/WebView.h +1 -0
  397. data/platform/shared/sqlite/crypto.c +907 -0
  398. data/platform/shared/sqlite/sqlite3.c +6 -0
  399. data/platform/shared/sync/SyncEngine.cpp +49 -19
  400. data/platform/shared/sync/SyncEngine.h +0 -1
  401. data/platform/shared/sync/SyncNotify.cpp +14 -5
  402. data/platform/shared/sync/SyncNotify.h +2 -2
  403. data/platform/shared/sync/SyncSource.cpp +79 -33
  404. data/platform/shared/sync/SyncSource.h +1 -0
  405. data/platform/shared/sync/SyncThread.cpp +26 -11
  406. data/platform/shared/xruby/src/com/xruby/compiler/codedom/StringExpression.java +4 -2
  407. data/platform/wm/RhoLib/RhoLib.vcproj +108 -72
  408. data/platform/wm/build/wm.rake +6 -0
  409. data/platform/wm/rhodes/Alert.cpp +4 -3
  410. data/platform/wm/rhodes/Alert.h +1 -1
  411. data/platform/wm/rhodes/DateTimePicker.cpp +30 -3
  412. data/platform/wm/rhodes/DateTimePicker.h +9 -1
  413. data/platform/wm/rhodes/MainWindow.cpp +121 -61
  414. data/platform/wm/rhodes/MainWindow.h +29 -4
  415. data/platform/wm/rhodes/MapView/Graphics.cpp +547 -0
  416. data/platform/wm/rhodes/MapView/Graphics.h +136 -0
  417. data/platform/wm/rhodes/MapView/MapViewManager.cpp +391 -0
  418. data/platform/wm/rhodes/MapView/MapViewManager.h +158 -0
  419. data/platform/wm/rhodes/RhoCryptImpl.cpp +248 -0
  420. data/platform/wm/rhodes/RhoCryptImpl.h +51 -0
  421. data/platform/wm/rhodes/RhoNativeViewManager.cpp +208 -0
  422. data/platform/wm/rhodes/Rhodes.cpp +94 -102
  423. data/platform/wm/rhodes/Rhodes.rc +27 -0
  424. data/platform/wm/rhodes/SyncStatusDlg.cpp +1 -0
  425. data/platform/wm/rhodes/SyncStatusDlg.h +2 -1
  426. data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +7 -4
  427. data/platform/wm/rhodes/camera/Camera.cpp +36 -15
  428. data/platform/wm/rhodes/camera/Camera.h +0 -4
  429. data/platform/wm/rhodes/resource.h +10 -2
  430. data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -0
  431. data/platform/wm/rhodes/rho/common/RhoClassFactory.h +1 -0
  432. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +10 -2
  433. data/platform/wm/rhodes/rho/net/NetRequestImpl.h +10 -0
  434. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +513 -0
  435. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.h +74 -0
  436. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +22 -10
  437. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +5 -0
  438. data/platform/wm/rhodes/rhodes.vcproj +38 -2
  439. data/platform/wm/rhodes/stdafx.h +2 -1
  440. data/platform/wm/rubylib/rubylib.vcproj +12 -0
  441. data/rakefile.rb +85 -80
  442. data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +14 -3
  443. data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
  444. data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +2 -0
  445. data/res/build-tools/xruby-0.3.3.jar +0 -0
  446. data/res/generators/templates/application/app/application.rb +2 -2
  447. data/res/generators/templates/application/app/helpers/application_helper.rb +1 -1
  448. data/res/generators/templates/application/public/css/android.css +1 -0
  449. data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
  450. data/res/generators/templates/application/rhoconfig.txt +66 -14
  451. data/rhodes.gemspec +3 -3
  452. data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +7 -3
  453. data/spec/framework_spec/build.yml +1 -1
  454. data/spec/phone_spec/Rakefile +1 -0
  455. data/spec/phone_spec/app/Account/account.rb +2 -0
  456. data/spec/phone_spec/app/Account_s/account_s.rb +7 -0
  457. data/spec/phone_spec/app/spec/{fixtures → array/fixtures}/classes.rb +0 -0
  458. data/spec/phone_spec/app/spec/{array_pack_spec.rb → array/pack_spec.rb} +2 -1
  459. data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
  460. data/spec/phone_spec/app/spec/contacts_spec.rb +2 -0
  461. data/spec/phone_spec/app/spec/rho_spec.rb +34 -233
  462. data/spec/phone_spec/app/spec/rhom_object_spec.rb +396 -87
  463. data/spec/phone_spec/app/spec/string/element_set_spec.rb +251 -0
  464. data/spec/phone_spec/app/spec/string/end_with_spec.rb +49 -0
  465. data/spec/phone_spec/app/spec/string/fixtures/classes.rb +27 -0
  466. data/spec/phone_spec/app/spec/{lstrip_spec.rb → string/lstrip_spec.rb} +0 -0
  467. data/spec/phone_spec/app/spec/string/replace_spec.rb +52 -0
  468. data/spec/phone_spec/app/spec/{rstrip_spec.rb → string/rstrip_spec.rb} +0 -0
  469. data/spec/phone_spec/app/spec/string/slice_spec.rb +473 -0
  470. data/spec/phone_spec/app/spec/string/split_spec.rb +302 -0
  471. data/spec/phone_spec/app/spec/string/start_with_spec.rb +48 -0
  472. data/spec/phone_spec/app/spec/{strip_spec.rb → string/strip_spec.rb} +0 -0
  473. data/spec/phone_spec/app/spec/syncengine_spec.rb +30 -1
  474. data/spec/phone_spec/app/spec_runner.rb +15 -7
  475. data/spec/phone_spec/build.yml +2 -2
  476. metadata +154 -25
  477. data/README.textile +0 -45
  478. data/platform/android/Rhodes/AndroidManifest.full.xml +0 -62
  479. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/Manifest.java +0 -14
  480. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +0 -20
  481. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +0 -193
  482. data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -25
  483. data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +0 -22
  484. data/platform/bb/RubyVM/src/com/rho/Capabilities.java +0 -6
  485. data/platform/bb/RubyVM/src/com/rho/Extensions.java +0 -11
  486. data/platform/iphone/Classes/RhoNativeViewManager.mm +0 -226
@@ -0,0 +1,547 @@
1
+
2
+
3
+ #include "stdafx.h"
4
+
5
+
6
+ #include <common/RhodesApp.h>
7
+ #include <logging/RhoLogConf.h>
8
+
9
+
10
+ #include "Graphics.h"
11
+
12
+
13
+ //#if 0
14
+ #ifdef OS_WINCE
15
+ #include <initguid.h>
16
+ #include <imgguids.h>
17
+ #endif //OS_WINCE
18
+
19
+ extern "C" HWND getMainWnd();
20
+ /*
21
+ #else
22
+
23
+
24
+ extern "C" HWND getMainWnd();
25
+
26
+ #undef DEFINE_GUID
27
+ #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
28
+ EXTERN_C const GUID name \
29
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
30
+
31
+ DEFINE_GUID(IID_IImagingFactory, 0x327abda7,0x072b,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
32
+ DEFINE_GUID(CLSID_ImagingFactory, 0x327abda8,0x072b,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
33
+
34
+ #endif*/
35
+
36
+ #undef DEFAULT_LOGCATEGORY
37
+ #define DEFAULT_LOGCATEGORY "WM MapView Graphics"
38
+
39
+
40
+
41
+ #define IP_PORTION_COUNT 32
42
+
43
+ static void msg_out(const char* text) {
44
+ //wchar_t msg[2048];
45
+ //mbstowcs(msg, text, 2048);
46
+ //RAWLOG_ERROR("MapView Graphics:");
47
+ //RAWLOG_ERROR(text);
48
+ }
49
+
50
+ static void err_out(const char* text) {
51
+ //wchar_t msg[2048];
52
+ //mbstowcs(msg, text, 2048);
53
+ RAWLOG_ERROR("MapView Graphics:");
54
+ RAWLOG_ERROR(text);
55
+ }
56
+
57
+
58
+
59
+
60
+ DrawingImageImpl::DrawingImageImpl(void const *p, int size, bool useAlpha) {
61
+ RHO_MAP_TRACE1("create DrawingImage with buffer length = %d", size);
62
+ init(NULL, p, size, NULL, useAlpha);
63
+ }
64
+
65
+ DrawingImageImpl::DrawingImageImpl(const char* path, bool useAlpha) {
66
+ RHO_MAP_TRACE1("create DrawingImage with filename = %s", path);
67
+ init(path, NULL, 0, NULL, useAlpha);
68
+ }
69
+
70
+ DrawingImageImpl::DrawingImageImpl(WMBitmap* bitmap) {
71
+ init(NULL, NULL, 0, bitmap, false);
72
+ }
73
+
74
+
75
+ static int ourDrawingImageID = 0;
76
+
77
+ DrawingImageImpl::~DrawingImageImpl() {
78
+ RHO_MAP_TRACE1("DrawingImage destroy with ID = %d", mID);
79
+ if (mBitmap != NULL) {
80
+ mBitmap->release();
81
+ mBitmap = NULL;
82
+ }
83
+ }
84
+
85
+ void DrawingImageImpl::init(const char* path, void const *p, int size, WMBitmap* bitmap, bool useAlpha) {
86
+ mID = ++ourDrawingImageID;
87
+ RHO_MAP_TRACE1("DrawingImage create with ID = %d", mID);
88
+
89
+ #if defined(_WIN32_WCE)
90
+ IImagingFactory *pImgFactory = NULL;
91
+ IImage *pImage = NULL;
92
+
93
+ mWidth = 0;
94
+ mHeight = 0;
95
+ mBitmap = NULL;
96
+
97
+ if (bitmap != NULL) {
98
+ mBitmap = bitmap;
99
+ mBitmap->addRef();
100
+ mWidth = bitmap->width();
101
+ mHeight = bitmap->height();
102
+ return;
103
+ }
104
+
105
+ HRESULT co_init_result = CoInitializeEx(NULL, 0/*COINIT_APARTMENTTHREADED*/);
106
+ if ( (co_init_result == S_OK) || (co_init_result == S_FALSE) ) {
107
+ msg_out("CoInitializeEx OK");
108
+ if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
109
+ NULL,
110
+ CLSCTX_INPROC_SERVER,
111
+ IID_IImagingFactory,
112
+ (void **)&pImgFactory)))
113
+ {
114
+ HRESULT res = 0;
115
+ if (p != NULL) {
116
+ // from buf
117
+ res = pImgFactory->CreateImageFromBuffer(
118
+ p,
119
+ size,
120
+ BufferDisposalFlagNone,
121
+ &pImage);
122
+ }
123
+ else {
124
+ // from file
125
+ msg_out("Create Image Factory OK");
126
+ wchar_t wc_filename[2048];
127
+ mbstowcs(wc_filename, path, 2048);
128
+ res = pImgFactory->CreateImageFromFile(
129
+ wc_filename,
130
+ &pImage);
131
+ }
132
+ if (SUCCEEDED(res))
133
+ {
134
+ IImage* mimage = pImage;
135
+ ImageInfo imgInfo;
136
+ mimage->GetImageInfo(&imgInfo);
137
+ mWidth = imgInfo.Width;
138
+ mHeight = imgInfo.Height;
139
+ RHO_MAP_TRACE2("Drawing Image was created with WIDTH = %d, HEIGHT = %d", mWidth, mHeight);
140
+ mBitmap = new WMBitmap(mimage, useAlpha);
141
+ mimage->Release();
142
+ }
143
+ else {
144
+ err_out("Image not created !");
145
+ }
146
+ pImgFactory->Release();
147
+ }
148
+ else {
149
+ err_out("ImageFactory not created !");
150
+ }
151
+ CoUninitialize();
152
+ }
153
+ else {
154
+ err_out("CoInitializeEx not initialized !");
155
+ }
156
+ #endif //#if defined(_WIN32_WCE)
157
+ }
158
+
159
+ IDrawingImage* DrawingImageImpl::clone() {
160
+ RHO_MAP_TRACE1("clone DrawingImage from ID = %d", mID);
161
+ return new DrawingImageImpl(mBitmap);
162
+ }
163
+
164
+
165
+ void DrawingImageImpl::draw(HDC hdc, int x, int y) {
166
+ RHO_MAP_TRACE2("draw DrawingImage with x = %d, y = %d", x, y);
167
+ if (mBitmap == NULL) {
168
+ return;
169
+ }
170
+ mBitmap->draw(hdc, x, y);
171
+ }
172
+
173
+
174
+
175
+ DrawingContextImpl::DrawingContextImpl(HDC hdc, int width, int height) {
176
+ RHO_MAP_TRACE2("DrawingContext create with WIDTH = %d, HEIGHT = %d", width, height);
177
+ mHDC = hdc;
178
+ mWidth = width;
179
+ mHeight = height;
180
+ }
181
+
182
+ int DrawingContextImpl::getWidth() {
183
+ return mWidth;
184
+ }
185
+
186
+ int DrawingContextImpl::getHeight() {
187
+ return mHeight;
188
+ }
189
+
190
+ void DrawingContextImpl::drawImage(int x, int y, IDrawingImage* image) {
191
+ DrawingImageImpl* img = (DrawingImageImpl*)image;
192
+ img->draw(mHDC, x, y);
193
+ }
194
+
195
+ void DrawingContextImpl::drawText(int x, int y, int nWidth, int nHeight, String const &text, int color) {
196
+ RHO_MAP_TRACE2("DrawingContext drawText with x = %d, y = %d", x, y);
197
+
198
+ HFONT hfontTahoma;
199
+ LOGFONT logfont;
200
+ HFONT hfontSave = NULL;
201
+
202
+ memset (&logfont, 0, sizeof (logfont));
203
+ logfont.lfHeight = 18;
204
+ logfont.lfWidth = 0;
205
+ logfont.lfEscapement = 0;
206
+ logfont.lfOrientation = 0;
207
+ logfont.lfWeight = FW_BOLD;
208
+ logfont.lfItalic = FALSE;
209
+ logfont.lfUnderline = FALSE;
210
+ logfont.lfStrikeOut = FALSE;
211
+ logfont.lfCharSet = DEFAULT_CHARSET;
212
+ logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
213
+ logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
214
+ logfont.lfQuality = DEFAULT_QUALITY;
215
+ logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
216
+ _tcsncpy (logfont.lfFaceName, TEXT("Tahoma"), LF_FACESIZE);
217
+ logfont.lfFaceName[LF_FACESIZE-1] = TEXT('\0'); // Ensure null termination
218
+ hfontTahoma = CreateFontIndirect (&logfont);
219
+
220
+ if (hfontTahoma) {
221
+ hfontSave = (HFONT) SelectObject(mHDC, hfontTahoma);
222
+ }
223
+
224
+ StringW pathW = convertToStringW(text);
225
+ SetBkMode(mHDC, TRANSPARENT);
226
+ SetTextColor(mHDC, color & 0xFFFFFF);
227
+ //TextOut(mHDC, x, y, pathW.c_str(), pathW.length());
228
+ RECT r;
229
+ r.left = x;
230
+ r.top = y;
231
+ r.right = x+nWidth;
232
+ r.bottom = y + nHeight;
233
+ DrawText(mHDC, pathW.c_str(), -1, &r, DT_LEFT | DT_TOP);
234
+
235
+ if (hfontTahoma) {
236
+ SelectObject(mHDC, hfontSave);
237
+ DeleteObject (hfontTahoma);
238
+ }
239
+ }
240
+
241
+ void DrawingContextImpl::fillRect(int x, int y, int width, int height, int color) {
242
+ RECT r;
243
+ r.left = x;
244
+ r.top = y;
245
+ r.right = x+width;
246
+ r.bottom = y + height;
247
+
248
+ HBRUSH hBrush;
249
+ HBRUSH hOldBrush;
250
+
251
+ hBrush = CreateSolidBrush(0xFF000000 | color);
252
+ hOldBrush = (HBRUSH)SelectObject(mHDC, hBrush);
253
+
254
+ FillRect(mHDC, &r, hBrush);
255
+
256
+ SelectObject(mHDC, hOldBrush);
257
+ DeleteObject(hBrush);
258
+ }
259
+
260
+ void DrawingContextImpl::getTextRect(int x, int y, String &text, RECT* resultRect) {
261
+ //GetTextExtentPoint32
262
+ }
263
+
264
+ void DrawingContextImpl::drawLine(int x1, int y1, int x2, int y2, int color) {
265
+
266
+ }
267
+
268
+
269
+ WMBitmap::WMBitmap(IImage* img, bool useAlpha) {
270
+ mReferenceCount = 1;
271
+
272
+ #if defined(_WIN32_WCE)
273
+ ImageInfo imgInfo;
274
+ img->GetImageInfo(&imgInfo);
275
+ mWidth = imgInfo.Width;
276
+ mHeight = imgInfo.Height;
277
+
278
+ mAlphaBitmap = NULL;
279
+ mBuf = NULL;
280
+
281
+ HDC windowDC = ::GetDC(getMainWnd());
282
+ BITMAP bmp;
283
+
284
+ HDC mMemoryDC = CreateCompatibleDC(windowDC);
285
+
286
+ mRowByteSize = mWidth*2;
287
+ if (((mWidth*2) & 0x3) != 0) {
288
+ mRowByteSize = ((mWidth*2) & (~0x3)) + 0x4;
289
+ }
290
+
291
+ char buf[sizeof(BITMAPINFOHEADER) + 100];
292
+ BITMAPINFO* bmi = (BITMAPINFO*)buf;
293
+
294
+ bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
295
+ bmi->bmiHeader.biWidth = mWidth;
296
+ bmi->bmiHeader.biHeight = mHeight;
297
+ bmi->bmiHeader.biPlanes = 1;
298
+ bmi->bmiHeader.biBitCount = 16;
299
+ bmi->bmiHeader.biCompression = BI_BITFIELDS;
300
+ bmi->bmiHeader.biSizeImage = mRowByteSize * mHeight;
301
+ bmi->bmiHeader.biXPelsPerMeter = 0;
302
+ bmi->bmiHeader.biYPelsPerMeter = 0;
303
+ bmi->bmiHeader.biClrUsed = 0;
304
+ bmi->bmiHeader.biClrImportant = 0;
305
+
306
+ *((DWORD*)&(bmi->bmiColors[0])) = 0x1F << 11;
307
+ *((DWORD*)&(bmi->bmiColors[1])) = 0x3F << 5;
308
+ *((DWORD*)&(bmi->bmiColors[2])) = 0x1F;
309
+
310
+ mMemoryBitmap = CreateDIBSection( mMemoryDC,
311
+ bmi,
312
+ DIB_RGB_COLORS,
313
+ (void**)&mBuf,
314
+ NULL,
315
+ 0);
316
+
317
+ HGDIOBJ resObj = ::SelectObject(mMemoryDC, mMemoryBitmap);
318
+
319
+ ::GetObject( mMemoryBitmap, sizeof(BITMAP), &bmp );
320
+
321
+ RECT r;
322
+ r.left = 0;
323
+ r.right = mWidth;
324
+ r.top = 0;
325
+ r.bottom = mHeight;
326
+
327
+ if (useAlpha) {
328
+ mAlphaBitmap = new WMAlphaBitmap(img);
329
+ }
330
+ else {
331
+ img->Draw(mMemoryDC, &r, NULL);
332
+ }
333
+
334
+ ::SelectObject(mMemoryDC, resObj);
335
+ DeleteDC(mMemoryDC);
336
+ #endif //#if defined(_WIN32_WCE)
337
+ }
338
+
339
+ WMBitmap::~WMBitmap() {
340
+ if (mMemoryBitmap != NULL) {
341
+ DeleteObject(mMemoryBitmap);
342
+ mMemoryBitmap = NULL;
343
+ }
344
+ /* if (mMemoryDC != NULL) {
345
+ DeleteDC(mMemoryDC);
346
+ mMemoryDC = NULL;
347
+ }*/
348
+ if (mAlphaBitmap != NULL) {
349
+ delete mAlphaBitmap;
350
+ mAlphaBitmap = NULL;
351
+ }
352
+ }
353
+
354
+ void WMBitmap::draw(HDC hdc, int x, int y)
355
+ {
356
+ HDC mMemoryDC = CreateCompatibleDC(hdc);
357
+ HGDIOBJ resObj = ::SelectObject(mMemoryDC, mMemoryBitmap);
358
+
359
+ if (mAlphaBitmap != NULL) {
360
+ ::BitBlt( mMemoryDC,
361
+ 0, 0,
362
+ mWidth, mHeight,
363
+ hdc,
364
+ x, y,
365
+ SRCCOPY);
366
+ mAlphaBitmap->draw(mBuf, mRowByteSize);
367
+ }
368
+ ::BitBlt( hdc,
369
+ x, y,
370
+ mWidth, mHeight,
371
+ mMemoryDC,
372
+ 0,0,
373
+ SRCCOPY);
374
+
375
+ ::SelectObject(mMemoryDC, resObj);
376
+ DeleteDC(mMemoryDC);
377
+ }
378
+
379
+ void WMBitmap::addRef() {
380
+ mReferenceCount++;
381
+ }
382
+
383
+ void WMBitmap::release() {
384
+ mReferenceCount--;
385
+ if (mReferenceCount <= 0) {
386
+ delete this;
387
+ }
388
+ }
389
+
390
+ WMAlphaBitmap::WMAlphaBitmap(IImage* img)
391
+ {
392
+ #if defined(_WIN32_WCE)
393
+ IImagingFactory *pImgFactory = NULL;
394
+
395
+ mWidth = 0;
396
+ mHeight = 0;
397
+ mImgBuf = NULL;
398
+
399
+ HRESULT co_init_result = CoInitializeEx(NULL, 0/*COINIT_APARTMENTTHREADED*/);
400
+ if ( (co_init_result == S_OK) || (co_init_result == S_FALSE) ) {
401
+ msg_out("CoInitializeEx OK");
402
+ if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
403
+ NULL,
404
+ CLSCTX_INPROC_SERVER,
405
+ IID_IImagingFactory,
406
+ (void **)&pImgFactory)))
407
+ {
408
+ ImageInfo imgInfo;
409
+ img->GetImageInfo(&imgInfo);
410
+ mWidth = imgInfo.Width;
411
+ mHeight = imgInfo.Height;
412
+ IBitmapImage* pBitmap = 0;
413
+
414
+ if ( SUCCEEDED(pImgFactory->CreateBitmapFromImage( img,
415
+ mWidth,
416
+ mHeight,
417
+ PixelFormat32bppARGB,
418
+ InterpolationHintDefault,
419
+ &pBitmap) )) {
420
+ msg_out("Create Bitmap OK");
421
+ RECT rc = { 0, 0, mWidth, mHeight};
422
+ BitmapData bitmap_data;
423
+ if ( SUCCEEDED(pBitmap->LockBits( &rc,
424
+ ImageLockModeRead,
425
+ PixelFormatDontCare,
426
+ &bitmap_data))) {
427
+ //
428
+ msg_out("Lock Bits OK");
429
+ void* src_buf = bitmap_data.Scan0;
430
+ int stride = bitmap_data.Stride;
431
+ int w = bitmap_data.Width;
432
+ int h = bitmap_data.Height;
433
+ mImgBuf = new unsigned int[w*h];
434
+ if (mImgBuf != 0) {
435
+ msg_out("Img buffer allocated OK");
436
+ // start convert
437
+ {
438
+ unsigned int* dst = mImgBuf;
439
+ unsigned int* src;
440
+ int x;
441
+ int y;
442
+ for (y = 0 ; y < h; y++) {
443
+ if (stride < 0) {
444
+ src = (unsigned int*)(((unsigned char*)src_buf) + (h-1-y)*(-stride));
445
+ }
446
+ else {
447
+ src = (unsigned int*)(((unsigned char*)src_buf) + y*(stride));
448
+ }
449
+ for (x = w; x > 0; x--) {
450
+ *dst++ = *src++;
451
+ }
452
+ }
453
+ }
454
+ msg_out("Convert to img buffer finished OK");
455
+ // finish convert
456
+ }
457
+ else {
458
+ err_out("Image Buffer not allocated !");
459
+ }
460
+ pBitmap->UnlockBits(&bitmap_data);
461
+ }
462
+ else {
463
+ err_out("Bitmap bits not locked !");
464
+ }
465
+ pBitmap->Release();
466
+ }
467
+
468
+ pImgFactory->Release();
469
+ }
470
+ CoUninitialize();
471
+ }
472
+ else {
473
+ err_out("CoInitializeEx not initialized !");
474
+ }
475
+ #endif //#if defined(_WIN32_WCE)
476
+ }
477
+
478
+ WMAlphaBitmap::~WMAlphaBitmap() {
479
+ if (mImgBuf != NULL) {
480
+ delete mImgBuf;
481
+ mImgBuf = NULL;
482
+ }
483
+ }
484
+
485
+ #define GET_R_32(dw) (((dw) & 0x00FF0000) >> 16)
486
+ #define GET_G_32(dw) (((dw) & 0x0000FF00) >> 8)
487
+ #define GET_B_32(dw) ((dw) & 0x000000FF)
488
+ #define GET_A_32(dw) (((dw) & 0xFF000000) >> 24)
489
+
490
+ #define GET_R_16(dw) (((dw) & 0xF800) >> 8)
491
+ #define GET_G_16(dw) (((dw) & 0x7E0) >> 3)
492
+ #define GET_B_16(dw) (((dw) & 0x1F) << 3)
493
+
494
+ #define SET_R_16(dw,dwc) dw = (unsigned short)(((dw) & (~0xF800)) | (((unsigned short)(dwc & 0xF8)) << 8))
495
+ #define SET_G_16(dw,dwc) dw = (unsigned short)(((dw) & (~0x7E0)) | (((unsigned short)(dwc & 0xF8)) << 3))
496
+ #define SET_B_16(dw,dwc) dw = (unsigned short)(((dw) & (~0x1F)) | (((unsigned short)(dwc & 0xF8)) >> 3))
497
+
498
+ // Normalize - stretch from 0..255 to 0..256
499
+ #define NORMALIZE_ALPHA(a) a = (unsigned int)(a) + ((unsigned int)(a) >> 7)
500
+ #define DENORMALIZE_ALPHA(a) a = (unsigned int)(a) - ((unsigned int)(a - 1) >> 7)
501
+
502
+ #define RENDER_R_16_32(dest, src, a) SET_R_16( (dest), ( ((int)GET_R_16(dest) << 8) + ((int)GET_R_32(src) - (int)GET_R_16(dest))*(int)(a) ) >> 8 )
503
+ #define RENDER_G_16_32(dest, src, a) SET_G_16( (dest), ( ((int)GET_G_16(dest) << 8) + ((int)GET_G_32(src) - (int)GET_G_16(dest))*(int)(a) ) >> 8 )
504
+ #define RENDER_B_16_32(dest, src, a) SET_B_16( (dest), ( ((int)GET_B_16(dest) << 8) + ((int)GET_B_32(src) - (int)GET_B_16(dest))*(int)(a) ) >> 8 )
505
+ #define RENDER_A_16_32(dest, src, a) SET_A_16( (dest), ( ((int)GET_A_16(dest) << 8) + ((int)GET_A_32(src) - (int)GET_A_16(dest))*(int)(a) ) >> 8 )
506
+
507
+ #define COLOR_32_TO_16(c) ((unsigned short)( ((c & 0xF80000) >> 8) | ((c & 0xF800) >> 5) | ((c & 0xF8) >> 3)))
508
+
509
+
510
+ void RENDER_DST16_SRC32(unsigned short* pdst, unsigned int* psrc)
511
+ {
512
+ register unsigned int src= *psrc;
513
+ register unsigned int srca = GET_A_32(src);
514
+ if (srca == 255)
515
+ {
516
+ *pdst = COLOR_32_TO_16(src);
517
+ }
518
+ else
519
+ {
520
+ if (srca != 0)
521
+ {
522
+ register unsigned short dst = *pdst;
523
+ NORMALIZE_ALPHA(srca);
524
+ RENDER_R_16_32(dst, src, srca);
525
+ RENDER_G_16_32(dst, src, srca);
526
+ RENDER_B_16_32(dst, src, srca);
527
+ *pdst = dst;
528
+ }
529
+ }
530
+ }
531
+
532
+ void WMAlphaBitmap::draw(unsigned short int *buf, int lineSizeInBytes) {
533
+ unsigned short* dst;
534
+ unsigned int* src = mImgBuf;
535
+
536
+ int x;
537
+ int y;
538
+
539
+ for (y = 0; y < mHeight; y++) {
540
+ src = mImgBuf + (mHeight-1-y)*mWidth;
541
+ dst = (unsigned short*)( ((unsigned char*)buf) + (lineSizeInBytes*y) );
542
+
543
+ for (x = 0; x < mWidth; x++) {
544
+ RENDER_DST16_SRC32(dst++, src++);
545
+ }
546
+ }
547
+ }
@@ -0,0 +1,136 @@
1
+ #pragma once
2
+
3
+ #include "stdafx.h"
4
+
5
+ #include <stdlib.h>
6
+ #include <windows.h>
7
+ #include <commctrl.h>
8
+
9
+ #if defined(_WIN32_WCE)
10
+ #include <imaging.h>
11
+ #else
12
+ struct IImage;
13
+ #endif
14
+
15
+ #include <string>
16
+ #include <string>
17
+ #include "ext/rho/rhoruby.h"
18
+ #include "common/StringConverter.h"
19
+
20
+ #include <common/rhoparams.h>
21
+ #include <common/map/MapEngine.h>
22
+
23
+
24
+ using namespace rho::common;
25
+ using namespace rho::common::map;
26
+ using namespace rho;
27
+ using namespace stdext;
28
+
29
+
30
+
31
+ class WMAlphaBitmap {
32
+ public:
33
+ WMAlphaBitmap(IImage* img);
34
+ virtual ~WMAlphaBitmap();
35
+ virtual int width() const {return mWidth;}
36
+ virtual int height() const {return mHeight;}
37
+
38
+ virtual void draw(unsigned short int *buf, int lineSizeInBytes);
39
+
40
+ private:
41
+ unsigned int *mImgBuf;
42
+ int mWidth;
43
+ int mHeight;
44
+ };
45
+
46
+ class WMBitmap {
47
+ public:
48
+ WMBitmap(IImage* img, bool useAlpha);
49
+ virtual public ~WMBitmap();
50
+
51
+ virtual void draw(HDC hdc, int x, int y);
52
+
53
+ virtual void addRef();
54
+ virtual void release();
55
+
56
+ virtual int width() const {return mWidth;}
57
+ virtual int height() const {return mHeight;}
58
+
59
+ private:
60
+ // HDC mMemoryDC;
61
+ HBITMAP mMemoryBitmap;
62
+ unsigned short* mBuf; // do not delete it - it controlled by Bitmap
63
+ int mWidth;
64
+ int mHeight;
65
+ int mRowByteSize;
66
+ int mReferenceCount;
67
+ WMAlphaBitmap* mAlphaBitmap;
68
+ };
69
+
70
+
71
+ class DrawingImageImpl : public IDrawingImage {
72
+ public:
73
+ DrawingImageImpl(void const *p, int size, bool useAlpha);
74
+ DrawingImageImpl(const char* path, bool useAlpha);
75
+ DrawingImageImpl(WMBitmap* bitmap);
76
+ virtual ~DrawingImageImpl();
77
+
78
+ virtual void draw(HDC hdc, int x, int y);
79
+
80
+ virtual IDrawingImage* clone();
81
+
82
+ virtual int width() const {return mWidth;}
83
+ virtual int height() const {return mHeight;}
84
+
85
+ private:
86
+ void init(const char* path, void const *p, int size, WMBitmap* bitmap, bool useAlpha);
87
+ //IImage* mImage;
88
+ WMBitmap* mBitmap;
89
+ int mWidth;
90
+ int mHeight;
91
+ int mID;
92
+ };
93
+
94
+
95
+ class DrawingContextImpl : public IDrawingContext{
96
+ public:
97
+ DrawingContextImpl(HDC hdc, int width, int height);
98
+ virtual int getWidth();
99
+ virtual int getHeight();
100
+ virtual void drawImage(int x, int y, IDrawingImage* image);
101
+ virtual void drawText(int x, int y, int nWidth, int nHeight, String const &text, int color);
102
+ virtual void getTextRect(int x, int y, String &text, RECT* resultRect);
103
+ virtual void fillRect(int x, int y, int width, int height, int color);
104
+ virtual void drawLine(int x1, int y1, int x2, int y2, int color);
105
+
106
+
107
+ private:
108
+ HDC mHDC;
109
+ int mWidth;
110
+ int mHeight;
111
+ };
112
+
113
+ class DrawingDeviceImpl : public IDrawingDevice
114
+ {
115
+ public:
116
+
117
+ virtual IDrawingImage* createImage(String const &path, bool useAlpha) {
118
+ return new DrawingImageImpl(path.c_str(), useAlpha);
119
+ }
120
+ virtual IDrawingImage* createImage(void const *p, size_t s, bool useAlpha) {
121
+ return new DrawingImageImpl(p, s, useAlpha);
122
+ }
123
+
124
+ virtual IDrawingImage* cloneImage(IDrawingImage *image) {
125
+ if (image == NULL) {
126
+ return NULL;
127
+ }
128
+ return ((DrawingImageImpl*)image)->clone();
129
+ }
130
+
131
+ virtual void destroyImage(IDrawingImage* image) {
132
+ delete image;
133
+ };
134
+
135
+ virtual void requestRedraw(){}
136
+ };