{ import: TextController } { import: Develop } { include "SDL/SDL.h" } "----------------------------------------------------------------" SampleText2 := [ '(+ 3 4) (openText ''"welcome.txt") '] "----------------------------------------------------------------" Window openExample [ | box frame | frame := self openWorkspace. frame content layout: CenterLayout. frame content textContents: SampleText2. ] Window backgroundWorkspace [ | box frame | box := TextView new. box extent: Window default extent. box propertyAt: #font put: ((Face named: 'profontwindows') fontAt: 32). box textContents: SampleText2. ^ box ] Window openImage: aString [ | image frame | image := ImageBox newImage: (SDLImage fromBMP: aString). frame := FrameBox with: image title: aString. frame position: Window default extent - frame extent / 2. Window default addFront: frame. ] Window openText: fileName [ | frame file | frame := self default openWorkspace. frame extent: 900, 700. file := File openIfPresent: fileName. file ifNil: [ ^ StdErr nextPutAll: fileName printString, ' is not found.' ]. frame content content textContents: file readStream contents. frame titleString: fileName. file close. ] Window openSpec: exp [ | key font layout paragraphLayout text frame box width height | width := 900. height := 700. exp do: [:each | key := each first. key = #font ifTrue: [ font := (Face named: each second) fontAt: each third ]. key = #layout ifTrue: [ layout := Layout named: each second ]. key = #paragraphLayout ifTrue: [ paragraphLayout := Layout named: each second ]. key = #text ifTrue: [ text := each second ]. key = #width ifTrue: [ width := each second ]. key = #height ifTrue: [ height := each second ]. ]. box := TextView new. box background: ColorWhite. box extent: width, height. paragraphLayout ifNotNil: [box propertyAt: #paragraphLayout put: paragraphLayout]. layout ifNotNil: [box layout: layout]. box propertyAt: #font put: font. box textContents: text. frame := FrameBox with: box title: 'Text'. frame position: Window default extent - frame extent / 2. Window default addFront: frame. ] [ | window menu text image | Shell new evalFile: 'boot.k'. window := Window new: 960,720. Window propertyAt: #default put: window. window addBack: window backgroundWorkspace. window buttonDown: (MenuHandler new label: 'inspect' action: [:anEvent | anEvent handler inspect ]; label: 'workspace' action: [:anEvent | window openWorkspace ]; label: 'quit' action: [:anEvent | OS exit: 0]). window mainLoop. ]