Przeglądaj źródła

Merge with Laurent

Nicolas Petton 12 lat temu
rodzic
commit
7107bd04db

BIN
examples/presentation/esug2011/images/asterix.png


BIN
examples/presentation/esug2011/images/background_box.png


BIN
examples/presentation/esug2011/images/background_header.png


BIN
examples/presentation/esug2011/images/balloon.jpg


BIN
examples/presentation/esug2011/images/balloon_header.png


BIN
examples/presentation/esug2011/images/devices.jpg


BIN
examples/presentation/esug2011/images/enyo.png


BIN
examples/presentation/esug2011/images/ide_star_wars.png


BIN
examples/presentation/esug2011/images/nodejs.png


BIN
examples/presentation/esug2011/images/terminal.png


BIN
examples/presentation/esug2011/images/webos.png


+ 17 - 0
examples/presentation/index.html

@@ -0,0 +1,17 @@
+<html>
+<head>
+<title>JTalk - Presentation</title>
+<script src="../../js/jtalk.js" type="text/javascript"></script>
+</head>
+<body>
+
+<script type="text/javascript"> 
+	loadJtalk({
+		files: ['Presentation.js'],
+		prefix: 'examples/presentation/js',
+		ready: function() {smalltalk.Browser._openOn_(smalltalk.ESUG2011Presentation)} 
+	}); 
+</script>
+
+</body>
+</html>

Plik diff jest za duży
+ 520 - 0
examples/presentation/js/Presentation.deploy.js


Plik diff jest za duży
+ 741 - 0
examples/presentation/js/Presentation.js


+ 1155 - 0
examples/presentation/st/Presentation.st

@@ -0,0 +1,1155 @@
+Widget subclass: #Slide
+	instanceVariableNames: 'presentation'
+	category: 'Presentation'!
+
+!Slide methodsFor: 'accessing'!
+
+presentation
+	^presentation
+!
+
+presentation: aPresentation
+	presentation := aPresentation
+!
+
+id
+	self subclassResponsibility
+!
+
+cssClass
+	^'slide'
+!
+
+backgroundColor
+	^'#555'
+! !
+
+!Slide methodsFor: 'actions'!
+
+show
+	document location hash: self id.
+	self backgroundColor ifNotNil: [
+		(window jQuery: '#slides') animate: (Dictionary with: 'backgroundColor' -> self backgroundColor) duration: 500].
+	(window jQuery: '.slide') hide: self presentation slideTransition options: #() duration: 300.
+	(window jQuery: '#', self id) show: self presentation slideTransition options: #() duration: 300.
+! !
+
+!Slide methodsFor: 'rendering'!
+
+renderOn: html
+	html div class: self cssClass; id: self id; with: [
+		self renderSlideOn: html.
+		self renderMetaOn: html]
+!
+
+renderSlideOn: html
+!
+
+renderMetaOn: html
+	html div 
+		id: 'meta';
+		with: [
+			html p class: 'title'; with: self presentation title.
+			html p class: 'description'; with: self presentation description.
+			html a class: 'author'; with: self presentation author; href: 'mailto:', self presentation email.
+			html a class: 'url'; with: self presentation url; href: self presentation url]
+! !
+
+!Slide class methodsFor: 'instance creation'!
+
+on: aPresentation
+	^self new
+		presentation: aPresentation;
+		yourself
+! !
+
+Widget subclass: #Presentation
+	instanceVariableNames: 'currentSlide slides'
+	category: 'Presentation'!
+
+!Presentation methodsFor: 'accessing'!
+
+title
+	^'Slides'
+!
+
+author
+	^'John Smith'
+!
+
+url
+	^'http://jtalk-project.org'
+!
+
+description
+	^'A presentation written in Jtalk'
+!
+
+email
+	^'john@smith.com'
+!
+
+slides
+	slides ifNil: [self initSlides].
+	^slides
+!
+
+slideClasses
+	^self subclassResponsibility
+!
+
+currentSlide
+	^currentSlide
+!
+
+currentSlide: aSlide
+	currentSlide := aSlide
+!
+
+slideTransition
+	^'fade'
+!
+
+style
+	"Should return a CSS style"
+	^ ''
+! !
+
+!Presentation methodsFor: 'actions'!
+
+reload
+	'#slides' asJQuery remove.
+	'#tools' asJQuery remove.
+	'body' asJQuery append: self.
+	self checkHash
+!
+
+setup
+	Presentation setCurrent: self.
+	JQuery documentReady: [
+		'body' asJQuery append: self.
+		self 
+			setKeybindings;
+			checkHashChange;
+			checkHash].
+!
+
+nextSlide
+	| next |
+	self currentSlide ifNotNil: [
+		next := self slides 
+			at: (self slides indexOf: self currentSlide) + 1
+			ifAbsent: [nil].
+		next ifNotNil: [currentSlide := next. next show]]
+!
+
+showCurrentSlide
+	self currentSlide ifNotNil: [
+		'.slide' asJQuery hide.
+		('#', self currentSlide id) asJQuery show]
+!
+
+previousSlide
+	| next |
+	self currentSlide ifNotNil: [
+		next := self slides 
+			at: (self slides indexOf: self currentSlide) - 1
+			ifAbsent: [nil].
+		next ifNotNil: [currentSlide := next. next show]]
+!
+
+setKeybindings
+	JQuery document on: 'keyup' do: [:e || node |
+		node := e target nodeName asLowercase.
+		(node = 'textarea' or: [node = 'input']) ifFalse: [
+			e keyCode = 39 ifTrue: [self nextSlide].
+			e keyCode = 37 ifTrue: [self previousSlide]]]
+!
+
+checkHashChange
+	JQuery window on: 'hashchange' do: [self checkHash]
+!
+
+checkHash
+	| hash slide |
+	hash := document location hash  replace: '^#' with: ''.
+	slide := self slides detect:  [:each | each id = hash] ifNone: [nil].
+	slide ifNotNil: [
+		self currentSlide = slide ifFalse: [
+			self currentSlide: slide.
+			slide show]]
+! !
+
+!Presentation methodsFor: 'initialization'!
+
+initSlides
+	slides := self slideClasses collect: [:each | each on: self]
+! !
+
+!Presentation methodsFor: 'rendering'!
+
+renderOn: html
+	html style
+		type: 'text/css';
+		with: self style.
+	html div 
+		id: 'tools';
+		with: [self renderToolsOn: html].
+	html div 
+		id: 'slides';
+		with: [self renderSlidesOn: html]
+!
+
+renderSlidesOn: html
+	self slides do: [:each | 
+		each renderOn: html].
+	currentSlide ifNil: [currentSlide := self slides first].
+	self showCurrentSlide
+!
+
+renderToolsOn: html
+	html a 
+		with: 'IDE';
+		onClick: [TabManager current open].
+	html a
+		with: 'Reload';
+		onClick: [self reload].
+	html a
+		with: '←';
+		onClick: [self previousSlide].
+	html a
+		with: '→';
+		onClick: [self nextSlide]
+! !
+
+Presentation class instanceVariableNames: 'current'!
+
+!Presentation class methodsFor: 'initialization'!
+
+initialize
+	self isConcrete ifTrue: [self setup]
+!
+
+setup
+	self new setup
+!
+
+setCurrent: aSlides
+	current := aSlides
+!
+
+current
+	^current
+! !
+
+!Presentation class methodsFor: 'testing'!
+
+isConcrete
+	^false
+! !
+
+Presentation subclass: #ESUG2011Presentation
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!ESUG2011Presentation methodsFor: 'accessing'!
+
+title
+	^'Jtalk'
+!
+
+description
+	^'ESUG 2011, Edinburgh'
+!
+
+author
+	^'Nicolas Petton'
+!
+
+email
+	^'nico@objectfusion.fr'
+!
+
+url
+	^'http://jtalk-project.org'
+!
+
+slideClasses
+	^Array new
+		add: IntroSlide;
+		add: AboutSlide;
+		add: WhatIsJtalkSlide;
+		add: JtalkFeaturesSlide;
+		add: WorkspaceSlide;
+		add: IDESlide;
+		add: CountersSlide;
+		add: JtalkAndJavascriptSlide;
+		add: JtalkAndJavascriptSlide2;
+		add: JtalkAndJavascriptSlide3;
+		add: JtalkAndJavascriptSlide4;
+		add: JtalkAndCLI;
+		add: JtalkAndNode;
+		add: JtalkAndNode2;
+		add: JtalkAndNode3;
+		add: JtalkAndWebOS;
+		add: JtalkAndEnyo;
+		add: ContributionsSlide;
+		yourself
+!
+
+style
+	^'
+body {
+    font-family: Helvetica,Arial,sans;
+}
+
+#slides {
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    background: #555;
+}
+
+.slide {
+    background: #fff;
+    color: #444;
+    text-align: left;
+    font-size: 20px;
+    line-height: 1.8em;
+    height: 500px;
+    width: 700px;
+    padding: 60px;
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    margin-left: -420px;
+    margin-top: -320px;
+    box-shadow: 0 0 20px #111;
+    -moz-box-shadow: 0 0 20px #111;
+    -webkit-box-shadow: 0 0 20px #111;
+}
+
+.slide.transparent {
+    background: transparent;
+    box-shadow: 0 0 0 none;
+    -moz-box-shadow: 0 0 0 transparent;
+    -webkit-box-shadow: 0 0 0 transparent;
+    color: #fff !!important;
+}
+
+.slide.black {
+    background: black;
+    background-image: -webkit-gradient(
+	linear,
+	left bottom,
+	left top,
+	color-stop(0.38, rgb(79,79,79)),
+	color-stop(0.69, rgb(33,33,33)),
+	color-stop(0.86, rgb(4,4,4))
+    );
+    background-image: -moz-linear-gradient(
+	center bottom,
+	rgb(79,79,79) 38%,
+	rgb(33,33,33) 69%,
+	rgb(4,4,4) 86%
+    );
+    color: #fff !!important;
+}
+
+.slide.black h1, .slide.black h2, .slide.black h3,
+.slide.transparent h1, .slide.transparent h2, .slide.transparent h3 {
+    color: #fff;
+    text-shadow: 0 1px 4px #aaa;
+}
+
+.slide.black a, .slide.transparent a {
+    color: #ccc;
+}
+
+.slide.white {
+    color: #333 !!important;
+}
+
+.slide.white h1, .slide.white h2, .slide.white h3 {
+    color: #333;
+}
+
+.slide.white a {
+    color: #333;
+}
+
+
+.slide h1, .slide h2, .slide h3 {
+    color: #333;
+    /* text-align: center; */
+}
+
+.slide h1 {
+    font-family: "Droid Sans";
+    font-size: 36px;
+    text-shadow: 0 1px 4px #aaa;
+    margin-top: 30px;
+    margin-bottom: 50px;
+}
+
+/* .slide ul, .slide li { */
+/*     padding: 0; */
+/*     margin: 0; */
+/* } */
+
+.slide button {
+    font-size: 18px;
+}
+
+.slide a {
+    color: #555;
+    text-decoration: none;
+    cursor: pointer;
+}
+
+.slide a:hover {
+    color: #fff;
+    background: #555;
+}
+
+.slide .right {
+    text-align: right;
+}
+
+.slide .section.center {
+    text-align: center;
+    display: table-cell;
+    vertical-align: middle;
+    width: 700px;
+    height: 500px;
+}
+
+.slide code {
+    font-family: "Droid Sans Mono";
+    color: #444;
+    border: 1px solid #ddd;
+    background: #eee;
+    border-radius: 4px;
+    padding: 2px;
+    font-size: 16px;
+}
+
+.slide .code2 {
+    font-family: "Droid Sans Mono";
+    line-height: 1.2em;
+    color: #444;
+    padding: 2px;
+    font-size: 16px;
+}
+
+
+.slide .CodeMirror {
+    width: 500px;
+    height: 300px;
+    text-align: left;
+}
+
+.slide .CodeMirror-scroll {
+    text-align: left;
+}
+
+.slide .fancy {
+    margin-top: 30px;
+    -webkit-transform: rotate(-10deg);
+    -moz-transform: rotate(-10deg);
+    transform: rotate(-10deg);
+    color: red;
+}
+
+.slide .comment {
+    opacity: 0.6;
+    font-weight: normal;
+}
+
+.slide .red {
+    color: red;
+}
+
+.slide .blue {
+    color: blue;
+}
+
+.slide#WhatIsJtalk {
+    background: white url("esug2011/images/balloon.jpg") 650px 50px no-repeat;
+}
+
+.slide#ide {
+    background: black url("esug2011/images/ide_star_wars.png") center center no-repeat;
+}
+
+.slide#JtalkAndCLI {
+    background: white url("esug2011/images/terminal.png") 620px 20px no-repeat;
+}
+
+.slide#JtalkAndNode {
+    background: white url("esug2011/images/nodejs.png") 580px 40px no-repeat;
+}
+.slide#JtalkAndNode2 {
+    background: white url("esug2011/images/nodejs.png") 580px 40px no-repeat;
+}
+
+.slide#JtalkAndNode3 {
+    background: white url("esug2011/images/nodejs.png") 580px 40px no-repeat;
+}
+
+.slide#JtalkAndWebOS {
+    background: white url("esug2011/images/devices.jpg") 380px 280px no-repeat;
+}
+
+.slide#JtalkAndEnyo {
+    background: white url("esug2011/images/enyo.png") 130px 150px no-repeat;
+}
+
+.slide#links {
+    background: white url("esug2011/images/asterix.png") 30px 130px no-repeat;
+}
+
+.slide#links .section {
+    margin-left: 250px;
+    margin-top: 200px;
+    font-family: "Droid Sans";
+    font-size: 26px;
+    font-weight: bold;
+}
+
+
+#meta {
+    position: absolute;
+    font-size: 12px;
+    opacity: 0.6;
+    bottom: 0;
+    right: 0;
+    z-index: 2;
+    background: #333;
+    text-align: right;
+    padding: 0 10px;
+    line-height: 1.8em;
+    color: #eee;
+    border-top-left-radius: 5px;
+}
+
+#meta:hover {
+    opacity: 0.8;
+}
+
+#meta p {
+    display: inline;
+    padding: 0 5px;
+}
+
+#meta a {
+    //background: #ccc;
+    color: #ccc;
+    text-decoration: none;
+    padding: 0 5px;
+}
+
+#tools {
+    z-index: 1;
+    position: fixed;
+    top: 0;
+    left: 50%;
+    margin-left: -150px;
+    width: 300px;
+    padding: 5px;
+    border-radius: 5px;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    background: #333;
+    opacity: 0.3;
+    color: #eee;
+}
+
+#tools a {
+    font-weight: bold;
+    color: #eee;
+    text-decoration: none;
+    cursor: pointer;
+    padding: 0 2px;
+    font-size: 14px;
+}
+
+#tools:hover {
+    opacity: 0.8;
+}
+
+.slide {
+    
+}
+'
+! !
+
+ESUG2011Presentation class instanceVariableNames: 'current'!
+
+!ESUG2011Presentation class methodsFor: 'testing'!
+
+isConcrete
+	^true
+! !
+
+Slide subclass: #IntroSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!IntroSlide methodsFor: 'accessing'!
+
+id
+	^'intro'
+!
+
+cssClass
+	^'slide black'
+! !
+
+!IntroSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html div class: 'section center'; with: [
+		html h1 with: 'Jtalk, the Smalltalk for Web developers'.
+		html p with: self presentation author, ' & Göran Krampe - ', self presentation description.
+		html p with: [
+			html a
+				with: self presentation email;
+				href: 'mailto:', self presentation email].
+		html p with: [
+			html a
+				with: 'goran@krampe.se';
+				href: 'mailto:goran@krampe.se'].
+		
+          	html p with: [
+			html a
+				with: 'objectfusion.fr';
+				href: 'http://www.objectfusion.fr']]
+! !
+
+Slide subclass: #WhatIsJtalkSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!WhatIsJtalkSlide methodsFor: 'accessing'!
+
+id
+	^'WhatIsJtalk'
+! !
+
+!WhatIsJtalkSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html div class: 'section center'; with: [
+		html h1 with: 'Jtalk in a nutshell'.
+		html h2 with: 'Jtalk is an implementation of Smalltalk'.
+		html h2 with: 'Jtalk runs on top of the JavaScript runtime'.
+		html h2 with: 'Jtalk is an opensource project (MIT)'.
+		html h2 class: 'fancy'; with: 'Jtalk is cool!!']
+! !
+
+Slide subclass: #JtalkFeaturesSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkFeaturesSlide methodsFor: 'accessing'!
+
+id
+	^'features'
+! !
+
+!JtalkFeaturesSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html h1 with: 'Jtalk features'.
+	html ul with: [
+		html li with: 'Jtalk is (mostly) written in itself, including the parser & compiler'.
+		html li with: 'Full Smalltalk object system, including classes & metaclasses, etc'.
+		html li with: 'Core libraries (streams, collections, RegExp, etc)'.
+		html li with: 'Web related libraries: HTML Canvas, DOM manipulation'.
+		html li with: 'Full featured IDE'.
+		html li with: [
+			html with:'Advanced Smalltalk features, including '.
+			html code with: '#doesNotUnderstand:'.
+			html with: ' support and '.
+			html code with: 'thisContext']]
+! !
+
+Slide subclass: #AboutSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!AboutSlide methodsFor: 'accessing'!
+
+id
+	^'about'
+!
+
+cssClass
+	^'slide transparent white'
+!
+
+backgroundColor
+	^'white'
+! !
+
+!AboutSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html div class: 'section center'; with: [
+		html h1 with: 'About this presentation'.
+		html p with: 'This presentation is entirely written in Jtalk and is licensed under CC BY-SA.'.
+		html p with: [
+			html with: 'Press '.
+			html code with: '←'.
+			html with: ' to move backward and '.
+			html code with: ' →'.
+			html with: ' to move forward.'].
+		html p with: [
+			html with: 'Open a '.
+			html button 
+				with: 'browser';
+				onClick: [Browser openOn: Presentation].
+			html with: ' to edit the source code.']]
+! !
+
+Slide subclass: #JtalkAndJavascriptSlide3
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndJavascriptSlide3 methodsFor: 'accessing'!
+
+id
+	^'jtalkAndJs3'
+!
+
+backgroundColor
+	^'#08C'
+! !
+
+!JtalkAndJavascriptSlide3 methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Smalltalk '.
+		html span class: 'red'; with: '♥'.
+		html with: ' JavaScript'].
+	html h2 with: 'Smalltalk ⇒ JavaScript'.
+	html ol with: [
+		html li 
+			with: 'Unary messages begin with an underscore: ';
+			with: [html code with: 'yourself'];
+			with: ' becomes ';
+			with: [html code with: '_yourself()'].
+		html li 
+			with: 'Binary messages are prefixed with 2 underscores: ';
+			with: [html code with: '3@4'];
+			with: ' becomes ';
+			with: [html code with: '(3).__at(4)'].
+		html li 
+			with: 'Keyword message follow the same rules as unary messages, with a final underscore: ';
+			with: [html code with: 'aDictionary at: 3 put: 4'];
+			with: ' becomes ';
+			with: [html code with: 'aDictionary._at_put_(3, 4)']]
+! !
+
+Slide subclass: #JtalkAndJavascriptSlide2
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndJavascriptSlide2 methodsFor: 'accessing'!
+
+id
+	^'jtalkAndJs2'
+!
+
+backgroundColor
+	^'#08C'
+! !
+
+!JtalkAndJavascriptSlide2 methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Smalltalk '.
+		html span class: 'red'; with: '♥'.
+		html with: ' JavaScript'].
+	html h2 with: 'Jtalk maps one to one with the JavaScript equivalent:'.
+	html ul with: [
+		html li with: 'String ⇔ String'.
+		html li with: 'Number ⇔ Number'.
+		html li with: 'BlockClosure ⇔ function'.
+		html li with: 'Dictionary ⇔ Object'.
+		html li with: 'Error ⇔ Error'.
+		html li with: 'etc.']
+! !
+
+Slide subclass: #JtalkAndJavascriptSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndJavascriptSlide methodsFor: 'accessing'!
+
+id
+	^'jtalkAndJs'
+!
+
+cssClass
+	^'slide transparent'
+!
+
+backgroundColor
+	^'#08C'
+! !
+
+!JtalkAndJavascriptSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html div class: 'section center'; with: [
+		html h1 with: [
+			html with: 'Smalltalk '.
+			html span class: 'red'; with: '♥'.
+			html with: ' JavaScript']]
+! !
+
+Slide subclass: #WorkspaceSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!WorkspaceSlide methodsFor: 'accessing'!
+
+id
+	^'workspace'
+!
+
+backgroundColor
+	^'#18bd7d'
+!
+
+renderSlideOn: html
+	| workspace |
+	workspace := SourceArea new.
+	html div class: 'section center'; with: [
+		html h1 with: 'Give Jtalk a try!!'.
+		workspace renderOn: html.
+		html div with: [
+			html button
+				with: 'DoIt';
+				onClick: [workspace doIt].
+			html button
+				with: 'PrintIt';
+				onClick: [workspace printIt].
+			html button
+				with: 'InspectIt';
+				onClick: [workspace inspectIt]]]
+! !
+
+Slide subclass: #CountersSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!CountersSlide methodsFor: 'accessing'!
+
+id
+	^'counters'
+!
+
+backgroundColor
+	^'#18bd7d'
+! !
+
+!CountersSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html div class: 'section center'; with: [
+		html h1 with: 'The counter example'.
+		html div with: [
+			2 timesRepeat: [Counter new renderOn: html]]]
+! !
+
+Slide subclass: #JtalkAndJavascriptSlide4
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndJavascriptSlide4 methodsFor: 'accessing'!
+
+id
+	^'jtalkAndJs4'
+!
+
+backgroundColor
+	^'#08C'
+! !
+
+!JtalkAndJavascriptSlide4 methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'JavaScript '.
+		html span class: 'red'; with: '♥'.
+		html with: ' Smalltalk too!! ';
+		with: [html span class: 'comment'; with: '(how cute)']].
+	html h2 with: 'JavaScript ⇒ Smalltalk'.
+	html ol with: [
+		html li 
+			with: [html code with: 'someUser.name'];
+			with: ' becomes ';
+			with: [html code with: 'someUser name'].
+		html li 
+			with: [html code with: 'someUser name = "John"'];
+			with: ' becomes ';
+			with: [html code with: 'someUser name: ''John'''].
+		html li 
+			with: [html code with: 'console.log(''hello world'')'];
+			with: ' becomes ';
+			with: [html code with: 'console log: ''hello world'''].
+		html li 
+			with: [html code with: 'window.jQuery(''foo'').css(''background'', ''red'')'];
+			with: ' becomes ';
+			with: [html br];
+			with: [html code with: '(window jQuery: ''foo'') css: ''background'' color: ''red''']]
+! !
+
+Slide subclass: #IDESlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!IDESlide methodsFor: 'accessing'!
+
+id
+	^'ide'
+!
+
+backgroundColor
+	^'black'
+!
+
+cssClass
+	^'slide transparent'
+! !
+
+!IDESlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+"	html div class: 'section center'; with: [
+		html h1 
+			with: 'The wonderful Jtalk ';
+			with: [
+				html a 
+					with: 'development tools';
+					onClick: [TabManager current open]];
+			with: '.']
+"
+! !
+
+Slide subclass: #ContributionsSlide
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!ContributionsSlide methodsFor: 'accessing'!
+
+id
+	^'links'
+! !
+
+!ContributionsSlide methodsFor: 'rendering'!
+
+renderSlideOn: html
+	html div class: 'section'; with: [
+		html p with: [
+			html a href: 'http://jtalk-project.org'; with: 'jtalk-project.org'].
+		html p with: [
+			html a href: 'https://github.com/NicolasPetton/jtalk'; with: 'github.com/NicolasPetton/jtalk'].
+		html p with: [
+			html a href: 'http://http://groups.google.com/group/jtalk-project'; with: 'groups.google.com/group/jtalk-project']]
+! !
+
+Slide subclass: #JtalkAndCLI
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndCLI methodsFor: 'not yet classified'!
+
+backgroundColor
+	^'#0A1'
+!
+
+id
+	^'JtalkAndCLI'
+!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Jtalk and '.
+		html span class: 'blue'; with: 'the command line'].
+
+	html h2 with: 'jtalkc - a fairly elaborate bash script that:'.
+
+	html ul with: [
+		html li with: 'Uses Node.js to run the Jtalk Compiler'.
+		html li with: 'Compiles .st files to .js'.
+		html li with: 'Links .js files into a single one'.
+		html li with: 'Adds class initilization and/or call to main'.
+		html li with: 'Optionally runs Google Closure compiler']
+! !
+
+Slide subclass: #JtalkAndNode
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndNode methodsFor: 'not yet classified'!
+
+backgroundColor
+	^'#0A1'
+!
+
+id
+	^'JtalkAndNode'
+!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Jtalk and '.
+		html span class: 'blue'; with: 'Node.js'].
+
+	html h2 with: 'Hello.st:'.
+	html pre with: [
+		html div class: 'code2'; with:  'Object subclass: #Hello
+        instanceVariableNames: ''''
+        category: ''Hello''!!
+
+!!Hello class methodsFor: ''main''!!
+main
+	console log: ''Hello world from JTalk in Node.js''
+!! !!']
+! !
+
+Slide subclass: #JtalkAndNode2
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndNode2 methodsFor: 'not yet classified'!
+
+backgroundColor
+	^'#0A1'
+!
+
+id
+	^'JtalkAndNode2'
+!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Jtalk and '.
+		html span class: 'blue'; with: 'Node.js'].
+
+	html h2 with: 'Makefile:'.
+	html pre with: [
+		html div class: 'code2'; with:  'Program.js: Hello.st
+	../../bin/jtalkc -N -m Hello Hello.st Program
+
+run: Program.js
+	./hello
+
+clean:
+	rm -f Program.js Hello.js
+'].
+html h2 with: 'hello:'.
+	html pre with: [
+		html div class: 'code2'; with:  'node Program.js $@']
+! !
+
+Slide subclass: #JtalkAndNode3
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndNode3 methodsFor: 'not yet classified'!
+
+backgroundColor
+	^'#0A1'
+!
+
+id
+	^'JtalkAndNode3'
+!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Jtalk and '.
+		html span class: 'blue'; with: 'Node.js'].
+
+	html h2 with: 'make clean && make run:'.
+
+	html pre with: [
+		html div class: 'code2'; with:  'rm -f Program.js Hello.js
+../../bin/jtalkc -N -m Hello Hello.st Program
+Loading libraries  /home/gokr/jtalk/js/boot.js /home/gokr/jtalk/js/Kernel.js
+/home/gokr/jtalk/js/Parser.js /home/gokr/jtalk/js/Compiler.js
+/home/gokr/jtalk/js/init.js /home/gokr/jtalk/nodejs/nodecompile.js
+and compiling ...
+Compiling in debugMode: false
+Reading file Hello.st
+Exporting category Hello as Hello.js
+Adding libraries  /home/gokr/jtalk/js/boot.js /home/gokr/jtalk/js/Kernel.js  ...
+Adding Jtalk code Hello.js ...
+Adding initializer /home/gokr/jtalk/js/init.js ...
+Adding call to Hello class >> main ...
+Writing Program.js ...
+Done.
+./hello'.
+html span class: 'blue'; with:'Hello world from JTalk in Node.js']
+! !
+
+Slide subclass: #JtalkAndWebOS
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndWebOS methodsFor: 'not yet classified'!
+
+backgroundColor
+	^'#0A1'
+!
+
+id
+	^'JtalkAndWebOS'
+!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Jtalk and '.
+		html span class: 'blue'; with: 'webOS'].
+
+	html h2 with: 'A really cool mobile OS based on Linux:'.
+
+	html ul with: [
+		html li with: 'The primary language in webOS is Javascript'.
+		html li with: 'The new UI framework for webOS 3.0 is called Enyo'.
+		html li with: 'Regular apps run in V8 + Webkit'.
+		html li with: 'Background services run in Node.js']
+! !
+
+Slide subclass: #JtalkAndEnyo
+	instanceVariableNames: ''
+	category: 'Presentation'!
+
+!JtalkAndEnyo methodsFor: 'not yet classified'!
+
+id
+	^'JtalkAndEnyo'
+!
+
+backgroundColor
+	^'#0A1'
+!
+
+renderSlideOn: html
+	html h1 with: [
+		html with: 'Jtalk and '.
+		html span class: 'blue'; with: 'Enyo'].
+! !
+

+ 18 - 0
examples/trysmalltalk/index.html

@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>TrySmalltalk</title>
+<script src="../../js/jtalk.js" type="text/javascript"></script>
+</head>
+<body>
+<script type="text/javascript"> 
+	loadJtalk({
+		files: ['TrySmalltalk.js'],
+		prefix: 'examples/trysmalltalk/js',
+		ready: function() {
+			smalltalk.Browser._openOn_(smalltalk.ProfStef)
+			smalltalk.TrySmalltalkWidget._open();
+		}}); 
+</script>
+
+</body>
+</html>

+ 121 - 110
examples/trysmalltalk/TrySmalltalk.deploy.js → examples/trysmalltalk/js/TrySmalltalk.deploy.js

@@ -1,16 +1,4 @@
 smalltalk.addClass('TrySmalltalkWidget', smalltalk.Widget, ['workspace', 'contents', 'header'], 'TrySmalltalk');
-smalltalk.addMethod(
-'_renderOn_',
-smalltalk.method({
-selector: 'renderOn:',
-fn: function (html){
-var self=this;
-(function($rec){smalltalk.send($rec, "_class_", ["profStef"]);smalltalk.send($rec, "_with_", [(function(){return self['@header']=smalltalk.send(html, "_h2", []);})]);smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_renderOn_", [html]);})]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(self, "_renderButtonsOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
-(function($rec){smalltalk.send($rec, "_widget_", [self]);return smalltalk.send($rec, "_showCurrentLesson", []);})(smalltalk.send((smalltalk.ProfStef || ProfStef), "_default", []));
-return self;}
-}),
-smalltalk.TrySmalltalkWidget);
-
 smalltalk.addMethod(
 '_workspace',
 smalltalk.method({
@@ -44,6 +32,29 @@ return self;}
 }),
 smalltalk.TrySmalltalkWidget);
 
+smalltalk.addMethod(
+'_setTitle_',
+smalltalk.method({
+selector: 'setTitle:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [aString]);})]);
+return self;}
+}),
+smalltalk.TrySmalltalkWidget);
+
+smalltalk.addMethod(
+'_renderOn_',
+smalltalk.method({
+selector: 'renderOn:',
+fn: function (html){
+var self=this;
+(function($rec){smalltalk.send($rec, "_class_", ["profStef"]);smalltalk.send($rec, "_with_", [(function(){return self['@header']=smalltalk.send(html, "_h2", []);})]);smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_renderOn_", [html]);})]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(self, "_renderButtonsOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
+(function($rec){smalltalk.send($rec, "_widget_", [self]);return smalltalk.send($rec, "_showCurrentLesson", []);})(smalltalk.send((smalltalk.ProfStef || ProfStef), "_default", []));
+return self;}
+}),
+smalltalk.TrySmalltalkWidget);
+
 smalltalk.addMethod(
 '_renderButtonsOn_',
 smalltalk.method({
@@ -57,17 +68,17 @@ return self;}
 }),
 smalltalk.TrySmalltalkWidget);
 
+
 smalltalk.addMethod(
-'_setTitle_',
+'_open',
 smalltalk.method({
-selector: 'setTitle:',
-fn: function (aString){
+selector: 'open',
+fn: function (){
 var self=this;
-smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [aString]);})]);
+smalltalk.send(smalltalk.send(self, "_new", []), "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
 return self;}
 }),
-smalltalk.TrySmalltalkWidget);
-
+smalltalk.TrySmalltalkWidget.klass);
 
 
 smalltalk.addClass('AbstractTutorial', smalltalk.Object, [], 'TrySmalltalk');
@@ -94,58 +105,58 @@ return self;}
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_welcome',
+'_lessonAt_',
 smalltalk.method({
-selector: 'welcome',
-fn: function (){
+selector: 'lessonAt:',
+fn: function (anInteger){
 var self=this;
-return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Welcome", unescape("%22Hi%2C%20this%20is%20a%20test%20tutorial.%22")]);
+var lessonSelector=nil;
+lessonSelector=smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_at_", [anInteger]);
+return smalltalk.send(self, "_perform_", [lessonSelector]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_testLesson',
+'_size',
 smalltalk.method({
-selector: 'testLesson',
+selector: 'size',
 fn: function (){
 var self=this;
-return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Test Lesson", unescape("%22This%20lesson%20is%20a%20test%22")]);
+return smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_size", []);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_theEnd',
+'_welcome',
 smalltalk.method({
-selector: 'theEnd',
+selector: 'welcome',
 fn: function (){
 var self=this;
-return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["The End", unescape("%22And%20that%27d%20be%20pretty%20much%20it%20%3A%29%22")]);
+return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Welcome", unescape("%22Hi%2C%20this%20is%20a%20test%20tutorial.%22")]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_lessonAt_',
+'_testLesson',
 smalltalk.method({
-selector: 'lessonAt:',
-fn: function (anInteger){
+selector: 'testLesson',
+fn: function (){
 var self=this;
-var lessonSelector=nil;
-lessonSelector=smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_at_", [anInteger]);
-return smalltalk.send(self, "_perform_", [lessonSelector]);
+return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Test Lesson", unescape("%22This%20lesson%20is%20a%20test%22")]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_size',
+'_theEnd',
 smalltalk.method({
-selector: 'size',
+selector: 'theEnd',
 fn: function (){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_size", []);
+return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["The End", unescape("%22And%20that%27d%20be%20pretty%20much%20it%20%3A%29%22")]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
@@ -223,115 +234,115 @@ return self;}
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_first',
+'_size',
 smalltalk.method({
-selector: 'first',
+selector: 'size',
 fn: function (){
 var self=this;
-smalltalk.send(self, "_rewind", []);
-return smalltalk.send(self, "_currentLesson", []);
+return smalltalk.send(smalltalk.send(self, "_tutorial", []), "_size", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_last',
+'_tutorial',
 smalltalk.method({
-selector: 'last',
+selector: 'tutorial',
 fn: function (){
 var self=this;
-self['@tutorialPosition']=smalltalk.send(self, "_size", []);
-return smalltalk.send(self, "_currentLesson", []);
+return (($receiver = self['@tutorial']) == nil || $receiver == undefined) ? (function(){return self['@tutorial']=smalltalk.send((smalltalk.SmalltalkSyntaxTutorial || SmalltalkSyntaxTutorial), "_new", []);})() : $receiver;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_next',
+'_tutorial_',
 smalltalk.method({
-selector: 'next',
-fn: function (){
+selector: 'tutorial:',
+fn: function (aTutorial){
 var self=this;
-(($receiver = (($receiver = smalltalk.send(self, "_tutorialPosition", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(self, "_size", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(self, "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})]);
-return smalltalk.send(self, "_currentLesson", []);
+self['@tutorial']=aTutorial;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_previous',
+'_tutorialPosition',
 smalltalk.method({
-selector: 'previous',
+selector: 'tutorialPosition',
 fn: function (){
 var self=this;
-(($receiver = (($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver >(1) : smalltalk.send($receiver, "__gt", [(1)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})]);
-return smalltalk.send(self, "_currentLesson", []);
+return (($receiver = self['@tutorialPosition']) == nil || $receiver == undefined) ? (function(){smalltalk.send(self, "_rewind", []);return self['@tutorialPosition'];})() : $receiver;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_rewind',
+'_tutorialPosition_',
 smalltalk.method({
-selector: 'rewind',
-fn: function (){
+selector: 'tutorialPosition:',
+fn: function (aTutorialPosition){
 var self=this;
-self['@tutorialPosition']=(1);
+self['@tutorialPosition']=aTutorialPosition;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_size',
+'_first',
 smalltalk.method({
-selector: 'size',
+selector: 'first',
 fn: function (){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_tutorial", []), "_size", []);
+smalltalk.send(self, "_rewind", []);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorial',
+'_last',
 smalltalk.method({
-selector: 'tutorial',
+selector: 'last',
 fn: function (){
 var self=this;
-return (($receiver = self['@tutorial']) == nil || $receiver == undefined) ? (function(){return self['@tutorial']=smalltalk.send((smalltalk.SmalltalkSyntaxTutorial || SmalltalkSyntaxTutorial), "_new", []);})() : $receiver;
+self['@tutorialPosition']=smalltalk.send(self, "_size", []);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorial_',
+'_next',
 smalltalk.method({
-selector: 'tutorial:',
-fn: function (aTutorial){
+selector: 'next',
+fn: function (){
 var self=this;
-self['@tutorial']=aTutorial;
+(($receiver = (($receiver = smalltalk.send(self, "_tutorialPosition", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(self, "_size", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(self, "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})]);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorialPosition',
+'_previous',
 smalltalk.method({
-selector: 'tutorialPosition',
+selector: 'previous',
 fn: function (){
 var self=this;
-return (($receiver = self['@tutorialPosition']) == nil || $receiver == undefined) ? (function(){smalltalk.send(self, "_rewind", []);return self['@tutorialPosition'];})() : $receiver;
+(($receiver = (($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver >(1) : smalltalk.send($receiver, "__gt", [(1)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})]);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorialPosition_',
+'_rewind',
 smalltalk.method({
-selector: 'tutorialPosition:',
-fn: function (aTutorialPosition){
+selector: 'rewind',
+fn: function (){
 var self=this;
-self['@tutorialPosition']=aTutorialPosition;
+self['@tutorialPosition']=(1);
 return self;}
 }),
 smalltalk.TutorialPlayer);
@@ -350,18 +361,6 @@ return self;}
 }),
 smalltalk.ProfStef);
 
-smalltalk.addMethod(
-'_first',
-smalltalk.method({
-selector: 'first',
-fn: function (){
-var self=this;
-smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_first", []);
-return smalltalk.send(self, "_showCurrentLesson", []);
-return self;}
-}),
-smalltalk.ProfStef);
-
 smalltalk.addMethod(
 '_progress',
 smalltalk.method({
@@ -396,50 +395,62 @@ return self;}
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_next',
+'_widget_',
 smalltalk.method({
-selector: 'next',
+selector: 'widget:',
+fn: function (aWidget){
+var self=this;
+self['@widget']=aWidget;
+return self;}
+}),
+smalltalk.ProfStef);
+
+smalltalk.addMethod(
+'_showCurrentLesson',
+smalltalk.method({
+selector: 'showCurrentLesson',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_next", []);
-return smalltalk.send(self, "_showCurrentLesson", []);
+var lesson=nil;
+lesson=smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_currentLesson", []);
+smalltalk.send(self['@widget'], "_contents_", [smalltalk.send(lesson, "_contents", [])]);
+smalltalk.send(self['@widget'], "_setTitle_", [smalltalk.send(smalltalk.send(smalltalk.send(lesson, "_title", []), "__comma", [" "]), "__comma", [smalltalk.send(self, "_progress", [])])]);
 return self;}
 }),
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_previous',
+'_first',
 smalltalk.method({
-selector: 'previous',
+selector: 'first',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_previous", []);
+smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_first", []);
 return smalltalk.send(self, "_showCurrentLesson", []);
 return self;}
 }),
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_widget_',
+'_next',
 smalltalk.method({
-selector: 'widget:',
-fn: function (aWidget){
+selector: 'next',
+fn: function (){
 var self=this;
-self['@widget']=aWidget;
+smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_next", []);
+return smalltalk.send(self, "_showCurrentLesson", []);
 return self;}
 }),
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_showCurrentLesson',
+'_previous',
 smalltalk.method({
-selector: 'showCurrentLesson',
+selector: 'previous',
 fn: function (){
 var self=this;
-var lesson=nil;
-lesson=smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_currentLesson", []);
-smalltalk.send(self['@widget'], "_contents_", [smalltalk.send(lesson, "_contents", [])]);
-smalltalk.send(self['@widget'], "_setTitle_", [smalltalk.send(smalltalk.send(smalltalk.send(lesson, "_title", []), "__comma", [" "]), "__comma", [smalltalk.send(self, "_progress", [])])]);
+smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_previous", []);
+return smalltalk.send(self, "_showCurrentLesson", []);
 return self;}
 }),
 smalltalk.ProfStef);
@@ -447,23 +458,23 @@ smalltalk.ProfStef);
 
 smalltalk.ProfStef.klass.iVarNames = ['instance'];
 smalltalk.addMethod(
-'_first',
+'_default',
 smalltalk.method({
-selector: 'first',
+selector: 'default',
 fn: function (){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_default", []), "_first", []);
+return (($receiver = self['@instance']) == nil || $receiver == undefined) ? (function(){return self['@instance']=smalltalk.send(self, "_new", []);})() : $receiver;
 return self;}
 }),
 smalltalk.ProfStef.klass);
 
 smalltalk.addMethod(
-'_default',
+'_first',
 smalltalk.method({
-selector: 'default',
+selector: 'first',
 fn: function (){
 var self=this;
-return (($receiver = self['@instance']) == nil || $receiver == undefined) ? (function(){return self['@instance']=smalltalk.send(self, "_new", []);})() : $receiver;
+return smalltalk.send(smalltalk.send(self, "_default", []), "_first", []);
 return self;}
 }),
 smalltalk.ProfStef.klass);

Plik diff jest za duży
+ 267 - 180
examples/trysmalltalk/js/TrySmalltalk.js


+ 964 - 0
examples/trysmalltalk/st/TrySmalltalk.st

@@ -0,0 +1,964 @@
+Widget subclass: #TrySmalltalkWidget
+	instanceVariableNames: 'workspace contents header'
+	category: 'TrySmalltalk'!
+
+!TrySmalltalkWidget methodsFor: 'accessing'!
+
+workspace
+	^ workspace ifNil: [
+          	workspace := SourceArea new]
+!
+
+contents: aString
+	self workspace val: aString
+!
+
+contents
+	^self workspace val
+!
+
+setTitle: aString
+	header contents: [:html | html with: aString]
+! !
+
+!TrySmalltalkWidget methodsFor: 'rendering'!
+
+renderOn: html
+	html div 
+		class: 'profStef'; 
+		with: [header := html h2];
+		with: [self workspace renderOn: html];
+		with: [self renderButtonsOn: html].
+          ProfStef default 
+		widget: self;
+		showCurrentLesson
+!
+
+renderButtonsOn: html
+    html button
+	with: 'DoIt';
+	title: 'ctrl+d';
+	onClick: [self workspace doIt].
+    html button
+	with: 'PrintIt';
+	title: 'ctrl+p';
+	onClick: [self workspace printIt].
+    html button
+	with: 'InspectIt';
+	title: 'ctrl+i';
+	onClick: [self workspace inspectIt]
+! !
+
+!TrySmalltalkWidget class methodsFor: 'initialize'!
+
+open
+	self new appendToJQuery: 'body' asJQuery.
+! !
+
+Object subclass: #AbstractTutorial
+	instanceVariableNames: ''
+	category: 'TrySmalltalk'!
+!AbstractTutorial commentStamp!
+Parent class of all ProfStef tutorials.
+
+To create your own tutorial:
+- subclass AbstractTutorial
+- implement a few methods which returns a Lesson instance
+- implement tutorial which returns a Collection of selectors to the methods you've created.!
+
+!AbstractTutorial methodsFor: 'accessing'!
+
+indexOfLesson: aSelector
+	^self tableOfContents indexOf: aSelector.
+!
+
+tableOfContents
+^ #(
+  'welcome'
+  'testLesson'
+  'theEnd'
+)
+!
+
+lessonAt: anInteger
+	| lessonSelector |
+	lessonSelector := self tableOfContents at: anInteger.
+	^ self perform: lessonSelector.
+!
+
+size
+	^ self tableOfContents size
+! !
+
+!AbstractTutorial methodsFor: 'pages'!
+
+welcome
+	^ Lesson
+		title: 'Welcome' 
+		contents: '"Hi, this is a test tutorial."'
+!
+
+testLesson
+	^ Lesson
+		title: 'Test Lesson' 
+		contents: '"This lesson is a test"'
+!
+
+theEnd
+	^ Lesson
+		title: 'The End' 
+		contents: '"And that''d be pretty much it :)"'
+! !
+
+Object subclass: #Lesson
+	instanceVariableNames: 'title contents'
+	category: 'TrySmalltalk'!
+
+!Lesson methodsFor: 'accessing'!
+
+contents
+	^ contents ifNil: [contents := '']
+!
+
+contents: aString
+	contents := aString
+!
+
+title: aString
+	title := aString
+!
+
+title
+	^ title ifNil: [title := '']
+! !
+
+!Lesson class methodsFor: 'instance creation'!
+
+title: aTitle contents: someContents
+	^ (self new)
+		title: aTitle;
+		contents: someContents
+! !
+
+Object subclass: #TutorialPlayer
+	instanceVariableNames: 'tutorialPosition tutorial'
+	category: 'TrySmalltalk'!
+!TutorialPlayer commentStamp!
+I can navigate through an AbstractTutorial subclass. With #next and #previous you can go forward and backward through the tutorial.!
+
+!TutorialPlayer methodsFor: 'accessing'!
+
+currentLesson
+	^ self tutorial lessonAt: self tutorialPosition.
+!
+
+size
+	^ self tutorial size
+!
+
+tutorial
+	^ tutorial  ifNil: [tutorial := SmalltalkSyntaxTutorial new]
+!
+
+tutorial: aTutorial
+	tutorial := aTutorial
+!
+
+tutorialPosition 
+	^ tutorialPosition  ifNil: [
+		self rewind.
+		tutorialPosition.
+	].
+!
+
+tutorialPosition: aTutorialPosition 
+	tutorialPosition := aTutorialPosition
+! !
+
+!TutorialPlayer methodsFor: 'navigation'!
+
+first
+	self rewind.
+	^ self currentLesson
+!
+
+last
+	tutorialPosition := self size.
+	^ self currentLesson
+!
+
+next
+	self tutorialPosition < self size
+		ifTrue: [tutorialPosition := tutorialPosition + 1].
+	^ self currentLesson
+!
+
+previous
+	tutorialPosition >  1 ifTrue: [tutorialPosition := tutorialPosition  - 1].
+	^ self currentLesson
+!
+
+rewind
+	tutorialPosition := 1.
+! !
+
+Object subclass: #ProfStef
+	instanceVariableNames: 'tutorialPlayer widget'
+	category: 'TrySmalltalk'!
+!ProfStef commentStamp!
+A ProfStef is the Smalltalk teacher. To start the tutorial, evaluate:
+ProfStef go.
+
+To go to the next lesson evaluate:
+ProfStef next.
+
+To execute your own tutorial:
+ProfStef goOn: MyOwnTutorial
+
+To see a table of contents with all defined tutorials:
+ProfStef contents!
+
+!ProfStef methodsFor: 'accessing'!
+
+tutorialPlayer
+	^ tutorialPlayer ifNil: [tutorialPlayer := TutorialPlayer new]
+!
+
+progress
+	^ '(', self tutorialPositionString, '/', self tutorialSizeString, ')'.
+!
+
+tutorialPositionString
+	^ self tutorialPlayer tutorialPosition asString.
+!
+
+tutorialSizeString
+	^ self tutorialPlayer size asString
+!
+
+widget: aWidget
+	widget := aWidget
+!
+
+showCurrentLesson
+	| lesson |
+	lesson := self tutorialPlayer currentLesson.
+	widget contents: lesson contents.
+	widget setTitle: lesson title , ' ' , self progress.
+! !
+
+!ProfStef methodsFor: 'navigation'!
+
+first
+	self tutorialPlayer first.
+	^ self showCurrentLesson.
+!
+
+next
+	self tutorialPlayer next.
+	^ self showCurrentLesson.
+!
+
+previous
+	self tutorialPlayer previous.
+	^ self showCurrentLesson.
+! !
+
+ProfStef class instanceVariableNames: 'instance'!
+
+!ProfStef class methodsFor: 'initialize'!
+
+default 
+	^ instance ifNil: [instance := self new]
+! !
+
+!ProfStef class methodsFor: 'navigation'!
+
+first
+	^ self default first.
+!
+
+previous
+	^ self default previous.
+!
+
+next
+	^ self default next.
+!
+
+go
+	self first.
+! !
+
+AbstractTutorial subclass: #SmalltalkSyntaxTutorial
+	instanceVariableNames: ''
+	category: 'TrySmalltalk'!
+!SmalltalkSyntaxTutorial commentStamp!
+The default ProfStef tutorial to learn Smalltalk syntax!
+
+!SmalltalkSyntaxTutorial methodsFor: 'contents'!
+
+tableOfContents
+^ #(	'welcome'
+	'doingVSPrinting'
+	'printing'
+
+	'basicTypesNumbers'
+	"'basicTypesCharacters'"
+	'basicTypesString'
+	"'basicTypesSymbol'"
+	'basicTypesArray'
+	'basicTypesDynamicArray'
+
+	'messageSyntaxUnary'
+	'messageSyntaxBinary'
+	'messageSyntaxKeyword'
+	'messageSyntaxExecutionOrder'
+	'messageSyntaxExecutionOrderParentheses'
+	'mathematicalPrecedence'
+	'messageSyntaxCascade'
+	'messageSyntaxCascadeShouldNotBeHere'
+
+	'blocks'
+	'blocksAssignation'
+	'conditionals'
+	'loops'
+	'iterators'
+
+	'instanciation'
+
+	'reflection'
+	'reflectionContinued'
+	"'pharoEnvironment'"
+
+	"'debugger'"
+	'theEnd' )
+! !
+
+!SmalltalkSyntaxTutorial methodsFor: 'pages'!
+
+basicTypesArray
+	^ Lesson
+title: 'Basic types: Array' 
+contents: 
+'"Literal arrays are created at parse time:"
+
+#(1 2 3).
+
+#( 1 2 3 #(4 5 6)) size.
+
+#(1 2 4) isEmpty.
+
+#(1 2 3) first.
+
+#(''hello'' ''Javascript'') at: 2 put: ''Smalltalk''; yourself.
+
+ProfStef next.'
+!
+
+basicTypesCharacters
+	^ Lesson
+title: 'Basic types: Characters' 
+contents: 
+'"A Character can be instantiated using $ operator:"
+
+$A.
+
+$A class.
+
+$B charCode.
+
+Character cr.
+
+Character space.
+
+"You can print all 256 characters of the ASCII extended set:"
+
+Character allByteCharacters.
+
+ProfStef next.'
+!
+
+basicTypesDynamicArray
+	^ Lesson
+title: 'Basic types: Dynamic Array' 
+contents: 
+'"Dynamic Arrays are created at execution time:"
+
+{ (2+3) . (6*6) }.
+
+{ (2+3) . (6*6) . ''hello'', '' Stef''} size.
+
+
+{ ProfStef } first next.'
+!
+
+basicTypesNumbers
+	^ Lesson
+title: 'Basic types: Numbers' 
+contents: 
+'"You now know how to execute Smalltalk code. 
+
+Now let''s talk about basic objects.
+
+1, 2, 100, 2/3 ... are Numbers, and respond to many messages evaluating mathematical expressions.
+Evaluate these ones:"
+
+2.
+
+(1/3).
+
+(1/3) + (4/5).
+
+(18/5) rounded.
+
+1 class.
+
+1 negated.
+
+1 negated negated.
+
+(1 + 3) odd.
+
+ProfStef next.'
+!
+
+basicTypesString
+	^ Lesson
+title: 'Basic types: Strings' 
+contents: 
+'"A String is a collection of characters. Use single quotes to create a String object. Print these expressions:"
+
+''ProfStef''.
+
+''ProfStef'' size.
+
+''abc'' asUppercase.
+
+''Hello World'' reversed. 
+
+"You can access each character using at: message"
+
+''ProfStef'' at: 1.
+
+"String concatenation uses the comma operator:"
+
+''ProfStef'', '' is cool''.
+
+ProfStef next.'
+!
+
+basicTypesSymbol
+	^ Lesson
+title: 'Basic types: Symbols' 
+contents: 
+'"A Symbol is a String which is guaranteed to be globally unique. 
+
+There is one and only one Symbol #ProfStef. There may be several ''ProfStef'' String objects.
+
+(Message == returns true if the two objects are the SAME)"
+
+''ProfStef'' asSymbol.
+
+#ProfStef asString.
+
+(2 asString) == (2 asString).
+
+(2 asString) asSymbol == (2 asString) asSymbol.
+
+
+(Smalltalk at: #ProfStef) next.'
+!
+
+blocks
+	^ Lesson
+title: 'Blocks' 
+contents: 
+'"Cascade is cool !! Let''s talk about blocks.
+
+Blocks are anonymous methods that can be stored into variables and executed on demand.
+
+Blocks are delimited by square brackets: []"
+
+[Transcript open].
+
+"does not open a Transcript because the block is not executed.
+
+Here is a block that adds 2 to its argument (its argument is named x):"
+
+[:x | x+2].
+
+"We can execute a block by sending it value messages."
+
+[:x | x+2] value: 5.
+
+[Transcript open] value.
+
+[:x | x+2] value: 10.
+
+[:x :y| x + y] value:3 value:5.
+
+[ProfStef next] value.'
+!
+
+blocksAssignation
+	^ Lesson
+title: 'Block assignation' 
+contents: 
+'"Blocks can be assigned to a variable then executed later.
+
+Note that |b| is the declaration of a variable named ''b'' and that '':='' assigns a value to a variable.
+
+Select the three lines then Print It:"
+
+|b|
+b := [:x | x+2].
+b value: 12.
+
+
+ProfStef next.'
+!
+
+conditionals
+	^ Lesson
+title: 'Conditionals' 
+contents: 
+'"Conditionals are just messages sent to Boolean objects"
+
+1 < 2
+  ifTrue: [100]
+  ifFalse: [42].
+
+"Here the message is ifTrue:ifFalse
+
+Try this:"
+
+Transcript open.
+
+3 > 10 
+	ifTrue: [Transcript show: ''maybe there''''s a bug ....'']
+	ifFalse: [Transcript show: ''No : 3 is less than 10''].
+
+3 = 3 ifTrue: [ProfStef next].'.
+!
+
+debugger
+	^ Lesson
+title: 'Debugger' 
+contents: '"The Debugger may be the most famous tool of Smalltalk environments. It will open as soon as an unmanaged Exception occurs. 
+
+The following code will open the debugger.
+
+***This should be rethought completely***"
+
+
+ '
+!
+
+doingVSPrinting 
+	^ Lesson
+title: 'Doing VS Printing: Doing' 
+contents: 
+'"Cool !! (I like to say Cooool :) ). You''ve just executed a Smalltalk expression. More precisely, you sent the message ''next'' to
+ProfStef class (it''s me !!).
+
+Note you can run this tutorial again by evaluating: ''ProfStef go''. 
+''ProfStef previous'' returns to the previous lesson.
+
+You can also Do It using the keyboard shortcut ''CTRL d''
+
+Try to evaluate this expression:"
+
+window alert: ''hello world!!''.
+
+"Then go to the next lesson:"
+
+ProfStef next.'
+!
+
+instanciation
+	^ Lesson
+title: 'Instanciation' 
+contents: 
+'"Objects are instances of their class. Usually, we send the message #new to a class for creating an instance of this class.
+
+For example, let''s create an instance of the class Array:"
+
+Array new
+	add: ''Some text'';
+	add: 3.;
+	yourself.
+
+"See the array we''ve created? Actually, #(''Some text'' 3) is just a shorthand for instantiating arrays."
+
+"If we use a variable to keep track of this object, we''ll be able to do stuff with it."
+
+"The following code must be ran all at one, as the ''anArray'' variable will cease to exist once the execution finishes:"
+
+|anArray|
+
+anArray := Array new
+	add: ''Some text'';
+	add: 3;
+	yourself;
+
+Transcript show: anArray; cr.
+
+anArray remove: 3.
+
+Transcript show: anArray; cr.
+
+anArray add: ''Some more text!!''.
+
+Transcript show: anArray; cr.
+	
+"I''ll put myself in an instance of a class named Dictionary and go to the next lesson:"
+
+((Dictionary new add: (''move on!!'' -> ProfStef)) at: ''move on!!'') next'
+!
+
+iterators
+	^ Lesson
+title: 'Iterators' 
+contents: 
+'"The message do: is sent to a collection of objects (Array, Dictionary, String, etc), evaluating the block for each element.
+
+Here we want to print all the numbers on the Transcript (a console)"
+
+#(11 38 3 -2 10) do: [:each |
+     Transcript show: each printString; cr].
+
+"Some other really nice iterators"
+
+#(11 38 3 -2 10) collect: [:each | each negated].
+
+#(11 38 3 -2 10) collect: [:each | each odd].
+
+#(11 38 3 -2 10) select: [:each | each odd].
+
+#(11 38 3 -2 10) select: [:each | each > 10].
+
+#(11 38 3 -2 10) reject: [:each | each > 10].
+
+#(11 38 3 -2 10) 
+     do: [:each | Transcript show: each printString]
+     separatedBy: [Transcript show: ''.''].
+
+
+(Smalltalk current classes select: [:eachClass | eachClass name = ''ProfStef'']) do: [:eachProfstef | eachProfstef next].'
+!
+
+loops
+	^ Lesson
+title: 'Loops' 
+contents: 
+'"Loops are high-level collection iterators, implemented as regular methods."
+
+"Basic loops:
+  to:do:
+  to:by:do"
+
+1 to: 100 do:
+  [:i | Transcript show: i asString; cr ].
+
+1 to: 100 by: 3 do: [:i | Transcript show: i asString; cr].
+
+100 to: 0 by: -2 do: 
+    [:i | Transcript show: i asString; cr].
+
+1 to: 1 do: [:i | ProfStef next].'
+!
+
+mathematicalPrecedence
+	^ Lesson
+title: 'Mathematical precedence'
+contents: 
+'"Traditional precedence rules from mathematics do not follow in Smalltalk."
+
+2 * 10 + 2.
+
+"Here the message * is sent to 2, which answers 20, then 20 receive the message +
+
+Remember that all messages always follow a simple left-to-right precedence rule, * without exceptions *."
+
+2 + 2 * 10.
+
+2 + (2 * 10).
+
+8 - 5 / 2.
+
+(8 - 5) / 2.
+
+8 - (5 / 2).
+
+ProfStef next.'
+!
+
+messageSyntaxBinary
+	^ Lesson
+title: 'Message syntax: Binary messages' 
+contents: 
+'"Binary messages have the following form:
+    anObject + anotherObject"
+
+3 * 2.
+
+Date today year = 2011.
+
+false | false.
+
+true & true.
+
+true & false.
+
+10 @ 100.
+
+10 <= 12.
+
+''ab'', ''cd''.
+
+ProfStef next.'
+!
+
+messageSyntaxCascade
+	^ Lesson
+title: 'Message syntax: Cascade' 
+contents: 
+'"; is the cascade operator. It''s useful to send message to the SAME receiver
+Open a Transcript (console):"
+
+Transcript open.
+
+"Then:"
+
+Transcript show: ''hello''.
+Transcript show: ''Smalltalk''.
+Transcript cr.
+
+"is equivalent to:"
+
+Transcript 
+	   show: ''hello'';
+	   show: ''Smalltalk'' ;
+	   cr.
+
+"You can close the development tools by clicking on the red circle with a cross at the bottom left of the website.
+Try to go to the next lesson with a cascade of two ''next'' messages:"
+
+ProfStef'.
+!
+
+messageSyntaxCascadeShouldNotBeHere
+	^ Lesson
+title: 'Lost ?' 
+contents: 
+'"Hey, you should not be here !!!! 
+
+Go back and use a cascade !!"
+
+ProfStef previous.'.
+!
+
+messageSyntaxExecutionOrder
+	^ Lesson
+title: 'Message syntax: Execution order' 
+contents: 
+'"Unary messages are executed first, then binary messages and finally keyword messages:
+    Unary > Binary > Keywords"
+
+2.5 + 3.8 rounded.
+
+3 max: 2 + 2.
+  
+(0@0) class.
+
+0@0 x: 100.
+
+(0@0 x: 100) class.
+
+"Between messages of similar precedence, expressions are executed from left to right"
+
+-12345 negated asString reversed.
+
+ProfStef next.'
+!
+
+messageSyntaxExecutionOrderParentheses
+	^ Lesson
+title: 'Message syntax: Parentheses'
+contents: 
+'"Use parentheses to change order of evaluation"
+
+(2.5 + 3.8) rounded.
+
+(3 max: 2) + 2.
+
+ProfStef next.'
+!
+
+messageSyntaxKeyword
+	^ Lesson
+title: 'Message syntax: Keyword messages' 
+contents: 
+'"Keyword Messages are messages with arguments. They have the following form:
+    anObject akey: anotherObject akey2: anotherObject2"
+
+''Web development is a good deal of pain'' copyFrom: 1 to: 30
+
+"The message is copyFrom:to: sent to the String ''Web development is a good deal of pain''"
+
+1 max: 3.
+
+Array with: ''hello'' with: 2 with: Smalltalk.
+
+"The message is with:with:with: implemented on class Array. Note you can also write"
+
+Array
+	with: ''Hi there!!''
+	with: 2
+	with: Smalltalk.
+	
+ProfStef perform: ''next''.'
+!
+
+messageSyntaxUnary
+	^ Lesson
+title: 'Message syntax: Unary messages' 
+contents: 
+'"Messages are sent to objects. There are three types of message: Unary, Binary and Keyword.
+
+Unary messages have the following form:
+    anObject aMessage 
+
+You''ve already sent unary messages. For example:"
+
+1 class.
+
+false not.
+
+Date today.
+
+Number pi.
+
+"And of course: "
+
+ProfStef next.'
+!
+
+pharoEnvironment
+	^ Lesson
+title: 'Pharo environment' 
+contents: 
+'"Every Smalltalk system is full of objects. There are windows, text, numbers, dates, colors, points and much more. You can interact with objects in a much more direct way than is possible with other programming languages.
+
+Every object understands the message ''explore''. As a result, you get an Explorer window that shows details about the object."
+
+Date today explore.
+
+"This shows that the date object consists of a point in time (start) and a duration (one day long)."
+
+ProfStef explore.
+
+"You see, ProfStef class has a lot of objects. Let''s take a look at my code:"
+
+ProfStef browse.
+
+ProfStef next.'
+!
+
+printing 
+	^ Lesson
+title: 'Doing VS Printing: Printing' 
+contents: 
+'"Now you''re a Do It master !! Let''s talk about printing. It''s a Do It which prints the result next to the expression you''ve selected.
+For example, select the text below, and click on ''PrintIt'':"
+
+1 + 2.
+
+"As with ''DoIt'', there is also a shortcut to execute this command.
+
+Try CTRL-p on the following expressions:"
+
+Date today.
+
+"The result is selected, so you can erase it using the backspace key. Try it !!"
+
+Date today asDateString.
+
+Date today asTimeString.
+
+ProfStef next.'
+!
+
+reflection
+	^ Lesson
+title: 'Reflection' 
+contents: 
+'"You can inspect and change the system at runtime.
+
+Take a look at the source code of the method #and: of the class Boolean:"
+
+(Boolean methodDictionary at: ''and:'') source.
+
+"Or all the methods it sends:"
+
+(Boolean methodDictionary at: ''and:'') messageSends.
+
+"Here''s all the methods I implement:"
+
+ProfStef methodDictionary.
+
+"Let''s create a new method to go to the next lesson:"
+
+|newMethod|
+newMethod := Compiler new load: ''goToNextLesson ProfStef next.'' forClass: ProfStef.
+ProfStef class addCompiledMethod: newMethod
+
+"Wow!! I can''t wait to use my new method!!"
+
+ProfStef goToNextLesson.'
+!
+
+reflectionContinued
+	^ Lesson
+title: 'Reflection continued' 
+contents: 
+'"So cool, isn''t it ?  Before going further, let''s remove this method:"
+
+ProfStef class methodAt: #goToNextLesson.
+
+ProfStef class removeCompiledMethod: (ProfStef class methodAt: #goToNextLesson).
+
+ProfStef class methodAt: #goToNextLesson.
+
+
+"Then move forward:"
+
+ProfStef perform:#next'
+!
+
+theEnd
+	^ Lesson
+title: 'Tutorial done !!' 
+contents: 
+'"This tutorial is done. Enjoy programming Smalltalk with JTalk. 
+
+You can run this tutorial again by evaluating: ProfStef go.
+
+See you soon !!"
+'
+!
+
+welcome
+	^ Lesson
+title: 'Welcome' 
+contents: 
+' "Hello!! I''m Professor Stef. 
+
+You must want me to help you learn Smalltalk.
+
+So let''s go to the first lesson.  Select the text below and click on the ''DoIt'' button"
+
+ProfStef next.'
+! !
+

+ 6 - 0
ide.html

@@ -55,6 +55,12 @@ t: 0; border: 0;" src="./ide/fork_me.png" alt="Fork me on GitHub"></a>
       <p>Jtalk is an implementation of the  <a href="http://en.wikipedia.org/wiki/Smalltalk">Smalltalk</a> language that runs on top of the <a href="http://en.wikipedia.org/wiki/Javascript">JavaScript</a> runtime. It is designed to make client-side development faster and easier.</p>
       <p>Jtalk is written in itself, including the parser and compiler. Jtalk compiles into efficient JavaScript, mapping one-to-one with the equivalent JavaScript. There is no interpretation at runtime.</p>
       <p>Try a <button onclick="smalltalk.Browser._open()"> Class browser</button> right now!</p>
+			<p>You may want to look at sample applications:
+			<ul>
+			  <li><a href="examples/trysmalltalk/index.html">Try Smalltalk in your web browser</a></li>
+				<li><a href="examples/presentation/index.html">JTalk slides</a></li>
+			</ul>
+			</p>
     </div>
     <div class="right"><img src="./ide/screen2.png"></div>
     <div class="clear"></div>

+ 1 - 1
js/IDE.js

@@ -1581,7 +1581,7 @@ var self=this;
 smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_addSubclassOf_named_instanceVariableNames_module_", [smalltalk.send(aClass, "_superclass", []), smalltalk.send(aClass, "_name", []), (function($rec){smalltalk.send($rec, "_add_", [aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.send(aClass, "_instanceVariableNames", []), "_copy", [])), smalltalk.send(smalltalk.send(aClass, "_module", []), "_name", [])]);
 return self;},
 args: ["aString", "aClass"],
-source: unescape('addInstanceVariableNamed%3A%20aString%20toClass%3A%20aClass%0A%09ClassBuilder%20new%0A%09%09addSubclassOf%3A%20aClass%20superclass%20%0A%09%09named%3A%20aClass%20name%20%0A%09%09instanceVariableNames%3A%20%28aClass%20instanceVariableNames%20copy%20add%3A%20aString%3B%20yourself%29%0A%09%09module%3A%20aClass%20module%20name%0A%09%09'),
+source: unescape('addInstanceVariableNamed%3A%20aString%20toClass%3A%20aClass%0A%09ClassBuilder%20new%0A%09%09addSubclassOf%3A%20aClass%20superclass%20%0A%09%09named%3A%20aClass%20name%20%0A%09%09instanceVariableNames%3A%20%28aClass%20instanceVariableNames%20copy%20add%3A%20aString%3B%20yourself%29%0A%09%09module%3A%20aClass%20module%20name'),
 messageSends: ["addSubclassOf:named:instanceVariableNames:module:", "new", "superclass", "name", "add:", "yourself", "copy", "instanceVariableNames", "module"],
 referencedClasses: [smalltalk.ClassBuilder]
 }),

+ 26 - 0
js/Kernel-Tests.deploy.js

@@ -262,3 +262,29 @@ smalltalk.NumberTest);
 
 
 
+smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+'_testPrintShowingDecimalPlaces',
+smalltalk.method({
+selector: 'testPrintShowingDecimalPlaces',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
+smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
+smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
+smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
+smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
+smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
+smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
+smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
+smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
+smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
+smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
+smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
+smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+
+

+ 33 - 0
js/Kernel.deploy.js

@@ -1680,6 +1680,17 @@ return self;
 }),
 smalltalk.Number);
 
+smalltalk.addMethod(
+'_printShowingDecimalPlaces_',
+smalltalk.method({
+selector: 'printShowingDecimalPlaces:',
+fn: function (placesDesired){
+var self=this;
+return self.toFixed(placesDesired);
+return self;}
+}),
+smalltalk.Number);
+
 
 smalltalk.addMethod(
 '_pi',
@@ -2969,6 +2980,28 @@ return self;}
 }),
 smalltalk.Collection);
 
+smalltalk.addMethod(
+'_ifNotEmpty_',
+smalltalk.method({
+selector: 'ifNotEmpty:',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_notEmpty", []), "_ifTrue_", [aBlock]);
+return self;}
+}),
+smalltalk.Collection);
+
+smalltalk.addMethod(
+'_ifEmpty_',
+smalltalk.method({
+selector: 'ifEmpty:',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_isEmpty", []), "_ifTrue_", [aBlock]);
+return self;}
+}),
+smalltalk.Collection);
+
 
 smalltalk.addMethod(
 '_streamClass',

+ 69 - 21
js/Kernel.js

@@ -187,7 +187,7 @@ return self;},
 args: ["anObject"],
 source: unescape('-%3E%20anObject%0A%09%5EAssociation%20key%3A%20self%20value%3A%20anObject'),
 messageSends: ["key:value:"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Association]
 }),
 smalltalk.Object);
 
@@ -683,7 +683,7 @@ return self;},
 args: ["aMessage"],
 source: unescape('doesNotUnderstand%3A%20aMessage%0A%09MessageNotUnderstood%20new%0A%09%09receiver%3A%20self%3B%0A%09%09message%3A%20aMessage%3B%0A%09%09signal'),
 messageSends: ["receiver:", "message:", "signal", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.MessageNotUnderstood]
 }),
 smalltalk.Object);
 
@@ -1191,7 +1191,7 @@ return self;},
 args: ["aString"],
 source: unescape('methodsFor%3A%20aString%0A%09%5EClassCategoryReader%20new%0A%09%20%20%20%20class%3A%20self%20category%3A%20aString%3B%0A%09%20%20%20%20yourself'),
 messageSends: ["class:category:", "yourself", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ClassCategoryReader]
 }),
 smalltalk.Behavior);
 
@@ -1271,7 +1271,7 @@ return self;},
 args: [],
 source: unescape('commentStamp%0A%20%20%20%20%5EClassCommentReader%20new%0A%09class%3A%20self%3B%0A%09yourself'),
 messageSends: ["class:", "yourself", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ClassCommentReader]
 }),
 smalltalk.Behavior);
 
@@ -1343,7 +1343,7 @@ return self;},
 args: ["aBlock"],
 source: unescape('protocolsDo%3A%20aBlock%0A%09%22Execute%20aBlock%20for%20each%20method%20category%20with%0A%09its%20collection%20of%20methods%20in%20the%20sort%20order%20of%20category%20name.%22%0A%0A%09%7C%20methodsByCategory%20%7C%0A%09methodsByCategory%20%3A%3D%20Dictionary%20new.%0A%09self%20methodDictionary%20values%20do%3A%20%5B%3Am%20%7C%0A%09%09%28methodsByCategory%20at%3A%20m%20category%20ifAbsentPut%3A%20%5BArray%20new%5D%29%0A%20%09%09%09add%3A%20m%5D.%20%0A%09self%20protocols%20do%3A%20%5B%3Acategory%20%7C%0A%09%09aBlock%20value%3A%20category%20value%3A%20%28methodsByCategory%20at%3A%20category%29%5D'),
 messageSends: ["new", "do:", "values", "methodDictionary", "add:", "at:ifAbsentPut:", "category", "protocols", "value:value:", "at:"],
-referencedClasses: [smalltalk.nil,smalltalk.Array]
+referencedClasses: [smalltalk.Dictionary,smalltalk.Array]
 }),
 smalltalk.Behavior);
 
@@ -1445,7 +1445,7 @@ return self;},
 args: ["aString", "anotherString"],
 source: unescape('compile%3A%20aString%20category%3A%20anotherString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20self.%0A%09method%20category%3A%20anotherString.%0A%09self%20addCompiledMethod%3A%20method'),
 messageSends: ["load:forClass:", "new", "category:", "addCompiledMethod:"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Compiler]
 }),
 smalltalk.Behavior);
 
@@ -1612,7 +1612,7 @@ return self;},
 args: ["aString", "aString2", "aString3"],
 source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20module%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20module%3A%20aString3'),
 messageSends: ["superclass:subclass:instanceVariableNames:module:", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ClassBuilder]
 }),
 smalltalk.Class);
 
@@ -1647,7 +1647,7 @@ return self;},
 args: ["aCollection"],
 source: unescape('instanceVariableNames%3A%20aCollection%0A%09ClassBuilder%20new%0A%09%20%20%20%20class%3A%20self%20instanceVariableNames%3A%20aCollection'),
 messageSends: ["class:instanceVariableNames:", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ClassBuilder]
 }),
 smalltalk.Metaclass);
 
@@ -2211,7 +2211,7 @@ return self;},
 args: [],
 source: unescape('atRandom%0A%20%20%20%20%5E%28Random%20new%20next%20*%20self%29%20truncated%20+%201'),
 messageSends: [unescape("+"), "truncated", unescape("*"), "next", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Random]
 }),
 smalltalk.Number);
 
@@ -2227,7 +2227,7 @@ return self;},
 args: ["aNumber"],
 source: unescape('@%20aNumber%0A%09%5EPoint%20x%3A%20self%20y%3A%20aNumber'),
 messageSends: ["x:y:"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Point]
 }),
 smalltalk.Number);
 
@@ -2243,7 +2243,7 @@ return self;},
 args: [],
 source: unescape('asPoint%0A%09%5EPoint%20x%3A%20self%20y%3A%20self'),
 messageSends: ["x:y:"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Point]
 }),
 smalltalk.Number);
 
@@ -2371,7 +2371,7 @@ return Number(self) == aNumber;
 return self;
 } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}},
 args: ["aNumber"],
-source: unescape('%3D%20aNumber%0A%09aNumber%20class%20%3D%20self%20class%20ifFalse%3A%20%5B%5Efalse%5D.%20%0A%09%3Creturn%20Number%28self%29%20%3D%3D%20aNumber%3E%20'),
+source: unescape('%3D%20aNumber%0A%09aNumber%20class%20%3D%20self%20class%20ifFalse%3A%20%5B%5Efalse%5D.%20%0A%09%3Creturn%20Number%28self%29%20%3D%3D%20aNumber%3E'),
 messageSends: ["ifFalse:", unescape("%3D"), "class"],
 referencedClasses: []
 }),
@@ -2389,12 +2389,28 @@ return Number(self) === Number(aNumber);
 return self;
 } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq_eq'){return e.fn()} throw(e)}},
 args: ["aNumber"],
-source: unescape('%3D%3D%20aNumber%0A%09aNumber%20class%20%3D%20self%20class%20ifFalse%3A%20%5B%5Efalse%5D.%20%0A%09%3Creturn%20Number%28self%29%20%3D%3D%3D%20Number%28aNumber%29%3E%20'),
+source: unescape('%3D%3D%20aNumber%0A%09aNumber%20class%20%3D%20self%20class%20ifFalse%3A%20%5B%5Efalse%5D.%20%0A%09%3Creturn%20Number%28self%29%20%3D%3D%3D%20Number%28aNumber%29%3E'),
 messageSends: ["ifFalse:", unescape("%3D"), "class"],
 referencedClasses: []
 }),
 smalltalk.Number);
 
+smalltalk.addMethod(
+'_printShowingDecimalPlaces_',
+smalltalk.method({
+selector: 'printShowingDecimalPlaces:',
+category: 'printing',
+fn: function (placesDesired){
+var self=this;
+return self.toFixed(placesDesired);
+return self;},
+args: ["placesDesired"],
+source: unescape('printShowingDecimalPlaces%3A%20placesDesired%0A%09%3Creturn%20self.toFixed%28placesDesired%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Number);
+
 
 smalltalk.addMethod(
 '_pi',
@@ -3789,7 +3805,7 @@ return self;},
 args: ["aString", "aString2", "aString3"],
 source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20module%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20module%3A%20aString3'),
 messageSends: ["superclass:subclass:instanceVariableNames:module:", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ClassBuilder]
 }),
 smalltalk.UndefinedObject);
 
@@ -4236,7 +4252,39 @@ return self;},
 args: [],
 source: unescape('asSet%0A%09%5ESet%20withAll%3A%20self'),
 messageSends: ["withAll:"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Set]
+}),
+smalltalk.Collection);
+
+smalltalk.addMethod(
+'_ifNotEmpty_',
+smalltalk.method({
+selector: 'ifNotEmpty:',
+category: 'testing',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_notEmpty", []), "_ifTrue_", [aBlock]);
+return self;},
+args: ["aBlock"],
+source: unescape('ifNotEmpty%3A%20aBlock%0A%09self%20notEmpty%20ifTrue%3A%20aBlock.'),
+messageSends: ["ifTrue:", "notEmpty"],
+referencedClasses: []
+}),
+smalltalk.Collection);
+
+smalltalk.addMethod(
+'_ifEmpty_',
+smalltalk.method({
+selector: 'ifEmpty:',
+category: 'testing',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_isEmpty", []), "_ifTrue_", [aBlock]);
+return self;},
+args: ["aBlock"],
+source: unescape('ifEmpty%3A%20aBlock%0A%09self%20isEmpty%20ifTrue%3A%20aBlock.'),
+messageSends: ["ifTrue:", "isEmpty"],
+referencedClasses: []
 }),
 smalltalk.Collection);
 
@@ -4253,7 +4301,7 @@ return self;},
 args: [],
 source: unescape('streamClass%0A%09%20%20%20%20%5EStream'),
 messageSends: [],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Stream]
 }),
 smalltalk.Collection.klass);
 
@@ -5446,7 +5494,7 @@ return self;},
 args: [],
 source: unescape('streamClass%0A%09%20%20%20%20%5EStringStream'),
 messageSends: [],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.StringStream]
 }),
 smalltalk.String.klass);
 
@@ -6200,7 +6248,7 @@ var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
 return self;},
 args: ["anAssociation"],
-source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D%0A'),
+source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D'),
 messageSends: ["and:", unescape("%3D"), "class", "key", "value"],
 referencedClasses: []
 }),
@@ -6914,7 +6962,7 @@ return self;},
 args: [],
 source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.'),
 messageSends: ["initialize", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ChunkParser]
 }),
 smalltalk.ClassCategoryReader);
 
@@ -6967,7 +7015,7 @@ return self;},
 args: ["aString"],
 source: unescape('compileMethod%3A%20aString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20class.%0A%09method%20category%3A%20category.%0A%09class%20addCompiledMethod%3A%20method'),
 messageSends: ["load:forClass:", "new", "category:", "addCompiledMethod:"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.Compiler]
 }),
 smalltalk.ClassCategoryReader);
 
@@ -7535,7 +7583,7 @@ return self;},
 args: [],
 source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.'),
 messageSends: ["initialize", "new"],
-referencedClasses: [smalltalk.nil]
+referencedClasses: [smalltalk.ChunkParser]
 }),
 smalltalk.ClassCommentReader);
 

+ 25 - 0
st/Kernel-Tests.st

@@ -47,6 +47,7 @@ testPrintString
                         	printString)
 !
 
+<<<<<<< .merge_file_pxtnya
 testEquality
 	| d1 d2 |
 
@@ -70,6 +71,8 @@ testDynamicDictionaries
 	self assert: #{1 -> 'hello'. 2 -> 'world'} = (Dictionary with: 1 -> 'hello' with: 2 -> 'world')
 ! !
 
+=======
+>>>>>>> .merge_file_i20xd7
 TestCase subclass: #BooleanTest
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
@@ -215,3 +218,25 @@ testTruncated
 	self assert: 3.51 truncated = 3
 ! !
 
+TestCase subclass: #NumberTest
+	instanceVariableNames: ''
+	category: 'Kernel-Tests'!
+
+!NumberTest methodsFor: 'not yet classified'!
+
+testPrintShowingDecimalPlaces
+	self assert: '23.00' equals: (23 printShowingDecimalPlaces: 2).
+	self assert: '23.57' equals: (23.5698 printShowingDecimalPlaces: 2).
+	self assert: '-234.56700' equals:( 234.567 negated printShowingDecimalPlaces: 5).
+	self assert: '23' equals: (23.4567 printShowingDecimalPlaces: 0).
+	self assert: '24' equals: (23.5567 printShowingDecimalPlaces: 0).
+	self assert: '-23' equals: (23.4567 negated printShowingDecimalPlaces: 0).
+	self assert: '-24' equals: (23.5567 negated printShowingDecimalPlaces: 0).
+	self assert: '100000000.0' equals: (100000000 printShowingDecimalPlaces: 1).
+	self assert: '0.98000' equals: (0.98 printShowingDecimalPlaces: 5).
+	self assert: '-0.98' equals: (0.98 negated printShowingDecimalPlaces: 2).
+	self assert: '2.57' equals: (2.567 printShowingDecimalPlaces: 2).
+	self assert: '-2.57' equals: (-2.567 printShowingDecimalPlaces: 2).
+	self assert: '0.00' equals: (0 printShowingDecimalPlaces: 2).
+! !
+

+ 12 - 0
st/Kernel.st

@@ -761,6 +761,10 @@ to: aNumber do: aBlock
 
 printString
 	<return String(self)>
+!
+
+printShowingDecimalPlaces: placesDesired
+	<return self.toFixed(placesDesired)>
 ! !
 
 !Number methodsFor: 'testing'!
@@ -1402,6 +1406,14 @@ notEmpty
 
 isEmpty
 	^self size = 0
+!
+
+ifNotEmpty: aBlock
+	self notEmpty ifTrue: aBlock.
+!
+
+ifEmpty: aBlock
+	self isEmpty ifTrue: aBlock.
 ! !
 
 !Collection class methodsFor: 'accessing'!

+ 0 - 0
examples/trysmalltalk/TrySmalltalk.st → st/TrySmalltalk.st


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików