{ import: Frame } { import: TextController } { import: Develop } { include "SDL/SDL.h" } "A simple text editor model." TextFileEditor : Object (fileName) TextFileEditor fileName [ ^fileName ] TextFileEditor fileName: aString [ fileName := aString ] TextFileEditor openFileNamed: aString [ "Create a frame box of text editor for the file name." | editor textView | editor := self new. editor fileName: aString. textView := TextView new. textView model: editor. ^ (FrameBox with: textView addScrollPane title: aString) extent: 400, 600. ] TextFileEditor contents [ | contents | File open: fileName do: [ :file | contents := file readStream contents ]. ^ contents ] TextFileEditor contents: aString [ | contents | File create: fileName do: [ :file | contents := file nextPutAll: aString ]. ^ contents ] Window showDrawTest [ | image pane frame ctx | image := ImageBox newImage: (SDLImage newExtent: 300, 300). pane := ScrollPane new. pane add: image. frame := FrameBox with: pane title: 'Picture'. ctx := SDLContext new: image image. ctx color: ColorBlue. ctx fillRectangle: 40,40 extent: 120,120. ctx color: ColorRed. ctx fillCircle: 100,50 radius: 80. self addFront: frame. ] Object asString [ ^self printString ] Array asPoint [ ^Point withX: self first withY: self second ] "for bunnu" ImageBox onMotion: anEvent [] ImageBox new [ self := super new. self motion: [ :event | self onMotion: event ]. ] [ | fileName window textView image pane frame ctx | fileName := 'turtle.k'. " textView := TextView new. File open: fileName do: [ :file | textView textContents: file readStream contents]. " Shell new evalFile: 'demo/boot.k'. Object allTypes do: [ :each | | name | name := each debugName asSymbol. (TheGlobalEnvironment lookupVariable: name) ifFalse: [ TheGlobalEnvironment defineVariable: name value_: each]]. window := Window new: 900,720. window add: ((TextFileEditor openFileNamed: fileName) position: 10,10). " window showDrawTest." window mainLoop. ]