Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial preparations of IronRuby site for first push

  • Loading branch information...
commit c1671389fc79c0b89789c0d08138c3412a800b45 1 parent 32ee4b0
@jschementi authored
Showing with 6,621 additions and 397 deletions.
  1. +9 −1 css/lang.css
  2. +22 −14 css/master.css
  3. +3 −3 generate.py
  4. BIN  images/ironruby-vstools-450.png
  5. BIN  images/tryrubyinbrowser-290x100.png
  6. +0 −1  iron-websites.csproj
  7. +13 −0 iron-websites.sln
  8. +1 −1  python/browser/examples.rst
  9. +6 −6 python/browser/index.rst
  10. +13 −13 python/download/index.rst
  11. +10 −10 python/support/index.rst
  12. +9 −0 ruby/browser/documentation/index.html
  13. +1 −0  ruby/browser/examples.rst
  14. BIN  ruby/browser/examples/calculator-testing.zip
  15. BIN  ruby/browser/examples/dlrconsole.zip
  16. BIN  ruby/browser/examples/dlrconsole/app.xap
  17. +40 −0 ruby/browser/examples/dlrconsole/index.html
  18. +55 −0 ruby/browser/examples/helloworld/index.html
  19. +9 −0 ruby/browser/examples/index.html
  20. BIN  ruby/browser/examples/mandelbrot.zip
  21. BIN  ruby/browser/examples/mandelbrot/bin.zip
  22. +19 −0 ruby/browser/examples/mandelbrot/build.bat
  23. +34 −0 ruby/browser/examples/mandelbrot/index.html
  24. +181 −0 ruby/browser/examples/mandelbrot/mandelbrot.py
  25. +58 −0 ruby/browser/examples/mandelbrot/mandelbrot.xaml
  26. +229 −0 ruby/browser/examples/mandelbrot/mandelbrotbase.cs
  27. BIN  ruby/browser/examples/mushroom.zip
  28. +48 −0 ruby/browser/examples/mushroom/index.html
  29. +156 −0 ruby/browser/examples/mushroom/mushroom.xaml
  30. +22 −0 ruby/browser/examples/mushroom/style.css
  31. BIN  ruby/browser/examples/photoviewer.zip
  32. +60 −0 ruby/browser/examples/photoviewer/app.rb
  33. BIN  ruby/browser/examples/photoviewer/assets/loading.gif
  34. +76 −0 ruby/browser/examples/photoviewer/assets/screen.css
  35. +16 −0 ruby/browser/examples/photoviewer/images.erb
  36. +50 −0 ruby/browser/examples/photoviewer/index.html
  37. BIN  ruby/browser/examples/photoviewer/lib.zip
  38. BIN  ruby/browser/examples/photoviewer/lib/System.Json.dll
  39. +799 −0 ruby/browser/examples/photoviewer/lib/erb.rb
  40. +25 −0 ruby/browser/examples/photoviewer/lib/system-json.rb
  41. +79 −0 ruby/browser/examples/photoviewer/lightbox/css/lightbox.css
  42. BIN  ruby/browser/examples/photoviewer/lightbox/images/blank.gif
  43. BIN  ruby/browser/examples/photoviewer/lightbox/images/close.gif
  44. BIN  ruby/browser/examples/photoviewer/lightbox/images/closelabel.gif
  45. BIN  ruby/browser/examples/photoviewer/lightbox/images/loading.gif
  46. BIN  ruby/browser/examples/photoviewer/lightbox/images/next.gif
  47. BIN  ruby/browser/examples/photoviewer/lightbox/images/nextlabel.gif
  48. BIN  ruby/browser/examples/photoviewer/lightbox/images/prev.gif
  49. BIN  ruby/browser/examples/photoviewer/lightbox/images/prevlabel.gif
  50. +903 −0 ruby/browser/examples/photoviewer/lightbox/js/effects.js
  51. +817 −0 ruby/browser/examples/photoviewer/lightbox/js/lightbox.js
  52. +1,785 −0 ruby/browser/examples/photoviewer/lightbox/js/prototype.js
  53. +45 −0 ruby/browser/examples/photoviewer/lightbox/js/scriptaculous.js
  54. +5 −0 ruby/browser/examples/photoviewer/pages.erb
  55. +71 −0 ruby/browser/examples/photoviewer/view.rb
  56. +32 −0 ruby/browser/examples/repl.rb
  57. BIN  ruby/browser/examples/webcam.zip
  58. +77 −0 ruby/browser/examples/webcam/app.xaml
  59. +36 −0 ruby/browser/examples/webcam/index.html
  60. +81 −0 ruby/browser/examples/webcam/webcam-mic.xaml
  61. +72 −0 ruby/browser/examples/webcam/webcam_mic.py
  62. BIN  ruby/browser/gestalt-20091120.zip
  63. BIN  ruby/browser/gestalt-20100305.zip
  64. +21 −0 ruby/browser/getting-started/01_ruby.html
  65. +20 −0 ruby/browser/getting-started/02_python.html
  66. +43 −0 ruby/browser/getting-started/03_xaml.html
  67. +93 −0 ruby/browser/getting-started/04_animation.html
  68. +189 −0 ruby/browser/getting-started/05_final.html
  69. +9 −0 ruby/browser/gettingstarted/index.html
  70. +7 −7 ruby/browser/index.rst
  71. BIN  ruby/browser/sl-back-to-just-text.pdf
  72. +117 −60 ruby/browser/spec.v2.rst
  73. +14 −0 ruby/clientaccesspolicy.xml
  74. +9 −66 ruby/documentation/index.rst
  75. +50 −30 ruby/download/index.rst
  76. +8 −10 ruby/index.rst
  77. +0 −130 ruby/old.html
  78. +13 −26 ruby/support/index.rst
  79. +32 −0 ruby/tools/download/index.html
  80. +7 −4 ruby/tools/index.rst
  81. +1 −2  ruby/tools/nav.py
  82. +15 −5 ruby/try/index.html
  83. +1 −1  ruby/tutorial/index.html
  84. +5 −7 templates/home.html
View
10 css/lang.css
@@ -187,13 +187,21 @@
border: 2px solid #555;
}
+#ironpython.home.page #get #tutorial p {
+ top: 0;
+}
+
+#ironpython.home.page #get #tutorial {
+ background: none;
+ top: 0;
+}
#ironpython.home.page #get #tutorial #code-snippet code {
background: none;
height: 279px;
padding: 0;
- top: -173px;
+ top: -190px;
width: 256px;
z-index: 10;
}
View
36 css/master.css
@@ -234,6 +234,7 @@ a.download_link:hover {
.home.page #get ul {
width: 780px;
margin: 0 auto;
+ height: 200px;
}
.page #get ul li {
list-style: none;
@@ -319,26 +320,28 @@ a.download_link:hover {
/* get tutorial */
.home.page #get #tutorial {
+ background-image: url("../images/code-snippet-bg.png");
float: left;
- width: 220px;
+ height: 270px;
list-style: none;
margin-left: 10px;
+ position: relative;
+ top: -190px;
+ width: 220px;
}
.home.page #get #tutorial #code-snippet code {
- width: 200px;
- height: 250px;
- background-image: url(../images/code-snippet-bg.png);
- background-color: #484848;
- background-position: 0 0;
+ background-image : url("../images/code-snippet-bg.png");
+ background-position: right center;
background-repeat: no-repeat;
- padding: 10px;
- position: absolute;
- top: -190px;
- font-family: consolas, "courier new", monospace;
+ font-family: consolas,"courier new",monospace;
font-size: 13px;
- overflow: hidden;
+ height: 250px;
+ letter-spacing: 0;
line-height: 110%;
- letter-spacing: 0px;
+ overflow: hidden;
+ padding: 10px;
+ position: absolute;
+ width: 250px;
}
.home.page #get #tutorial #code-snippet code .constant {
color: #ff0;
@@ -353,11 +356,16 @@ a.download_link:hover {
color: #0af;
}
.home.page #get #tutorial #code-snippet code .comment {
- color: #f0f;
+ color: #999;
}
.home.page #get #tutorial p {
- margin: 105px 5px 5px;
+ font-size: 16px;
+ margin: 105px 0 5px;
+ position: relative;
+ text-align: right;
+ top: 190px;
+ width: 260px;
}
.home.page #get #tutorial a#tutorial-image,
View
6 generate.py
@@ -47,10 +47,10 @@
'language': 'Ruby',
'language_website': 'http://ruby-lang.org',
'stable_version': '1.0',
- 'stable_release_url': 'http://ironruby.codeplex.com/',
+ 'stable_release_url': 'http://ironruby.codeplex.com/releases/view/25901',
'stable_release_date': '1.0 released on 2010-04-12',
- 'stable_release_notes': 'http://rubyforge.org/projects/ironruby',
- 'stable_release_source': 'http://github.com/ironruby/ironruby/tags/v1.0/zipball',
+ 'stable_release_notes': 'http://rubyforge.org/frs/shownotes.php?group_id=4359&release_id=43292',
+ 'stable_release_source': 'http://github.com/IronLanguages/main/zipball/v1.0-rtm',
'code_snippet_html': """<span class="comment"># namespaces are modules</span>
<span class="keyword">include</span> <span class="constant">System</span>::<span class="constant">Collections</span>::<span class="constant">Generic</span>
View
BIN  images/ironruby-vstools-450.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  images/tryrubyinbrowser-290x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  iron-websites.csproj
@@ -94,7 +94,6 @@
<Content Include="python\try\index.html" />
<Content Include="python\tutorial\index.html" />
<Content Include="ruby\browser\new-index.html" />
- <Content Include="ruby\old.html" />
<Content Include="ruby\support\articles.html" />
<Content Include="ruby\try\index.html" />
<Content Include="ruby\tutorial\index.html" />
View
13 iron-websites.sln
@@ -3,6 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iron-websites", "iron-websites.csproj", "{8125A0FD-84E7-42C9-9629-EBC3824B1407}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{86A95B0D-207C-44FB-94D2-62F7F075B7CF}"
+ ProjectSection(SolutionItems) = preProject
+ .gitignore = .gitignore
+ clean.bat = clean.bat
+ clean.py = clean.py
+ deploy.rb = deploy.rb
+ generate.bat = generate.bat
+ generate.py = generate.py
+ NEWRELEASE.rst = NEWRELEASE.rst
+ README.rst = README.rst
+ TODO.txt = TODO.txt
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
View
2  python/browser/examples.rst
@@ -1,7 +1,7 @@
--------
Examples
--------
-
+- `Silverlight.net/dlr examples <http://www.silverlight.net/dlr#example_applications>`_
- `PyCon 2010 demos <http://github.com/jschementi/pycon2010/>`_
- `Gestalt Samples <http://www.visitmix.com/labs/gestalt/samples/>`_
- `Gestalt Widget Pack <http://www.visitmix.com/labs/gestalt/widgets/>`_
View
12 python/browser/index.rst
@@ -1,15 +1,15 @@
====================================
Write browser applications in Python
====================================
-IronPython allows you to use python code in browser applications to script the
-HTML page and vector-graphics; combining the benefits of Python and
+Iron{{language}} allows you to use {{language}} code in browser applications to script the
+HTML page and vector-graphics; combining the benefits of {{language}} and
rich-internet applications, without changing the way web-developers work.
-At a very basic level, this lets you write Python code directly in HTML
+At a very basic level, this lets you write {{language}} code directly in HTML
pages::
- <script type="text/python">
- window.Alert("Hello from Python")
+ <script type="text/{{language_lower}}">
+ window.Alert("Hello from {{language}}")
</script>
.. container::
@@ -17,4 +17,4 @@ pages::
- `Getting started <gettingstarted.html>`_
- `Examples <examples.html>`_
- - `Spread the word <http://twitter.com/home/?status=RT+Python+and+XAML+in+web+pages+http://ironpython.net/browser+%23ironpython+%23silverlight+%23microsoft>`_
+ - `Spread the word <http://twitter.com/home/?status=RT+{{language}}+and+XAML+in+web+pages+http://iron{{language_lower}}.net/browser+%23iron{{language_lower}}+%23silverlight+%23microsoft>`_
View
26 python/download/index.rst
@@ -10,7 +10,7 @@ IronPython maintains compatible versions with `Python 2.5`_ and `Python 2.6`_;
`IronPython 2.0.3`_ and `IronPython 2.6.1`_, respectively. If you're not sure
which version to use, use `IronPython 2.6.1`_.
-`All major IronPython releases`_
+`All major Iron{{language}} releases`_
--------------
@@ -37,7 +37,7 @@ IronPython is an `open source project`_ freely available under the `Apache Licen
`Download latest (zip)`_ | `Browse Online`_ | `Recent Check-ins`_
-`Instructions for accessing with SVN or TFS`_
+`Instructions for accessing with GIT`_
.. container:: divider
@@ -46,7 +46,7 @@ IronPython is an `open source project`_ freely available under the `Apache Licen
-------------
Prerequisites
-------------
-IronPython is a cross-platform and cross-browser programming language,
+Iron{{language}} is a cross-platform and cross-browser programming language,
so prerequisites will vary based on usage.
Here are the recommended runtimes are for each platform:
@@ -65,7 +65,7 @@ Windows desktop & server apps
.. note::
- | IronPython also runs on .NET: `3.5 SP1`_, but must be compiled from
+ | Iron{{language}} also runs on .NET: `3.5 SP1`_, but must be compiled from
| source.
Windows & Mac OS browser apps
@@ -79,12 +79,12 @@ Windows & Mac OS browser apps
`Latest Silverlight version (4.0)`_
- Silverlight enables you to use Python to script HTML pages just as
+ Silverlight enables you to use {{language}} to script HTML pages just as
you would with JavaScript, and also enables advanced vector graphics
for rich user-interfaces and video.
|
- | `Learn more about Python in the browser`_
+ | `Learn more about {{language}} in the browser`_
Mac OS & Linux desktop & server apps
@@ -127,15 +127,15 @@ Linux browser apps
.. _IronPython 2.6.1: http://ironpython.codeplex.com/releases/view/36280
.. _IronPython 2.7 Alpha 1: http://ironpython.codeplex.com/releases/view/42434
.. _Download IronPython 2.7 Alpha 1: http://ironpython.codeplex.com/releases/view/42434
-.. _All major IronPython releases: http://ironpython.codeplex.com/wikipage?title=SupportedReleaseList
-.. _open source project: http://ironpython.codeplex.com
+.. _All major Iron{{language}} releases: http://iron{{language_lower}}.codeplex.com/wikipage?title=SupportedReleaseList
+.. _open source project: http://iron{{language_lower}}.codeplex.com
.. _Apache License (Version 2): http://ironpython.codeplex.com/license
.. _Download IronPython 2.6.1 Source Code: http://ironpython.codeplex.com/releases/view/36280#DownloadId=116511
.. _Download IronPython 2.7 Alpha 1 Source Code: http://ironpython.codeplex.com/releases/view/42434#DownloadId=133181
-.. _Download latest (zip): http://ironpython.codeplex.com/SourceControl/ListDownloadableCommits.aspx#DownloadLatest
-.. _Browse Online: http://ironpython.codeplex.com/SourceControl/BrowseLatest
-.. _Recent Check-ins: http://ironpython.codeplex.com/SourceControl/ListDownloadableCommits.aspx
-.. _Instructions for accessing with SVN or TFS: http://ironpython.codeplex.com/SourceControl/ListDownloadableCommits.aspx
+.. _Download latest (zip): http://github.com/iron-languages/main
+.. _Browse Online: http://github.com/iron-languages/main
+.. _Recent Check-ins: http://github.com/iron-languages/main
+.. _Instructions for accessing with GIT: http://github.com/iron-languages/main
.. _Latest .NET version (4.0): http://bit.ly/iron-dotnet40
.. _4.0: http://bit.ly/iron-dotnet40
.. _3.5 SP1: http://bit.ly/iron-dotnet35sp1
@@ -143,7 +143,7 @@ Linux browser apps
.. _3.0: http://bit.ly/iron-dotnet3
.. _2.0 SP1: http://bit.ly/iron-dotnet20sp1
.. _Latest Silverlight version (4.0): http://go.microsoft.com/fwlink/?linkid=150228
-.. _Learn more about Python in the browser: ../browser/
+.. _Learn more about {{language}} in the browser: ../browser/
.. _Mono: http://www.mono-project.com
.. _Latest Mono version (2.6.4): http://www.go-mono.com/mono-downloads/download.html
.. _Moonlight: http://www.mono-project.com/Moonlight
View
20 python/support/index.rst
@@ -5,21 +5,21 @@ Get help from the community
------------
Report a bug
------------
-If you encounter a bug in IronPython, or would like to ask for a feature,
-please `submit an issue <http://ironpython.codeplex.com/WorkItem/Create.aspx>`_ on the
-`IronPython CodePlex project <http://ironpython.codeplex.com>`_. Take a
-look through the `existing issues <http://ironpython.codeplex.com/WorkItem/List.aspx>`_
+If you encounter a bug in Iron{{language}}, or would like to ask for a feature,
+please `submit an issue <http://iron{{language_lower}}.codeplex.com/WorkItem/Create.aspx>`_ on the
+`Iron{{language}} CodePlex project <http://iron{{language_lower}}.codeplex.com>`_. Take a
+look through the `existing issues <http://iron{{language_lower}}.codeplex.com/WorkItem/List.aspx>`_
to see if others are having the same problems you are. When creating an issue,
keep in mind a
-`bug report should include as much information as possible <http://ironpython.codeplex.com/wikipage?title=IronPython%20Bug%20Template>`_.
+`bug report should include as much information as possible <http://iron{{language_lower}}.codeplex.com/wikipage?title=Iron{{language}}%20Bug%20Template>`_.
--------------------
Ask the mailing list
--------------------
If all else fails and you just want to talk to someone, or interested
-in tracking IronPython more closely, please
+in tracking Iron{{language}} more closely, please
`subscribe <http://lists.ironpython.com/listinfo.cgi/users-ironpython.com>`_
-to the IronPython users mailing list.
+to the Iron{{language}} users mailing list.
Please search the `archives <http://lists.ironpython.com/pipermail/users-ironpython.com>`_
to see if someone has had the same questions as you.
@@ -28,16 +28,16 @@ to see if someone has had the same questions as you.
FAQ
---
See the `FAQ <http://ironpython.codeplex.com/wikipage?title=FAQ>`_
-for common questions about IronPython, like *When will Python support be added into Visual Studio*,
+for common questions about Iron{{language}}, like *When will {{language}} support be added into Visual Studio*,
and various .NET interop and compatibility questions.
------------
Project Info
------------
-`2.6 Release Plan <http://ironpython.codeplex.com/wikipage?title=2.6%20Release%20Plan">`_
+`2.7 Release Plan <http://ironpython.codeplex.com/wikipage?title=2.6%20Release%20Plan">`_
------------------
Articles and Blogs
------------------
-`All notable articles and blog-posts about IronPython <articles.html>`_
+`All notable articles and blog-posts about Iron{{language}} <articles.html>`_
View
9 ruby/browser/documentation/index.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Loading ...</title>
+<meta http-equiv="REFRESH" content="0;url=../docs.html"></HEAD>
+<BODY>
+Loading ...
+</BODY>
+</HTML>
View
1  ruby/browser/examples.rst
@@ -2,6 +2,7 @@
Examples
--------
+- `Silverlight.net/dlr examples <http://www.silverlight.net/dlr#example_applications>`_
- `Gestalt Samples <http://www.visitmix.com/labs/gestalt/samples/>`_
- `Gestalt Widget Pack <http://www.visitmix.com/labs/gestalt/widgets/>`_
View
BIN  ruby/browser/examples/calculator-testing.zip
Binary file not shown
View
BIN  ruby/browser/examples/dlrconsole.zip
Binary file not shown
View
BIN  ruby/browser/examples/dlrconsole/app.xap
Binary file not shown
View
40 ruby/browser/examples/dlrconsole/index.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>Interactive DLR Console</title>
+
+ <style type="text/css">
+ #silverlightControlHost {
+ position:absolute;
+ bottom:0;
+ left:0;
+ right:0;
+ top:0;
+ }
+ </style>
+</head>
+
+<body>
+ <div id="silverlightControlHost" onload="this.focus()">
+ <object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
+ <param name="source" value="app.xap" />
+ <param name="initParams" value="reportErrors=errorLocation" />
+ <param name="windowless" value="true" />
+ <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
+ <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
+ </a>
+ </object>
+ <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
+ </div>
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-16148811-1");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+
+</body>
+</html>
View
55 ruby/browser/examples/helloworld/index.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Hello, World</title>
+ <script type="text/javascript"
+ src="http://gestalt.ironpython.net/dlr-latest.js"></script>
+ </head>
+ <body>
+
+ <!-- code which will run when you click the "run-me" button -->
+ <pre><code class="code_block">
+&lt;script src=&quot;http://gestalt.ironruby.net/dlr-latest.js&quot;
+ type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;text/ruby&quot;&gt;
+ window.alert &quot;Ruby in the browser!&quot;
+&lt;/script&gt;
+&lt;script type=&quot;text/python&quot;&gt;
+ window.Alert(&quot;Python works too!&quot;)
+&lt;/script&gt;</code></pre>
+ <input type="button" value="Run me!" id="run_me" />
+
+ <!-- non-escaped version of the code above, but it doesn't run -->
+ <script type="text/ruby" defer="defer" id="rubySnippet">
+ window.alert "Ruby in the browser!"
+ </script>
+ <script type="text/python" defer="defer" id="pythonSnippet">
+ window.Alert("Python works too!")
+ </script>
+
+ <!-- invokes the code above when the button is clicked -->
+ <script type="text/ruby">
+ document.run_me.onclick do |s, e|
+ eval document.rubySnippet.innerHTML.to_s
+ end
+ </script>
+ <script type="text/python">
+ def run_code(s, e):
+ eval(document.pythonSnippet.innerHTML.strip())
+ document.run_me.events.onclick += run_code
+ </script>
+
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-16148811-1");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+
+ </body>
+</html>
+
View
9 ruby/browser/examples/index.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Loading ...</title>
+<meta http-equiv="REFRESH" content="0;url=../examples.html"></HEAD>
+<BODY>
+Loading ...
+</BODY>
+</HTML>
View
BIN  ruby/browser/examples/mandelbrot.zip
Binary file not shown
View
BIN  ruby/browser/examples/mandelbrot/bin.zip
Binary file not shown
View
19 ruby/browser/examples/mandelbrot/build.bat
@@ -0,0 +1,19 @@
+@echo off
+
+set csc=C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe
+set slpath=%merlin_root%\Utilities\Silverlight\x86ret
+
+if exist %~dp0bin.zip del %~dp0bin.zip
+
+if not exist %~dp0__bin (
+ mkdir %~dp0__bin
+) else (
+ rmdir /Q /S %~dp0__bin
+)
+%csc% /noconfig /nologo /nostdlib+ /target:library /out:%~dp0__bin\mandelbrotbase.dll /reference:%slpath%\mscorlib.dll,%slpath%\System.dll,%slpath%\System.Windows.dll,%slpath%\System.Core.dll %~dp0mandelbrotbase.cs
+%~dp0bin3\chiron.exe /s /d:__bin /x:bin.zip
+if exist %~dp0__bin (
+ rmdir /Q /S %~dp0__bin
+)
+
+echo mandelbrotbase.cs compiled and put in bin.zip
View
34 ruby/browser/examples/mandelbrot/index.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <style type="text/css">
+ html, body { height: 100%; overflow: auto; }
+ body { padding: 0; margin: 0; }
+ #silverlightControlHost { height: 100%; text-align: center; }
+ </style>
+ <script type="text/javascript">
+ window.DLR = { settings: {
+ windowless: 'true', EnableGPUAcceleration: 'true', background: "black"
+ }}
+ </script>
+ <script src="http://gestalt.ironpython.net/dlr-latest.js" type="text/javascript"></script>
+ <title>mandelbrot</title>
+</head>
+<body>
+ <script type="application/x-zip-compressed" src="bin.zip"></script>
+ <script type="application/xml+xaml" id="xaml" width="100%" height="100%" defer='true' src="mandelbrot.xaml"></script>
+ <script type="text/python" class="xaml" src="mandelbrot.py"></script>
+
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-16148811-1");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+
+</body>
+</html>
View
181 ruby/browser/examples/mandelbrot/mandelbrot.py
@@ -0,0 +1,181 @@
+import sys
+sys.path.append("bin")
+
+# Uses C# for the actual mandelbrot calculation, because it's
+# very very number crunchy. However, that doesn't mean IronPython is
+# slow, in-fact, on mandelbrot IronPython it one of the fastest
+# scripting languages:
+# http://mastrodonato.info/index.php/2009/08/comparison-script-languages-for-the-fractal-geometry/
+import clr
+clr.AddReferenceToFile("bin/mandelbrotbase.dll")
+import mandelbrotbase
+
+from System import Random, DateTime, Math
+from System.Windows import Visibility
+from System.Windows.Controls import UserControl, Canvas
+from Microsoft.Scripting.Silverlight import DynamicApplication
+
+class Mandelbrot(UserControl):
+
+ DefaultXS = -2.1
+ DefaultYS = -1.3
+ DefaultXE = 1.0
+ DefaultYE = 1.3
+
+ def __init__(self):
+ print '__init__'
+ self.LoadComponent()
+
+ self.StartPoint = None
+ self.Randomizer = Random(DateTime.Now.Millisecond)
+ self.Generator = mandelbrotbase.MandelbrotGenerator(self, int(self.Content.FractalArea.Width), int(self.Content.FractalArea.Height))
+ self.Generator.Completed += self.Generator_Completed
+
+ # commands
+ self.Content.ResetButton.Click += lambda sender, e: self.Reset()
+ self.Content.ZoomInButton.Click += lambda sender, e: self.ZoomIn()
+ self.Content.ZoomOutButton.Click += lambda sender, e: self.ZoomOut()
+ self.Content.PanLeftButton.Click += lambda sender, e: self.Pan(-50, 0)
+ self.Content.PanRightButton.Click += lambda sender, e: self.Pan(50, 0)
+ self.Content.PanUpButton.Click += lambda sender, e: self.Pan(0, -50)
+ self.Content.PanDownButton.Click += lambda sender, e: self.Pan(0, 50)
+ self.Content.RandomButton.Click += lambda sender, e: self.Randomize()
+
+ self.Content.FractalArea.MouseLeftButtonDown += self.area_MouseLeftButtonDown
+ self.Content.FractalArea.MouseLeftButtonUp += self.area_MouseLeftButtonUp
+ self.Content.FractalArea.MouseMove += self.area_MouseMove
+
+ def LoadComponent(self):
+ print 'LoadComponent'
+ xaml = DynamicApplication.LoadComponentFromString(open("mandelbrot.xaml").read())
+ xaml.Loaded += self.UserControl_Loaded
+ self.Content = xaml
+
+ def Generator_Completed(self, sender, e):
+ self.Content.image.ImageSource = e.Image
+ self.SetEnabled(True)
+
+ def UserControl_Loaded(self, sender, e):
+ print 'UserControl_Loaded'
+ self.Reset()
+
+ def ZoomIn(self):
+ self.Redraw(50, 50, self.Content.FractalArea.Width - 50, self.Content.FractalArea.Height - 50)
+
+ def ZoomOut(self):
+ self.Redraw(-50, -50, self.Content.FractalArea.Width + 50, self.Content.FractalArea.Height + 50)
+
+ def Pan(self, panX, panY):
+ self.Redraw(0 + panX, 0 + panY, self.Content.FractalArea.Width + panX, self.Content.FractalArea.Height + panY)
+
+ def Randomize(self):
+ self.CurrentXS = Mandelbrot.DefaultXS
+ self.CurrentYS = Mandelbrot.DefaultYS
+ self.CurrentXE = Mandelbrot.DefaultXE
+ self.CurrentYE = Mandelbrot.DefaultYE
+
+ xs = self.Randomizer.Next(0, int(self.Content.FractalArea.Width))
+ ys = self.Randomizer.Next(0, int(self.Content.FractalArea.Height))
+ w = self.Randomizer.Next(3, 100)
+ h = int(w / (self.Content.FractalArea.Width / self.Content.FractalArea.Height))
+
+ self.Redraw(xs, ys, xs + w, ys + h)
+
+ def Reset(self):
+ print 'Reset'
+ self.CurrentXS = Mandelbrot.DefaultXS
+ self.CurrentYS = Mandelbrot.DefaultYS
+ self.CurrentXE = Mandelbrot.DefaultXE
+ self.CurrentYE = Mandelbrot.DefaultYE
+ self.Redraw(0, 0, self.Content.FractalArea.Width, self.Content.FractalArea.Height)
+
+ def area_MouseLeftButtonDown(self, sender, e):
+ self.StartPoint = e.GetPosition(self.Content.FractalArea)
+ self.Content.selection.Visibility = Visibility.Visible
+ self.Content.selection.Width = 0
+ self.Content.selection.Height = 0
+ Canvas.SetLeft(self.Content.selection, self.StartPoint.X)
+ Canvas.SetTop(self.Content.selection, self.StartPoint.Y)
+ self.Content.FractalArea.CaptureMouse()
+
+ def area_MouseLeftButtonUp(self, sender, e):
+ if self.StartPoint is not None:
+ currentPoint = e.GetPosition(self.Content.FractalArea)
+ if currentPoint != self.StartPoint:
+ if currentPoint.X > self.StartPoint.X:
+ xs = self.StartPoint.X
+ else:
+ xs = currentPoint.X
+ if currentPoint.Y > self.StartPoint.Y:
+ ys = self.StartPoint.Y
+ else:
+ ys = currentPoint.Y
+ xe = xs + self.Content.selection.Width
+ ye = ys + self.Content.selection.Height
+
+ self.Redraw(xs, ys, xe, ye)
+
+ self.StartPoint = None
+ self.Content.selection.Visibility = Visibility.Collapsed
+ self.Content.FractalArea.ReleaseMouseCapture()
+
+ def area_MouseMove(self, sender, e):
+ if self.StartPoint is not None:
+ currentPoint = e.GetPosition(self.Content.FractalArea)
+
+ if currentPoint.X < 0: currentPoint.X = 0
+ if currentPoint.Y < 0: currentPoint.Y = 0
+ if currentPoint.X > self.Content.FractalArea.Width: currentPoint.X = self.Content.FractalArea.Width
+ if currentPoint.Y > self.Content.FractalArea.Height: currentPoint.Y = self.Content.FractalArea.Height
+
+ self.Content.selection.Width = Math.Abs(currentPoint.X - self.StartPoint.X)
+ self.Content.selection.Height = self.Content.selection.Width / (self.Content.FractalArea.Width / self.Content.FractalArea.Height)
+
+ if currentPoint.X > self.StartPoint.X:
+ canvasLeft = self.StartPoint.X
+ else:
+ canvasLeft = currentPoint.X
+
+ if currentPoint.Y > self.StartPoint.Y:
+ canvasTop = self.StartPoint.Y
+ else:
+ canvasTop = currentPoint.Y
+
+ Canvas.SetLeft(self.Content.selection, canvasLeft)
+ Canvas.SetTop(self.Content.selection, canvasTop)
+
+ def Redraw(self, xs, ys, xe, ye):
+ print 'Redraw'
+ self.SetEnabled(False)
+
+ w = self.CurrentXE - self.CurrentXS
+ h = self.CurrentYE - self.CurrentYS
+
+ xsp = (xs * 100 / self.Content.FractalArea.Width)
+ cxs = (w / 100 * xsp) + self.CurrentXS
+ xep = (xe * 100 / self.Content.FractalArea.Width)
+ cxe = (w / 100 * xep) + self.CurrentXS
+ ysp = (ys * 100 / self.Content.FractalArea.Height)
+ cys = (h / 100 * ysp) + self.CurrentYS
+ yep = (ye * 100 / self.Content.FractalArea.Height)
+ cye = (h / 100 * yep) + self.CurrentYS
+
+ self.CurrentXS = cxs
+ self.CurrentXE = cxe
+ self.CurrentYS = cys
+ self.CurrentYE = cye
+
+ self.Generator.Generate(self.CurrentXS, self.CurrentYS, self.CurrentXE, self.CurrentYE)
+
+ def SetEnabled(self, enabled):
+ self.Content.PanDownButton.IsEnabled = enabled
+ self.Content.PanLeftButton.IsEnabled = enabled
+ self.Content.PanRightButton.IsEnabled = enabled
+ self.Content.PanUpButton.IsEnabled = enabled
+ self.Content.ZoomInButton.IsEnabled = enabled
+ self.Content.ZoomOutButton.IsEnabled = enabled
+ self.Content.ResetButton.IsEnabled = enabled
+ self.Content.RandomButton.IsEnabled = enabled
+
+from Microsoft.Scripting.Silverlight import DynamicApplication
+DynamicApplication.Current.RootVisual = Mandelbrot()
View
58 ruby/browser/examples/mandelbrot/mandelbrot.xaml
@@ -0,0 +1,58 @@
+<UserControl
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Width="Auto" Height="Auto"
+ Background="Black" VerticalContentAlignment="Center" HorizontalContentAlignment="Center">
+ <Grid x:Name="LayoutRoot" Width="642" Height="502" Background="Black" Margin="0">
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="482" />
+ <RowDefinition Height="20" />
+ </Grid.RowDefinitions>
+
+ <Border x:Name="FractalBorder" Grid.Row="0" BorderBrush="#FFFFFFFF" BorderThickness="1">
+ <Canvas x:Name="FractalArea" Width="640" Height="480">
+ <Canvas.Background>
+ <ImageBrush x:Name="image" ImageSource="" Stretch="UniformToFill" />
+ </Canvas.Background>
+ <Rectangle x:Name="selection" Visibility="Collapsed" Stroke="White" StrokeDashArray="3,3" Fill="#33FFFFFF" />
+ </Canvas>
+ </Border>
+
+ <Grid x:Name="tools" Grid.Row="2">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <TextBlock Grid.Column="0" Grid.ColumnSpan="2"
+ VerticalAlignment="Center" HorizontalAlignment="Left"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10">Originally created by A.Boschin : andrea@boschin.it</TextBlock>
+ <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
+ <HyperlinkButton x:Name="PanLeftButton" Grid.Column="1" Content="Left"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="PanRightButton" Grid.Column="1" Content="Right"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="PanUpButton" Grid.Column="1" Content="Up"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="PanDownButton" Grid.Column="1" Content="Down"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="ZoomInButton" Grid.Column="1" Content="Zoom In"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="ZoomOutButton" Grid.Column="1" Content="Zoom Out"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="ResetButton" Grid.Column="1" Content="Reset"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ <HyperlinkButton x:Name="RandomButton" Grid.Column="1" Content="Random"
+ VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3"
+ Foreground="#FFff9900" FontFamily="Verdana" FontSize="10" />
+ </StackPanel>
+ </Grid>
+ </Grid>
+</UserControl>
View
229 ruby/browser/examples/mandelbrot/mandelbrotbase.cs
@@ -0,0 +1,229 @@
+using System;
+using System.Net;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using System.Collections.Generic;
+using System.Windows.Media.Imaging;
+using System.ComponentModel;
+using System.Threading;
+
+namespace mandelbrotbase
+{
+ public class MandelbrotGenerator
+ {
+ /// <summary>
+ /// Occurs when [completed].
+ /// </summary>
+ public event EventHandler<CompletedEventArgs> Completed;
+ /// <summary>
+ /// Gets or sets the palette.
+ /// </summary>
+ /// <value>The palette.</value>
+ private Color[] Palette { get; set; }
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ /// <value>The width.</value>
+ public int Width { get; set; }
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ /// <value>The height.</value>
+ public int Height { get; set; }
+ /// <summary>
+ /// Gets or sets the UI element.
+ /// </summary>
+ /// <value>The UI element.</value>
+ public UIElement UIElement { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MandelbrotGenerator"/> class.
+ /// </summary>
+ public MandelbrotGenerator(UIElement uiElement, int width, int height)
+ {
+ this.UIElement = uiElement;
+ this.Width = width;
+ this.Height = height;
+ this.Palette = GeneratePalette();
+ }
+
+ /// <summary>
+ /// Draws the specified sx.
+ /// </summary>
+ /// <param name="sx">The sx.</param>
+ /// <param name="sy">The sy.</param>
+ /// <param name="fx">The fx.</param>
+ /// <param name="fy">The fy.</param>
+ /// <returns></returns>
+ private void Draw(object state)
+ {
+ GenerationState size = state as GenerationState;
+
+ if (size == null)
+ throw new InvalidOperationException();
+
+ int[] bmap = new int[this.Width * this.Height];
+
+ // Creates the Bitmap we draw to
+ // From here on out is just converted from the c++ version.
+ double x, y, x1, y1, xx, xmin, xmax, ymin, ymax = 0.0;
+
+ int looper, s, z = 0;
+ double intigralX, intigralY = 0.0;
+ xmin = size.SX; // Start x value, normally -2.1
+ ymin = size.SY; // Start y value, normally -1.3
+ xmax = size.FX; // Finish x value, normally 1
+ ymax = size.FY; // Finish y value, normally 1.3
+ intigralX = (xmax - xmin) / this.Width; // Make it fill the whole window
+ intigralY = (ymax - ymin) / this.Height;
+ x = xmin;
+
+ for (s = 0; s < this.Width; s++)
+ {
+ y = ymin;
+ for (z = 0; z < this.Height; z++)
+ {
+ x1 = 0;
+ y1 = 0;
+ looper = 0;
+
+ while (looper < 100 && ((x1 * x1) + (y1 * y1)) < 4)
+ {
+ looper++;
+ xx = (x1 * x1) - (y1 * y1) + x;
+ y1 = 2 * x1 * y1 + y;
+ x1 = xx;
+ }
+
+ // Get the percent of where the looper stopped
+ double perc = looper / (100.0);
+ // Get that part of a 255 scale
+ int val = ((int)(perc * (this.Palette.Length - 1)));
+ // Use that number to set the color
+
+ Color px = this.Palette[val];
+ bmap[z * this.Width + s] = px.A << 24 | px.R << 16 | px.G << 8 | px.B;
+
+ y += intigralY;
+ }
+
+ x += intigralX;
+ }
+
+ this.UIElement.Dispatcher.BeginInvoke(
+ new Action<int[]>(
+ data =>
+ {
+ WriteableBitmap output = new WriteableBitmap(this.Width, this.Height);
+
+ try
+ {
+ for (int i = 0; i < data.Length; i++)
+ output.Pixels[i] = data[i];
+
+ this.OnCompleted(new CompletedEventArgs(output));
+ }
+ finally
+ {
+ output.Invalidate();
+ }
+
+ }), bmap);
+ }
+
+ /// <summary>
+ /// Generates the palette.
+ /// </summary>
+ /// <returns></returns>
+ private Color[] GeneratePalette()
+ {
+ List<Color> colors = new List<Color>();
+
+ for (int c = 0; c < 256; c++)
+ colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));
+ for (int c = 0; c < 256; c++)
+ colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
+ for (int c = 255; c >= 0; c--)
+ colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
+ for (int c = 0; c < 256; c++)
+ colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
+ for (int c = 255; c >= 0; c--)
+ colors.Add(Color.FromArgb(0xff, 0, 0xff, (byte)c));
+ for (int c = 0; c < 256; c++)
+ colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
+ for (int c = 255; c >= 0; c--)
+ colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
+ for (int c = 0; c < 256; c++)
+ colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
+ for (int c = 0; c < 256; c++)
+ colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));
+
+ var half =
+ colors.Concat(
+ colors.Reverse<Color>());
+
+ return half.Concat(half).ToArray();
+ }
+
+ /// <summary>
+ /// Raises the <see cref="E:Completed"/> event.
+ /// </summary>
+ /// <param name="e">The <see cref="Elite.Silverlight3.Fractals.Silverlight.CompletedEventArgs"/> instance containing the event data.</param>
+ private void OnCompleted(CompletedEventArgs e)
+ {
+ EventHandler<CompletedEventArgs> handler = Completed;
+
+ if (handler != null)
+ handler(this, e);
+ }
+
+ /// <summary>
+ /// Generates the specified sx.
+ /// </summary>
+ /// <param name="sx">The sx.</param>
+ /// <param name="sy">The sy.</param>
+ /// <param name="fx">The fx.</param>
+ /// <param name="fy">The fy.</param>
+ public void Generate(double sx, double sy, double fx, double fy)
+ {
+ ThreadPool.QueueUserWorkItem(
+ new WaitCallback(Draw), new GenerationState { SX = sx, SY = sy, FX = fx, FY = fy });
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class GenerationState
+ {
+ public double SX { get; set; }
+ public double SY { get; set; }
+ public double FX { get; set; }
+ public double FY { get; set; }
+ }
+ }
+
+ public class CompletedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Gets or sets the image.
+ /// </summary>
+ /// <value>The image.</value>
+ public ImageSource Image { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompletedEventArgs"/> class.
+ /// </summary>
+ /// <param name="image">The image.</param>
+ public CompletedEventArgs(ImageSource image)
+ {
+ this.Image = image;
+ }
+ }
+}
View
BIN  ruby/browser/examples/mushroom.zip
Binary file not shown
View
48 ruby/browser/examples/mushroom/index.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Speaking Mushroom</title>
+ <script type="text/javascript"
+ src="http://gestalt.ironpython.net/dlr-latest.js"></script>
+ <link rel="stylesheet" href="style.css" type="text/css" />
+ </head>
+ <body id="demo">
+ <div>
+ Type your name:
+ <input id="name" type="text" /><input id="go" type="button" value="go!" />
+ </div>
+
+ <script type="application/xml+xaml" src="mushroom.xaml" id="mushroom" width="200" height="280">
+ </script>
+
+ <script type="text/python" class="mushroom">
+ bm = xaml.blinking_mushroom
+ bm.left_eye_blink.Begin()
+ bm.right_eye_blink.Begin()
+
+ def Completed(s,e):
+ bm.float_bubble.Begin()
+
+ bm.show_bubble.Completed += Completed
+
+ def OnClick(s,e):
+ xaml.bubble_text.Text = "Hello, " + document.name.value + "!"
+ bm.show_bubble.Begin()
+
+ document.go.events.onclick += OnClick
+ </script>
+
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-16148811-1");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+
+ </body>
+</html>
+
View
156 ruby/browser/examples/mushroom/mushroom.xaml
@@ -0,0 +1,156 @@
+<UserControl x:Name="blinking_mushroom" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="200" Height="280" Background="Black" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
+ <UserControl.Resources>
+ <Storyboard x:Name="left_eye_blink" RepeatBehavior="Forever">
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.025"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.084"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:03" Value="0"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Name="right_eye_blink" RepeatBehavior="Forever">
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_6" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.025"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_6" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.084"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:03" Value="0"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Name="show_bubble">
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="166.742"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0" KeySpline="0,0,0.73199999332428,0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="3.235"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.337"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1" KeySpline="0,0,0.73199999332428,0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.951"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.337"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1" KeySpline="0,0,0.73199999332428,0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.951"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-1"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0" KeySpline="0,0,0.73199999332428,0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-0.5"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.Visibility)">
+ <DiscreteObjectKeyFrame KeyTime="00:00:00">
+ <DiscreteObjectKeyFrame.Value>
+ <Visibility>Visible</Visibility>
+ </DiscreteObjectKeyFrame.Value>
+ </DiscreteObjectKeyFrame>
+ <DiscreteObjectKeyFrame KeyTime="00:00:00.4000000">
+ <DiscreteObjectKeyFrame.Value>
+ <Visibility>Visible</Visibility>
+ </DiscreteObjectKeyFrame.Value>
+ </DiscreteObjectKeyFrame>
+ </ObjectAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Name="float_bubble" RepeatBehavior="Forever">
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:01.3000000" Value="5"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:01.6000000" Value="5"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:02.6000000" Value="1"></SplineDoubleKeyFrame>
+ <SplineDoubleKeyFrame KeyTime="00:00:02.9000000" Value="1"></SplineDoubleKeyFrame>
+ </DoubleAnimationUsingKeyFrames>
+ <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bubble" Storyboard.TargetProperty="(UIElement.Visibility)">
+ <DiscreteObjectKeyFrame KeyTime="00:00:00">
+ <DiscreteObjectKeyFrame.Value>
+ <Visibility>Visible</Visibility>
+ </DiscreteObjectKeyFrame.Value>
+ </DiscreteObjectKeyFrame>
+ <DiscreteObjectKeyFrame KeyTime="00:00:01.3000000">
+ <DiscreteObjectKeyFrame.Value>
+ <Visibility>Visible</Visibility>
+ </DiscreteObjectKeyFrame.Value>
+ </DiscreteObjectKeyFrame>
+ <DiscreteObjectKeyFrame KeyTime="00:00:02.6000000">
+ <DiscreteObjectKeyFrame.Value>
+ <Visibility>Visible</Visibility>
+ </DiscreteObjectKeyFrame.Value>
+ </DiscreteObjectKeyFrame>
+ <DiscreteObjectKeyFrame KeyTime="00:00:02.9000000">
+ <DiscreteObjectKeyFrame.Value>
+ <Visibility>Visible</Visibility>
+ </DiscreteObjectKeyFrame.Value>
+ </DiscreteObjectKeyFrame>
+ </ObjectAnimationUsingKeyFrames>
+ </Storyboard>
+ </UserControl.Resources>
+
+ <Canvas Height="280" Width="200" x:Name="container" Background="Black">
+ <Canvas x:Name="mushroom" Width="200" Height="230" Canvas.Top="50">
+ <Path x:Name="Path" Width="166.838" Height="196.367" Canvas.Left="13.9608" Canvas.Top="28.0281" Stretch="Fill" Fill="#FFFAE2BA" Data="F1 M 162.759,168.252C 138.947,152.15 138.303,124.811 138.303,124.811C 138.303,124.811 138.063,121.492 137.768,119.23C 137.713,93.3346 137.67,69.5864 137.67,58.5115C 137.67,27.6608 97.3799,28.0283 97.3799,28.0283C 97.3799,28.0283 57.089,27.6608 57.089,58.5115C 57.089,69.5864 57.0464,93.3338 56.9904,119.228C 56.6957,121.49 56.4555,124.811 56.4555,124.811C 56.4555,124.811 55.8113,152.15 31.9993,168.252C 8.18806,184.354 11.0358,200.356 22.8609,199.995C 33.155,199.68 52.086,182.464 56.914,152.773C 56.8331,187.823 56.7537,218.535 56.7537,218.535C 56.7537,218.535 56.5745,224.395 62.5651,224.395C 67.7127,224.395 68.9801,221.156 69.7566,218.481C 70.5309,215.805 72.2238,210.878 75.395,210.878L 119.363,210.878C 122.535,210.878 124.227,215.805 125.003,218.481C 125.777,221.156 127.047,224.395 132.19,224.395C 138.183,224.395 138.004,218.535 138.004,218.535C 138.004,218.535 137.925,187.822 137.844,152.772C 142.671,182.464 161.604,199.68 171.898,199.995C 183.724,200.356 186.572,184.354 162.759,168.252 Z "></Path>
+ <Path x:Name="Path_0" Width="8.6793" Height="6.93059" Canvas.Left="23.9336" Canvas.Top="190.457" Stretch="Fill" Fill="#FFD7C28C" Data="F1 M 32.2067,191.479C 33.39,193.451 31.8226,194.836 29.6348,196.164C 27.4485,197.492 25.3359,198.022 24.2884,196.289C 23.5245,195.026 23.828,193.373 26.8588,191.603C 29.6448,189.976 31.4474,190.215 32.2067,191.479 Z "></Path>
+ <Path x:Name="Path_1" Width="8.67891" Height="6.93059" Canvas.Left="162.667" Canvas.Top="190.457" Stretch="Fill" Fill="#FFD7C28C" Data="F1 M 163.073,191.479C 161.89,193.451 163.457,194.836 165.643,196.164C 167.83,197.492 169.943,198.022 170.991,196.289C 171.755,195.026 171.452,193.373 168.421,191.603C 165.633,189.976 163.832,190.215 163.073,191.479 Z "></Path>
+ <Path x:Name="Path_2" Width="80.8181" Height="19.238" Canvas.Left="56.9526" Canvas.Top="109.18" Stretch="Fill" Fill="#FFE5CCA2" Data="F1 M 137.748,109.18L 56.9726,111.171C 56.9664,114.394 56.9595,117.651 56.9526,120.921C 62.1018,125.872 73.1168,128.27 89.1134,128.407C 106.995,128.562 124.073,127.075 137.771,119.956C 137.762,116.336 137.755,112.734 137.748,109.18 Z "></Path>
+ <Grid Height="8" Width="9" Canvas.Left="66.414" Canvas.Top="128.355">
+ <Path x:Name="Path_3" Stretch="Fill" Fill="#FF221E1F" Data="F1 M 75.5618,132.354C 75.5618,135.105 73.6556,136.471 71.0876,136.471C 68.5207,136.471 66.2653,135.137 66.2653,132.354C 66.2653,129.574 68.1711,128.239 70.738,128.239C 73.3072,128.239 75.5618,129.443 75.5618,132.354 Z " RenderTransformOrigin="0.496,0.501">
+ <Path.RenderTransform>
+ <TransformGroup>
+ <ScaleTransform></ScaleTransform>
+ <SkewTransform></SkewTransform>
+ <RotateTransform></RotateTransform>
+ <TranslateTransform></TranslateTransform>
+ </TransformGroup>
+ </Path.RenderTransform>
+ </Path>
+ </Grid>
+ <Path x:Name="Path_5" Width="7.90562" Height="3.64575" Canvas.Left="67.1899" Canvas.Top="136.693" Stretch="Fill" Fill="#FFC1AA7A" Data="F1 M 67.1899,136.94C 67.1899,136.94 68.0766,138.097 70.9382,138.097C 73.7997,138.097 75.0955,136.693 75.0955,136.693C 75.0955,136.693 71.7209,144.729 67.1899,136.94 Z "></Path>
+ <Path x:Name="Path_6" Width="9.29535" Height="8.23141" Canvas.Left="119.197" Canvas.Top="128.239" Stretch="Fill" Fill="#FF221E1F" Data="F1 M 128.493,132.354C 128.493,135.105 126.587,136.471 124.02,136.471C 121.454,136.471 119.197,135.137 119.197,132.354C 119.197,129.574 121.104,128.239 123.67,128.239C 126.239,128.239 128.493,129.443 128.493,132.354 Z ">
+ <Path.RenderTransform>
+ <TransformGroup>
+ <ScaleTransform></ScaleTransform>
+ <SkewTransform></SkewTransform>
+ <RotateTransform></RotateTransform>
+ <TranslateTransform></TranslateTransform>
+ </TransformGroup>
+ </Path.RenderTransform>
+ </Path>
+ <Path x:Name="Path_8" Width="7.90639" Height="3.64575" Canvas.Left="120.121" Canvas.Top="136.693" Stretch="Fill" Fill="#FFC1AA7A" Data="F1 M 120.121,136.94C 120.121,136.94 121.008,138.097 123.87,138.097C 126.731,138.097 128.027,136.693 128.027,136.693C 128.027,136.693 124.653,144.729 120.121,136.94 Z "></Path>
+ <Path x:Name="Path_9" Width="189.831" Height="112.562" Canvas.Left="4.32246" Canvas.Top="4.19066" Stretch="Fill" Fill="#FFB92025" Data="F1 M 194.153,82.5396C 194.153,118.638 151.658,116.735 99.2382,116.735C 46.8169,116.735 4.32246,118.638 4.32246,82.5396C 4.32246,46.4404 46.8169,4.19066 99.2382,4.19066C 151.658,4.19066 194.153,46.4404 194.153,82.5396 Z "></Path>
+ <Path x:Name="Path_10" Width="11.6821" Height="10.754" Canvas.Left="166.918" Canvas.Top="89.5578" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 175.074,99.3477C 172.208,100.824 169.289,100.867 167.605,97.6049C 166.345,95.1669 166.552,92.5572 170.511,90.5173C 174.305,88.5625 176.721,89.8206 177.98,92.2594C 179.565,95.3282 177.939,97.8712 175.074,99.3477 Z "></Path>
+ <Path x:Name="Path_11" Width="29.5489" Height="31.9077" Canvas.Left="41.918" Canvas.Top="75.4503" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 64.1035,105.535C 57.3769,109.001 50.0158,108.116 44.6234,97.6769C 40.5907,89.8712 40.2043,82.0582 49.5016,77.2677C 58.4052,72.6802 64.9499,77.3198 68.9802,85.1263C 74.0561,94.95 70.8288,102.069 64.1035,105.535 Z "></Path>
+ <Path x:Name="Path_12" Width="154.91" Height="86.0429" Canvas.Left="37.6103" Canvas.Top="4.19078" Stretch="Fill" Fill="#FFE82225" Data="F1 M 192.52,69.9377C 184.266,37.2974 145.641,4.19078 99.2383,4.19078C 76.2658,4.19078 55.1991,12.3057 38.7797,24.4598C 36.0206,34.1861 36.0428,55.0448 63.1937,70.8099C 97.9326,90.9819 174.829,102.224 192.52,69.9377 Z "></Path>
+ <Canvas x:Name="Group" Width="214.848" Height="130.531" Canvas.Left="-9.10198" Canvas.Top="4">
+ <Canvas Width="200" Height="230" x:Name="Clip" Clip="F1 M 13.102,78.6138C 13.102,114.836 55.7414,112.926 108.34,112.926L 108.34,112.926C 160.938,112.926 203.578,114.836 203.578,78.6138L 203.578,78.6138C 203.578,42.3927 160.938,0 108.34,0L 108.34,0C 55.7414,0 13.102,42.3927 13.102,78.6138 Z ">
+ <Path x:Name="Path_13" Width="46.2032" Height="46.1474" Canvas.Left="0" Canvas.Top="37.2407" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 46.2032,60.3148C 46.2032,73.0575 40.1643,83.3882 23.101,83.3882C 10.3432,83.3882 0,77.927 0,60.3148C 0,43.445 10.3432,37.2407 23.101,37.2407C 39.1597,37.2407 46.2032,47.5718 46.2032,60.3148 Z "></Path>
+ <Path x:Name="Path_14" Width="48.5257" Height="48.4644" Canvas.Left="118.391" Canvas.Top="82.0665" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 166.917,106.299C 166.917,119.681 160.575,130.531 142.654,130.531C 129.253,130.531 118.391,124.796 118.391,106.299C 118.391,88.5815 129.253,82.0665 142.654,82.0665C 159.518,82.0665 166.917,92.9153 166.917,106.299 Z "></Path>
+ <Path x:Name="Path_15" Width="60.1456" Height="60.1163" Canvas.Left="149.526" Canvas.Top="8.23954" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 193.106,64.056C 178.86,71.3977 163.828,70.6148 153.997,51.5828C 146.648,37.3525 146.793,22.6693 166.485,12.5218C 185.348,2.80305 198.245,10.7647 205.596,24.9958C 214.848,42.9053 207.355,56.7144 193.106,64.056 Z "></Path>
+ </Canvas>
+ </Canvas>
+ <Path x:Name="Path_16" Width="20.1736" Height="18.571" Canvas.Left="94.167" Canvas.Top="56.6697" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 108.249,73.576C 103.302,76.1255 98.2626,76.1987 95.3531,70.567C 93.1768,66.3559 93.5336,61.85 100.374,58.3264C 106.921,54.951 111.094,57.1242 113.269,61.335C 116.007,66.6356 113.196,71.0269 108.249,73.576 Z "></Path>
+ <Path x:Name="Path_17" Width="12.6564" Height="11.8898" Canvas.Left="99.5336" Canvas.Top="8.78829" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 101.054,17.8553C 99.1645,15.246 98.6868,12.3704 101.664,10.2206C 103.891,8.61183 108.635,7.66148 111.246,11.2671C 113.748,14.7211 110.732,18.06 108.506,19.668C 105.704,21.6909 102.943,20.4643 101.054,17.8553 Z "></Path>
+ <Path x:Name="Path_18" Width="28.3932" Height="28.3795" Canvas.Left="49.2328" Canvas.Top="19.2153" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 69.8064,45.5656C 63.0803,49.0306 55.9854,48.6608 51.3435,39.6767C 47.8741,32.9586 47.942,26.0282 57.2389,21.2368C 66.1448,16.6486 72.2314,20.4079 75.7022,27.1257C 80.0691,35.5806 76.5326,42.1002 69.8064,45.5656 Z "></Path>
+ <Path x:Name="Path_19" Width="56.2268" Height="29.6914" Canvas.Left="68.8136" Canvas.Top="143.184" Stretch="Fill" Fill="#FF221E1F" Data="F1 M 110.719,171.532C 122.593,165.059 127.245,149.635 124.069,146.7C 123.362,146.046 121.82,145.473 119.686,144.99C 119.04,146.676 117.022,149.341 114.983,149.923C 112.761,150.558 111.31,146.252 111.57,143.803C 103.391,143.034 92.7783,142.954 84.1717,143.719C 84.159,146.311 82.3384,150.145 80.225,149.38C 78.4489,148.739 76.8919,146.91 76.2035,144.812C 71.7331,145.723 68.8324,147.031 68.8136,148.787C 68.8136,148.787 70.7451,165.859 88.3397,172.281C 90.2498,172.977 107.274,173.411 110.719,171.532 Z "></Path>
+ <Path x:Name="Path_20" Width="19.6567" Height="16.1161" Canvas.Left="90.2381" Canvas.Top="157.141" Stretch="Fill" Fill="#FF541018" Data="F1 M 91.8171,169.709C 89.3503,167.055 89.9658,160.722 92.3373,158.39C 94.7082,156.061 98.0049,158.331 98.9538,160.154C 99.9007,161.978 96.7851,163.874 96.6589,166.118C 96.5338,168.359 100.707,168.179 102.537,166.805C 104.365,165.432 100.53,163.478 101.95,159.964C 103.368,156.452 109.365,155.539 109.853,161.204C 110.343,166.868 106.358,170.254 106.358,170.254C 106.358,170.254 98.9231,177.361 91.8171,169.709 Z "></Path>
+ <Path x:Name="Path_21" Width="22.6076" Height="3.78664" Canvas.Left="88.2496" Canvas.Top="170.621" Stretch="Fill" Fill="#FFF05665" Data="F1 M 94.2663,170.915C 97.6071,170.334 98.9746,172.172 98.9746,172.172C 101.628,169.749 107.828,170.698 110.857,171.469C 110.795,171.504 110.732,171.538 110.67,171.572C 110.645,171.585 110.62,171.598 110.596,171.61C 106.233,173.956 100.906,175.093 94.6389,173.973C 92.306,173.555 90.1846,172.97 88.2496,172.258C 89.9682,171.832 92.0566,171.298 94.2663,170.915 Z "></Path>
+ </Canvas>
+ <Canvas Height="50.5" Width="184" Canvas.Left="8" Canvas.Top="7" x:Name="bubble" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
+ <Canvas.RenderTransform>
+ <TransformGroup>
+ <ScaleTransform></ScaleTransform>
+ <SkewTransform></SkewTransform>
+ <RotateTransform></RotateTransform>
+ <TranslateTransform></TranslateTransform>
+ </TransformGroup>
+ </Canvas.RenderTransform>
+ <Rectangle Height="43" Width="184" Fill="#FFFFFFFF"></Rectangle>
+ <Path Height="8.5" Width="16" Canvas.Left="81.5" Canvas.Top="41.5" Data="M83,59 L90.5,66.5 L98,59 z" Fill="#FFFFFFFF" Stretch="Fill"></Path>
+ <TextBlock Height="29.5" Width="168" Canvas.Left="8" Canvas.Top="6" Text="Hello, World!" TextWrapping="Wrap" FontSize="20" HorizontalAlignment="Center" TextAlignment="Center" x:Name="bubble_text"></TextBlock>
+ </Canvas>
+ </Canvas>
+</UserControl>
View
22 ruby/browser/examples/mushroom/style.css
@@ -0,0 +1,22 @@
+body {
+ text-align: center;
+}
+body, input[type=text], input[type=button] {
+ background-color: black;
+ color: white;
+ font-family: consolas, monotype;
+ font-size: 24px;
+}
+input[type=text], input[type=button] {
+ border: 2px solid gray;
+ font-size: 24px;
+ font-family: consolas, monotype;
+}
+input[type=button] {
+ background-color: #333;
+ margin-left: 5px;
+}
+#silverlightDLRObject1 {
+ margin-left: auto;
+ margin-right: auto;
+}
View
BIN  ruby/browser/examples/photoviewer.zip
Binary file not shown
View
60 ruby/browser/examples/photoviewer/app.rb
@@ -0,0 +1,60 @@
+require 'view'
+require 'lib/system-json'
+
+module Photoviewer
+ class App
+ Uri = System::Uri
+ Net = System::Net
+ Json = System::Json
+
+ def initialize
+ @view = View.new(self)
+ @url = "http://api.flickr.com/services/rest"
+ @options = {
+ :method => "flickr.photos.search",
+ :format => "json",
+ :nojsoncallback => "1",
+ :api_key => "6dba7971b2abf352b9dcd48a2e5a5921",
+ :sort => "relevance",
+ :per_page => "30"
+ }
+ document.submit_search.onclick do |s, e|
+ create_request document.keyword.value
+ end
+ end
+
+ def create_request(keyword, page = 1)
+ @view.loading_start
+
+ @options[:tags] = keyword
+ @options[:page] = page
+ @url = make_url @url, @options
+
+ request = Net::WebClient.new
+ request.download_string_completed do |_,e|
+ show_images e.result
+ end
+ request.download_string_async Uri.new(@url)
+ end
+
+ def show_images(response)
+ @flickr = Json.parse response
+ @view.show_images @flickr, @options[:tags], @options[:page]
+ @view.loading_finish
+ end
+
+ private
+
+ def make_url(url, options)
+ first, separator = true, '?'
+ options.each do |key, value|
+ separator = "&" unless first
+ url += "#{separator}#{key}=#{value}"
+ first = false
+ end
+ url
+ end
+ end
+end
+
+$app = Photoviewer::App.new
View
BIN  ruby/browser/examples/photoviewer/assets/loading.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
76 ruby/browser/examples/photoviewer/assets/screen.css
@@ -0,0 +1,76 @@
+body {
+ font-family: "Trebuchet MS" Verdana sans-serif;
+ border: 0px; padding: 0px; margin: 0px;
+}
+
+div.clear {
+ clear: both;
+}
+
+/* main search box */
+.search {
+ padding: 20px;
+ margin: 20px;
+ border: 10px solid gray;
+ background-color: #ccc;
+}
+
+form#search {
+ margin: 0px;
+}
+form#search #images_loading {
+ width: 18px;
+ height: 15px;
+ display: none;
+}
+
+
+/* search results */
+#search_results {
+ display: none;
+}
+
+/* search images */
+#search_images {
+ padding-top: 10px;
+}
+#search_images .image, .image a, .image a img {
+ float: left;
+ padding: 0px;
+ margin: 0px;
+ border: 0px;
+}
+#search_images .image a:link,
+#search_images .image a:visited {
+ background-color: white;
+ padding: 5px;
+ margin: 5px;
+ background-color: white;
+ border: 1px solid gray;
+}
+#search_images .image a:hover {
+ background-color: #ff9966;
+}
+
+/* search links */
+#search_links {
+ clear: both;
+ padding-top: 10px;
+}
+#search_links a {
+ border: 1px solid #003344;
+ margin: 2px;
+ padding: 4px 5px 1px;
+ color: #003344;
+ background-color: white;
+ text-decoration: none;
+}
+#search_links a:hover,
+#search_links a.active {
+ color: white;
+ background-color: #003344;
+ border: 1px solid white;
+}
+#search_links a.active {
+ cursor: default;
+}
View
16 ruby/browser/examples/photoviewer/images.erb
@@ -0,0 +1,16 @@
+<% if @flickr.stat == "ok" && @flickr.photos.total.to_i > 0 %>
+ <div class='images'>
+ <% @flickr.photos.photo.each do |p| %>
+ <div class='image'>
+ <a href="<%= flickr_source(p) %>.jpg"
+ title="<%= encode("<a href='#{flickr_page(p)}' target='_blank'>#{ p.title }</a>") %>"
+ rel="lightbox[<%= @tags %>]"
+ >
+ <img src="<%= flickr_source(p) %>_s.jpg" />
+ </a>
+ </div>
+ <% end %>
+ </div>
+<% else %>
+ No images found!
+<% end %>
View
50 ruby/browser/examples/photoviewer/index.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>photoviewer</title>
+
+ <script type="text/javascript" src="lightbox/js/prototype.js"></script>
+ <script type="text/javascript" src="lightbox/js/scriptaculous.js?load=effects"></script>
+ <script type="text/javascript" src="lightbox/js/lightbox.js"></script>
+ <link rel="stylesheet" href="lightbox/css/lightbox.css" type="text/css" media="screen" />
+
+ <link type="text/css" rel="stylesheet" href="assets/screen.css" />
+
+ <script src="http://gestalt.ironruby.net/dlr-latest.js" type="text/javascript"></script>
+ <script src="../repl.rb" type="text/ruby"></script>
+</head>
+
+<body>
+ <script src="lib.zip" type="application/x-zip-compressed"></script>
+ <div class="search">
+ <form id="search" action="javascript:void(0)">
+ <input type="text" id="keyword" />
+ <input type="submit" id="submit_search" value="search" />
+ <img src="assets/loading.gif" id="images_loading" alt="Loading ..." />
+ </form>
+ <div id="search_results">
+ <div id="search_images"></div>
+ <div id="search_links"></div>
+ </div>
+ </div>
+ <div class="clear"></div>
+
+ <script type="text/ruby" src="pages.erb" defer='true'></script>
+ <script type="text/ruby" src="images.erb" defer='true'></script>
+
+ <script type="text/ruby" src="view.rb" defer='true'></script>
+ <script type="text/ruby" src="app.rb"></script>
+
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-16148811-1");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+
+</body>
+</html>
View
BIN  ruby/browser/examples/photoviewer/lib.zip
Binary file not shown
View
BIN  ruby/browser/examples/photoviewer/lib/System.Json.dll
Binary file not shown
View
799 ruby/browser/examples/photoviewer/lib/erb.rb
@@ -0,0 +1,799 @@
+# = ERB -- Ruby Templating
+#
+# Author:: Masatoshi SEKI
+# Documentation:: James Edward Gray II and Gavin Sinclair
+#
+# See ERB for primary documentation and ERB::Util for a couple of utility
+# routines.
+#
+# Copyright (c) 1999-2000,2002,2003 Masatoshi SEKI
+#
+# You can redistribute it and/or modify it under the same terms as Ruby.
+
+#
+# = ERB -- Ruby Templating
+#
+# == Introduction
+#
+# ERB provides an easy to use but powerful templating system for Ruby. Using
+# ERB, actual Ruby code can be added to any plain text document for the
+# purposes of generating document information details and/or flow control.
+#
+# A very simple example is this:
+#
+# require 'erb'
+#
+# x = 42
+# template = ERB.new <<-EOF
+# The value of x is: <%= x %>
+# EOF
+# puts template.result(binding)
+#
+# <em>Prints:</em> The value of x is: 42
+#
+# More complex examples are given below.
+#
+#
+# == Recognized Tags
+#
+# ERB recognizes certain tags in the provided template and converts them based
+# on the rules below:
+#
+# <% Ruby code -- inline with output %>
+# <%= Ruby expression -- replace with result %>
+# <%# comment -- ignored -- useful in testing %>
+# % a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
+# %% replaced with % if first thing on a line and % processing is used
+# <%% or %%> -- replace with <% or %> respectively
+#
+# All other text is passed through ERB filtering unchanged.
+#
+#
+# == Options
+#
+# There are several settings you can change when you use ERB:
+# * the nature of the tags that are recognized;
+# * the value of <tt>$SAFE</tt> under which the template is run;
+# * the binding used to resolve local variables in the template.
+#
+# See the ERB.new and ERB#result methods for more detail.
+#
+#
+# == Examples
+#
+# === Plain Text
+#
+# ERB is useful for any generic templating situation. Note that in this example, we use the
+# convenient "% at start of line" tag, and we quote the template literally with
+# <tt>%q{...}</tt> to avoid trouble with the backslash.
+#
+# require "erb"
+#
+# # Create template.
+# template = %q{
+# From: James Edward Gray II <james@grayproductions.net>
+# To: <%= to %>
+# Subject: Addressing Needs
+#
+# <%= to[/\w+/] %>:
+#
+# Just wanted to send a quick note assuring that your needs are being
+# addressed.
+#
+# I want you to know that my team will keep working on the issues,
+# especially:
+#
+# <%# ignore numerous minor requests -- focus on priorities %>
+# % priorities.each do |priority|
+# * <%= priority %>
+# % end
+#
+# Thanks for your patience.
+#
+# James Edward Gray II
+# }.gsub(/^ /, '')
+#
+# message = ERB.new(template, 0, "%<>")
+#
+# # Set up template data.
+# to = "Community Spokesman <spokesman@ruby_community.org>"
+# priorities = [ "Run Ruby Quiz",
+# "Document Modules",
+# "Answer Questions on Ruby Talk" ]
+#
+# # Produce result.
+# email = message.result
+# puts email
+#
+# <i>Generates:</i>
+#
+# From: James Edward Gray II <james@grayproductions.net>
+# To: Community Spokesman <spokesman@ruby_community.org>
+# Subject: Addressing Needs
+#
+# Community:
+#
+# Just wanted to send a quick note assuring that your needs are being addressed.
+#
+# I want you to know that my team will keep working on the issues, especially:
+#
+# * Run Ruby Quiz
+# * Document Modules
+# * Answer Questions on Ruby Talk
+#
+# Thanks for your patience.
+#
+# James Edward Gray II
+#
+# === Ruby in HTML
+#
+# ERB is often used in <tt>.rhtml</tt> files (HTML with embedded Ruby). Notice the need in
+# this example to provide a special binding when the template is run, so that the instance
+# variables in the Product object can be resolved.
+#
+# require "erb"
+#
+# # Build template data class.
+# class Product
+# def initialize( code, name, desc, cost )
+# @code = code
+# @name = name
+# @desc = desc
+# @cost = cost
+#
+# @features = [ ]
+# end
+#
+# def add_feature( feature )
+# @features << feature
+# end
+#
+# # Support templating of member data.
+# def get_binding
+# binding
+# end
+#
+# # ...
+# end
+#
+# # Create template.
+# template = %{
+# <html>
+# <head><title>Ruby Toys -- <%= @name %></title></head>
+# <body>
+#
+# <h1><%= @name %> (<%= @code %>)</h1>
+# <p><%= @desc %></p>
+#
+# <ul>
+# <% @features.each do |f| %>
+# <li><b><%= f %></b></li>
+# <% end %>
+# </ul>
+#
+# <p>
+# <% if @cost < 10 %>
+# <b>Only <%= @cost %>!!!</b>
+# <% else %>
+# Call for a price, today!
+# <% end %>
+# </p>
+#
+# </body>
+# </html>
+# }.gsub(/^ /, '')
+#
+# rhtml = ERB.new(template)
+#
+# # Set up template data.
+# toy = Product.new( "TZ-1002",
+# "Rubysapien",
+# "Geek's Best Friend! Responds to Ruby commands...",
+# 999.95 )
+# toy.add_feature("Listens for verbal commands in the Ruby language!")
+# toy.add_feature("Ignores Perl, Java, and all C variants.")
+# toy.add_feature("Karate-Chop Action!!!")
+# toy.add_feature("Matz signature on left leg.")
+# toy.add_feature("Gem studded eyes... Rubies, of course!")
+#
+# # Produce result.
+# rhtml.run(toy.get_binding)
+#
+# <i>Generates (some blank lines removed):</i>
+#
+# <html>
+# <head><title>Ruby Toys -- Rubysapien</title></head>
+# <body>
+#
+# <h1>Rubysapien (TZ-1002)</h1>
+# <p>Geek's Best Friend! Responds to Ruby commands...</p>
+#
+# <ul>
+# <li><b>Listens for verbal commands in the Ruby language!</b></li>
+# <li><b>Ignores Perl, Java, and all C variants.</b></li>
+# <li><b>Karate-Chop Action!!!</b></li>
+# <li><b>Matz signature on left leg.</b></li>
+# <li><b>Gem studded eyes... Rubies, of course!</b></li>
+# </ul>
+#
+# <p>
+# Call for a price, today!
+# </p>
+#
+# </body>
+# </html>
+#
+#
+# == Notes
+#
+# There are a variety of templating solutions available in various Ruby projects:
+# * ERB's big brother, eRuby, works the same but is written in C for speed;
+# * Amrita (smart at producing HTML/XML);
+# * cs/Template (written in C for speed);
+# * RDoc, distributed with Ruby, uses its own template engine, which can be reused elsewhere;
+# * and others; search the RAA.
+#
+# Rails, the web application framework, uses ERB to create views.
+#
+class ERB
+ Revision = '$Date: 2009-02-24 02:43:45 +0900 (Tue, 24 Feb 2009) $' #'
+
+ # Returns revision information for the erb.rb module.
+ def self.version
+ "erb.rb [2.0.4 #{ERB::Revision.split[1]}]"
+ end
+end
+
+#--
+# ERB::Compiler
+class ERB
+ class Compiler # :nodoc:
+ class PercentLine # :nodoc:
+ def initialize(str)
+ @value = str
+ end
+ attr_reader :value
+ alias :to_s :value
+ end
+
+ class Scanner # :nodoc:
+ SplitRegexp = /(<%%)|(%%>)|(<%=)|(<%#)|(<%)|(%>)|(\n)/
+
+ @scanner_map = {}
+ def self.regist_scanner(klass, trim_mode, percent)
+ @scanner_map[[trim_mode, percent]] = klass
+ end
+
+ def self.default_scanner=(klass)
+ @default_scanner = klass
+ end
+
+ def self.make_scanner(src, trim_mode, percent)
+ klass = @scanner_map.fetch([trim_mode, percent], @default_scanner)
+ klass.new(src, trim_mode, percent)
+ end
+
+ def initialize(src, trim_mode, percent)
+ @src = src
+ @stag = nil
+ end
+ attr_accessor :stag
+
+ def scan; end
+ end
+
+ class TrimScanner < Scanner # :nodoc:
+ TrimSplitRegexp = /(<%%)|(%%>)|(<%=)|(<%#)|(<%)|(%>\n)|(%>)|(\n)/
+
+ def initialize(src, trim_mode, percent)
+ super
+ @trim_mode = trim_mode
+ @percent = percent
+ if @trim_mode == '>'
+ @scan_line = self.method(:trim_line1)
+ elsif @trim_mode == '<>'
+ @scan_line = self.method(:trim_line2)
+ elsif @trim_mode == '-'
+ @scan_line = self.method(:explicit_trim_line)
+ else
+ @scan_line = self.method(:scan_line)
+ end
+ end
+ attr_accessor :stag
+
+ def scan(&block)
+ @stag = nil
+ if @percent
+ @src.each do |line|
+ percent_line(line, &block)
+ end
+ else
+ @src.each do |line|
+ @scan_line.call(line, &block)
+ end
+ end
+ nil
+ end
+
+ def percent_line(line, &block)
+ if @stag || line[0] != ?%
+ return @scan_line.call(line, &block)
+ end
+
+ line[0] = ''
+ if line[0] == ?%
+ @scan_line.call(line, &block)
+ else
+ yield(PercentLine.new(line.chomp))
+ end
+ end
+
+ def scan_line(line)
+ line.split(SplitRegexp).each do |token|
+ next if token.empty?
+ yield(token)
+ end
+ end
+
+ def trim_line1(line)
+ line.split(TrimSplitRegexp).each do |token|
+ next if token.empty?
+ if token == "%>\n"
+ yield('%>')
+ yield(:cr)
+ break
+ end
+ yield(token)
+ end
+ end
+
+ def trim_line2(line)
+ head = nil
+ line.split(TrimSplitRegexp).each do |token|
+ next if token.empty?
+ head = token unless head
+ if token == "%>\n"
+ yield('%>')
+ if is_erb_stag?(head)
+ yield(:cr)
+ else
+ yield("\n")
+ end
+ break
+ end
+ yield(token)
+ end
+ end
+
+ def explicit_trim_line(line)
+ line.scan(/(.*?)(^[ \t]*<%\-|<%\-|<%%|%%>|<%=|<%#|<%|-%>\n|-%>|%>|\z)/m) do |tokens|
+ tokens.each do |token|
+ next if token.empty?
+ if @stag.nil? && /[ \t]*<%-/ =~ token
+ yield('<%')
+ elsif @stag && token == "-%>\n"
+ yield('%>')
+ yield(:cr)
+ elsif @stag && token == '-%>'
+ yield('%>')
+ else
+ yield(token)
+ end
+ end
+ end
+ end
+
+ ERB_STAG = %w(<%= <%# <%)
+ def is_erb_stag?(s)
+ ERB_STAG.member?(s)
+ end
+ end
+
+ Scanner.default_scanner = TrimScanner
+
+ class SimpleScanner < Scanner # :nodoc:
+ def scan
+ @src.each do |line|
+ line.split(SplitRegexp).each do |token|
+ next if token.empty?
+ yield(token)
+ end
+ end
+ end
+ end
+
+ Scanner.regist_scanner(SimpleScanner, nil, false)
+
+ begin
+ require 'strscan'
+ class SimpleScanner2 < Scanner # :nodoc:
+ def scan
+ stag_reg = /(.*?)(<%%|<%=|<%#|<%|\n|\z)/
+ etag_reg = /(.*?)(%%>|%>|\n|\z)/
+ scanner = StringScanner.new(@src)
+ while ! scanner.eos?
+ scanner.scan(@stag ? etag_reg : stag_reg)
+ text = scanner[1]
+ elem = scanner[2]
+ yield(text) unless text.empty?
+ yield(elem) unless elem.empty?
+ end
+ end
+ end
+ Scanner.regist_scanner(SimpleScanner2, nil, false)
+
+ class ExplicitScanner < Scanner # :nodoc:
+ def scan
+ new_line = true
+ stag_reg = /(.*?)(<%%|<%=|<%#|<%-|<%|\n|\z)/
+ etag_reg = /(.*?)(%%>|-%>|%>|\n|\z)/
+ scanner = StringScanner.new(@src)
+ while ! scanner.eos?
+ if new_line && @stag.nil? && scanner.scan(/[ \t]*<%-/)
+ yield('<%')
+ new_line = false
+ next
+ end
+ scanner.scan(@stag ? etag_reg : stag_reg)
+ text = scanner[1]
+ elem = scanner[2]
+ new_line = (elem == "\n")
+ yield(text) unless text.empty?
+ if elem == '-%>'
+ yield('%>')
+ if scanner.scan(/(\n|\z)/)
+ yield(:cr)
+ new_line = true
+ end
+ elsif elem == '<%-'
+ yield('<%')
+ else
+ yield(elem) unless elem.empty?
+ end
+ end
+ end
+ end
+ Scanner.regist_scanner(ExplicitScanner, '-', false)
+
+ rescue LoadError
+ end
+
+ class Buffer # :nodoc:
+ def initialize(compiler)
+ @compiler = compiler
+ @line = []
+ @script = ""
+ @compiler.pre_cmd.each do |x|
+ push(x)
+ end
+ end
+ attr_reader :script
+
+ def push(cmd)
+ @line << cmd
+ end
+
+ def cr
+ @script << (@line.join('; '))
+ @line = []
+ @script << "\n"
+ end
+
+ def close
+ return unless @line
+ @compiler.post_cmd.each do |x|
+ push(x)
+ end
+ @script << (@line.join('; '))
+ @line = nil
+ end
+ end
+
+ def compile(s)
+ out = Buffer.new(self)
+
+ content = ''
+ scanner = make_scanner(s)
+ scanner.scan do |token|
+ if scanner.stag.nil?
+ case token
+ when PercentLine
+ out.push("#{@put_cmd} #{content.dump}") if content.size > 0
+ content = ''
+ out.push(token.to_s)
+ out.cr
+ when :cr
+ out.cr
+ when '<%', '<%=', '<%#'
+ scanner.stag = token
+ out.push("#{@put_cmd} #{content.dump}") if content.size > 0
+ content = ''
+ when "\n"
+ content << "\n"
+ out.push("#{@put_cmd} #{content.dump}")
+ out.cr
+ content = ''
+ when '<%%'
+ content << '<%'
+ else
+ content << token
+ end
+ else
+ case token
+ when '%>'
+