shoes 4.0.0.pre2 → 4.0.0.pre3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -21
  3. metadata +18 -337
  4. data/CHANGELOG +0 -84
  5. data/Gemfile +0 -24
  6. data/Guardfile +0 -11
  7. data/Rakefile +0 -14
  8. data/app.yaml +0 -60
  9. data/benchmark/app_clear.rb +0 -21
  10. data/benchmark/clear.rb +0 -69
  11. data/benchmark/memory/text_dispose.rb +0 -9
  12. data/benchmark/para_creator.rb +0 -9
  13. data/benchmark/paras.rb +0 -52
  14. data/benchmark/urls.rb +0 -40
  15. data/bin/ruby-shoes +0 -6
  16. data/bin/shoes-guard +0 -8
  17. data/bin/shoes-stub +0 -59
  18. data/ext/install/Rakefile +0 -29
  19. data/ext/install/shoes.bat +0 -9
  20. data/lib/shoes.rb +0 -5
  21. data/lib/shoes/ui/cli.rb +0 -102
  22. data/lib/shoes/ui/help.rb +0 -535
  23. data/lib/shoes/ui/manual.rb +0 -6
  24. data/lib/shoes/version.rb +0 -3
  25. data/manifests/common.rb +0 -34
  26. data/manifests/shoes.rb +0 -44
  27. data/samples/Gemfile +0 -3
  28. data/samples/Gemfile.lock +0 -35
  29. data/samples/README +0 -97
  30. data/samples/boom.rb +0 -239
  31. data/samples/class-book-adjusted.rb +0 -45
  32. data/samples/class-book.rb +0 -43
  33. data/samples/class-book.yaml +0 -387
  34. data/samples/clicky.rb +0 -24
  35. data/samples/cy.png +0 -0
  36. data/samples/expert-definr.rb +0 -23
  37. data/samples/expert-funnies.rb +0 -60
  38. data/samples/expert-game-of-life-adjusted.rb +0 -249
  39. data/samples/expert-game-of-life.rb +0 -243
  40. data/samples/expert-irb-adjusted.rb +0 -110
  41. data/samples/expert-irb.rb +0 -112
  42. data/samples/expert-minesweeper-adjusted.rb +0 -272
  43. data/samples/expert-minesweeper.rb +0 -267
  44. data/samples/expert-othello-adjusted.rb +0 -325
  45. data/samples/expert-othello.rb +0 -318
  46. data/samples/expert-pong.rb +0 -62
  47. data/samples/expert-snake.rb +0 -78
  48. data/samples/expert-tankspank.rb +0 -385
  49. data/samples/flow.rb +0 -63
  50. data/samples/good-arc.rb +0 -45
  51. data/samples/good-clock.rb +0 -51
  52. data/samples/good-displace.rb +0 -98
  53. data/samples/good-follow.rb +0 -26
  54. data/samples/good-potato-chopping.rb +0 -22
  55. data/samples/good-reminder.rb +0 -174
  56. data/samples/good-vjot.rb +0 -58
  57. data/samples/gray.rb +0 -11
  58. data/samples/loogink.png +0 -0
  59. data/samples/nks_booklist.rb +0 -24
  60. data/samples/nks_breadsticks.rb +0 -7
  61. data/samples/nks_dancing_circle.rb +0 -13
  62. data/samples/nks_dictionary.rb +0 -23
  63. data/samples/nks_edit_box.rb +0 -4
  64. data/samples/nks_edit_line.rb +0 -6
  65. data/samples/nks_notes.rb +0 -16
  66. data/samples/nks_poem.rb +0 -22
  67. data/samples/nks_self.rb +0 -6
  68. data/samples/nks_text_sizes.rb +0 -10
  69. data/samples/nks_trurl.rb +0 -5
  70. data/samples/original-manual-adjusted.rb +0 -475
  71. data/samples/original-manual.rb +0 -472
  72. data/samples/packaging/package_me.rb +0 -6
  73. data/samples/potato_chopping/1258_s001.gif +0 -0
  74. data/samples/potato_chopping/1258_s002.gif +0 -0
  75. data/samples/potato_chopping/1258_s003.gif +0 -0
  76. data/samples/potato_chopping/1258_s004.gif +0 -0
  77. data/samples/potato_chopping/1258_s005.gif +0 -0
  78. data/samples/potato_chopping/1258_s006.gif +0 -0
  79. data/samples/potato_chopping/1258_s007.gif +0 -0
  80. data/samples/potato_chopping/1258_s008.gif +0 -0
  81. data/samples/potato_chopping/1258_s009.gif +0 -0
  82. data/samples/potato_chopping/1258_s010.gif +0 -0
  83. data/samples/potato_chopping/1258_s011.gif +0 -0
  84. data/samples/potato_chopping/1258_s012.gif +0 -0
  85. data/samples/potato_chopping/1258_s013.gif +0 -0
  86. data/samples/potato_chopping/1258_s014.gif +0 -0
  87. data/samples/potato_chopping/1258_s015.gif +0 -0
  88. data/samples/potato_chopping/1258_s016.gif +0 -0
  89. data/samples/potato_chopping/1258_s017.gif +0 -0
  90. data/samples/potato_chopping/1258_s018.gif +0 -0
  91. data/samples/potato_chopping/1258_s019.gif +0 -0
  92. data/samples/potato_chopping/1258_s020.gif +0 -0
  93. data/samples/potato_chopping/1258_s021.gif +0 -0
  94. data/samples/potato_chopping/1258_s022.gif +0 -0
  95. data/samples/potato_chopping/1258_s023.gif +0 -0
  96. data/samples/potato_chopping/1258_s024.gif +0 -0
  97. data/samples/potato_chopping/1258_s025.gif +0 -0
  98. data/samples/potato_chopping/1258_s026.gif +0 -0
  99. data/samples/potato_chopping/1258_s027.gif +0 -0
  100. data/samples/potato_chopping/1258_s028.gif +0 -0
  101. data/samples/potato_chopping/1258_s029.gif +0 -0
  102. data/samples/potato_chopping/1258_s030.gif +0 -0
  103. data/samples/potato_chopping/1258_s031.gif +0 -0
  104. data/samples/potato_chopping/1258_s032.gif +0 -0
  105. data/samples/potato_chopping/1258_s033.gif +0 -0
  106. data/samples/potato_chopping/1258_s034.gif +0 -0
  107. data/samples/potato_chopping/1258_s035.gif +0 -0
  108. data/samples/potato_chopping/1258_s036.gif +0 -0
  109. data/samples/potato_chopping/1258_s037.gif +0 -0
  110. data/samples/potato_chopping/1258_s038.gif +0 -0
  111. data/samples/potato_chopping/1258_s039.gif +0 -0
  112. data/samples/potato_chopping/1258_s040.gif +0 -0
  113. data/samples/potato_chopping/1258_s041.gif +0 -0
  114. data/samples/potato_chopping/1258_s042.gif +0 -0
  115. data/samples/potato_chopping/1258_s043.gif +0 -0
  116. data/samples/potato_chopping/1258_s044.gif +0 -0
  117. data/samples/potato_chopping/1258_s045.gif +0 -0
  118. data/samples/potato_chopping/1258_s046.gif +0 -0
  119. data/samples/potato_chopping/1258_s047.gif +0 -0
  120. data/samples/potato_chopping/1258_s048.gif +0 -0
  121. data/samples/potato_chopping/1258_s049.gif +0 -0
  122. data/samples/potato_chopping/1258_s050.gif +0 -0
  123. data/samples/potato_chopping/1258_s051.gif +0 -0
  124. data/samples/potato_chopping/1258_s052.gif +0 -0
  125. data/samples/potato_chopping/1258_s053.gif +0 -0
  126. data/samples/potato_chopping/1258_s054.gif +0 -0
  127. data/samples/potato_chopping/1258_s055.gif +0 -0
  128. data/samples/potato_chopping/1258_s056.gif +0 -0
  129. data/samples/potato_chopping/1258_s057.gif +0 -0
  130. data/samples/potato_chopping/1258_s058.gif +0 -0
  131. data/samples/potato_chopping/1258_s059.gif +0 -0
  132. data/samples/present.rb +0 -27
  133. data/samples/progress.rb +0 -10
  134. data/samples/sample1.rb +0 -30
  135. data/samples/sample12.rb +0 -21
  136. data/samples/sample13.rb +0 -13
  137. data/samples/sample14.rb +0 -64
  138. data/samples/sample15.rb +0 -18
  139. data/samples/sample16.rb +0 -10
  140. data/samples/sample17.rb +0 -10
  141. data/samples/sample2.rb +0 -14
  142. data/samples/sample21.rb +0 -5
  143. data/samples/sample23.rb +0 -8
  144. data/samples/sample24.rb +0 -21
  145. data/samples/sample27.rb +0 -18
  146. data/samples/sample3.rb +0 -14
  147. data/samples/sample31.rb +0 -22
  148. data/samples/sample34.rb +0 -27
  149. data/samples/sample35.rb +0 -32
  150. data/samples/sample37.rb +0 -8
  151. data/samples/sample4.rb +0 -7
  152. data/samples/sample42.rb +0 -14
  153. data/samples/sample45.rb +0 -11
  154. data/samples/sample56.rb +0 -10
  155. data/samples/sample6.rb +0 -9
  156. data/samples/sample7.rb +0 -3
  157. data/samples/sample8.rb +0 -7
  158. data/samples/sample9.rb +0 -10
  159. data/samples/simple-accordion.rb +0 -75
  160. data/samples/simple-anim-shapes.rb +0 -17
  161. data/samples/simple-anim-text.rb +0 -13
  162. data/samples/simple-animate.rb +0 -12
  163. data/samples/simple-arc.rb +0 -23
  164. data/samples/simple-bounce.rb +0 -24
  165. data/samples/simple-brightness-transitions.rb +0 -8
  166. data/samples/simple-button-animate.rb +0 -16
  167. data/samples/simple-calc-2.rb +0 -34
  168. data/samples/simple-calc.rb +0 -70
  169. data/samples/simple-color-selector.rb +0 -10
  170. data/samples/simple-color-transitions.rb +0 -11
  171. data/samples/simple-control-sizes.rb +0 -24
  172. data/samples/simple-curve.rb +0 -26
  173. data/samples/simple-dialogs-outside.rb +0 -12
  174. data/samples/simple-dialogs.rb +0 -32
  175. data/samples/simple-displace.rb +0 -15
  176. data/samples/simple-downloader.rb +0 -27
  177. data/samples/simple-draw.rb +0 -13
  178. data/samples/simple-editor.rb +0 -28
  179. data/samples/simple-face.rb +0 -14
  180. data/samples/simple-flow-wrap.rb +0 -11
  181. data/samples/simple-font.rb +0 -17
  182. data/samples/simple-form.rb +0 -29
  183. data/samples/simple-form.shy +0 -0
  184. data/samples/simple-fullscreen.rb +0 -4
  185. data/samples/simple-guess-game.rb +0 -28
  186. data/samples/simple-keypress.rb +0 -14
  187. data/samples/simple-manual.rb +0 -2
  188. data/samples/simple-mask.rb +0 -21
  189. data/samples/simple-menu.rb +0 -47
  190. data/samples/simple-mouse-follow.rb +0 -8
  191. data/samples/simple-move.rb +0 -13
  192. data/samples/simple-oval.rb +0 -3
  193. data/samples/simple-sample-executor.rb +0 -6
  194. data/samples/simple-shoes-intro.rb +0 -22
  195. data/samples/simple-slide.rb +0 -56
  196. data/samples/simple-sound.rb +0 -30
  197. data/samples/simple-sphere.rb +0 -28
  198. data/samples/simple-stripes.rb +0 -8
  199. data/samples/simple-tictactoe.rb +0 -238
  200. data/samples/simple-timer.rb +0 -15
  201. data/samples/simple-video.rb +0 -13
  202. data/samples/simple-visibility.rb +0 -11
  203. data/samples/simple-widget.rb +0 -9
  204. data/samples/sounds/102719__sarge4267__explosion.mp3 +0 -0
  205. data/samples/sounds/145622__andybrannan__train-fog-horn-long-wyomming.aiff +0 -0
  206. data/samples/sounds/46492__phreaksaccount__shields1.ogg +0 -0
  207. data/samples/sounds/61847__simon-rue__boink-v3.wav +0 -0
  208. data/samples/swt-raw.rb +0 -20
  209. data/samples/troll.rb +0 -22
  210. data/shoes.gemspec +0 -29
  211. data/snapshots/sample1.png +0 -0
  212. data/snapshots/sample10.png +0 -0
  213. data/snapshots/sample11.png +0 -0
  214. data/snapshots/sample12.png +0 -0
  215. data/snapshots/sample13.png +0 -0
  216. data/snapshots/sample14.png +0 -0
  217. data/snapshots/sample15.png +0 -0
  218. data/snapshots/sample16.png +0 -0
  219. data/snapshots/sample17.png +0 -0
  220. data/snapshots/sample18.png +0 -0
  221. data/snapshots/sample19.png +0 -0
  222. data/snapshots/sample2.png +0 -0
  223. data/snapshots/sample20.png +0 -0
  224. data/snapshots/sample21.png +0 -0
  225. data/snapshots/sample22.png +0 -0
  226. data/snapshots/sample23.png +0 -0
  227. data/snapshots/sample24.png +0 -0
  228. data/snapshots/sample27.png +0 -0
  229. data/snapshots/sample28.png +0 -0
  230. data/snapshots/sample29.png +0 -0
  231. data/snapshots/sample3.png +0 -0
  232. data/snapshots/sample30.png +0 -0
  233. data/snapshots/sample31.png +0 -0
  234. data/snapshots/sample34.png +0 -0
  235. data/snapshots/sample35.png +0 -0
  236. data/snapshots/sample36.png +0 -0
  237. data/snapshots/sample37.png +0 -0
  238. data/snapshots/sample4.png +0 -0
  239. data/snapshots/sample42.png +0 -0
  240. data/snapshots/sample44.png +0 -0
  241. data/snapshots/sample45.png +0 -0
  242. data/snapshots/sample46.png +0 -0
  243. data/snapshots/sample5.png +0 -0
  244. data/snapshots/sample56.png +0 -0
  245. data/snapshots/sample6.png +0 -0
  246. data/snapshots/sample7.png +0 -0
  247. data/snapshots/sample8.png +0 -0
  248. data/snapshots/sample9.png +0 -0
  249. data/snapshots/sample99.png +0 -0
  250. data/static/PKGBUILD +0 -47
  251. data/static/Shoes.icns +0 -0
  252. data/static/avatar.png +0 -0
  253. data/static/code_highlighter.js +0 -188
  254. data/static/code_highlighter_ruby.js +0 -26
  255. data/static/downloading.png +0 -0
  256. data/static/icon-debug.png +0 -0
  257. data/static/icon-error.png +0 -0
  258. data/static/icon-info.png +0 -0
  259. data/static/icon-warn.png +0 -0
  260. data/static/listbox_button1.png +0 -0
  261. data/static/listbox_button2.png +0 -0
  262. data/static/man-app.png +0 -0
  263. data/static/man-builds.png +0 -0
  264. data/static/man-builds1.png +0 -0
  265. data/static/man-editor-notepad.png +0 -0
  266. data/static/man-editor-osx.png +0 -0
  267. data/static/man-ele-background.png +0 -0
  268. data/static/man-ele-border.png +0 -0
  269. data/static/man-ele-button.png +0 -0
  270. data/static/man-ele-check.png +0 -0
  271. data/static/man-ele-editbox.png +0 -0
  272. data/static/man-ele-editline.png +0 -0
  273. data/static/man-ele-image.png +0 -0
  274. data/static/man-ele-listbox.png +0 -0
  275. data/static/man-ele-progress.png +0 -0
  276. data/static/man-ele-radio.png +0 -0
  277. data/static/man-ele-shape.png +0 -0
  278. data/static/man-ele-textblock.png +0 -0
  279. data/static/man-ele-video.png +0 -0
  280. data/static/man-intro-dmg.png +0 -0
  281. data/static/man-intro-exe.png +0 -0
  282. data/static/man-look-tiger.png +0 -0
  283. data/static/man-look-ubuntu.png +0 -0
  284. data/static/man-look-vista.png +0 -0
  285. data/static/man-run-osx.png +0 -0
  286. data/static/man-run-vista.png +0 -0
  287. data/static/man-run-xp.png +0 -0
  288. data/static/man-shot1.png +0 -0
  289. data/static/manual-en.txt +0 -3531
  290. data/static/manual-ja.txt +0 -2829
  291. data/static/manual.css +0 -184
  292. data/static/menu-corner1.png +0 -0
  293. data/static/menu-corner2.png +0 -0
  294. data/static/menu-gray.png +0 -0
  295. data/static/menu-left.png +0 -0
  296. data/static/menu-right.png +0 -0
  297. data/static/menu-top.png +0 -0
  298. data/static/shoes-dmg.jpg +0 -0
  299. data/static/shoes-icon-blue.png +0 -0
  300. data/static/shoes-icon-brown.png +0 -0
  301. data/static/shoes-icon.png +0 -0
  302. data/static/shoes-manual-apps.gif +0 -0
  303. data/static/shoes-manual-apps.png +0 -0
  304. data/static/shoes_main_window.png +0 -0
  305. data/static/stripe.png +0 -0
  306. data/static/tutor-back.png +0 -0
  307. data/tasks/changelog.rb +0 -92
  308. data/tasks/gem.rb +0 -38
  309. data/tasks/rspec.rb +0 -106
  310. data/tasks/sample.rb +0 -66
  311. data/tasks/yard.rb +0 -13
data/samples/loogink.png DELETED
Binary file
@@ -1,24 +0,0 @@
1
- class BookList < Shoes
2
- url '/', :index
3
- url '/twain', :twain
4
- url '/kv', :vonnegut
5
-
6
- def index
7
- para "Books I've read: ",
8
- link("by Mark Twain", :click => "/twain"),
9
- link("by Kurt Vonnegut", :click => "/kv")
10
- end
11
-
12
- def twain
13
- para "Just Huck Finn.\n",
14
- link("Go back.", :click => "/")
15
- end
16
-
17
- def vonnegut
18
- para "Cat's Cradle. Sirens of Titan. ",
19
- "Breakfast of Champions.\n",
20
- link("Go back.", :click => "/")
21
- end
22
- end
23
-
24
- Shoes.app :width => 400, :height => 500
@@ -1,7 +0,0 @@
1
- Shoes.app width: 200, height: 80 do
2
- para "Testing test test. ",
3
- strong("Breadsticks. "),
4
- em("Breadsticks. "),
5
- code("Breadsticks. "),
6
- strong(ins("Very good."))
7
- end
@@ -1,13 +0,0 @@
1
- Shoes.app do
2
- @o = oval :top => 0, :left => 0,
3
- :radius => 40
4
-
5
- stack :margin => 40 do
6
- title "Dancing With a Circle"
7
- subtitle "How graceful and round."
8
- end
9
-
10
- motion do |x, y|
11
- @o.move width - x, height - y
12
- end
13
- end
@@ -1,23 +0,0 @@
1
- class Dictionary < Shoes
2
- url '/', :index
3
- url '/(\w+)', :word
4
-
5
- def index
6
- stack do
7
- title "Enter a Word"
8
- @word = edit_line
9
- button "OK" do
10
- visit "/#{@word.text}"
11
- end
12
- end
13
- end
14
-
15
- def word(string)
16
- stack do
17
- para "No definition found for #{string}. ",
18
- "Sorry this doesn't actually work."
19
- end
20
- end
21
- end
22
-
23
- Shoes.app
@@ -1,4 +0,0 @@
1
- Shoes.app do
2
- @e = edit_box "Would that I...",
3
- :width => 400, :height => 240
4
- end
@@ -1,6 +0,0 @@
1
- Shoes.app do
2
- @e = edit_line :width => 400
3
- button "O.K." do
4
- alert @e.text
5
- end
6
- end
data/samples/nks_notes.rb DELETED
@@ -1,16 +0,0 @@
1
- Shoes.app do
2
- stack :margin => 20, :width => 250 do
3
- subtitle "Shoes Notebook"
4
- para "Add a note."
5
- @add = edit_line
6
-
7
- button "Save" do
8
- @notes.append do
9
- para @add.text, " ",
10
- link("delete") { |x| x.parent.remove }
11
- end
12
- @add.text = ""
13
- end
14
- end
15
- @notes = stack :margin => 20, :width => -250
16
- end
data/samples/nks_poem.rb DELETED
@@ -1,22 +0,0 @@
1
- Shoes.app :width => 280, :height => 350 do
2
- flow :width => 280, :margin => 10 do
3
- stack :width => "100%" do
4
- banner "A POEM"
5
- end
6
- stack :width => "80px" do
7
- para "Goes like:"
8
- end
9
- s = stack :width => "-90px" do
10
- para "the sun.\n",
11
- "a lemon.\n",
12
- "the goalie.\n",
13
- "a fireplace.\n",
14
- "i want to write\n",
15
- "a poem for the\n",
16
- "kids who haven't\n",
17
- "even heard one yet.\n\n",
18
- "and the goalie guards\n",
19
- "the fireplace"
20
- end
21
- end
22
- end
data/samples/nks_self.rb DELETED
@@ -1,6 +0,0 @@
1
- Shoes.app do
2
- self.stack do
3
- self.edit_line "Sample sample."
4
- self.button "Breadsticks."
5
- end
6
- end
@@ -1,10 +0,0 @@
1
- Shoes.app width: 150, height: 200 do
2
- stack do
3
- title "Title"
4
- subtitle "Subtitle"
5
- tagline "Tagline"
6
- caption "Caption"
7
- para "Para"
8
- inscription "Inscription"
9
- end
10
- end
data/samples/nks_trurl.rb DELETED
@@ -1,5 +0,0 @@
1
- Shoes.app {
2
- button("Trurl?") {
3
- alert("Klapaucius!")
4
- }
5
- }
@@ -1,475 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # trying to get it working
3
- # Not working yet... too many building blocks missing. Such as Shoes::Search which is in shoes3/lib/shoes/search.rb but it uses an old outdated gem, which has a fork but that also seems unmaintained for 3 years
4
- # Also a couple of methods missing like Shoes.read_file although I'm uncertain if we really want to implement those.
5
- module Shoes::Manual
6
- PARA_RE = /\s*?(\{{3}(?:.+?)\}{3})|\n\n/m
7
- CODE_RE = /\{{3}(?:\s*\#![^\n]+)?(.+?)\}{3}/m
8
- IMAGE_RE = /\!(\{([^}\n]+)\})?([^!\n]+\.\w+)\!/
9
- CODE_STYLE = {:size => 9, :margin => 12}
10
- INTRO_STYLE = {:size => 16, :margin_bottom => 20, :stroke => "#000"}
11
- SUB_STYLE = {:stroke => "#CCC", :margin_top => 10}
12
- IMAGE_STYLE = {:margin => 8, :margin_left => 100}
13
- COLON = ": "
14
-
15
- [INTRO_STYLE, SUB_STYLE].each do |h|
16
- h[:font] = "MS UI Gothic"
17
- end #if Shoes.language == 'ja'
18
-
19
- def self.path
20
- #path = "#{Shoes::DIR}/static/manual-#{Shoes.language}.txt"
21
- #unless File.exists? path
22
- path = "#{Shoes::DIR}/static/manual-en.txt"
23
- #end
24
- path
25
- end
26
-
27
- def dewikify_hi(str, terms, intro = false)
28
- if terms
29
- code = []
30
- str = str.
31
- gsub(CODE_RE) { |x| code << x; "CODE#[#{code.length-1}]" }.
32
- gsub(/#{Regexp::quote(terms)}/i, '@\0@').
33
- gsub(/CODE#\[(\d+)\]/) { code[$1.to_i] }
34
- end
35
- dewikify(str, intro)
36
- end
37
-
38
- def dewikify_p(ele, str, *args)
39
- str = str.gsub(/\n+\s*/, " ").dump.
40
- gsub(/`(.+?)`/m, '", code("\1"), "').gsub(/\[\[BR\]\]/i, "\n").
41
- gsub(/\^(.+?)\^/m, '\1').
42
- gsub(/@(.+?)@/m, '", strong("\1", :fill => yellow), "').
43
- gsub(/'''(.+?)'''/m, '", strong("\1"), "').gsub(/''(.+?)''/m, '", em("\1"), "').
44
- gsub(/\[\[(\S+?)\]\]/m, '", link("\1".split(".", 2).last) { open_link("\1") }, "').
45
- gsub(/\[\[(\S+?) (.+?)\]\]/m, '", link("\2") { open_link("\1") }, "').
46
- gsub(IMAGE_RE, '", *args); stack(IMAGE_STYLE.merge({\2})) { image("#{Shoes::DIR}/static/\3") }; #{ele}("')
47
- #debug str if str =~ /The list of special keys/
48
- a = str.split(', ", ", ')
49
- if a.size == 1
50
- eval("#{ele}(#{str}, *args)")
51
- else
52
- flow do
53
- a[0...-1].each{|s| eval("#{ele}(#{s}, ',', *args)")}
54
- eval("#{ele}(#{a[-1]}, *args)")
55
- end
56
- end
57
- end
58
-
59
- def dewikify_code(str)
60
- str = str.gsub(/\A\n+/, '').chomp
61
- stack :margin_bottom => 12 do
62
- background rgb(210, 210, 210), :curve => 4
63
- para code(str), CODE_STYLE
64
- stack :top => 0, :right => 2, :width => 70 do
65
- stack do
66
- background "#8A7", :margin => [0, 2, 0, 2], :curve => 4
67
- para link("Run this", :stroke => "#eee", :underline => "none") { run_code(str) },
68
- :margin => 4, :align => 'center', :weight => 'bold', :size => 9
69
- end
70
- end
71
- end
72
- end
73
-
74
- def wiki_tokens(str, intro = false)
75
- paras = str.split(PARA_RE).reject { |x| x.empty? }
76
- if intro
77
- yield :intro, paras.shift
78
- end
79
- paras.map do |ps|
80
- if ps =~ CODE_RE
81
- yield :code, $1
82
- else
83
- case ps
84
- when /\A\{COLORS\}/
85
- yield :colors, nil
86
- when /\A\{INDEX\}/
87
- yield :index, nil
88
- when /\A\{SAMPLES\}/
89
- yield :samples, nil
90
- when /\A \* (.+)/m
91
- yield :list, $1.split(/^ \* /)
92
- when /\A==== (.+) ====/
93
- yield :caption, $1
94
- when /\A=== (.+) ===/
95
- yield :tagline, $1
96
- when /\A== (.+) ==/
97
- yield :subtitle, $1
98
- when /\A= (.+) =/
99
- yield :title, $1
100
- else
101
- yield :para, ps
102
- end
103
- end
104
- end
105
- end
106
-
107
- def dewikify(str, intro = false)
108
- proc do
109
- wiki_tokens(str, intro) do |sym, text|
110
- case sym when :intro
111
- dewikify_p :para, text, INTRO_STYLE
112
- when :code
113
- dewikify_code(text)
114
- when :colors
115
- color_page
116
- when :index
117
- index_page
118
- when :samples
119
- sample_page
120
- when :list
121
- text.each { |t| stack(:margin_left => 30) {
122
- fill black; oval -10, 7, 6; dewikify_p :para, t } }
123
- else
124
- dewikify_p sym, text
125
- end
126
- end
127
- end
128
- end
129
-
130
- def sample_page
131
- folder = File.join Shoes::DIR, 'samples'
132
- h = {}
133
- Dir.glob(File.join folder, '*').each do |file|
134
- if File.extname(file) == '.rb'
135
- key = File.basename(file).split('-')[0]
136
- h[key] ? h[key].push(file) : h[key] = [file]
137
- end
138
- end
139
- stack do
140
- h.each do |k, v|
141
- subtitle k
142
- flow do
143
- v.each do |file|
144
- para link(File.basename(file).split('-')[1..-1].join('-')[0..-4]){
145
- Dir.chdir(folder){eval IO.read(file).force_encoding("UTF-8"), TOPLEVEL_BINDING}
146
- }
147
- end
148
- end
149
- end
150
- end
151
- end
152
-
153
- def color_page
154
- color_names = (Shoes::COLORS.keys*"\n").split("\n").sort
155
- flow do
156
- color_names.each do |color|
157
- flow :width => 0.33 do
158
- c = send(color)
159
- background c
160
- para strong(color), "\n", c, :stroke => (c.dark? ? white : black),
161
- :margin => 4, :align => 'center'
162
- end
163
- end
164
- end
165
- end
166
-
167
- def class_tree
168
- tree = {}
169
- Shoes.constants.each do |c|
170
- k = Shoes.const_get(c)
171
- next unless k.respond_to? :superclass
172
-
173
- c = "Shoes::#{c}"
174
- if k.superclass == Object
175
- tree[c] ||= []
176
- else
177
- k.ancestors[1..-1].each do |sk|
178
- break if [Object, Kernel].include? sk
179
- next unless sk.is_a? Class #don't show mixins
180
- (tree[sk.name] ||= []) << c
181
- c = sk.name
182
- end
183
- end
184
- end
185
- tree
186
- end
187
-
188
- def index_page
189
- tree = class_tree
190
- shown = []
191
- index_p = proc do |k, subs|
192
- unless shown.include? k
193
- stack :margin_left => 20 do
194
- flow do
195
- para "▸ ", :font => case RUBY_PLATFORM
196
- when /mingw/; "MS UI Gothic"
197
- when /darwin/; "AppleGothic, Arial"
198
- else "Arial"
199
- end
200
- para k
201
- end
202
- subs.uniq.sort.each do |s|
203
- index_p[s, tree[s]]
204
- end if subs
205
- end
206
- shown << k
207
- end
208
- end
209
- tree.sort.each &index_p
210
- end
211
-
212
- def run_code str
213
- eval(str, TOPLEVEL_BINDING)
214
- end
215
-
216
- def load_docs path
217
- return @docs if @docs
218
- str = Shoes.read_file(path)
219
- @search = Shoes::Search.new
220
- @sections, @methods, @mindex = {}, {}, {}
221
- @docs =
222
- (str.split(/^= (.+?) =/)[1..-1]/2).map do |k,v|
223
- sparts = v.split(/^== (.+?) ==/)
224
-
225
- sections = (sparts[1..-1]/2).map do |k2,v2|
226
- meth = v2.split(/^=== (.+?) ===/)
227
- k2t = k2[/^(?:The )?([\-\w]+)/, 1]
228
- meth_plain = meth[0].gsub(IMAGE_RE, '')
229
- @search.add_document :uri => "T #{k2t}", :body => "#{k2}\n#{meth_plain}".downcase
230
-
231
- hsh = {'title' => k2, 'section' => k,
232
- 'description' => meth[0],
233
- 'methods' => (meth[1..-1]/2).map { |_k,_v|
234
- @search.add_document :uri => "M #{k}#{COLON}#{k2t}#{COLON}#{_k}", :body => "#{_k}\n#{_v}".downcase
235
- @mindex["#{k2t}.#{_k[/[\w\.]+/]}"] = [k2t, _k]
236
- [_k, _v]
237
- }}
238
- @methods[k2t] = hsh
239
- [k2t, hsh]
240
- end
241
-
242
- @search.add_document :uri => "S #{k}", :body => "#{k}\n#{sparts[0]}".downcase
243
- hsh = {'description' => sparts[0], 'sections' => sections,
244
- 'class' => "toc" + k.downcase.gsub(/\W+/, '')}
245
- @sections[k] = hsh
246
- [k, hsh]
247
- end
248
- @search.finish!
249
- @docs
250
- end
251
-
252
- def show_search
253
- @toc.each { |k,v| v.hide }
254
- @title.replace "Search"
255
- @doc.clear do
256
- dewikify_p :para, "Try method names (like `button` or `arrow`) or topics (like `slots`)", :align => 'center'
257
- flow :margin_left => 60 do
258
- edit_line :width => -60 do |terms|
259
- @results.clear do
260
- termd = terms.text.downcase
261
- #found = termd.empty? ? [] : manual_search(termd)
262
- found = (termd.empty? or termd[0] == 'z' or termd[0] == 'y') ? [] : manual_search(termd)
263
- para "#{found.length} matches", :align => "center", :margin_bottom => 0
264
- found.each do |typ, head|
265
- flow :margin => 4 do
266
- case typ
267
- when "S"
268
- background "#333", :curve => 4
269
- caption strong(link(head, :stroke => white) { open_section(head, terms.text) })
270
- para "Section header", Shoes::Manual::SUB_STYLE
271
- when "T"
272
- background "#777", :curve => 4
273
- caption strong(link(head, :stroke => "#EEE") { open_methods(head, terms.text) })
274
- hsh = @methods[head]
275
- para "Sub-section under #{hsh['section']} (#{hsh['methods'].length} methods)", Shoes::Manual::SUB_STYLE
276
- when "M"
277
- background "#CCC", :curve => 4
278
- sect, subhead, head = head.split(Shoes::Manual::COLON, 3)
279
- para strong(sect, Shoes::Manual::COLON, subhead, Shoes::Manual::COLON, link(head) { open_methods(subhead, terms.text, head) })
280
- end
281
- end
282
- end
283
- end
284
- end
285
- end
286
- @results = stack
287
- end
288
- app.slot.scroll_top = 0
289
- end
290
-
291
- def open_link(head)
292
- if head == "Search"
293
- show_search
294
- elsif @sections.has_key? head
295
- open_section(head)
296
- elsif @methods.has_key? head
297
- open_methods(head)
298
- elsif @mindex.has_key? head
299
- head, sub = @mindex[head]
300
- open_methods(head, nil, sub)
301
- elsif head =~ /^http:\/\//
302
- debug head
303
- visit head
304
- end
305
- end
306
-
307
- def add_next_link(docn, optn)
308
- opt1, optn = @docs[docn][1], optn + 1
309
- if opt1['sections'][optn]
310
- @doc.para "Next: ",
311
- link(opt1['sections'][optn][1]['title']) { open_methods(opt1['sections'][optn][0]) },
312
- :align => "right"
313
- elsif @docs[docn + 1]
314
- @doc.para "Next: ",
315
- link(@docs[docn + 1][0]) { open_section(@docs[docn + 1][0].gsub(/\W/, '')) },
316
- :align => "right"
317
- end
318
- end
319
-
320
- def open_section(sect_s, terms = nil)
321
- sect_h = @sections[sect_s]
322
- sect_cls = sect_h['class']
323
- @toc.each { |k,v| v.send(k == sect_cls ? :show : :hide) }
324
- @title.replace sect_s
325
- @doc.clear(&dewikify_hi(sect_h['description'], terms, true))
326
- add_next_link(@docs.index { |x,| x == sect_s }, -1) rescue nil
327
- app.slot.scroll_top = 0
328
- end
329
-
330
- def open_methods(meth_s, terms = nil, meth_a = nil)
331
- meth_h = @methods[meth_s]
332
- @title.replace meth_h['title']
333
- @doc.clear do
334
- unless meth_a
335
- instance_eval &dewikify_hi(meth_h['description'], terms, true)
336
- end
337
- meth_h['methods'].each do |mname, expl|
338
- if meth_a.nil? or meth_a == mname
339
- sig, val = mname.split("»", 2)
340
- stack(:margin_top => 8, :margin_bottom => 8) {
341
- background "#333".."#666", :curve => 3, :angle => 90
342
- tagline sig, (span("»", val, :stroke => "#BBB") if val), :margin => 4 }
343
- instance_eval &dewikify_hi(expl, terms)
344
- end
345
- end
346
- end
347
- optn = nil
348
- docn = @docs.index { |_,h| optn = h['sections'].index { |x,| x == meth_s } } rescue nil
349
- add_next_link(docn, optn) if docn
350
- app.slot.scroll_top = 0
351
- end
352
-
353
- def manual_search(terms)
354
- terms += " " if terms.length == 1
355
- @search.find_all(terms).map do |title, count|
356
- title.split(" ", 2)
357
- end
358
- end
359
-
360
- def make_html(path, title, menu, &blk)
361
- require 'hpricot'
362
- File.open(path, 'w') do |f|
363
- f << Hpricot do
364
- xhtml_transitional do
365
- head do
366
- meta :"http-equiv" => "Content-Type", "content" => "text/html; charset=utf-8"
367
- title "The Shoes Manual // #{title}"
368
- script :type => "text/javascript", :src => "static/code_highlighter.js"
369
- script :type => "text/javascript", :src => "static/code_highlighter_ruby.js"
370
- style :type => "text/css" do
371
- text "@import 'static/manual.css';"
372
- end
373
- end
374
- body do
375
- div.main! do
376
- div.manual! &blk
377
- div.sidebar do
378
- img :src => "static/shoes-icon.png"
379
- ul do
380
- li { a.prime "HELP", :href => "./" }
381
- menu.each do |m, sm|
382
- li do
383
- a m, :href => "#{m[/^\w+/]}.html"
384
- if sm
385
- ul.sub do
386
- sm.each { |smm| li { a smm, :href => "#{smm}.html" } }
387
- end
388
- end
389
- end
390
- end
391
-
392
- end
393
- end
394
- end
395
- end
396
- end
397
- end.to_html
398
- end
399
- end
400
- end
401
-
402
- def Shoes.make_help_page
403
- #font "#{Shoes::DIR}/fonts/Coolvetica.ttf" unless Shoes::FONTS.include? "Coolvetica"
404
- proc do
405
- extend Shoes::Manual
406
- docs = load_docs Shoes::Manual.path
407
-
408
- style(Shoes::Image, :margin => 8, :margin_left => 100)
409
- style(Shoes::Code, :stroke => "#C30")
410
- style(Shoes::LinkHover, :stroke => green, :fill => nil)
411
- style(Shoes::Para, :size => 12, :stroke => "#332")
412
- style(Shoes::Tagline, :size => 12, :weight => "bold", :stroke => "#eee", :margin => 6)
413
- style(Shoes::Caption, :size => 24)
414
- background "#ddd".."#fff", :angle => 90
415
-
416
- [Shoes::LinkHover, Shoes::Para, Shoes::Tagline, Shoes::Caption].each do |type|
417
- style(type, :font => "MS UI Gothic")
418
- end if Shoes.language == 'ja'
419
-
420
- stack do
421
- background black
422
- stack :margin_left => 118 do
423
- para "The Shoes Manual", :stroke => "#eee", :margin_top => 8, :margin_left => 17,
424
- :margin_bottom => 0
425
- @title = title docs[0][0], :stroke => white, :margin => 4, :margin_left => 14,
426
- :margin_top => 0, :font => "Coolvetica"
427
- end
428
- background "rgb(66, 66, 66, 180)".."rgb(0, 0, 0, 0)", :height => 0.7
429
- background "rgb(66, 66, 66, 100)".."rgb(255, 255, 255, 0)", :height => 20, :bottom => 0
430
- end
431
- @doc =
432
- stack :margin_left => 130, :margin_top => 20, :margin_bottom => 50, :margin_right => 50 + gutter,
433
- &dewikify(docs[0][-1]['description'], true)
434
- add_next_link(0, -1)
435
- stack :top => 80, :left => 0, :attach => Shoes::Window do
436
- @toc = {}
437
- stack :margin => 12, :width => 130, :margin_top => 20 do
438
- docs.each do |sect_s, sect_h|
439
- sect_cls = sect_h['class']
440
- para strong(link(sect_s, :stroke => black) { open_section(sect_s) }),
441
- :size => 11, :margin => 4, :margin_top => 0
442
- @toc[sect_cls] =
443
- stack :hidden => @toc.empty? ? false : true do
444
- links = sect_h['sections'].map do |meth_s, meth_h|
445
- [link(meth_s) { open_methods(meth_s) }, "\n"]
446
- end.flatten
447
- links[-1] = {:size => 9, :margin => 4, :margin_left => 10}
448
- para *links
449
- end
450
- end
451
- end
452
- stack :margin => 12, :width => 118, :margin_top => 6 do
453
- background "#330", :curve => 4
454
- para "Not finding it? Try ", strong(link("Search", :stroke => white) { show_search }), "!", :stroke => "#ddd", :size => 9, :align => "center", :margin => 6
455
- end
456
- stack :margin => 12, :width => 118 do
457
- inscription "Shoes #{Shoes::RELEASE_NAME}\nRevision: #{Shoes::REVISION}",
458
- :size => 7, :align => "center", :stroke => "#999"
459
- end
460
- end
461
- image :width => 120, :height => 120, :top => -18, :left => 6 do
462
- image "#{Shoes::DIR}/static/shoes-icon.png", :width => 100, :height => 100, :top => 10, :left => 10
463
- glow 2
464
- end
465
- end
466
- rescue => e
467
- p e.message
468
- p e.class
469
- end
470
-
471
-
472
- Shoes::Help = Shoes.make_help_page
473
- p Shoes::Help
474
- # added to start the app, was Shoes.manual_as :shoes
475
- Shoes.app(:width => 720, :height => 640, &Shoes::Help)