rhodes 3.4.2 → 3.5.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (705) hide show
  1. data/CHANGELOG +9 -0
  2. data/Rakefile +61 -9
  3. data/doc/build.txt +147 -38
  4. data/doc/configuration.txt +49 -33
  5. data/doc/connect-to-web-services.txt +32 -32
  6. data/doc/contributing.txt +1 -1
  7. data/doc/device-caps.txt +62 -311
  8. data/doc/extensions.txt +104 -5
  9. data/doc/install.txt +17 -61
  10. data/doc/linea.txt +11 -11
  11. data/doc/nfc.txt +3 -3
  12. data/doc/release.txt +4 -4
  13. data/doc/rhom.txt +7 -7
  14. data/doc/rhostudio-test-plan.txt +12 -12
  15. data/doc/simulator.txt +32 -19
  16. data/doc/syncengine-ajax-api.txt +1 -1
  17. data/doc/synchronization.txt +8 -2
  18. data/doc/test-log-debug.txt +34 -3
  19. data/doc/ui.txt +8 -3
  20. data/installer/icon.ico +0 -0
  21. data/lib/build/jake.rb +27 -6
  22. data/lib/extensions/audiocapture/audiocapture.rb +43 -0
  23. data/lib/extensions/audiocapture/ext.yml +5 -0
  24. data/lib/extensions/audiocapture/ext/audiocapture/platform/android/AndroidManifest.xml +10 -0
  25. data/lib/extensions/audiocapture/ext/audiocapture/platform/android/Rakefile +77 -0
  26. data/lib/extensions/audiocapture/ext/audiocapture/platform/android/ext_build.files +2 -0
  27. data/lib/extensions/audiocapture/ext/audiocapture/platform/android/jni/src/audiocapture.cpp +189 -0
  28. data/lib/extensions/audiocapture/ext/audiocapture/platform/android/src/com/audiocapture/Audiocapture.java +236 -0
  29. data/lib/extensions/audiocapture/ext/audiocapture/platform/android/src/com/audiocapture/ExtAudioRecorder.java +573 -0
  30. data/lib/extensions/audiocapture/ext/audiocapture/platform/bb/Audiocapture.files +1 -0
  31. data/lib/extensions/audiocapture/ext/audiocapture/platform/bb/Rakefile +97 -0
  32. data/lib/extensions/audiocapture/ext/audiocapture/platform/bb/audiocapture.jdp +48 -0
  33. data/lib/extensions/audiocapture/ext/audiocapture/platform/bb/src/com/audiocapture/Audiocapture.java +118 -0
  34. data/lib/extensions/audiocapture/ext/audiocapture/platform/iphone/Audiocapture.xcodeproj/project.pbxproj +314 -0
  35. data/lib/extensions/audiocapture/ext/audiocapture/platform/iphone/Audiocapture_Prefix.pch +7 -0
  36. data/lib/extensions/audiocapture/ext/audiocapture/platform/iphone/Classes/audioCapture.h +51 -0
  37. data/lib/extensions/audiocapture/ext/audiocapture/platform/iphone/Classes/audioCapture.m +418 -0
  38. data/lib/extensions/audiocapture/ext/audiocapture/platform/iphone/Rakefile +79 -0
  39. data/lib/extensions/audiocapture/ext/audiocapture/platform/wm/Audiocapture.sln +44 -0
  40. data/lib/extensions/audiocapture/ext/audiocapture/platform/wm/Audiocapture.vcproj +647 -0
  41. data/lib/extensions/audiocapture/ext/audiocapture/platform/wm/Audiocapture.vsprops +15 -0
  42. data/lib/extensions/audiocapture/ext/audiocapture/platform/wm/Rakefile +62 -0
  43. data/lib/extensions/audiocapture/ext/audiocapture/platform/wm/src/audiocapture_wm.cpp +40 -0
  44. data/lib/extensions/audiocapture/ext/audiocapture/platform/wm/src/audiocapture_wm.h +2 -0
  45. data/lib/extensions/audiocapture/ext/audiocapture/shared/ruby/audiocapture.i +29 -0
  46. data/lib/extensions/audiocapture/ext/audiocapture/shared/ruby/audiocapture_wrap.c +2310 -0
  47. data/lib/extensions/audiocapture/ext/audiocapture/shared/src/audiocapture.c +26 -0
  48. data/lib/extensions/audiocapture/ext/build +17 -0
  49. data/lib/extensions/audiocapture/ext/build.bat +36 -0
  50. data/lib/extensions/barcode/ext.yml +5 -3
  51. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +87 -87
  52. data/lib/extensions/digest-md5/ext/build +1 -1
  53. data/lib/extensions/digest-sha1/ext/build +1 -1
  54. data/lib/extensions/digest-sha2/ext/build +1 -1
  55. data/lib/extensions/digest/ext/build +1 -1
  56. data/lib/extensions/fcntl/ext/fcntl.c +5 -5
  57. data/lib/extensions/gcm-push/ext.yml +8 -0
  58. data/lib/extensions/gcm-push/ext/android/AndroidManifest.rb +5 -0
  59. data/lib/extensions/gcm-push/ext/android/ApplicationManifestAdds.erb +8 -0
  60. data/lib/extensions/gcm-push/ext/android/Rakefile +66 -0
  61. data/lib/extensions/gcm-push/ext/android/ext_build.files +3 -0
  62. data/lib/extensions/gcm-push/ext/android/jni/src/com_rhomobile_rhodes_gcm_GCMRhoListener.h +21 -0
  63. data/lib/extensions/gcm-push/ext/android/jni/src/gcmpushclient.cpp +173 -0
  64. data/lib/extensions/gcm-push/ext/android/jni/src/gcmpushclient.h +62 -0
  65. data/lib/extensions/gcm-push/ext/android/src/com/rhomobile/rhodes/gcm/GCMBroadcastReceiver.java +40 -0
  66. data/lib/extensions/gcm-push/ext/android/src/com/rhomobile/rhodes/gcm/GCMFacade.java +55 -0
  67. data/lib/extensions/gcm-push/ext/android/src/com/rhomobile/rhodes/gcm/GCMIntentService.java +60 -0
  68. data/lib/extensions/gcm-push/ext/build +12 -0
  69. data/lib/extensions/gcm-push/ext/build.bat +8 -0
  70. data/lib/extensions/net-http/net/http.rb +153 -119
  71. data/lib/extensions/net-http/net/https.rb +4 -38
  72. data/lib/extensions/nfc/ext.yml +6 -4
  73. data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +2 -2
  74. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcTechActivity.java +0 -1
  75. data/lib/extensions/openssl/openssl/ssl-internal.rb +3 -1
  76. data/lib/extensions/rawsensors/ext.yml +4 -0
  77. data/lib/extensions/rawsensors/ext/build +17 -0
  78. data/lib/extensions/rawsensors/ext/build.bat +36 -0
  79. data/lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile +77 -0
  80. data/lib/extensions/rawsensors/ext/rawsensors/platform/android/ext_build.files +1 -0
  81. data/lib/extensions/rawsensors/ext/rawsensors/platform/android/jni/src/rawsensors.cpp +180 -0
  82. data/lib/extensions/rawsensors/ext/rawsensors/platform/android/src/com/rawsensors/Rawsensors.java +355 -0
  83. data/lib/extensions/rawsensors/ext/rawsensors/platform/bb/Rakefile +97 -0
  84. data/lib/extensions/rawsensors/ext/rawsensors/platform/bb/Rawsensors.files +1 -0
  85. data/lib/extensions/rawsensors/ext/rawsensors/platform/bb/rawsensors.jdp +48 -0
  86. data/lib/extensions/rawsensors/ext/rawsensors/platform/bb/src/com/rawsensors/Rawsensors.java +118 -0
  87. data/lib/extensions/rawsensors/ext/rawsensors/platform/iphone/Classes/RawSensors.h +66 -0
  88. data/lib/extensions/rawsensors/ext/rawsensors/platform/iphone/Classes/RawSensors.m +351 -0
  89. data/lib/extensions/rawsensors/ext/rawsensors/platform/iphone/Rakefile +79 -0
  90. data/lib/extensions/rawsensors/ext/rawsensors/platform/iphone/Rawsensors.xcodeproj/project.pbxproj +316 -0
  91. data/lib/extensions/rawsensors/ext/rawsensors/platform/iphone/Rawsensors_Prefix.pch +7 -0
  92. data/lib/extensions/rawsensors/ext/rawsensors/platform/wm/Rakefile +62 -0
  93. data/lib/extensions/rawsensors/ext/rawsensors/platform/wm/Rawsensors.sln +44 -0
  94. data/lib/extensions/rawsensors/ext/rawsensors/platform/wm/Rawsensors.vcproj +647 -0
  95. data/lib/extensions/rawsensors/ext/rawsensors/platform/wm/Rawsensors.vsprops +15 -0
  96. data/lib/extensions/rawsensors/ext/rawsensors/platform/wm/src/rawsensors_wm.cpp +40 -0
  97. data/lib/extensions/rawsensors/ext/rawsensors/platform/wm/src/rawsensors_wm.h +2 -0
  98. data/lib/extensions/rawsensors/ext/rawsensors/shared/ruby/rawsensors.i +22 -0
  99. data/lib/extensions/rawsensors/ext/rawsensors/shared/ruby/rawsensors_wrap.c +2308 -0
  100. data/lib/extensions/rawsensors/ext/rawsensors/shared/src/rawsensors.c +25 -0
  101. data/lib/extensions/rawsensors/rawsensors.rb +36 -0
  102. data/lib/framework/autocomplete/AddressBar.rb +19 -0
  103. data/lib/framework/autocomplete/Alarm.rb +23 -0
  104. data/lib/framework/autocomplete/Alert.rb +19 -0
  105. data/lib/framework/autocomplete/AppApplication.rb +17 -0
  106. data/lib/framework/autocomplete/AppSwitcher.rb +13 -0
  107. data/lib/framework/autocomplete/Application.rb +23 -0
  108. data/lib/framework/autocomplete/AudioCapture.rb +31 -0
  109. data/lib/framework/autocomplete/BackButton.rb +25 -0
  110. data/lib/framework/autocomplete/Backlight.rb +21 -0
  111. data/lib/framework/autocomplete/Barcode.rb +29 -0
  112. data/lib/framework/autocomplete/BasicSocket.rb +87 -0
  113. data/lib/framework/autocomplete/Battery.rb +33 -0
  114. data/lib/framework/autocomplete/BottomCommandArea.rb +19 -0
  115. data/lib/framework/autocomplete/BrowserHelper.rb +19 -0
  116. data/lib/framework/autocomplete/Bsearch.rb +11 -0
  117. data/lib/framework/autocomplete/Camera.rb +17 -0
  118. data/lib/framework/autocomplete/CardReader.rb +29 -0
  119. data/lib/framework/autocomplete/Comm.rb +45 -0
  120. data/lib/framework/autocomplete/Cradle.rb +15 -0
  121. data/lib/framework/autocomplete/Date.rb +50 -0
  122. data/lib/framework/autocomplete/DateTime.rb +24 -0
  123. data/lib/framework/autocomplete/DateTimePicker.rb +15 -0
  124. data/lib/framework/autocomplete/Device.rb +19 -0
  125. data/lib/framework/autocomplete/Digest.rb +28 -0
  126. data/lib/framework/autocomplete/Dir.rb +63 -0
  127. data/lib/framework/autocomplete/Eink.rb +19 -0
  128. data/lib/framework/autocomplete/EmmlProfile.rb +19 -0
  129. data/lib/framework/autocomplete/File.rb +301 -0
  130. data/lib/framework/autocomplete/FileTransfer.rb +27 -0
  131. data/lib/framework/autocomplete/ForwardButton.rb +25 -0
  132. data/lib/framework/autocomplete/GeneratorController.rb +15 -0
  133. data/lib/framework/autocomplete/GeoLocation.rb +27 -0
  134. data/lib/framework/autocomplete/Gesture.rb +71 -0
  135. data/lib/framework/autocomplete/GoButton.rb +25 -0
  136. data/lib/framework/autocomplete/HashWithIndifferentAccess.rb +51 -0
  137. data/lib/framework/autocomplete/History.rb +11 -0
  138. data/lib/framework/autocomplete/HomeButton.rb +25 -0
  139. data/lib/framework/autocomplete/Hourglass.rb +17 -0
  140. data/lib/framework/autocomplete/IPSocket.rb +65 -0
  141. data/lib/framework/autocomplete/Imager.rb +53 -0
  142. data/lib/framework/autocomplete/IoAnalog.rb +73 -0
  143. data/lib/framework/autocomplete/IoDigital.rb +93 -0
  144. data/lib/framework/autocomplete/IoSystem.rb +21 -0
  145. data/lib/framework/autocomplete/JSON.rb +142 -0
  146. data/lib/framework/autocomplete/KeyCapture.rb +25 -0
  147. data/lib/framework/autocomplete/KeyState.rb +23 -0
  148. data/lib/framework/autocomplete/Keylight.rb +17 -0
  149. data/lib/framework/autocomplete/Lightsensor.rb +19 -0
  150. data/lib/framework/autocomplete/LocalizationSimplified.rb +33 -0
  151. data/lib/framework/autocomplete/MapView.rb +23 -0
  152. data/lib/framework/autocomplete/MediaPlayer.rb +19 -0
  153. data/lib/framework/autocomplete/Memory.rb +17 -0
  154. data/lib/framework/autocomplete/MinimizeButton.rb +25 -0
  155. data/lib/framework/autocomplete/NativeBar.rb +31 -0
  156. data/lib/framework/autocomplete/NavBar.rb +15 -0
  157. data/lib/framework/autocomplete/Network.rb +31 -0
  158. data/lib/framework/autocomplete/Notification.rb +35 -0
  159. data/lib/framework/autocomplete/OpenSSL.rb +440 -0
  160. data/lib/framework/autocomplete/Phonebook.rb +39 -0
  161. data/lib/framework/autocomplete/PowerOn.rb +13 -0
  162. data/lib/framework/autocomplete/Push.rb +27 -0
  163. data/lib/framework/autocomplete/QuitButton.rb +25 -0
  164. data/lib/framework/autocomplete/RHO_APPS_DIR.rb +8 -0
  165. data/lib/framework/autocomplete/RHO_ERB_EXT.rb +8 -0
  166. data/lib/framework/autocomplete/RHO_FRAMEWORK.rb +0 -0
  167. data/lib/framework/autocomplete/RHO_RB_EXT.rb +8 -0
  168. data/lib/framework/autocomplete/RawSensors.rb +53 -0
  169. data/lib/framework/autocomplete/Reboot.rb +13 -0
  170. data/lib/framework/autocomplete/Registry.rb +25 -0
  171. data/lib/framework/autocomplete/ReloadButton.rb +25 -0
  172. data/lib/framework/autocomplete/Rfid.rb +173 -0
  173. data/lib/framework/autocomplete/Rho.rb +496 -0
  174. data/lib/framework/autocomplete/RhoBluetooth.rb +41 -0
  175. data/lib/framework/autocomplete/RhoConf.rb +23 -0
  176. data/lib/framework/autocomplete/RhoElementsExt.rb +11 -0
  177. data/lib/framework/autocomplete/RhoLog.rb +13 -0
  178. data/lib/framework/autocomplete/RhoProfiler.rb +21 -0
  179. data/lib/framework/autocomplete/RhoStdout.rb +19 -0
  180. data/lib/framework/autocomplete/Rhodes.rb +13 -0
  181. data/lib/framework/autocomplete/RhodesNativeViewManager.rb +15 -0
  182. data/lib/framework/autocomplete/Rhom.rb +198 -0
  183. data/lib/framework/autocomplete/Rsm.rb +135 -0
  184. data/lib/framework/autocomplete/SQLite3.rb +36 -0
  185. data/lib/framework/autocomplete/SWIG.rb +24 -0
  186. data/lib/framework/autocomplete/ScanError.rb +9 -0
  187. data/lib/framework/autocomplete/Scanner.rb +379 -0
  188. data/lib/framework/autocomplete/ScreenOrientation.rb +23 -0
  189. data/lib/framework/autocomplete/SignatureCapture.rb +47 -0
  190. data/lib/framework/autocomplete/SignatureTool.rb +11 -0
  191. data/lib/framework/autocomplete/Sip.rb +19 -0
  192. data/lib/framework/autocomplete/SipButton.rb +25 -0
  193. data/lib/framework/autocomplete/Sntp.rb +13 -0
  194. data/lib/framework/autocomplete/Socket.rb +356 -0
  195. data/lib/framework/autocomplete/SocketError.rb +9 -0
  196. data/lib/framework/autocomplete/StopButton.rb +25 -0
  197. data/lib/framework/autocomplete/StringIO.rb +139 -0
  198. data/lib/framework/autocomplete/StringScanner.rb +102 -0
  199. data/lib/framework/autocomplete/Stylus.rb +15 -0
  200. data/lib/framework/autocomplete/SyncEngine.rb +77 -0
  201. data/lib/framework/autocomplete/System.rb +79 -0
  202. data/lib/framework/autocomplete/SystemTime.rb +17 -0
  203. data/lib/framework/autocomplete/TCPServer.rb +65 -0
  204. data/lib/framework/autocomplete/TCPSocket.rb +59 -0
  205. data/lib/framework/autocomplete/Telemetry.rb +23 -0
  206. data/lib/framework/autocomplete/Thread.rb +85 -0
  207. data/lib/framework/autocomplete/Time.rb +167 -0
  208. data/lib/framework/autocomplete/Timer.rb +19 -0
  209. data/lib/framework/autocomplete/TopCommandArea.rb +19 -0
  210. data/lib/framework/autocomplete/UDPSocket.rb +65 -0
  211. data/lib/framework/autocomplete/VideoCapture.rb +29 -0
  212. data/lib/framework/autocomplete/Volume.rb +13 -0
  213. data/lib/framework/autocomplete/Wake.rb +15 -0
  214. data/lib/framework/autocomplete/WebView.rb +31 -0
  215. data/lib/framework/autocomplete/Wlan.rb +87 -0
  216. data/lib/framework/autocomplete/Zoom.rb +15 -0
  217. data/lib/framework/autocomplete/ZoomInPageButton.rb +25 -0
  218. data/lib/framework/autocomplete/ZoomOutPageButton.rb +25 -0
  219. data/lib/framework/autocomplete/ZoomTextButton.rb +25 -0
  220. data/lib/framework/rho/render.rb +15 -4
  221. data/lib/framework/rho/rho.rb +17 -8
  222. data/lib/framework/rho/rhoapplication.rb +25 -3
  223. data/lib/framework/rho/rhocontact.rb +13 -0
  224. data/lib/framework/rho/rhoevent.rb +15 -0
  225. data/lib/framework/rho/rhonativeviewmanager.rb +3 -3
  226. data/lib/framework/rhodes.rb +1 -1
  227. data/lib/framework/rhom/rhom.rb +5 -0
  228. data/lib/framework/rhomotoapi.rb +2 -1
  229. data/lib/framework/version.rb +1 -1
  230. data/lib/rhodes.rb +1 -1
  231. data/platform/android/Rhodes/AndroidManifest.xml +4 -3
  232. data/platform/android/Rhodes/AndroidManifest.xml.erb +7 -7
  233. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +22 -0
  234. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +1 -9
  235. data/platform/android/Rhodes/jni/src/callbacks.cpp +2 -0
  236. data/platform/android/Rhodes/jni/src/camera.cpp +5 -0
  237. data/platform/android/Rhodes/jni/src/event.cpp +10 -0
  238. data/platform/android/Rhodes/jni/src/geolocation.cpp +10 -0
  239. data/platform/android/Rhodes/jni/src/logger.cpp +3 -1
  240. data/platform/android/Rhodes/jni/src/phonebook.cpp +11 -0
  241. data/platform/android/Rhodes/jni/src/rhodes.cpp +1 -1
  242. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +41 -25
  243. data/platform/android/Rhodes/jni/src/signature.cpp +7 -6
  244. data/platform/android/Rhodes/jni/src/webview.cpp +29 -0
  245. data/platform/android/Rhodes/project.properties +1 -1
  246. data/platform/android/Rhodes/res/drawable/icon.png +0 -0
  247. data/platform/android/Rhodes/src/com/rhomobile/rhodes/ConnectionChangeReceiver.java +28 -0
  248. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +1 -1
  249. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushContract.java +102 -0
  250. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +20 -56
  251. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +9 -124
  252. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +114 -126
  253. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +26 -0
  254. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +3 -5
  255. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +31 -13
  256. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +2 -0
  257. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePicker.java +3 -7
  258. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/CalendarIDsProvider.java +19 -0
  259. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/CalendarIDsProviderFroyo.java +5 -0
  260. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/CalendarIDsProviderICS.java +22 -0
  261. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +32 -22
  262. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +5 -0
  263. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoListener.java +34 -0
  264. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +11 -2
  265. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +1 -0
  266. data/platform/android/Rhodes/src/com/rhomobile/rhodes/{webview → extmanager}/IRhoWebView.java +5 -1
  267. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +605 -492
  268. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +16 -0
  269. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +9 -2
  270. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +43 -14
  271. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +82 -64
  272. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +28 -13
  273. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +4 -4
  274. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +0 -1
  275. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +4 -0
  276. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +6 -0
  277. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality08.java +7 -0
  278. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality12.java +6 -0
  279. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality13.java +6 -0
  280. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality14.java +12 -0
  281. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +10 -1
  282. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +3 -6
  283. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/RhoSocketImpl.java +1 -1
  284. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +1 -1
  285. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +43 -0
  286. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebChromeClient.java +5 -0
  287. data/platform/android/build/RhodesSRC_build.files +10 -4
  288. data/platform/android/build/android.rake +46 -193
  289. data/platform/android/build/android_tools.rb +181 -13
  290. data/platform/bb/Hsqldb/src/org/hsqldb/CompiledStatementExecutor.java +3 -3
  291. data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +4 -2
  292. data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -0
  293. data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +6 -0
  294. data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +13 -8
  295. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +103 -1
  296. data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +18 -0
  297. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +9 -2
  298. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +16 -11
  299. data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +25 -3
  300. data/platform/bb/RubyVM/src/com/rho/sync/ISyncProtocol.java +1 -1
  301. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +122 -32
  302. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +44 -14
  303. data/platform/bb/RubyVM/src/com/rho/sync/SyncProtocol_3.java +3 -2
  304. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +340 -88
  305. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +62 -15
  306. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/AttrReader.java +1 -1
  307. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFixnum.java +3 -1
  308. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyHash.java +1 -1
  309. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +19 -1
  310. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyBasic.java +9 -0
  311. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyBinding.java +4 -4
  312. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyModule.java +13 -1
  313. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyObject.java +16 -1
  314. data/platform/bb/build/bb.rake +3 -1
  315. data/platform/bb/build/rhodes_build.files +0 -1
  316. data/platform/bb/rhodes/platform/4.7/com/rho/rubyext/SignatureCapture.java +13 -18
  317. data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +13 -3
  318. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +1 -1
  319. data/platform/bb/rhodes/platform/common/com/rho/rubyext/SignatureCapture.java +13 -18
  320. data/platform/bb/rhodes/resources/icon.png +0 -0
  321. data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +10 -0
  322. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +13 -3
  323. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +5 -0
  324. data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +1 -1
  325. data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +6 -1
  326. data/platform/bb/rhodes/src/com/rho/file/Jsr75RAFileImpl.java +6 -1
  327. data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +38 -9
  328. data/platform/bb/rhodes/src/com/rho/rubyext/SignatureCapture.java +13 -18
  329. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +16 -1
  330. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +0 -20
  331. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +1 -10
  332. data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +40 -35
  333. data/platform/iphone/Classes/AppManager/AppManager.h +1 -1
  334. data/platform/iphone/Classes/AppManager/AppManager.m +46 -29
  335. data/platform/iphone/Classes/Camera/PickImageDelegate.m +9 -0
  336. data/platform/iphone/Classes/Event/Event.h +6 -1
  337. data/platform/iphone/Classes/Event/Event.m +67 -1
  338. data/platform/iphone/Classes/GeoLocation/LocationController.h +2 -1
  339. data/platform/iphone/Classes/GeoLocation/LocationController.m +17 -1
  340. data/platform/iphone/Classes/NetworkStatusMonitor.h +17 -0
  341. data/platform/iphone/Classes/NetworkStatusMonitor.mm +58 -0
  342. data/platform/iphone/Classes/Phonebook/phonebook.h +6 -0
  343. data/platform/iphone/Classes/Phonebook/phonebook.m +62 -6
  344. data/platform/iphone/Classes/Reachability.h +31 -0
  345. data/platform/iphone/Classes/Reachability.m +223 -0
  346. data/platform/iphone/Classes/RhoMainView.h +1 -0
  347. data/platform/iphone/Classes/RhoViewController.m +16 -0
  348. data/platform/iphone/Classes/Rhodes.h +2 -0
  349. data/platform/iphone/Classes/Rhodes.m +89 -10
  350. data/platform/iphone/Classes/Signature/SignatureDelegate.m +4 -7
  351. data/platform/iphone/Classes/SimpleMainView.m +16 -0
  352. data/platform/iphone/Classes/SplashViewController.m +11 -1
  353. data/platform/iphone/Classes/SplitView/RightViewController.m +6 -0
  354. data/platform/iphone/Classes/SplitView/SplittedMainView.m +5 -0
  355. data/platform/iphone/Classes/TabbedMainView.m +4 -0
  356. data/platform/iphone/Classes/WebView.m +14 -0
  357. data/platform/iphone/Info.plist +1 -6
  358. data/platform/iphone/iTunesArtwork.jpg +0 -0
  359. data/platform/iphone/icon.png +0 -0
  360. data/platform/iphone/icon114.png +0 -0
  361. data/platform/iphone/icon57.png +0 -0
  362. data/platform/iphone/icon72.png +0 -0
  363. data/platform/iphone/rbuild/iphone.rake +8 -11
  364. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +20 -4
  365. data/platform/osx/Rhodes Launcher/rhorunner.app/icon.png +0 -0
  366. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore +0 -0
  367. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui +0 -0
  368. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork +0 -0
  369. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtWebKit.framework/Versions/4/QtWebKit +0 -0
  370. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
  371. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
  372. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib +0 -0
  373. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib +0 -0
  374. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqgenericbearer.dylib +0 -0
  375. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqcncodecs.dylib +0 -0
  376. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqjpcodecs.dylib +0 -0
  377. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqkrcodecs.dylib +0 -0
  378. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqtwcodecs.dylib +0 -0
  379. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/graphicssystems/libqtracegraphicssystem.dylib +0 -0
  380. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqgif.dylib +0 -0
  381. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqico.dylib +0 -0
  382. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqjpeg.dylib +0 -0
  383. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqmng.dylib +0 -0
  384. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtga.dylib +0 -0
  385. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtiff.dylib +0 -0
  386. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_inspector.dylib +0 -0
  387. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_tcp.dylib +0 -0
  388. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Resources/rho.icns +0 -0
  389. data/platform/shared/common/ExtManager.h +8 -0
  390. data/platform/shared/common/RhoDefs.h +3 -2
  391. data/platform/shared/common/RhoFile.cpp +14 -1
  392. data/platform/shared/common/RhoMutexLock.h +4 -0
  393. data/platform/shared/common/RhoPort.h +5 -1
  394. data/platform/shared/common/RhoStd.h +12 -0
  395. data/platform/shared/common/RhoThread.cpp +1 -2
  396. data/platform/shared/common/RhoTime.h +4 -0
  397. data/platform/shared/common/RhodesApp.cpp +189 -65
  398. data/platform/shared/common/RhodesApp.h +60 -7
  399. data/platform/shared/common/RhodesAppBase.cpp +2 -8
  400. data/platform/shared/common/RhodesAppBase.h +1 -0
  401. data/platform/shared/common/ThreadQueue.cpp +2 -2
  402. data/platform/shared/common/app_build_configs.c +3 -1
  403. data/platform/shared/common/map/MapEngine.cpp +39 -3
  404. data/platform/shared/common/push/IRhoPushClient.h +3 -3
  405. data/platform/shared/common/push/RhoPushManager.cpp +31 -53
  406. data/platform/shared/common/push/RhoPushManager.h +12 -26
  407. data/platform/shared/curl/lib/curl_config.h +1 -1
  408. data/platform/shared/json/RJSONTokener.c +3 -1
  409. data/platform/shared/json/config.h +4 -4
  410. data/platform/shared/json/json_tokener.c +1 -1
  411. data/platform/shared/logging/RhoLog.cpp +5 -5
  412. data/platform/shared/logging/RhoLogConf.cpp +4 -6
  413. data/platform/shared/logging/RhoLogConf.h +2 -2
  414. data/platform/shared/logging/RhoLogSink.cpp +2 -0
  415. data/platform/shared/net/HttpServer.cpp +54 -7
  416. data/platform/shared/net/HttpServer.h +2 -0
  417. data/platform/shared/qt/rhodes/QtMainWindow.cpp +22 -0
  418. data/platform/shared/qt/rhodes/QtMainWindow.h +1 -0
  419. data/platform/shared/qt/rhodes/impl/CalendarImpl.cpp +4 -0
  420. data/platform/shared/qt/rhodes/impl/CameraImpl.cpp +4 -0
  421. data/platform/shared/qt/rhodes/impl/GeoLocationImpl.cpp +6 -0
  422. data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +7 -0
  423. data/platform/shared/qt/rhodes/impl/MainWindowImpl.h +2 -0
  424. data/platform/shared/qt/rhodes/impl/PhonebookImpl.cpp +4 -0
  425. data/platform/shared/qt/rhodes/impl/SystemImpl.cpp +5 -0
  426. data/platform/shared/qt/rhodes/impl/WebViewImpl.cpp +12 -0
  427. data/platform/shared/qt/rhodes/main.cpp +0 -7
  428. data/platform/shared/qt/rhodes/resources/rho.icns +0 -0
  429. data/platform/shared/qt/rhodes/resources/rho.ico +0 -0
  430. data/platform/shared/qt/rhodes/resources/rho.png +0 -0
  431. data/platform/shared/ruby/encoding.c +4 -0
  432. data/platform/shared/ruby/ext/calendar/calendar.i +3 -0
  433. data/platform/shared/ruby/ext/calendar/calendar_wrap.c +19 -0
  434. data/platform/shared/ruby/ext/camera/camera.i +2 -0
  435. data/platform/shared/ruby/ext/camera/camera_wrap.c +43 -2
  436. data/platform/shared/ruby/ext/geolocation/geolocation.i +4 -0
  437. data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +24 -4
  438. data/platform/shared/ruby/ext/phonebook/phonebook.i +4 -0
  439. data/platform/shared/ruby/ext/phonebook/phonebook_wrap.c +44 -0
  440. data/platform/shared/ruby/ext/rho/extensions.c +0 -2
  441. data/platform/shared/ruby/ext/rho/rhoruby.c +2 -0
  442. data/platform/shared/ruby/ext/rho/rhosupport.c +8 -0
  443. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +1 -1
  444. data/platform/shared/ruby/ext/syncengine/syncengine.i +6 -2
  445. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +19 -6
  446. data/platform/shared/ruby/ext/system/system.i +22 -0
  447. data/platform/shared/ruby/ext/system/system_wrap.c +158 -86
  448. data/platform/shared/ruby/ext/webview/webview.i +13 -8
  449. data/platform/shared/ruby/ext/webview/webview_wrap.c +88 -2
  450. data/platform/shared/ruby/include/ruby/win32.h +3 -1
  451. data/platform/shared/ruby/iphone/ruby/config.h +3 -3
  452. data/platform/shared/ruby/missing/hypot.c +4 -0
  453. data/platform/shared/ruby/random.c +6 -2
  454. data/platform/shared/ruby/thread_win32.c +8 -3
  455. data/platform/shared/ruby/win32/ruby/config.h +0 -3
  456. data/platform/shared/ruby/win32/win32.c +4 -0
  457. data/platform/shared/ruby/wp8/assert.c +12 -0
  458. data/platform/shared/ruby/wp8/assert.h +18 -0
  459. data/platform/shared/ruby/wp8/errno.c +11 -0
  460. data/platform/shared/ruby/wp8/errno.h +59 -0
  461. data/platform/shared/ruby/wp8/missing_wp8.h +74 -0
  462. data/platform/shared/ruby/wp8/signal.h +71 -0
  463. data/platform/shared/ruby/wp8/signal_wp8.c +26 -0
  464. data/platform/shared/ruby/wp8/stdio.c +36 -0
  465. data/platform/shared/ruby/wp8/stdlib.c +61 -0
  466. data/platform/shared/ruby/wp8/string_wp8.c +89 -0
  467. data/platform/shared/ruby/wp8/sys/stat.c +183 -0
  468. data/platform/shared/ruby/wp8/sys/stat.h +70 -0
  469. data/platform/shared/ruby/wp8/sys/timeb.c +31 -0
  470. data/platform/shared/ruby/wp8/sys/timeb.h +27 -0
  471. data/platform/shared/ruby/wp8/sys/types.h +62 -0
  472. data/platform/shared/ruby/wp8/sys/utime.c +44 -0
  473. data/platform/shared/ruby/wp8/sys/utime.h +27 -0
  474. data/platform/shared/ruby/wp8/time_wp8.c +256 -0
  475. data/platform/shared/ruby/wp8/varargs.h +34 -0
  476. data/platform/shared/ruby/wp8/win32/win32.c +5783 -0
  477. data/platform/shared/ruby/wp8/winsock_wp8.c +26 -0
  478. data/platform/shared/ruby/wp8/winsock_wp8.h +23 -0
  479. data/platform/shared/ruby/wp8/wp8.c +516 -0
  480. data/platform/shared/ruby/wp8/wp8.h +274 -0
  481. data/platform/shared/ruby/wp8/wp8main.c +18 -0
  482. data/platform/shared/rubyext/GeoLocation.cpp +1 -1
  483. data/platform/shared/rubyext/System.cpp +18 -4
  484. data/platform/shared/rubyext/ZipFiles.cpp +1 -1
  485. data/platform/shared/sync/ClientRegister.cpp +113 -23
  486. data/platform/shared/sync/ClientRegister.h +27 -16
  487. data/platform/shared/sync/ILoginListener.h +44 -0
  488. data/platform/shared/sync/SyncEngine.cpp +50 -24
  489. data/platform/shared/sync/SyncEngine.h +11 -5
  490. data/platform/shared/sync/SyncSource.cpp +87 -61
  491. data/platform/shared/sync/SyncSource.h +6 -3
  492. data/platform/shared/sync/SyncThread.cpp +8 -15
  493. data/platform/shared/sync/SyncThread.h +13 -7
  494. data/platform/shared/unzip/unzip.cpp +1 -1
  495. data/platform/shared/unzip/zip.h +8 -1
  496. data/platform/shared/xruby/src/com/xruby/runtime/builtin/AttrReader.java +13 -0
  497. data/platform/shared/xruby/src/com/xruby/runtime/builtin/RubyFixnum.java +3 -1
  498. data/platform/shared/xruby/src/com/xruby/runtime/lang/MethodBlockBase.java +9 -0
  499. data/platform/shared/xruby/src/com/xruby/runtime/lang/RubyBasic.java +9 -0
  500. data/platform/shared/xruby/src/com/xruby/runtime/lang/RubyBinding.java +17 -0
  501. data/platform/shared/xruby/src/com/xruby/runtime/lang/RubyMethod.java +22 -2
  502. data/platform/shared/xruby/src/com/xruby/runtime/lang/RubyModule.java +25 -0
  503. data/platform/shared/xruby/src/com/xruby/runtime/lang/RubyObject.java +21 -0
  504. data/platform/shared/xruby/src/com/xruby/runtime/lang/RubyValue.java +8 -0
  505. data/platform/symbian/rhodes/src/phonebook/ruby_phonebook.cpp +6 -0
  506. data/platform/win32/RhoSimulator/Microsoft.VC90.CRT.manifest +12 -5
  507. data/platform/win32/RhoSimulator/Microsoft.VC90.OpenMP.manifest +12 -5
  508. data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
  509. data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
  510. data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
  511. data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
  512. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  513. data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
  514. data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
  515. data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
  516. data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
  517. data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
  518. data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
  519. data/platform/win32/RhoSimulator/msvcm90.dll +0 -0
  520. data/platform/win32/RhoSimulator/msvcp90.dll +0 -0
  521. data/platform/win32/RhoSimulator/msvcr90.dll +0 -0
  522. data/platform/win32/RhoSimulator/phonon4.dll +0 -0
  523. data/platform/win32/RhoSimulator/vcomp90.dll +0 -0
  524. data/platform/wm/build/wm.rake +67 -22
  525. data/platform/wm/rhodes.sln +485 -493
  526. data/platform/wm/rhodes/IEBrowserEngine.cpp +2 -6
  527. data/platform/wm/rhodes/MainWindow.cpp +86 -35
  528. data/platform/wm/rhodes/MainWindow.h +33 -0
  529. data/platform/wm/rhodes/Rhodes.cpp +288 -215
  530. data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +22 -17
  531. data/platform/wm/rhodes/bluetooth/Bluetooth.h +3 -3
  532. data/platform/wm/rhodes/camera/Camera.cpp +4 -0
  533. data/platform/wm/rhodes/camera/Camera.h +1 -0
  534. data/platform/wm/rhodes/phonebook/phonebook.cpp +9 -0
  535. data/platform/wm/rhodes/phonebook/phonebook.h +2 -0
  536. data/platform/wm/rhodes/resources/icon.ico +0 -0
  537. data/platform/wm/rhodes/rho/common/ExtManager.cpp +5 -1
  538. data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +1 -11
  539. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +5 -0
  540. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +21 -2
  541. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +12 -0
  542. data/platform/wm/rhodes/rho/rubyext/calendar.cpp +9 -0
  543. data/platform/wm/rhodes/rhodes.vcproj +60 -60
  544. data/platform/wm/rhodes/simulator/MainWindowQt.cpp +91 -6
  545. data/platform/wm/rhodes/simulator/MainWindowQt.h +6 -0
  546. data/platform/wm/rhoelements.sln +624 -623
  547. data/platform/wm/tcmalloc/tcmalloc.vcproj +1230 -1070
  548. data/platform/wp7/RhoRubyLib/rubyext/RhoCamera.cs +6 -3
  549. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +5 -0
  550. data/platform/wp7/rhodes/icon.png +0 -0
  551. data/platform/wp8/RhoAppRunner/Program.cs +99 -0
  552. data/platform/wp8/RhoAppRunner/Properties/AssemblyInfo.cs +36 -0
  553. data/platform/wp8/RhoAppRunner/RhoAppRunner.csproj +69 -0
  554. data/platform/wp8/build/wp.rake +486 -0
  555. data/platform/wp8/rhodes.sln +154 -0
  556. data/platform/wp8/rhodes/App.xaml +20 -0
  557. data/platform/wp8/rhodes/App.xaml.cs +189 -0
  558. data/platform/wp8/rhodes/Assets/ApplicationIcon.png +0 -0
  559. data/platform/wp8/rhodes/Assets/Tiles/FlipCycleTileMedium.png +0 -0
  560. data/platform/wp8/rhodes/Assets/Tiles/FlipCycleTileSmall.png +0 -0
  561. data/platform/wp8/rhodes/LocalizedStrings.cs +37 -0
  562. data/platform/wp8/rhodes/MainPage.xaml +21 -0
  563. data/platform/wp8/rhodes/MainPage.xaml.cs +339 -0
  564. data/platform/wp8/rhodes/Properties/AppManifest.xml +6 -0
  565. data/platform/wp8/rhodes/Properties/AssemblyInfo.cs +37 -0
  566. data/platform/wp8/rhodes/Properties/WMAppManifest.xml +47 -0
  567. data/platform/wp8/rhodes/Resources/AppResources.Designer.cs +127 -0
  568. data/platform/wp8/rhodes/Resources/AppResources.resx +135 -0
  569. data/platform/wp8/rhodes/common/IInputStream.cs +47 -0
  570. data/platform/wp8/rhodes/common/RhoFile.cs +374 -0
  571. data/platform/wp8/rhodes/common/RhoFilePath.cs +115 -0
  572. data/platform/wp8/rhodes/common/RhoResourceMap.cs +92 -0
  573. data/platform/wp8/rhodes/common/RhoStd.cs +237 -0
  574. data/platform/wp8/rhodes/icon.png +0 -0
  575. data/platform/wp8/rhodes/rhodes.csproj +198 -0
  576. data/platform/wp8/rholib/rholib.vcxproj +240 -0
  577. data/platform/wp8/rholib/rholib.vcxproj.filters +289 -0
  578. data/platform/wp8/rhoruntime/FakeDefs.cpp +134 -0
  579. data/platform/wp8/rhoruntime/common/ExtManager.cpp +449 -0
  580. data/platform/wp8/rhoruntime/common/RhoClassFactory.cpp +58 -0
  581. data/platform/wp8/rhoruntime/common/RhoClassFactory.h +60 -0
  582. data/platform/wp8/rhoruntime/common/RhoCryptImpl.cpp +274 -0
  583. data/platform/wp8/rhoruntime/common/RhoCryptImpl.h +78 -0
  584. data/platform/wp8/rhoruntime/common/RhoThreadImpl.cpp +109 -0
  585. data/platform/wp8/rhoruntime/common/RhoThreadImpl.h +56 -0
  586. data/platform/wp8/rhoruntime/pch_rhoruntime.cpp +27 -0
  587. data/platform/wp8/rhoruntime/pch_rhoruntime.h +30 -0
  588. data/platform/wp8/rhoruntime/rhoruntime.cpp +93 -0
  589. data/platform/wp8/rhoruntime/rhoruntime.h +114 -0
  590. data/platform/wp8/rhoruntime/rhoruntime.vcxproj +175 -0
  591. data/platform/wp8/rhoruntime/rhoruntime.vcxproj.filters +44 -0
  592. data/platform/wp8/rubylib/file.c +5459 -0
  593. data/platform/wp8/rubylib/rubylib.vcxproj +286 -0
  594. data/platform/wp8/rubylib/rubylib.vcxproj.filters +307 -0
  595. data/platform/wp8/sqlite3/crypto.c +933 -0
  596. data/platform/wp8/sqlite3/sqlite3.c +136332 -0
  597. data/platform/wp8/sqlite3/sqlite3.vcxproj +149 -0
  598. data/platform/wp8/sqlite3/sqlite3.vcxproj.filters +16 -0
  599. data/platform/wp8/syncengine/syncengine.vcxproj +199 -0
  600. data/platform/wp8/syncengine/syncengine.vcxproj.filters +155 -0
  601. data/rakefile.rb +61 -9
  602. data/res/build-tools/RhoAppRunnerWP8.exe +0 -0
  603. data/res/build-tools/license_rc.dll +0 -0
  604. data/res/build-tools/win32/license_rc.dll +0 -0
  605. data/res/build-tools/xruby-0.3.3.jar +0 -0
  606. data/res/generators/rhogen.rb +36 -0
  607. data/res/generators/templates/application/app/loading-568h@2x.png +0 -0
  608. data/res/generators/templates/application/app/loading-Landscape.png +0 -0
  609. data/res/generators/templates/application/app/loading-LandscapeLeft.png +0 -0
  610. data/res/generators/templates/application/app/loading-LandscapeRight.png +0 -0
  611. data/res/generators/templates/application/app/loading-Portrait.png +0 -0
  612. data/res/generators/templates/application/app/loading-PortraitUpsideDown.png +0 -0
  613. data/res/generators/templates/application/app/loading.png +0 -0
  614. data/res/generators/templates/application/app/loading@2x.png +0 -0
  615. data/res/generators/templates/application/icon/icon.ico +0 -0
  616. data/res/generators/templates/application/icon/icon.png +0 -0
  617. data/res/generators/templates/application/icon/icon114.png +0 -0
  618. data/res/generators/templates/application/icon/icon57.png +0 -0
  619. data/res/generators/templates/application/icon/icon72.png +0 -0
  620. data/res/generators/templates/application/public/css/android.css +1 -1
  621. data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
  622. data/res/generators/templates/application/rhoconfig.txt +3 -1
  623. data/res/generators/templates/model/model.rb +1 -1
  624. data/res/icons/rho.icns +0 -0
  625. data/res/icons/rho.ico +0 -0
  626. data/res/icons/rho.png +0 -0
  627. data/res/icons/rhodes.icns +0 -0
  628. data/res/icons/rhodes.ico +0 -0
  629. data/res/icons/rhodes.png +0 -0
  630. data/res/icons/rhosim.icns +0 -0
  631. data/res/icons/rhosim.ico +0 -0
  632. data/res/icons/rhosim.png +0 -0
  633. data/res/libs/motorolalicence/android/MotorolaLicence.h +2 -1
  634. data/res/libs/motorolalicence/android/libMotorolaLicence.a +0 -0
  635. data/res/libs/motorolalicence/iphone/MotorolaLicence.h +2 -1
  636. data/res/libs/motorolalicence/iphone/libMotorolaLicence.a +0 -0
  637. data/spec/autocomplete_generator/Rakefile +37 -0
  638. data/spec/autocomplete_generator/app/Generator/controller.rb +40 -0
  639. data/spec/autocomplete_generator/app/Generator/generator.rb +236 -0
  640. data/spec/autocomplete_generator/app/Generator/index.erb +21 -0
  641. data/spec/autocomplete_generator/app/Settings/controller.rb +117 -0
  642. data/spec/autocomplete_generator/app/Settings/err_sync.erb +11 -0
  643. data/spec/autocomplete_generator/app/Settings/home.bb.erb +18 -0
  644. data/spec/autocomplete_generator/app/Settings/home.erb +19 -0
  645. data/spec/autocomplete_generator/app/Settings/index.bb.erb +31 -0
  646. data/spec/autocomplete_generator/app/Settings/index.erb +31 -0
  647. data/spec/autocomplete_generator/app/Settings/login.bb.erb +29 -0
  648. data/spec/autocomplete_generator/app/Settings/login.erb +25 -0
  649. data/spec/autocomplete_generator/app/Settings/reset.bb.erb +16 -0
  650. data/spec/autocomplete_generator/app/Settings/reset.erb +14 -0
  651. data/spec/autocomplete_generator/app/Settings/wait.bb.erb +10 -0
  652. data/spec/autocomplete_generator/app/Settings/wait.erb +10 -0
  653. data/spec/autocomplete_generator/app/application.rb +16 -0
  654. data/spec/autocomplete_generator/app/helpers/application_helper.rb +129 -0
  655. data/spec/autocomplete_generator/app/helpers/browser_helper.rb +22 -0
  656. data/spec/autocomplete_generator/app/index.bb.erb +21 -0
  657. data/spec/autocomplete_generator/app/index.erb +24 -0
  658. data/spec/autocomplete_generator/app/layout.erb +94 -0
  659. data/spec/autocomplete_generator/app/loading.html +11 -0
  660. data/spec/autocomplete_generator/build.yml +41 -0
  661. data/spec/autocomplete_generator/icon/icon.ico +0 -0
  662. data/spec/autocomplete_generator/icon/icon.png +0 -0
  663. data/spec/autocomplete_generator/icon/icon.svg +5334 -0
  664. data/spec/autocomplete_generator/icon/icon114.png +0 -0
  665. data/spec/autocomplete_generator/icon/icon57.png +0 -0
  666. data/spec/autocomplete_generator/icon/icon72.png +0 -0
  667. data/spec/autocomplete_generator/readme.txt +1 -0
  668. data/spec/autocomplete_generator/rhoconfig.txt +88 -0
  669. data/spec/autocomplete_generator/rhosimulator/Databases/Databases.db +0 -0
  670. data/spec/autocomplete_generator/rhosimulator/WebpageIcons.db +0 -0
  671. data/spec/autocomplete_generator/rhosimulator/db/syncdbuser.sqlite +0 -0
  672. data/spec/autocomplete_generator/rhosimulator/db/syncdbuser.sqlite.version +1 -0
  673. data/spec/autocomplete_generator/rhosimulator/rholog.txt_pos +1 -0
  674. data/spec/autocomplete_generator/rhosimulator/rhosimconfig.txt +8 -0
  675. data/spec/framework_spec/app/spec/rhomobile/NetHttp_spec.rb +22 -0
  676. data/spec/framework_spec/app/spec_runner.rb +12 -0
  677. data/spec/framework_spec/icon/icon.ico +0 -0
  678. data/spec/framework_spec/icon/icon.png +0 -0
  679. data/spec/perfomance_spec/icon/icon.ico +0 -0
  680. data/spec/perfomance_spec/icon/icon.png +0 -0
  681. data/spec/phone_spec/app/BlobBulkTest/blob_bulk_test.png +0 -0
  682. data/spec/phone_spec/app/BlobBulkTest_s/blob_bulk_test_s.png +0 -0
  683. data/spec/phone_spec/app/PartialTest/_index_partial.erb +5 -0
  684. data/spec/phone_spec/app/PartialTest/_index_partial_nested.erb +2 -0
  685. data/spec/phone_spec/app/PartialTest/index.erb +6 -0
  686. data/spec/phone_spec/app/spec/blob_bulksync_spec.rb +5 -3
  687. data/spec/phone_spec/app/spec/bulksync_spec.rb +33 -41
  688. data/spec/phone_spec/app/spec/database_spec.rb +5 -0
  689. data/spec/phone_spec/app/spec/json_spec.rb +50 -50
  690. data/spec/phone_spec/app/spec/rho_controller_spec.rb +29 -0
  691. data/spec/phone_spec/app/spec/syncengine_spec.rb +184 -47
  692. data/spec/phone_spec/app/spec_runner.rb +3 -2
  693. data/spec/phone_spec/icon/icon.ico +0 -0
  694. data/spec/phone_spec/icon/icon.png +0 -0
  695. data/spec/phone_spec/rhoconfig.txt +2 -0
  696. data/version +1 -1
  697. metadata +339 -47
  698. data/platform/android/Rhodes/PushReceiver.erb +0 -14
  699. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +0 -126
  700. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +0 -83
  701. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/Config.java +0 -246
  702. data/platform/bb/rhodes/src/com/rho/rubyext/PNGEncoder.java +0 -613
  703. data/res/icons/rho.psd +0 -0
  704. data/res/icons/rhodes.psd +0 -0
  705. data/res/icons/rhosim.psd +0 -0
@@ -1,613 +0,0 @@
1
- package com.rho.rubyext;
2
-
3
- import java.io.ByteArrayOutputStream;
4
- import java.io.IOException;
5
-
6
- import net.rim.device.api.compress.ZLibOutputStream;
7
- import net.rim.device.api.system.Bitmap;
8
- import net.rim.device.api.util.CRC32;
9
-
10
- /**
11
- * PNGEncoder takes a Java Image object and creates a byte string which can be saved as a PNG file.
12
- * The Image is presumed to use the DirectColorModel.
13
- *
14
- * <p>Thanks to Jay Denny at KeyPoint Software
15
- * http://www.keypoint.com/
16
- * who let me develop this code on company time.</p>
17
- *
18
- * <p>You may contact me with (probably very-much-needed) improvements,
19
- * comments, and bug fixes at:</p>
20
- *
21
- * <p><code>david@catcode.com</code></p>
22
- *
23
- * <p>This library is free software; you can redistribute it and/or
24
- * modify it under the terms of the GNU Lesser General Public
25
- * License as published by the Free Software Foundation; either
26
- * version 2.1 of the License, or (at your option) any later version.</p>
27
- *
28
- * <p>This library is distributed in the hope that it will be useful,
29
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
30
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31
- * Lesser General Public License for more details.</p>
32
- *
33
- * <p>You should have received a copy of the GNU Lesser General Public
34
- * License along with this library; if not, write to the Free Software
35
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36
- * A copy of the GNU LGPL may be found at
37
- * <code>http://www.gnu.org/copyleft/lesser.html</code></p>
38
- *
39
- * @author J. David Eisenberg
40
- * @version 1.5, 19 Oct 2003
41
- *
42
- * CHANGES:
43
- * --------
44
- * 19-Nov-2002 : CODING STYLE CHANGES ONLY (by David Gilbert for Object Refinery Limited);
45
- * 19-Sep-2003 : Fix for platforms using EBCDIC (contributed by Paulo Soares);
46
- * 19-Oct-2003 : Change private fields to protected fields so that
47
- * PNGEncoderB can inherit them (JDE)
48
- * Fixed bug with calculation of nRows
49
- * 08-Apr-2008 : Ported to BlackBerry (by Richard Puckett II)
50
- */
51
-
52
- public class PNGEncoder {
53
-
54
- /** Constant specifying that alpha channel should be encoded. */
55
- public static final boolean ENCODE_ALPHA = true;
56
-
57
- /** Constant specifying that alpha channel should not be encoded. */
58
- public static final boolean NO_ALPHA = false;
59
-
60
- /** Constants for filter (NONE) */
61
- public static final int FILTER_NONE = 0;
62
-
63
- /** Constants for filter (SUB) */
64
- public static final int FILTER_SUB = 1;
65
-
66
- /** Constants for filter (UP) */
67
- public static final int FILTER_UP = 2;
68
-
69
- /** Constants for filter (LAST) */
70
- public static final int FILTER_LAST = 2;
71
-
72
- /** IHDR tag. */
73
- protected static final byte IHDR[] = {73, 72, 68, 82};
74
-
75
- /** IDAT tag. */
76
- protected static final byte IDAT[] = {73, 68, 65, 84};
77
-
78
- /** IEND tag. */
79
- protected static final byte IEND[] = {73, 69, 78, 68};
80
-
81
- /** The png bytes. */
82
- protected byte[] pngBytes;
83
-
84
- /** The prior row. */
85
- protected byte[] priorRow;
86
-
87
- /** The left bytes. */
88
- protected byte[] leftBytes;
89
-
90
- /** The image. */
91
- protected Bitmap image;
92
-
93
- /** The width. */
94
- protected int width, height;
95
-
96
- /** The byte position. */
97
- protected int bytePos, maxPos;
98
-
99
- /** The CRC value. */
100
- protected int crcValue;
101
-
102
- /** Encode alpha? */
103
- protected boolean encodeAlpha;
104
-
105
- /** The filter type. */
106
- protected int filter;
107
-
108
- /** The bytes-per-pixel. */
109
- protected int bytesPerPixel;
110
-
111
- /** The compression level. */
112
- protected int compressionLevel;
113
-
114
- /**
115
- * Class constructor
116
- */
117
- public PNGEncoder() {
118
- this(null, false, FILTER_NONE, 0);
119
- }
120
-
121
- /**
122
- * Class constructor specifying Image to encode, with no alpha channel encoding.
123
- *
124
- * @param image A Java Image object which uses the DirectColorModel
125
- */
126
- public PNGEncoder(Bitmap image) {
127
- this(image, false, FILTER_NONE, 0);
128
- }
129
-
130
- /**
131
- * Class constructor specifying Image to encode, and whether to encode alpha.
132
- *
133
- * @param image A Java Image object which uses the DirectColorModel
134
- * @param encodeAlpha Encode the alpha channel? false=no; true=yes
135
- */
136
- public PNGEncoder(Bitmap image, boolean encodeAlpha) {
137
- this(image, encodeAlpha, FILTER_NONE, 0);
138
- }
139
-
140
- /**
141
- * Class constructor specifying Image to encode, whether to encode alpha, and filter to use.
142
- *
143
- * @param image A Java Image object which uses the DirectColorModel
144
- * @param encodeAlpha Encode the alpha channel? false=no; true=yes
145
- * @param whichFilter 0=none, 1=sub, 2=up
146
- */
147
- public PNGEncoder(Bitmap image, boolean encodeAlpha, int whichFilter) {
148
- this(image, encodeAlpha, whichFilter, 0);
149
- }
150
-
151
-
152
- /**
153
- * Class constructor specifying Image source to encode, whether to encode alpha, filter to use,
154
- * and compression level.
155
- *
156
- * @param image A Java Image object
157
- * @param encodeAlpha Encode the alpha channel? false=no; true=yes
158
- * @param whichFilter 0=none, 1=sub, 2=up
159
- * @param compLevel 0..9
160
- */
161
- public PNGEncoder(Bitmap image, boolean encodeAlpha, int whichFilter, int compLevel) {
162
- this.image = image;
163
- this.encodeAlpha = encodeAlpha;
164
- setFilter(whichFilter);
165
- if (compLevel >= 0 && compLevel <= 9) {
166
- this.compressionLevel = compLevel;
167
- }
168
- }
169
-
170
- /**
171
- * Set the image to be encoded
172
- *
173
- * @param image A Java Image object which uses the DirectColorModel
174
- */
175
- public void setImage(Bitmap image) {
176
- this.image = image;
177
- pngBytes = null;
178
- }
179
-
180
- /**
181
- * Creates an array of bytes that is the PNG equivalent of the current image, specifying
182
- * whether to encode alpha or not.
183
- *
184
- * @param encodeAlpha boolean false=no alpha, true=encode alpha
185
- * @return an array of bytes, or null if there was a problem
186
- */
187
- public byte[] encode(boolean encodeAlpha) throws IOException {
188
- byte[] pngIdBytes = {-119, 80, 78, 71, 13, 10, 26, 10};
189
-
190
- if (image == null) {
191
- return null;
192
- }
193
- width = image.getWidth();
194
- height = image.getHeight();
195
-
196
- /*
197
- * start with an array that is big enough to hold all the pixels
198
- * (plus filter bytes), and an extra 200 bytes for header info
199
- */
200
- pngBytes = new byte[((width + 1) * height * 3) + 200];
201
-
202
- /*
203
- * keep track of largest byte written to the array
204
- */
205
- maxPos = 0;
206
-
207
- bytePos = writeBytes(pngIdBytes, 0);
208
-
209
- writeHeader();
210
-
211
- if (writeImageData()) {
212
- writeEnd();
213
- pngBytes = resizeByteArray(pngBytes, maxPos);
214
- }
215
- else {
216
- pngBytes = null;
217
- }
218
- return pngBytes;
219
- }
220
-
221
- /**
222
- * Creates an array of bytes that is the PNG equivalent of the current image.
223
- * Alpha encoding is determined by its setting in the constructor.
224
- *
225
- * @return an array of bytes, or null if there was a problem
226
- */
227
- public byte[] encode() throws IOException {
228
- return encode(encodeAlpha);
229
- }
230
-
231
- /**
232
- * Set the alpha encoding on or off.
233
- *
234
- * @param encodeAlpha false=no, true=yes
235
- */
236
- public void setEncodeAlpha(boolean encodeAlpha) {
237
- this.encodeAlpha = encodeAlpha;
238
- }
239
-
240
- /**
241
- * Retrieve alpha encoding status.
242
- *
243
- * @return boolean false=no, true=yes
244
- */
245
- public boolean getEncodeAlpha() {
246
- return encodeAlpha;
247
- }
248
-
249
- /**
250
- * Set the filter to use
251
- *
252
- * @param whichFilter from constant list
253
- */
254
- public void setFilter(int whichFilter) {
255
- this.filter = FILTER_NONE;
256
- if (whichFilter <= FILTER_LAST) {
257
- this.filter = whichFilter;
258
- }
259
- }
260
-
261
- /**
262
- * Retrieve filtering scheme
263
- *
264
- * @return int (see constant list)
265
- */
266
- public int getFilter() {
267
- return filter;
268
- }
269
-
270
- /**
271
- * Set the compression level to use
272
- *
273
- * @param level 0 through 9
274
- */
275
- public void setCompressionLevel(int level) {
276
- if (level >= 0 && level <= 9) {
277
- this.compressionLevel = level;
278
- }
279
- }
280
-
281
- /**
282
- * Retrieve compression level
283
- *
284
- * @return int in range 0-9
285
- */
286
- public int getCompressionLevel() {
287
- return compressionLevel;
288
- }
289
-
290
- /**
291
- * Increase or decrease the length of a byte array.
292
- *
293
- * @param array The original array.
294
- * @param newLength The length you wish the new array to have.
295
- * @return Array of newly desired length. If shorter than the
296
- * original, the trailing elements are truncated.
297
- */
298
- protected byte[] resizeByteArray(byte[] array, int newLength) {
299
- byte[] newArray = new byte[newLength];
300
- int oldLength = array.length;
301
-
302
- java.lang.System.arraycopy(array, 0, newArray, 0, Math.min(oldLength, newLength));
303
- return newArray;
304
- }
305
-
306
- /**
307
- * Write an array of bytes into the pngBytes array.
308
- * Note: This routine has the side effect of updating
309
- * maxPos, the largest element written in the array.
310
- * The array is resized by 1000 bytes or the length
311
- * of the data to be written, whichever is larger.
312
- *
313
- * @param data The data to be written into pngBytes.
314
- * @param offset The starting point to write to.
315
- * @return The next place to be written to in the pngBytes array.
316
- */
317
- protected int writeBytes(byte[] data, int offset) {
318
- maxPos = Math.max(maxPos, offset + data.length);
319
- if (data.length + offset > pngBytes.length) {
320
- pngBytes = resizeByteArray(pngBytes, pngBytes.length + Math.max(1000, data.length));
321
- }
322
- java.lang.System.arraycopy(data, 0, pngBytes, offset, data.length);
323
- return offset + data.length;
324
- }
325
-
326
- /**
327
- * Write an array of bytes into the pngBytes array, specifying number of bytes to write.
328
- * Note: This routine has the side effect of updating
329
- * maxPos, the largest element written in the array.
330
- * The array is resized by 1000 bytes or the length
331
- * of the data to be written, whichever is larger.
332
- *
333
- * @param data The data to be written into pngBytes.
334
- * @param nBytes The number of bytes to be written.
335
- * @param offset The starting point to write to.
336
- * @return The next place to be written to in the pngBytes array.
337
- */
338
- protected int writeBytes(byte[] data, int nBytes, int offset) {
339
- maxPos = Math.max(maxPos, offset + nBytes);
340
- if (nBytes + offset > pngBytes.length) {
341
- pngBytes = resizeByteArray(pngBytes, pngBytes.length + Math.max(1000, nBytes));
342
- }
343
- java.lang.System.arraycopy(data, 0, pngBytes, offset, nBytes);
344
- return offset + nBytes;
345
- }
346
-
347
- /**
348
- * Write a two-byte integer into the pngBytes array at a given position.
349
- *
350
- * @param n The integer to be written into pngBytes.
351
- * @param offset The starting point to write to.
352
- * @return The next place to be written to in the pngBytes array.
353
- */
354
- protected int writeInt2(int n, int offset) {
355
- byte[] temp = {(byte) ((n >> 8) & 0xff), (byte) (n & 0xff)};
356
- return writeBytes(temp, offset);
357
- }
358
-
359
- /**
360
- * Write a four-byte integer into the pngBytes array at a given position.
361
- *
362
- * @param n The integer to be written into pngBytes.
363
- * @param offset The starting point to write to.
364
- * @return The next place to be written to in the pngBytes array.
365
- */
366
- protected int writeInt4(int n, int offset) {
367
- byte[] temp = {(byte) ((n >> 24) & 0xff),
368
- (byte) ((n >> 16) & 0xff),
369
- (byte) ((n >> 8) & 0xff),
370
- (byte) (n & 0xff)};
371
- return writeBytes(temp, offset);
372
- }
373
-
374
- /**
375
- * Write a single byte into the pngBytes array at a given position.
376
- *
377
- * @param b The integer to be written into pngBytes.
378
- * @param offset The starting point to write to.
379
- * @return The next place to be written to in the pngBytes array.
380
- */
381
- protected int writeByte(int b, int offset) {
382
- byte[] temp = {(byte) b};
383
- return writeBytes(temp, offset);
384
- }
385
-
386
- /**
387
- * Write a PNG "IHDR" chunk into the pngBytes array.
388
- */
389
- protected void writeHeader() {
390
- int startPos;
391
-
392
- startPos = bytePos = writeInt4(13, bytePos);
393
- bytePos = writeBytes(IHDR, bytePos);
394
- width = image.getWidth();
395
- height = image.getHeight();
396
- bytePos = writeInt4(width, bytePos);
397
- bytePos = writeInt4(height, bytePos);
398
- bytePos = writeByte(8, bytePos); // bit depth
399
- bytePos = writeByte((encodeAlpha) ? 6 : 2, bytePos); // direct model
400
- bytePos = writeByte(0, bytePos); // compression method
401
- bytePos = writeByte(0, bytePos); // filter method
402
- bytePos = writeByte(0, bytePos); // no interlace
403
- crcValue = CRC32.update(CRC32.INITIAL_VALUE, pngBytes, startPos, bytePos - startPos);
404
- bytePos = writeInt4(crcValue, bytePos);
405
- }
406
-
407
- /**
408
- * Perform "sub" filtering on the given row.
409
- * Uses temporary array leftBytes to store the original values
410
- * of the previous pixels. The array is 16 bytes long, which
411
- * will easily hold two-byte samples plus two-byte alpha.
412
- *
413
- * @param pixels The array holding the scan lines being built
414
- * @param startPos Starting position within pixels of bytes to be filtered.
415
- * @param width Width of a scanline in pixels.
416
- */
417
- protected void filterSub(byte[] pixels, int startPos, int width) {
418
- int i;
419
- int offset = bytesPerPixel;
420
- int actualStart = startPos + offset;
421
- int nBytes = width * bytesPerPixel;
422
- int leftInsert = offset;
423
- int leftExtract = 0;
424
-
425
- for (i = actualStart; i < startPos + nBytes; i++) {
426
- leftBytes[leftInsert] = pixels[i];
427
- pixels[i] = (byte) ((pixels[i] - leftBytes[leftExtract]) % 256);
428
- leftInsert = (leftInsert + 1) % 0x0f;
429
- leftExtract = (leftExtract + 1) % 0x0f;
430
- }
431
- }
432
-
433
- /**
434
- * Perform "up" filtering on the given row.
435
- * Side effect: refills the prior row with current row
436
- *
437
- * @param pixels The array holding the scan lines being built
438
- * @param startPos Starting position within pixels of bytes to be filtered.
439
- * @param width Width of a scanline in pixels.
440
- */
441
- protected void filterUp(byte[] pixels, int startPos, int width) {
442
- int i, nBytes;
443
- byte currentByte;
444
-
445
- nBytes = width * bytesPerPixel;
446
-
447
- for (i = 0; i < nBytes; i++) {
448
- currentByte = pixels[startPos + i];
449
- pixels[startPos + i] = (byte) ((pixels[startPos + i] - priorRow[i]) % 256);
450
- priorRow[i] = currentByte;
451
- }
452
- }
453
-
454
- // protected int[] blur(int[] src, int width, int height) {
455
- // int[] blurred = new int[width * height];
456
- // int scanPos = 0; // where we are in the scan lines
457
- //
458
- // int boxw = 2;
459
- // double mul = 1.0 / (double) (boxw * 2 + 1);
460
- // System.out.println("mul = " + mul);
461
- //
462
- // for (int y = 0; y < height; y++) {
463
- // int redChannel = 0;
464
- // int greenChannel = 0;
465
- // int blueChannel = 0;
466
- //
467
- // for (int x = 0; x < boxw; x++) {
468
- // redChannel += (src[scanPos] >> 16) & 0xff;
469
- // greenChannel += (src[scanPos] >> 8) & 0xff;
470
- // blueChannel += src[scanPos] & 0xff;
471
- // }
472
- // System.out.println("Primed redChannel (" + scanPos + ") = " + redChannel);
473
- // System.out.println("Primed greenChannel = " + greenChannel);
474
- // System.out.println("Primed blueChannel = " + blueChannel);
475
- //
476
- // for (int x = 0; x < width; x++) {
477
- // if (x > boxw) {
478
- // redChannel -= (src[scanPos - boxw - 1] >> 16) & 0xff;
479
- // greenChannel -= (src[scanPos - boxw - 1] >> 8) & 0xff;
480
- // blueChannel -= src[scanPos - boxw - 1] & 0xff;
481
- // }
482
- //
483
- // if (x + boxw < width) {
484
- // redChannel += (src[scanPos + boxw] >> 16) & 0xff;
485
- // greenChannel += (src[scanPos + boxw] >> 8) & 0xff;
486
- // blueChannel += src[scanPos + boxw] & 0xff;
487
- // }
488
- //
489
- // blurred[scanPos] |= (new Double(redChannel / (boxw + 1)).byteValue() << 16);
490
- // blurred[scanPos] |= (new Double(greenChannel / (boxw + 1)).byteValue() << 8);
491
- // blurred[scanPos] |= new Double(blueChannel / (boxw + 1)).byteValue();
492
- //
493
- // if (encodeAlpha) {
494
- // blurred[scanPos] |= (src[scanPos] & 0xff000000);
495
- // }
496
- //
497
- // scanPos++;
498
- // }
499
- // }
500
- //
501
- // return blurred;
502
- // }
503
-
504
- /**
505
- * Write the image data into the pngBytes array.
506
- * This will write one or more PNG "IDAT" chunks. In order
507
- * to conserve memory, this method grabs as many rows as will
508
- * fit into 32K bytes, or the whole image; whichever is less.
509
- *
510
- *
511
- * @return true if no errors; false if error grabbing pixels
512
- */
513
- protected boolean writeImageData() throws IOException {
514
- int rowsLeft = height; // number of rows remaining to write
515
- int startRow = 0; // starting row to process this time through
516
- int nRows; // how many rows to grab at a time
517
-
518
- byte[] scanLines; // the scan lines to be compressed
519
- int scanPos; // where we are in the scan lines
520
- int startPos; // where this line's actual pixels start (used for filtering)
521
-
522
- byte[] compressedLines; // the resultant compressed lines
523
- int nCompressed; // how big is the compressed area?
524
-
525
- bytesPerPixel = (encodeAlpha) ? 4 : 3;
526
-
527
- ByteArrayOutputStream outBytes = new ByteArrayOutputStream(1024);
528
-
529
- ZLibOutputStream compBytes = new ZLibOutputStream(outBytes);
530
-
531
- while (rowsLeft > 0) {
532
- nRows = Math.min(32767 / (width * (bytesPerPixel + 1)), rowsLeft);
533
- nRows = Math.max( nRows, 1 );
534
-
535
- int[] pixels = new int[width * nRows];
536
-
537
- image.getARGB(pixels, 0, width, 0, startRow, width, nRows);
538
-
539
- /*
540
- * Create a data chunk. scanLines adds "nRows" for
541
- * the filter bytes.
542
- */
543
- scanLines = new byte[width * nRows * bytesPerPixel + nRows];
544
-
545
- if (filter == FILTER_SUB) {
546
- leftBytes = new byte[16];
547
- }
548
- if (filter == FILTER_UP) {
549
- priorRow = new byte[width * bytesPerPixel];
550
- }
551
-
552
- scanPos = 0;
553
- startPos = 1;
554
- for (int i = 0; i < width * nRows; i++) {
555
- if (i % width == 0) {
556
- scanLines[scanPos++] = (byte) filter;
557
- startPos = scanPos;
558
- }
559
- scanLines[scanPos++] = (byte) ((pixels[i] >> 16) & 0xff);
560
- scanLines[scanPos++] = (byte) ((pixels[i] >> 8) & 0xff);
561
- scanLines[scanPos++] = (byte) ((pixels[i]) & 0xff);
562
- if (encodeAlpha) {
563
- scanLines[scanPos++] = (byte) ((pixels[i] >> 24) & 0xff);
564
- }
565
- if ((i % width == width - 1) && (filter != FILTER_NONE)) {
566
- if (filter == FILTER_SUB) {
567
- filterSub(scanLines, startPos, width);
568
- }
569
- if (filter == FILTER_UP) {
570
- filterUp(scanLines, startPos, width);
571
- }
572
- }
573
- }
574
-
575
- /*
576
- * Write these lines to the output area
577
- */
578
- compBytes.write(scanLines, 0, scanPos);
579
-
580
- startRow += nRows;
581
- rowsLeft -= nRows;
582
- }
583
- compBytes.close();
584
-
585
- /*
586
- * Write the compressed bytes
587
- */
588
- compressedLines = outBytes.toByteArray();
589
- nCompressed = compressedLines.length;
590
-
591
- bytePos = writeInt4(nCompressed, bytePos);
592
- bytePos = writeBytes(IDAT, bytePos);
593
- crcValue = CRC32.update(CRC32.INITIAL_VALUE, IDAT);
594
-
595
- bytePos = writeBytes(compressedLines, nCompressed, bytePos);
596
- crcValue = CRC32.update(crcValue, compressedLines, 0, nCompressed);
597
-
598
- bytePos = writeInt4(crcValue, bytePos);
599
- return true;
600
- }
601
-
602
- /**
603
- * Write a PNG "IEND" chunk into the pngBytes array.
604
- */
605
- protected void writeEnd() {
606
- bytePos = writeInt4(0, bytePos);
607
- bytePos = writeBytes(IEND, bytePos);
608
- crcValue = CRC32.update(CRC32.INITIAL_VALUE, IEND);
609
-
610
- bytePos = writeInt4(crcValue, bytePos);
611
- }
612
-
613
- }