Squeakあれこれ

Squeak関連情報など

TextStreamあれこれ #2

2005-03-19 | squeakあれこれ
TextStream第2弾.
| ts |
ts := TextStream on: (Text new: 100).
"font size"
ts nextPutAll: 'TextFontChange ';cr.
ts withAttribute: (TextFontChange fontNumber: 1)
	do: [ts nextPutAll: 'font 1']; cr.
ts withAttribute: (TextFontChange fontNumber: 2)
	do: [ts nextPutAll: 'font 2']; cr.
ts withAttribute: (TextFontChange fontNumber: 3)
	do: [ts nextPutAll: 'font 3']; cr.
ts withAttribute: (TextFontChange fontNumber: 4)
	do: [ts nextPutAll: 'font 4']; cr.
ts withAttribute: (TextFontChange fontNumber: 5)
	do: [ts nextPutAll: 'font 5']; cr.
"link to URL"
ts withAttribute: (TextURL scanFrom: 'http://www.yahoo.co.jp')
	do: [ts nextPutAll: 'www.yahoo.co.jp']; cr.
"link to project"
ts withAttribute: (TextSqkProjectLink scanFrom: '名無し')
	do: [ts nextPutAll: 'Go to ''名無し'' project']; cr.
(Workspace new contents: ts contents)
         openLabel: 'TextStreams'

TextStreamあれこれ

2005-03-17 | squeakあれこれ
TextStreamのサンプル。
| ts |
ts := TextStream on: (Text new: 100).
"強調(italic,bold,narrow,normal,struckOut,underlined)"
ts nextPutAll: 'TextEmphasis ';cr.
ts withAttribute: TextEmphasis italic
	do: [ts nextPutAll: 'italic']; cr.
ts withAttribute: TextEmphasis bold
	do: [ts nextPutAll: 'bold']; cr.
ts withAttribute: TextEmphasis narrow
	do: [ts nextPutAll: 'narrow']; cr.
ts withAttribute: TextEmphasis normal
	do: [ts nextPutAll: 'normal']; cr.
ts withAttribute: TextEmphasis struckOut
	do: [ts nextPutAll: 'struckOut']; cr.
ts withAttribute: TextEmphasis underlined
	do: [ts nextPutAll: 'underlined']; cr.
"フォント"
ts nextPutAll: 'TextFontReference ';cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #BitstreamVeraSansMono) 
		fontNamed: 'BitstreamVeraSansMono'))
	do: [ts nextPutAll: 'BitstreamVeraSansMono']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accuat) 
		fontNamed: 'Accuat18'))
	do: [ts nextPutAll: 'Accuat']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accujen) 
		fontNamed: 'Accujen09'))
	do: [ts nextPutAll: 'Accujen']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accula) 
		fontNamed: 'Accula12'))
	do: [ts nextPutAll: 'Accujen']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accumon) 
		fontNamed: 'Accumon09'))
	do: [ts nextPutAll: 'Accumon']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accuny) 
		fontNamed: 'Accuny11'))
	do: [ts nextPutAll: 'Accuny']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accusf) 
		fontNamed: 'Accusf18'))
	do: [ts nextPutAll: 'Accusf']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accushi) 
		fontNamed: 'Accushi12'))
	do: [ts nextPutAll: 'Accushi']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Accuve) 
		fontNamed: 'Accuve12'))
	do: [ts nextPutAll: 'Accuve']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #Atlanta) 
		fontNamed: 'Atlanta'))
	do: [ts nextPutAll: 'Atlanta']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #BitstreamVeraSans) 
		fontNamed: 'BitstreamVeraSans'))
	do: [ts nextPutAll: 'BitstreamVeraSans']; cr.
ts withAttribute: (TextFontReference toFont:
		((TextStyle named: #BitstreamVeraSerif) 
		fontNamed: 'BitstreamVeraSerif'))
	do: [ts nextPutAll: 'BitstreamVeraSerif']; cr.
"色"
ts withAttribute: TextColor black
	do: [ts nextPutAll: 'black']; cr.
ts withAttribute: TextColor blue
	do: [ts nextPutAll: 'blue']; cr.
ts withAttribute: TextColor cyan
	do: [ts nextPutAll: 'cyan']; cr.
ts withAttribute: TextColor gray
	do: [ts nextPutAll: 'gray']; cr.
ts withAttribute: TextColor green
	do: [ts nextPutAll: 'green']; cr.
ts withAttribute: TextColor magenta
	do: [ts nextPutAll: 'magenta']; cr.
ts withAttribute: TextColor red
	do: [ts nextPutAll: 'red']; cr.
ts withAttribute: TextColor yellow
	do: [ts nextPutAll: 'yellow']; cr.
"alignment"
ts withAttribute: TextAlignment centered
	do: [ts nextPutAll: 'centered']; cr.
ts withAttribute: TextAlignment justified
	do: [ts nextPutAll: 'justified']; cr.
ts withAttribute: TextAlignment leftFlush
	do: [ts nextPutAll: 'leftFlush']; cr.
ts withAttribute: TextAlignment rightFlush
	do: [ts nextPutAll: 'rightFlush']; cr.
"do it"
ts withAttribute: (TextDoIt evalString: 'StarMorph new openInWorld')
	do: [ts nextPutAll: 'StarMorph']; cr.
"indent"
ts withAttribute: (TextIndent amount: 1)
	do: [ts nextPutAll: 'amount = 1']; cr.
ts withAttribute: (TextIndent amount: 2)
	do: [ts nextPutAll: 'amount = 2']; cr.
"kern"
ts withAttribute: (TextKern kern: 1)
	do: [ts nextPutAll: 'kern = 1']; cr.
ts withAttribute: (TextKern kern: 2)
	do: [ts nextPutAll: 'kern = 2']; cr.
ts withAttribute: (TextKern kern: -1)
	do: [ts nextPutAll: 'kern = -1']; cr.
"Link"
ts withAttribute: (TextLink scanFrom: 'Symbol asString')
	do: [ts nextPutAll: 'Symbol asString']; cr.
"print it"
ts withAttribute: (TextPrintIt evalString: 'SmallInteger maxVal')
	do: [ts nextPutAll: 'SmallInteger maxVal']; cr.
(Workspace new contents: ts contents)
         openLabel: 'TextStreams'

[N7]'Building with Squeak'を復活させる

2005-03-17 | squeakあれこれ
プロジェクト'Building with Squeak'が存在しているが、トッププロジェクトから直接飛ぶ口がありません。そこで'Building with Squeak'を参照するProjectViewMorphを作りましょう(実はオブジェクトのカタログにあるプロジェクトの履歴から飛べるんですが…)。
Project addingProject: (Project allInstances at: 2 ).
(ProjectViewMorph on: 
    (Project named: 'Building with Squeak')) openInWorld

Nihongo7

2005-03-16 | squeakあれこれ
NSqueak-2005-03-16をダウンロードしました。いつの間にかお化粧直しされていました。金曜のリリースに向けて開発者の激務に申し訳ないです。なにもしてない…