rhodes 3.2.3 → 3.3.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (368) hide show
  1. data/CHANGELOG +10 -0
  2. data/Rakefile +153 -46
  3. data/doc/build.txt +261 -102
  4. data/doc/configuration.txt +5 -2
  5. data/doc/device-caps.txt +134 -23
  6. data/doc/extensions.txt +922 -69
  7. data/doc/generator.txt +96 -39
  8. data/doc/install.txt +35 -19
  9. data/doc/jqt-jqm-transition.txt +17 -1
  10. data/doc/rhom.txt +23 -2
  11. data/doc/rhostudio-eclipse.txt +49 -0
  12. data/doc/rhostudio-test-plan.txt +440 -0
  13. data/doc/simulator.txt +1 -1
  14. data/doc/synchronization.txt +40 -1
  15. data/lib/build/jake.rb +108 -7
  16. data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +0 -35
  17. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +8 -2
  18. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +195 -195
  19. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +6 -0
  20. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +5 -0
  21. data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +64 -20
  22. data/lib/extensions/debugger/CHANGELOG +3 -0
  23. data/lib/extensions/debugger/debugger.rb +26 -21
  24. data/lib/extensions/digest-md5/ext/Rakefile +5 -5
  25. data/lib/extensions/digest-md5/ext/build +10 -1
  26. data/lib/extensions/digest-md5/ext/defs.h +19 -0
  27. data/lib/extensions/digest-md5/ext/digest-md5.vcproj +317 -9
  28. data/lib/extensions/digest-md5/ext/iphone/Dmd5.xcodeproj/project.pbxproj +290 -0
  29. data/lib/extensions/digest-md5/ext/iphone/Dmd5_Prefix.pch +7 -0
  30. data/lib/extensions/digest-md5/ext/iphone/Rakefile +79 -0
  31. data/lib/extensions/digest-sha1/ext/Rakefile +5 -5
  32. data/lib/extensions/digest-sha1/ext/build +10 -1
  33. data/lib/extensions/digest-sha1/ext/defs.h +19 -0
  34. data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +317 -9
  35. data/lib/extensions/digest-sha1/ext/iphone/Dsha1.xcodeproj/project.pbxproj +278 -0
  36. data/lib/extensions/digest-sha1/ext/iphone/Dsha1_Prefix.pch +7 -0
  37. data/lib/extensions/digest-sha1/ext/iphone/Rakefile +79 -0
  38. data/lib/extensions/digest/ext/Rakefile +5 -5
  39. data/lib/extensions/digest/ext/build +10 -1
  40. data/lib/extensions/digest/ext/digest.vcproj +317 -9
  41. data/lib/extensions/digest/ext/iphone/Digest.xcodeproj/project.pbxproj +270 -0
  42. data/lib/extensions/digest/ext/iphone/Digest_Prefix.pch +7 -0
  43. data/lib/extensions/digest/ext/iphone/Rakefile +79 -0
  44. data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +10 -2
  45. data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +6 -0
  46. data/lib/extensions/fcntl/ext/Rakefile +5 -5
  47. data/lib/extensions/fcntl/ext/build +9 -1
  48. data/lib/extensions/fcntl/ext/iphone/Fcntl.xcodeproj/project.pbxproj +262 -0
  49. data/lib/extensions/fcntl/ext/iphone/Fcntl_Prefix.pch +7 -0
  50. data/lib/extensions/fcntl/ext/iphone/Rakefile +79 -0
  51. data/lib/extensions/net-http/net/http.rb +9 -7
  52. data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +64 -20
  53. data/lib/extensions/rhoxml/rexml/document.rb +3 -2
  54. data/lib/extensions/rhoxml/rexml/instruction.rb +70 -0
  55. data/lib/framework/builtinME.rb +9 -0
  56. data/lib/framework/date/format.rb +1 -1
  57. data/lib/framework/dateME.rb +19 -2
  58. data/lib/framework/rho/rho.rb +15 -4
  59. data/lib/framework/rho/rhoapplication.rb +1 -0
  60. data/lib/framework/rho/rhocontact.rb +10 -27
  61. data/lib/framework/rho/rhoevent_c.rb +8 -2
  62. data/lib/framework/rho/rhosupport.rb +25 -0
  63. data/lib/framework/rhodes.rb +1 -1
  64. data/lib/framework/rhoframework.rb +15 -0
  65. data/lib/framework/rholang/localization_simplified.rb +8 -10
  66. data/lib/framework/rhom/rhom_object_factory.rb +8 -2
  67. data/lib/framework/version.rb +1 -1
  68. data/lib/rhodes.rb +1 -1
  69. data/platform/android/Rhodes/jni/Application.mk +2 -1
  70. data/platform/android/Rhodes/jni/include/rhodes.h +9 -0
  71. data/platform/android/Rhodes/jni/src/callbacks.cpp +31 -1
  72. data/platform/android/Rhodes/jni/src/event.cpp +75 -31
  73. data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
  74. data/platform/android/Rhodes/jni/src/phonebook.cpp +73 -9
  75. data/platform/android/Rhodes/jni/src/rhodes.cpp +21 -0
  76. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +16 -24
  77. data/platform/android/Rhodes/jni/src/signature.cpp +27 -1
  78. data/platform/android/Rhodes/{default.properties → project.properties} +2 -2
  79. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +14 -12
  80. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +14 -12
  81. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +38 -115
  82. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +69 -52
  83. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +9 -0
  84. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +21 -1
  85. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraOldService.java +1 -1
  86. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +1 -1
  87. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraService.java +1 -1
  88. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +38 -6
  89. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +212 -1
  90. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +82 -125
  91. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
  92. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +2 -1
  93. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +39 -19
  94. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +106 -136
  95. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +26 -25
  96. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +1 -1
  97. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +40 -0
  98. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +47 -0
  99. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality02.java +33 -0
  100. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality03.java +33 -0
  101. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality04.java +34 -0
  102. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality05.java +75 -0
  103. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality06.java +34 -0
  104. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality07.java +34 -0
  105. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality08.java +44 -0
  106. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality09.java +34 -0
  107. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality10.java +34 -0
  108. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +73 -0
  109. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +57 -6
  110. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessor.java +2 -2
  111. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +322 -76
  112. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +11 -6
  113. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +5 -5
  114. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +2 -1
  115. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +125 -0
  116. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsOld.java +2 -3
  117. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebView.java +16 -0
  118. data/platform/android/build/RhodesSRC_build.files +14 -0
  119. data/platform/android/build/android.rake +149 -147
  120. data/platform/android/build/android_tools.rb +58 -0
  121. data/platform/android/build/librhocommon_build.files +1 -0
  122. data/platform/android/build/libruby_build.files +3 -0
  123. data/platform/bb/RubyVM/src/com/rho/RhoConf.java +11 -1
  124. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +11 -5
  125. data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +3 -2
  126. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +2 -0
  127. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +20 -8
  128. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +9 -6
  129. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +45 -18
  130. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -2
  131. data/platform/bb/build/bb.rake +84 -70
  132. data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +106 -14
  133. data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +1 -1
  134. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +108 -16
  135. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +10 -5
  136. data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +21 -4
  137. data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +17 -0
  138. data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +8 -5
  139. data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +3 -1
  140. data/platform/iphone/Classes/AppManager/AppManager.m +15 -3
  141. data/platform/iphone/Classes/Event/Event.m +45 -2
  142. data/platform/iphone/Classes/MapView/MapViewController.m +8 -4
  143. data/platform/iphone/Classes/Phonebook/phonebook.m +30 -7
  144. data/platform/iphone/Classes/Rhodes.h +11 -1
  145. data/platform/iphone/Classes/Rhodes.m +141 -9
  146. data/platform/iphone/Classes/Signature/SignatureDelegate.m +27 -1
  147. data/platform/iphone/Classes/SimpleMainView.h +1 -0
  148. data/platform/iphone/Classes/SimpleMainView.m +4 -0
  149. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +31 -1
  150. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +10 -0
  151. data/platform/iphone/rbuild/iphone.rake +33 -6
  152. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +10 -2
  153. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +22 -2
  154. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +14 -0
  155. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +10 -0
  156. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
  157. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
  158. data/platform/osx/build/osx.rake +58 -7
  159. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +427 -69
  160. data/platform/shared/RhoConnectClient/RhoConnectClient.h +21 -2
  161. data/platform/shared/common/Android.mk +2 -1
  162. data/platform/shared/common/AutoPointer.h +23 -0
  163. data/platform/shared/common/BundleManager.cpp +333 -0
  164. data/platform/shared/common/RhoFile.cpp +206 -23
  165. data/platform/shared/common/RhoFile.h +14 -4
  166. data/platform/shared/common/RhoFilePath.h +18 -0
  167. data/platform/shared/common/RhoStd.h +11 -1
  168. data/platform/shared/common/RhoThread.h +4 -1
  169. data/platform/shared/common/RhodesApp.cpp +31 -8
  170. data/platform/shared/common/RhodesApp.h +14 -0
  171. data/platform/shared/common/RhodesAppBase.cpp +6 -6
  172. data/platform/shared/common/RhodesAppBase.h +1 -1
  173. data/platform/shared/common/emml.h +34 -0
  174. data/platform/shared/common/iphone/RhoFileImpl.m +30 -2
  175. data/platform/shared/common/map/BaseMapEngine.cpp +3 -3
  176. data/platform/shared/common/map/GeocodingMapEngine.cpp +205 -14
  177. data/platform/shared/common/map/GeocodingMapEngine.h +25 -2
  178. data/platform/shared/common/map/MapEngine.cpp +24 -2
  179. data/platform/shared/common/map/MapEngine.h +23 -12
  180. data/platform/shared/common/phonebook/PhonebookParams.cpp +99 -0
  181. data/platform/shared/common/phonebook/PhonebookParams.h +52 -0
  182. data/platform/shared/common/rhoparams.cpp +14 -0
  183. data/platform/shared/common/rhoparams.h +1 -0
  184. data/platform/shared/db/DBAdapter.cpp +43 -24
  185. data/platform/shared/db/DBAdapter.h +6 -1
  186. data/platform/shared/db/DBAttrManager.cpp +50 -1
  187. data/platform/shared/logging/RhoLog.h +3 -0
  188. data/platform/shared/logging/RhoLogSink.cpp +5 -1
  189. data/platform/shared/net/CURLNetRequest.cpp +2 -0
  190. data/platform/shared/qt/rhodes/QtMainWindow.cpp +14 -1
  191. data/platform/shared/qt/rhodes/impl/PhonebookImpl.cpp +2 -2
  192. data/platform/shared/qt/rhodes/impl/RhoFileImpl.cpp +1 -1
  193. data/platform/shared/qt/rhodes/impl/SignatureImpl.cpp +14 -2
  194. data/platform/shared/qt/rhodes/impl/SystemImpl.cpp +16 -2
  195. data/platform/shared/qt/rhodes/main.cpp +28 -0
  196. data/platform/shared/qt/rhodes/rhodes.pro +3 -0
  197. data/platform/shared/qt/rholib/rholib.pro +2 -1
  198. data/platform/shared/qt/rubylib/rubylib.pro +2 -1
  199. data/platform/shared/ruby/Android.mk +3 -0
  200. data/platform/shared/ruby/class.c +7 -0
  201. data/platform/shared/ruby/compile.c +18 -10
  202. data/platform/shared/ruby/encdb.h +18 -8
  203. data/platform/shared/ruby/eval.c +108 -2
  204. data/platform/shared/ruby/ext/alert/alert_wrap.c +64 -20
  205. data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +64 -20
  206. data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +67 -23
  207. data/platform/shared/ruby/ext/calendar/calendar_wrap.c +64 -20
  208. data/platform/shared/ruby/ext/calendar/event_wrap.c +64 -20
  209. data/platform/shared/ruby/ext/camera/camera_wrap.c +64 -20
  210. data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +64 -20
  211. data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -0
  212. data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +127 -26
  213. data/platform/shared/ruby/ext/mapview/mapview_wrap.c +64 -20
  214. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +65 -21
  215. data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +64 -20
  216. data/platform/shared/ruby/ext/navbar/navbar_wrap.c +64 -20
  217. data/platform/shared/ruby/ext/phonebook/phonebook.i +7 -7
  218. data/platform/shared/ruby/ext/phonebook/phonebook_wrap.c +95 -120
  219. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -4
  220. data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
  221. data/platform/shared/ruby/ext/rho/rhosupport.c +39 -6
  222. data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +65 -21
  223. data/platform/shared/ruby/ext/ringtones/ringtones_wrap.c +64 -20
  224. data/platform/shared/ruby/ext/signature/signature.i +37 -5
  225. data/platform/shared/ruby/ext/signature/signature_wrap.c +274 -45
  226. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +65 -21
  227. data/platform/shared/ruby/ext/system/system.i +14 -2
  228. data/platform/shared/ruby/ext/system/system_wrap.c +146 -25
  229. data/platform/shared/ruby/ext/webview/webview_wrap.c +65 -21
  230. data/platform/shared/ruby/include/ruby/ruby.h +15 -4
  231. data/platform/shared/ruby/inits.c +1 -0
  232. data/platform/shared/ruby/io.c +13 -3
  233. data/platform/shared/ruby/win32/win32.c +3 -3
  234. data/platform/shared/ruby/wince/io_wce.c +2 -2
  235. data/platform/shared/rubyext/System.cpp +9 -5
  236. data/platform/shared/sync/ClientRegister.cpp +18 -8
  237. data/platform/shared/sync/SyncEngine.cpp +25 -11
  238. data/platform/shared/sync/SyncEngine.h +2 -0
  239. data/platform/shared/sync/SyncSource.cpp +40 -15
  240. data/platform/shared/sync/SyncSource.h +3 -2
  241. data/platform/shared/sync/SyncThread.cpp +9 -4
  242. data/platform/shared/sync/SyncThread.h +3 -1
  243. data/platform/symbian/build/symbian.rake +14 -9
  244. data/platform/symbian/rhodes/rhodes.pro +11 -8
  245. data/platform/symbian/rhodes/src/phonebook/ruby_phonebook.cpp +2 -2
  246. data/platform/symbian/rubylib/rubylib.pro +3 -0
  247. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  248. data/platform/wm/RhoLib/RhoLib.vcproj +315 -2
  249. data/platform/wm/build/build_inf.js +235 -187
  250. data/platform/wm/build/wm.rake +388 -233
  251. data/platform/wm/rhodes.sln +56 -0
  252. data/platform/wm/rhodes/MainWindow.cpp +139 -77
  253. data/platform/wm/rhodes/MainWindow.h +27 -22
  254. data/platform/wm/rhodes/MapView/{Graphics.cpp → Bitmap.cpp} +15 -253
  255. data/platform/wm/rhodes/MapView/Bitmap.h +86 -0
  256. data/platform/wm/rhodes/MapView/MapViewManager.cpp +7 -2
  257. data/platform/wm/rhodes/MapView/MapViewManager.h +1 -1
  258. data/platform/wm/rhodes/MapView/Win32Graphics.cpp +263 -0
  259. data/platform/wm/rhodes/MapView/Win32Graphics.h +133 -0
  260. data/platform/wm/rhodes/MapView/WmGraphics.cpp +291 -0
  261. data/platform/wm/rhodes/MapView/{Graphics.h → WmGraphics.h} +14 -56
  262. data/platform/wm/rhodes/Rhodes.cpp +128 -32
  263. data/platform/wm/rhodes/Rhodes.rc +6 -2
  264. data/platform/wm/rhodes/camera/Camera.cpp +1 -0
  265. data/platform/wm/rhodes/phonebook/phonebook.cpp +2 -2
  266. data/platform/wm/rhodes/phonebook/phonebook.h +2 -2
  267. data/platform/wm/rhodes/resource.h +3 -2
  268. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -0
  269. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +4 -0
  270. data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +675 -0
  271. data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +123 -0
  272. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +12 -2
  273. data/platform/wm/rhodes/rhodes.vcproj +2732 -1113
  274. data/platform/wm/rhodes/simulator/MainWindowQt.h +1 -1
  275. data/platform/wm/rhodes/stdafx.h +1 -0
  276. data/platform/wm/rhoelements.sln +118 -62
  277. data/platform/wm/rubylib/rubylib.vcproj +345 -16
  278. data/platform/wm/sqlite3/sqlite3.vcproj +305 -0
  279. data/platform/wm/syncengine/syncengine.vcproj +309 -0
  280. data/platform/wm/tools/detool/LogServer.cpp +19 -2
  281. data/platform/wm/tools/detool/detool.cpp +131 -6
  282. data/platform/wm/tools/detool/detool.vcproj +3 -1
  283. data/platform/wm/tools/detool/stdafx.h +1 -0
  284. data/platform/wp7/IronRuby/Languages/Ruby/Libraries/Builtins/RangeOps.cs +589 -0
  285. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/RubyEncoding.cs +678 -0
  286. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs +271 -0
  287. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +31 -1
  288. data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
  289. data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.dll +0 -0
  290. data/platform/wp7/RhoRubyLib/common/RhoStd.cs +6 -0
  291. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +16 -2
  292. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +2 -0
  293. data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +1 -2
  294. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +13 -10
  295. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +30 -8
  296. data/platform/wp7/build/wp.rake +5 -0
  297. data/rakefile.rb +153 -46
  298. data/res/build-tools/detool.exe +0 -0
  299. data/res/build-tools/swig_patch/Lib/ruby/rubyerrors.swg +155 -0
  300. data/res/build-tools/swig_patch/Lib/ruby/rubyhead.swg +158 -0
  301. data/res/build-tools/swig_patch/Lib/ruby/rubyiterators.swg +932 -0
  302. data/res/build-tools/swig_patch/Lib/ruby/rubyrun.swg +448 -0
  303. data/res/build-tools/swig_patch/Lib/ruby/rubystdfunctors.swg +162 -0
  304. data/res/build-tools/swig_patch/Lib/ruby/rubytracking.swg +159 -0
  305. data/res/build-tools/swig_patch/Lib/ruby/std_basic_string.i +97 -0
  306. data/res/build-tools/swig_patch/Lib/ruby/std_map.i +418 -0
  307. data/res/build-tools/swig_patch/Lib/ruby/std_multimap.i +227 -0
  308. data/res/build-tools/swig_patch/Lib/swiginit.swg +269 -0
  309. data/res/build-tools/swig_patch/README +7 -0
  310. data/res/generators/templates/application/app/Settings/controller.rb +42 -1
  311. data/res/generators/templates/application/app/Settings/wait.erb +1 -1
  312. data/res/generators/templates/application/app/application.rb +1 -1
  313. data/res/generators/templates/application/app/layout.erb +8 -8
  314. data/res/generators/templates/application/build.yml +0 -1
  315. data/res/generators/templates/application/public/css/android.css +6 -0
  316. data/res/generators/templates/application/public/css/blackberry.css +6 -0
  317. data/res/generators/templates/application/public/css/iphone.css +6 -0
  318. data/res/generators/templates/application/public/css/jqmobile-patch.css +14 -0
  319. data/res/generators/templates/application/public/jqmobile/images/ajax-loader.png +0 -0
  320. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  321. data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
  322. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  323. data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
  324. data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0rc1.css → jquery.mobile-1.0.css} +452 -354
  325. data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0rc1.js → jquery.mobile-1.0.js} +629 -442
  326. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.css +2 -0
  327. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.js +172 -0
  328. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.css +714 -0
  329. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.min.css +2 -0
  330. data/res/generators/templates/application/public/js/jqmobile-patch.js +136 -7
  331. data/res/generators/templates/extension/app/MontanaTest/controller.rb +20 -20
  332. data/res/generators/templates/extension/app/MontanaTest/index.erb +17 -17
  333. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj +8 -2
  334. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile +5 -0
  335. data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c +64 -20
  336. data/rhomobile-debug.gemspec +1 -1
  337. data/spec/framework_spec/app/layout.erb +1 -1
  338. data/spec/framework_spec/app/spec/core/rational/Rational_spec.rb +1 -1
  339. data/spec/framework_spec/app/spec/library/stringio/shared/each_char.rb +6 -2
  340. data/spec/framework_spec/app/spec/shared/rational/{Rational.rb → rational_main.rb} +0 -0
  341. data/spec/framework_spec/build.yml +0 -3
  342. data/spec/perfomance_spec/app/Benchmark/controller.rb +1 -1
  343. data/spec/perfomance_spec/app/layout.erb +1 -1
  344. data/spec/phone_spec/app/BlobTest_s/blob_test_s.rb +13 -0
  345. data/spec/phone_spec/app/BlobTest_s/test.png +0 -0
  346. data/spec/phone_spec/app/BlobTest_s/test2.png +0 -0
  347. data/spec/phone_spec/app/spec/blobsync_spec.rb +27 -15
  348. data/spec/phone_spec/app/spec/date_spec.rb +27 -1
  349. data/spec/phone_spec/app/spec/rho_spec.rb +6 -0
  350. data/spec/phone_spec/app/spec/rhom_object_spec.rb +64 -26
  351. data/spec/phone_spec/app/spec/syncengine_spec.rb +28 -7
  352. data/spec/phone_spec/app/spec/uri_spec.rb +4 -4
  353. data/spec/phone_spec/app/spec_runner.rb +4 -2
  354. data/spec/phone_spec/build.yml +7 -9
  355. data/spec/phone_spec/rhoconfig.txt +1 -0
  356. data/version +1 -1
  357. metadata +75 -22
  358. data/Manifest.txt +0 -7853
  359. data/platform/wm/rhodes/rhoelements/RhoWKBrowserEngine.cpp +0 -384
  360. data/platform/wm/rhodes/rhoelements/RhoWKBrowserEngine.h +0 -41
  361. data/platform/wm/rhodes/signature/Signature.cpp +0 -396
  362. data/platform/wm/rhodes/signature/Signature.h +0 -84
  363. data/platform/wm/rubylib/rubylib.vcproj.VLAD.Vladimir.user +0 -429
  364. data/platform/wm/sqlite3/sqlite3.vcproj.VLAD.Vladimir.user +0 -429
  365. data/platform/wm/syncengine/syncengine.vcproj.VLAD.Vladimir.user +0 -429
  366. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.css +0 -12
  367. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.js +0 -170
  368. data/rhomobile-debug-1.0.5.gem +0 -0
@@ -67,7 +67,7 @@ public:
67
67
  };
68
68
 
69
69
 
70
- class DrawingDeviceMapViewImpl : public DrawingDeviceImpl {
70
+ class DrawingDeviceMapViewImpl : public WmDrawingDeviceImpl {
71
71
  virtual void requestRedraw(){
72
72
  RHO_MAP_TRACE("MapView requested redraw -> post command to UI thread");
73
73
  RhoMapViewRedrawViewCommand* command = new RhoMapViewRedrawViewCommand();
@@ -251,7 +251,12 @@ LRESULT CRhoMapViewDlg::OnDraw(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam
251
251
 
252
252
  HBITMAP hOldBitmap = (HBITMAP)SelectObject(mMemoryDC, m_hMemBitmap );
253
253
 
254
- DrawingContextImpl* context = new DrawingContextImpl(mMemoryDC, rect.Width(), rect.Height());
254
+ IDrawingContext* context = 0;
255
+
256
+ #if defined(_WIN32_WCE)
257
+ context = new WmDrawingContextImpl(mMemoryDC, rect.Width(), rect.Height());
258
+ #else
259
+ #endif
255
260
 
256
261
  context->fillRect(0, 0, rect.Width(), rect.Height(), BACKGROUND_COLOR);
257
262
 
@@ -30,7 +30,7 @@
30
30
 
31
31
  #include "stdafx.h"
32
32
 
33
- #include "Graphics.h"
33
+ #include "WmGraphics.h"
34
34
  #include <string>
35
35
  #include "ext/rho/rhoruby.h"
36
36
  #include "common/StringConverter.h"
@@ -0,0 +1,263 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://rhomobile.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #include "stdafx.h"
28
+
29
+ #include <common/RhodesApp.h>
30
+ #include <logging/RhoLogConf.h>
31
+
32
+ /*
33
+ #include "Win32Graphics.h"
34
+
35
+ #ifdef OS_WINCE
36
+ #include <initguid.h>
37
+ #include <imgguids.h>
38
+ #endif //OS_WINCE
39
+
40
+ extern "C" HWND getMainWnd();
41
+ extern "C" void msg_out(const char* text);
42
+ extern "C" void err_out(const char* text);
43
+
44
+ #undef DEFAULT_LOGCATEGORY
45
+ #define DEFAULT_LOGCATEGORY "WM MapView Graphics (Win32)"
46
+
47
+ #define IP_PORTION_COUNT 32
48
+
49
+
50
+ Win32DrawingImageImpl::Win32DrawingImageImpl(void const *p, int size, bool useAlpha) {
51
+ RHO_MAP_TRACE1("create DrawingImage with buffer length = %d", size);
52
+ init(NULL, p, size, NULL, useAlpha);
53
+ }
54
+
55
+ Win32DrawingImageImpl::Win32DrawingImageImpl(const char* path, bool useAlpha) {
56
+ RHO_MAP_TRACE1("create DrawingImage with filename = %s", path);
57
+ init(path, NULL, 0, NULL, useAlpha);
58
+ }
59
+
60
+ Win32DrawingImageImpl::Win32DrawingImageImpl(WMBitmap* bitmap) {
61
+ init(NULL, NULL, 0, bitmap, false);
62
+ }
63
+
64
+
65
+ static int ourDrawingImageID = 0;
66
+
67
+ Win32DrawingImageImpl::~Win32DrawingImageImpl()
68
+ {
69
+ RHO_MAP_TRACE1("DrawingImage destroy with ID = %d", mID);
70
+ if (mBitmap != NULL) {
71
+ mBitmap->release();
72
+ mBitmap = NULL;
73
+ }
74
+ }
75
+
76
+ void Win32DrawingImageImpl::init(const char* path, void const *p, int size, WMBitmap* bitmap, bool useAlpha)
77
+ {
78
+ mID = ++ourDrawingImageID;
79
+ RHO_MAP_TRACE1("DrawingImage create with ID = %d", mID);
80
+
81
+ #if defined(_WIN32_WCE)
82
+ IImagingFactory *pImgFactory = NULL;
83
+ IImage *pImage = NULL;
84
+
85
+ mWidth = 0;
86
+ mHeight = 0;
87
+ mBitmap = NULL;
88
+
89
+ if (bitmap != NULL) {
90
+ mBitmap = bitmap;
91
+ mBitmap->addRef();
92
+ mWidth = bitmap->width();
93
+ mHeight = bitmap->height();
94
+ return;
95
+ }
96
+
97
+ HRESULT co_init_result = CoInitializeEx(NULL, 0/*COINIT_APARTMENTTHREADED);
98
+ if ( (co_init_result == S_OK) || (co_init_result == S_FALSE) ) {
99
+ msg_out("CoInitializeEx OK");
100
+ if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
101
+ NULL,
102
+ CLSCTX_INPROC_SERVER,
103
+ IID_IImagingFactory,
104
+ (void **)&pImgFactory)))
105
+ {
106
+ HRESULT res = 0;
107
+ if (p != NULL) {
108
+ // from buf
109
+ res = pImgFactory->CreateImageFromBuffer(
110
+ p,
111
+ size,
112
+ BufferDisposalFlagNone,
113
+ &pImage);
114
+ }
115
+ else {
116
+ // from file
117
+ msg_out("Create Image Factory OK");
118
+ wchar_t wc_filename[2048];
119
+ mbstowcs(wc_filename, path, 2048);
120
+ res = pImgFactory->CreateImageFromFile(
121
+ wc_filename,
122
+ &pImage);
123
+ }
124
+ if (SUCCEEDED(res))
125
+ {
126
+ IImage* mimage = pImage;
127
+ ImageInfo imgInfo;
128
+ mimage->GetImageInfo(&imgInfo);
129
+ mWidth = imgInfo.Width;
130
+ mHeight = imgInfo.Height;
131
+ RHO_MAP_TRACE2("Drawing Image was created with WIDTH = %d, HEIGHT = %d", mWidth, mHeight);
132
+ mBitmap = new WMBitmap(mimage, useAlpha);
133
+ mimage->Release();
134
+ }
135
+ else {
136
+ err_out("Image not created !");
137
+ }
138
+ pImgFactory->Release();
139
+ }
140
+ else {
141
+ err_out("ImageFactory not created !");
142
+ }
143
+ CoUninitialize();
144
+ }
145
+ else {
146
+ err_out("CoInitializeEx not initialized !");
147
+ }
148
+ #endif //#if defined(_WIN32_WCE)
149
+ }
150
+
151
+ IDrawingImage* Win32DrawingImageImpl::clone() {
152
+ RHO_MAP_TRACE1("clone DrawingImage from ID = %d", mID);
153
+ return new Win32DrawingImageImpl(mBitmap);
154
+ }
155
+
156
+
157
+ void Win32DrawingImageImpl::draw(HDC hdc, int x, int y)
158
+ {
159
+ RHO_MAP_TRACE2("draw DrawingImage with x = %d, y = %d", x, y);
160
+ if (mBitmap == NULL) {
161
+ return;
162
+ }
163
+ mBitmap->draw(hdc, x, y);
164
+ }
165
+
166
+
167
+
168
+ Win32DrawingContextImpl::Win32DrawingContextImpl(HDC hdc, int width, int height) {
169
+ RHO_MAP_TRACE2("DrawingContext create with WIDTH = %d, HEIGHT = %d", width, height);
170
+ mHDC = hdc;
171
+ mWidth = width;
172
+ mHeight = height;
173
+ }
174
+
175
+ int Win32DrawingContextImpl::getWidth() {
176
+ return mWidth;
177
+ }
178
+
179
+ int Win32DrawingContextImpl::getHeight() {
180
+ return mHeight;
181
+ }
182
+
183
+ void Win32DrawingContextImpl::drawImage(int x, int y, IDrawingImage* image) {
184
+ Win32DrawingImageImpl* img = (Win32DrawingImageImpl*)image;
185
+ img->draw(mHDC, x, y);
186
+ }
187
+
188
+ void Win32DrawingContextImpl::drawText(int x, int y, int nWidth, int nHeight, String const &text, int color)
189
+ {
190
+ RHO_MAP_TRACE2("DrawingContext drawText with x = %d, y = %d", x, y);
191
+
192
+ HFONT hfontTahoma;
193
+ LOGFONT logfont;
194
+ HFONT hfontSave = NULL;
195
+
196
+ memset (&logfont, 0, sizeof (logfont));
197
+ logfont.lfHeight = 18;
198
+ logfont.lfWidth = 0;
199
+ logfont.lfEscapement = 0;
200
+ logfont.lfOrientation = 0;
201
+ logfont.lfWeight = FW_BOLD;
202
+ logfont.lfItalic = FALSE;
203
+ logfont.lfUnderline = FALSE;
204
+ logfont.lfStrikeOut = FALSE;
205
+ logfont.lfCharSet = DEFAULT_CHARSET;
206
+ logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
207
+ logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
208
+ logfont.lfQuality = DEFAULT_QUALITY;
209
+ logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
210
+ _tcsncpy (logfont.lfFaceName, TEXT("Tahoma"), LF_FACESIZE);
211
+ logfont.lfFaceName[LF_FACESIZE-1] = TEXT('\0'); // Ensure null termination
212
+ hfontTahoma = CreateFontIndirect (&logfont);
213
+
214
+ if (hfontTahoma) {
215
+ hfontSave = (HFONT) SelectObject(mHDC, hfontTahoma);
216
+ }
217
+
218
+ StringW pathW = convertToStringW(text);
219
+ SetBkMode(mHDC, TRANSPARENT);
220
+ SetTextColor(mHDC, color & 0xFFFFFF);
221
+ //TextOut(mHDC, x, y, pathW.c_str(), pathW.length());
222
+ RECT r;
223
+ r.left = x;
224
+ r.top = y;
225
+ r.right = x+nWidth;
226
+ r.bottom = y + nHeight;
227
+ DrawText(mHDC, pathW.c_str(), -1, &r, DT_LEFT | DT_TOP);
228
+
229
+ if (hfontTahoma) {
230
+ SelectObject(mHDC, hfontSave);
231
+ DeleteObject (hfontTahoma);
232
+ }
233
+ }
234
+
235
+ void Win32DrawingContextImpl::fillRect(int x, int y, int width, int height, int color) {
236
+ RECT r;
237
+ r.left = x;
238
+ r.top = y;
239
+ r.right = x+width;
240
+ r.bottom = y + height;
241
+
242
+ HBRUSH hBrush;
243
+ HBRUSH hOldBrush;
244
+
245
+ hBrush = CreateSolidBrush(0xFF000000 | color);
246
+ hOldBrush = (HBRUSH)SelectObject(mHDC, hBrush);
247
+
248
+ FillRect(mHDC, &r, hBrush);
249
+
250
+ SelectObject(mHDC, hOldBrush);
251
+ DeleteObject(hBrush);
252
+ }
253
+
254
+ void Win32DrawingContextImpl::getTextRect(int x, int y, String &text, RECT* resultRect)
255
+ {
256
+ //GetTextExtentPoint32
257
+ }
258
+
259
+ void Win32DrawingContextImpl::drawLine(int x1, int y1, int x2, int y2, int color)
260
+ {
261
+ }
262
+
263
+ */
@@ -0,0 +1,133 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://rhomobile.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #pragma once
28
+
29
+ #include "stdafx.h"
30
+
31
+ #include <stdlib.h>
32
+ #include <windows.h>
33
+ #include <commctrl.h>
34
+
35
+ #include <string>
36
+
37
+ //#if defined(_WIN32_WCE)
38
+ //#include <imaging.h>
39
+ //#else
40
+ //struct IImage;
41
+ //#endif
42
+
43
+ #include "ext/rho/rhoruby.h"
44
+ #include "common/StringConverter.h"
45
+ #include "Bitmap.h"
46
+
47
+ #include <common/rhoparams.h>
48
+ #include <common/map/MapEngine.h>
49
+
50
+
51
+ using namespace rho::common;
52
+ using namespace rho::common::map;
53
+ using namespace rho;
54
+ using namespace stdext;
55
+
56
+ /*
57
+ class Win32DrawingImageImpl : public IDrawingImage {
58
+ public:
59
+ Win32DrawingImageImpl(void const *p, int size, bool useAlpha);
60
+ Win32DrawingImageImpl(const char* path, bool useAlpha);
61
+ Win32DrawingImageImpl(WMBitmap* bitmap);
62
+ virtual ~Win32DrawingImageImpl();
63
+
64
+ virtual void draw(HDC hdc, int x, int y);
65
+
66
+ virtual IDrawingImage* clone();
67
+
68
+ virtual int width() const {return mWidth;}
69
+ virtual int height() const {return mHeight;}
70
+
71
+ private:
72
+ void init(const char* path, void const *p, int size, WMBitmap* bitmap, bool useAlpha);
73
+ //IImage* mImage;
74
+ WMBitmap* mBitmap;
75
+ int mWidth;
76
+ int mHeight;
77
+ int mID;
78
+ };
79
+
80
+
81
+ class Win32DrawingContextImpl : public IDrawingContext{
82
+ public:
83
+ Win32DrawingContextImpl(HDC hdc, int width, int height);
84
+ virtual int getWidth();
85
+ virtual int getHeight();
86
+ virtual void drawImage(int x, int y, IDrawingImage* image);
87
+ virtual void drawText(int x, int y, int nWidth, int nHeight, String const &text, int color);
88
+ virtual void getTextRect(int x, int y, String &text, RECT* resultRect);
89
+ virtual void fillRect(int x, int y, int width, int height, int color);
90
+ virtual void drawLine(int x1, int y1, int x2, int y2, int color);
91
+
92
+
93
+ private:
94
+ HDC mHDC;
95
+ int mWidth;
96
+ int mHeight;
97
+ };
98
+
99
+ class Win32DrawingDeviceImpl : public IDrawingDevice
100
+ {
101
+ public:
102
+
103
+ virtual IDrawingImage* createImage(String const &path, bool useAlpha) {
104
+ return new Win32DrawingImageImpl(path.c_str(), useAlpha);
105
+ }
106
+ virtual IDrawingImage* createImage(void const *p, size_t s, bool useAlpha) {
107
+ return new Win32DrawingImageImpl(p, s, useAlpha);
108
+ }
109
+
110
+ virtual IDrawingImage* createImageEx(void const *p, size_t s, int x, int y, int w, int h, bool useAlpha) {
111
+ return new Win32DrawingImageImpl(p, s, useAlpha);
112
+ }
113
+
114
+
115
+ virtual IDrawingImage* cloneImage(IDrawingImage *image) {
116
+ if (image == NULL) {
117
+ return NULL;
118
+ }
119
+ return ((Win32DrawingImageImpl*)image)->clone();
120
+ }
121
+
122
+ virtual void destroyImage(IDrawingImage* image) {
123
+ delete image;
124
+ };
125
+
126
+
127
+ virtual IDrawingImage* createCalloutImage(String const &title, String const &subtitle, String const& url, int* x_offset, int* y_offset) {
128
+ return NULL;
129
+ }
130
+
131
+ virtual void requestRedraw(){}
132
+ };
133
+ */
@@ -0,0 +1,291 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://rhomobile.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #include "stdafx.h"
28
+
29
+
30
+ #include <common/RhodesApp.h>
31
+ #include <logging/RhoLogConf.h>
32
+
33
+
34
+ #include "WmGraphics.h"
35
+
36
+
37
+ //#if 0
38
+ #ifdef OS_WINCE
39
+ #include <initguid.h>
40
+ #include <imgguids.h>
41
+ #endif //OS_WINCE
42
+
43
+ extern "C" HWND getMainWnd();
44
+
45
+ static void msg_out(const char* text)
46
+ {
47
+ RAWLOG_ERROR("MapView Graphics:");
48
+ RAWLOG_ERROR(text);
49
+ }
50
+
51
+ static void err_out(const char* text)
52
+ {
53
+ RAWLOG_ERROR("MapView Graphics:");
54
+ RAWLOG_ERROR(text);
55
+ }
56
+
57
+ /*
58
+ #else
59
+
60
+
61
+ extern "C" HWND getMainWnd();
62
+
63
+ #undef DEFINE_GUID
64
+ #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
65
+ EXTERN_C const GUID name \
66
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
67
+
68
+ DEFINE_GUID(IID_IImagingFactory, 0x327abda7,0x072b,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
69
+ DEFINE_GUID(CLSID_ImagingFactory, 0x327abda8,0x072b,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
70
+
71
+ #endif*/
72
+
73
+ #undef DEFAULT_LOGCATEGORY
74
+ #define DEFAULT_LOGCATEGORY "WM MapView Graphics"
75
+
76
+
77
+
78
+ #define IP_PORTION_COUNT 32
79
+
80
+ WmDrawingImageImpl::WmDrawingImageImpl(void const *p, int size, bool useAlpha) {
81
+ RHO_MAP_TRACE1("create DrawingImage with buffer length = %d", size);
82
+ init(NULL, p, size, NULL, useAlpha);
83
+ }
84
+
85
+ WmDrawingImageImpl::WmDrawingImageImpl(const char* path, bool useAlpha) {
86
+ RHO_MAP_TRACE1("create DrawingImage with filename = %s", path);
87
+ init(path, NULL, 0, NULL, useAlpha);
88
+ }
89
+
90
+ WmDrawingImageImpl::WmDrawingImageImpl(WMBitmap* bitmap) {
91
+ init(NULL, NULL, 0, bitmap, false);
92
+ }
93
+
94
+
95
+ static int ourDrawingImageID = 0;
96
+
97
+ WmDrawingImageImpl::~WmDrawingImageImpl()
98
+ {
99
+ RHO_MAP_TRACE1("DrawingImage destroy with ID = %d", mID);
100
+ if (mBitmap != NULL) {
101
+ mBitmap->release();
102
+ mBitmap = NULL;
103
+ }
104
+ }
105
+
106
+ void WmDrawingImageImpl::init(const char* path, void const *p, int size, WMBitmap* bitmap, bool useAlpha)
107
+ {
108
+ mID = ++ourDrawingImageID;
109
+ RHO_MAP_TRACE1("DrawingImage create with ID = %d", mID);
110
+
111
+ #if defined(_WIN32_WCE)
112
+ IImagingFactory *pImgFactory = NULL;
113
+ IImage *pImage = NULL;
114
+
115
+ mWidth = 0;
116
+ mHeight = 0;
117
+ mBitmap = NULL;
118
+
119
+ if (bitmap != NULL) {
120
+ mBitmap = bitmap;
121
+ mBitmap->addRef();
122
+ mWidth = bitmap->width();
123
+ mHeight = bitmap->height();
124
+ return;
125
+ }
126
+
127
+ HRESULT co_init_result = CoInitializeEx(NULL, 0/*COINIT_APARTMENTTHREADED*/);
128
+ if ( (co_init_result == S_OK) || (co_init_result == S_FALSE) ) {
129
+ msg_out("CoInitializeEx OK");
130
+ if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
131
+ NULL,
132
+ CLSCTX_INPROC_SERVER,
133
+ IID_IImagingFactory,
134
+ (void **)&pImgFactory)))
135
+ {
136
+ HRESULT res = 0;
137
+ if (p != NULL) {
138
+ // from buf
139
+ res = pImgFactory->CreateImageFromBuffer(
140
+ p,
141
+ size,
142
+ BufferDisposalFlagNone,
143
+ &pImage);
144
+ }
145
+ else {
146
+ // from file
147
+ msg_out("Create Image Factory OK");
148
+ wchar_t wc_filename[2048];
149
+ mbstowcs(wc_filename, path, 2048);
150
+ res = pImgFactory->CreateImageFromFile(
151
+ wc_filename,
152
+ &pImage);
153
+ }
154
+ if (SUCCEEDED(res))
155
+ {
156
+ IImage* mimage = pImage;
157
+ ImageInfo imgInfo;
158
+ mimage->GetImageInfo(&imgInfo);
159
+ mWidth = imgInfo.Width;
160
+ mHeight = imgInfo.Height;
161
+ RHO_MAP_TRACE2("Drawing Image was created with WIDTH = %d, HEIGHT = %d", mWidth, mHeight);
162
+ mBitmap = new WMBitmap(mimage, useAlpha);
163
+ mimage->Release();
164
+ }
165
+ else {
166
+ err_out("Image not created !");
167
+ }
168
+ pImgFactory->Release();
169
+ }
170
+ else {
171
+ err_out("ImageFactory not created !");
172
+ }
173
+ CoUninitialize();
174
+ }
175
+ else {
176
+ err_out("CoInitializeEx not initialized !");
177
+ }
178
+ #endif //#if defined(_WIN32_WCE)
179
+ }
180
+
181
+ IDrawingImage* WmDrawingImageImpl::clone() {
182
+ RHO_MAP_TRACE1("clone DrawingImage from ID = %d", mID);
183
+ return new WmDrawingImageImpl(mBitmap);
184
+ }
185
+
186
+
187
+ void WmDrawingImageImpl::draw(HDC hdc, int x, int y)
188
+ {
189
+ RHO_MAP_TRACE2("draw DrawingImage with x = %d, y = %d", x, y);
190
+ if (mBitmap == NULL) {
191
+ return;
192
+ }
193
+ mBitmap->draw(hdc, x, y);
194
+ }
195
+
196
+
197
+
198
+ WmDrawingContextImpl::WmDrawingContextImpl(HDC hdc, int width, int height) {
199
+ RHO_MAP_TRACE2("DrawingContext create with WIDTH = %d, HEIGHT = %d", width, height);
200
+ mHDC = hdc;
201
+ mWidth = width;
202
+ mHeight = height;
203
+ }
204
+
205
+ int WmDrawingContextImpl::getWidth() {
206
+ return mWidth;
207
+ }
208
+
209
+ int WmDrawingContextImpl::getHeight() {
210
+ return mHeight;
211
+ }
212
+
213
+ void WmDrawingContextImpl::drawImage(int x, int y, IDrawingImage* image) {
214
+ WmDrawingImageImpl* img = (WmDrawingImageImpl*)image;
215
+ img->draw(mHDC, x, y);
216
+ }
217
+
218
+ void WmDrawingContextImpl::drawText(int x, int y, int nWidth, int nHeight, String const &text, int color)
219
+ {
220
+ RHO_MAP_TRACE2("DrawingContext drawText with x = %d, y = %d", x, y);
221
+
222
+ HFONT hfontTahoma;
223
+ LOGFONT logfont;
224
+ HFONT hfontSave = NULL;
225
+
226
+ memset (&logfont, 0, sizeof (logfont));
227
+ logfont.lfHeight = 18;
228
+ logfont.lfWidth = 0;
229
+ logfont.lfEscapement = 0;
230
+ logfont.lfOrientation = 0;
231
+ logfont.lfWeight = FW_BOLD;
232
+ logfont.lfItalic = FALSE;
233
+ logfont.lfUnderline = FALSE;
234
+ logfont.lfStrikeOut = FALSE;
235
+ logfont.lfCharSet = DEFAULT_CHARSET;
236
+ logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
237
+ logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
238
+ logfont.lfQuality = DEFAULT_QUALITY;
239
+ logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
240
+ _tcsncpy (logfont.lfFaceName, TEXT("Tahoma"), LF_FACESIZE);
241
+ logfont.lfFaceName[LF_FACESIZE-1] = TEXT('\0'); // Ensure null termination
242
+ hfontTahoma = CreateFontIndirect (&logfont);
243
+
244
+ if (hfontTahoma) {
245
+ hfontSave = (HFONT) SelectObject(mHDC, hfontTahoma);
246
+ }
247
+
248
+ StringW pathW = convertToStringW(text);
249
+ SetBkMode(mHDC, TRANSPARENT);
250
+ SetTextColor(mHDC, color & 0xFFFFFF);
251
+ //TextOut(mHDC, x, y, pathW.c_str(), pathW.length());
252
+ RECT r;
253
+ r.left = x;
254
+ r.top = y;
255
+ r.right = x+nWidth;
256
+ r.bottom = y + nHeight;
257
+ DrawText(mHDC, pathW.c_str(), -1, &r, DT_LEFT | DT_TOP);
258
+
259
+ if (hfontTahoma) {
260
+ SelectObject(mHDC, hfontSave);
261
+ DeleteObject (hfontTahoma);
262
+ }
263
+ }
264
+
265
+ void WmDrawingContextImpl::fillRect(int x, int y, int width, int height, int color) {
266
+ RECT r;
267
+ r.left = x;
268
+ r.top = y;
269
+ r.right = x+width;
270
+ r.bottom = y + height;
271
+
272
+ HBRUSH hBrush;
273
+ HBRUSH hOldBrush;
274
+
275
+ hBrush = CreateSolidBrush(0xFF000000 | color);
276
+ hOldBrush = (HBRUSH)SelectObject(mHDC, hBrush);
277
+
278
+ FillRect(mHDC, &r, hBrush);
279
+
280
+ SelectObject(mHDC, hOldBrush);
281
+ DeleteObject(hBrush);
282
+ }
283
+
284
+ void WmDrawingContextImpl::getTextRect(int x, int y, String &text, RECT* resultRect)
285
+ {
286
+ //GetTextExtentPoint32
287
+ }
288
+
289
+ void WmDrawingContextImpl::drawLine(int x1, int y1, int x2, int y2, int color)
290
+ {
291
+ }