<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.7.1 of 2010年7月26日 on 2010年8月5日 at 13:35:31</time-stamp>


<component-created>
<name>SSK</name> <type>package</type>
</component-created><!-- Package SSK* -->


<component-property>
<name>SSK</name> <type>package</type>
<property>comment</property> <value>'Smalltalk Studies in Kyoto'</value>
</component-property>

<class>
<name>OldFashionedBrowser</name>
<environment>Smalltalk</environment>
<super>UI.ApplicationModel</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>classTable instanceMethodTable classMethodTable classList methodList isMeta codeText </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category></category>
<attributes>
<package>SSK</package>
</attributes>
</class>

<comment>
<class-id>OldFashionedBrowser</class-id>
<body>Smalltalk Studies in Kyoto</body>
</comment>

<methods>
<class-id>OldFashionedBrowser class</class-id> <category>interface specs</category>

<body package="SSK" selector="windowSpec">windowSpec
	"Tools.UIPainter new openOnClass: self andSelector: #windowSpec"

	&lt;resource: #canvas&gt;
	^#(#{UI.FullSpec} 
		#window: 
		#(#{UI.WindowSpec} 
			#label: 'Old Fashioned Browser' 
			#min: #(#{Core.Point} 400 300 ) 
			#max: #(#{Core.Point} 0 0 ) 
			#bounds: #(#{Graphics.Rectangle} 960 600 1760 1050 ) ) 
		#component: 
		#(#{UI.SpecCollection} 
			#collection: #(
				#(#{UI.SequenceViewSpec} 
					#layout: #(#{Graphics.LayoutFrame} 8 0 8 0 -4 0.5 -4 0.5 ) 
					#name: #classList 
					#model: #classList 
					#callbacksSpec: 
					#(#{UI.UIEventCallbackSubSpec} 
						#valueChangeSelector: #classListSelectionChanged ) 
					#menu: #classListMenu 
					#useModifierKeys: true 
					#selectionType: #highlight ) 
				#(#{UI.SequenceViewSpec} 
					#layout: #(#{Graphics.LayoutFrame} 4 0.5 8 0 -8 1 -40 0.5 ) 
					#name: #methodList 
					#model: #methodList 
					#callbacksSpec: 
					#(#{UI.UIEventCallbackSubSpec} 
						#valueChangeSelector: #methodListSelectionChanged ) 
					#menu: #methodListMenu 
					#useModifierKeys: true 
					#selectionType: #highlight ) 
				#(#{UI.RadioButtonSpec} 
					#layout: #(#{Graphics.LayoutOrigin} 15 0.5 -30 0.5 ) 
					#name: #instanceButton 
					#model: #isMeta 
					#callbacksSpec: 
					#(#{UI.UIEventCallbackSubSpec} 
						#valueChangeSelector: #instanceButtonPressed ) 
					#label: 'instance' 
					#select: false ) 
				#(#{UI.RadioButtonSpec} 
					#layout: #(#{Graphics.LayoutOrigin} 15 0.75 -30 0.5 ) 
					#name: #classButton 
					#model: #isMeta 
					#callbacksSpec: 
					#(#{UI.UIEventCallbackSubSpec} 
						#valueChangeSelector: #classButtonPressed ) 
					#label: 'class' 
					#select: true ) 
				#(#{UI.TextEditorSpec} 
					#layout: #(#{Graphics.LayoutFrame} 8 0 4 0.5 -8 1 -8 1 ) 
					#name: #codeText 
					#model: #codeText 
					#tabRequiresControl: true ) 
				#(#{UI.ResizingSplitterSpec} 
					#layout: #(#{Graphics.LayoutFrame} 8 0 -2 0.5 -8 1 2 0.5 ) 
					#name: #horizontalResizer 
					#horizontal: true 
					#minAboveSize: 100 
					#minBelowSize: 100 
					#aboveWidgets: 'classList methodList instanceButton classButton verticalResizer' 
					#belowWidgets: 'codeText' ) 
				#(#{UI.ResizingSplitterSpec} 
					#layout: #(#{Graphics.LayoutFrame} -2 0.5 8 0 2 0.5 -4 0.5 ) 
					#name: #verticalResizer 
					#horizontal: false 
					#minAboveSize: 100 
					#minBelowSize: 100 
					#aboveWidgets: 'classList ' 
					#belowWidgets: 'methodList instanceButton classButton' ) ) ) )</body>
</methods>

<methods>
<class-id>OldFashionedBrowser class</class-id> <category>examples</category>

<body package="SSK" selector="example">example
	"OldFashionedBrowser example."

	| aBrowser |
	aBrowser := OldFashionedBrowser new.
	aBrowser open.
	^aBrowser</body>
</methods>

<methods>
<class-id>OldFashionedBrowser class</class-id> <category>resources</category>

<body package="SSK" selector="classListMenu">classListMenu
	"Tools.MenuEditor new openOnClass: self andSelector: #classListMenu"

	&lt;resource: #menu&gt;
	^#(#{UI.Menu} #(
			#(#{UI.MenuItem} 
				#rawLabel: 'Find Class...' 
				#value: #findClass ) ) #(1 ) nil ) decodeAsLiteralArray</body>

<body package="SSK" selector="methodListMenu">methodListMenu
	"Tools.MenuEditor new openOnClass: self andSelector: #classListMenu"

	&lt;resource: #menu&gt;
	^#(#{UI.Menu} #(
			#(#{UI.MenuItem} 
				#rawLabel: 'Find Method...' 
				#value: #findMethod ) ) #(1 ) nil ) decodeAsLiteralArray</body>
</methods>


<methods>
<class-id>OldFashionedBrowser</class-id> <category>aspects</category>

<body package="SSK" selector="codeText">codeText

	codeText value: (classList selection
				ifNil: [Text new]
				ifNotNil: 
					[:aKey |
					| aClass |
					aClass := classTable at: aKey.
					isMeta value ifTrue: [aClass := aClass class].
					methodList selection
						ifNil: [aClass definition asText]
						ifNotNil: [:aSelector | (aClass sourceMethodAt: aSelector) asText]]).
	^codeText</body>

<body package="SSK" selector="instanceButtonPressed">instanceButtonPressed

	self methodList</body>

<body package="SSK" selector="isMeta">isMeta

	^isMeta</body>

<body package="SSK" selector="methodList">methodList

	methodList list: (classList selection
				ifNil: [SortedCollection new]
				ifNotNil: 
					[:aKey |
					isMeta value
						ifTrue: [classMethodTable at: aKey]
						ifFalse: [instanceMethodTable at: aKey]]).
	self codeText.
	^methodList</body>

<body package="SSK" selector="classList">classList

	classList list isEmpty ifFalse: [^classList].
	classList list: instanceMethodTable keys asSortedCollection.
	^classList</body>

<body package="SSK" selector="methodListSelectionChanged">methodListSelectionChanged

	self codeText</body>

<body package="SSK" selector="classButtonPressed">classButtonPressed

	self methodList</body>

<body package="SSK" selector="classListSelectionChanged">classListSelectionChanged

	self methodList</body>
</methods>

<methods>
<class-id>OldFashionedBrowser</class-id> <category>menu messages</category>

<body package="SSK" selector="findClass">findClass

	| aDialog aSymbol |
	aDialog := IncrementalSearchDialog forSelectionWithSearch: 
					[:aPattern |
					(aPattern isEmpty
						ifTrue: [classList list copy]
						ifFalse: [classList list select: [:each | aPattern , '*' match: each]])
							asSortedCollection].
	aDialog windowLabel: 'Find Class'.
	aDialog firstLabel: 'Filter:'.
	aDialog secondLabel: 'Classes:'.
	aSymbol := aDialog select.
	aSymbol ifNil: [^nil].
	classList selection: aSymbol.
	self methodList</body>

<body package="SSK" selector="findMethod">findMethod

	| aDialog aSymbol |
	aDialog := IncrementalSearchDialog forSelectionWithSearch: 
					[:aPattern |
					(aPattern isEmpty
						ifTrue: [methodList list copy]
						ifFalse: [methodList list select: [:each | aPattern , '*' match: each]])
							asSortedCollection].
	aDialog windowLabel: 'Find Method'.
	aDialog firstLabel: 'Filter:'.
	aDialog secondLabel: 'Methods:'.
	aSymbol := aDialog select.
	aSymbol ifNil: [^nil].
	methodList selection: aSymbol.
	self codeText</body>
</methods>

<methods>
<class-id>OldFashionedBrowser</class-id> <category>initialize-release</category>

<body package="SSK" selector="initialize">initialize

	| altDown |
	altDown := InputState default altDown.
	super initialize.
	classTable := Dictionary new: 1000.
	instanceMethodTable := Dictionary new: 1000.
	classMethodTable := Dictionary new: 1000.
	SystemUtils allClassesDo: 
			[:aClass |
			| aKey |
			aKey := (altDown
						ifTrue: [aClass fullyQualifiedReference]
						ifFalse: [aClass simpleReference]) displayStringWithTrailingNameSpace.
			classTable at: aKey put: aClass.
			instanceMethodTable at: aKey put: aClass selectors asSortedCollection.
			classMethodTable at: aKey put: aClass class selectors asSortedCollection].
	classList := SelectionInList new.
	methodList := SelectionInList new.
	isMeta := ValueHolder with: false.
	codeText := ValueHolder with: String new.
	^self</body>
</methods>



</st-source>
