The Inbox: HelpSystem-Core-kfr.59.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: HelpSystem-Core-kfr.59.mcz

commits-2
A new version of HelpSystem-Core was added to project The Inbox:
http://source.squeak.org/inbox/HelpSystem-Core-kfr.59.mcz

==================== Summary ====================

Name: HelpSystem-Core-kfr.59
Author: kfr
Time: 29 June 2014, 9:53:04.669 pm
UUID: cb93ef4f-12d3-ea46-b92f-eaa54938646d
Ancestors: HelpSystem-Core-kfr.58

Edit and accecept in help browser pane.
Browser is refreshed/reset on accept and current location is lost! I'll se if I can find a work around.

=============== Diff against HelpSystem-Core-kfr.58 ===============

Item was changed:
  Object subclass: #HelpBrowser
+ instanceVariableNames: 'rootTopic window treeMorph contentMorph topicClass topicMethod topic'
- instanceVariableNames: 'rootTopic window treeMorph contentMorph'
  classVariableNames: 'DefaultHelpBrowser'
  poolDictionaries: ''
  category: 'HelpSystem-Core-UI'!
 
  !HelpBrowser commentStamp: 'tbn 3/8/2010 09:33' prior: 0!
  A HelpBrowser is used to display a hierarchy of help topics and their contents.
 
  Instance Variables
  rootTopic: <HelpTopic>
  window: <StandardWindow>
  treeMorph: <PluggableTreeMorph>
  contentMorph: <Morph>
 
  rootTopic
  - xxxxx
 
  window
  - xxxxx
 
  treeMorph
  - xxxxx
 
  contentMorph
  - xxxxx
 
  !

Item was added:
+ ----- Method: HelpBrowser>>accept: (in category 'actions') -----
+ accept: text
+ "Accept edited text. Compile it into a HelpTopic"
+
+ | code |
+ code := String streamContents:[:s|
+ s nextPutAll: topicMethod.
+ s crtab; nextPutAll: '"This method was automatically generated. Edit it using:"'.
+ s crtab; nextPutAll: '"', self name,' edit: ', topicMethod storeString,'"'.
+ s crtab; nextPutAll: '^HelpTopic'.
+ s crtab: 2; nextPutAll: 'title: ', topic title storeString.
+ s crtab: 2; nextPutAll: 'contents: '.
+ s cr; nextPutAll: (String streamContents:[:c| c nextChunkPutWithStyle: text]) storeString.
+ s nextPutAll:' readStream nextChunkText'.
+ ].
+
+ topicClass class
+ compile: code
+ classified: ((topicClass class organization categoryOfElement: topicMethod) ifNil:['pages']).
+ self refresh.
+     !

Item was changed:
  ----- Method: HelpBrowser>>codePaneMenu:shifted: (in category 'events') -----
  codePaneMenu: aMenu shifted: shifted
- aMenu
- add: 'edit' target: self selector: #editContents argument: self.
 
  ^StringHolder codePaneMenu: aMenu shifted: shifted.
  !

Item was removed:
- ----- Method: HelpBrowser>>editContents (in category 'actions') -----
- editContents
- | classList |
- classList := self find: contentMorph textMorph contents string.
- classList first actualClass theNonMetaClass edit: classList first selector.
- self refresh!

Item was changed:
  ----- Method: HelpBrowser>>initWindow (in category 'initialize-release') -----
  initWindow
  window := SystemWindow labelled: 'Help Browser'.
  window model: self.
  "Tree"
  treeMorph := PluggableTreeMorph new.
  treeMorph model: self; setSelectedSelector: #onItemClicked:.
  window addMorph: treeMorph frame: (0@0 corner: 0.3@1).
 
  "Text"
  contentMorph := self defaultViewerClass on: self
+ text: nil accept: #accept:
- text: nil accept: nil
  readSelection: nil menu: #codePaneMenu:shifted:.
  window addMorph: contentMorph frame: (0.3@0 corner: 1@1).
  !

Item was changed:
  ----- Method: HelpBrowser>>onItemClicked: (in category 'events') -----
  onItemClicked: anItem
+ | classList |
  anItem isNil ifTrue: [^contentMorph setText: rootTopic asHelpTopic contents].
+ contentMorph setText: anItem contents.
+ topic := anItem.
+ classList := self find: anItem contents.
+ classList ifNotEmpty:[
+ topicClass := classList first actualClass theNonMetaClass.
+ topicMethod := classList first selector]!
- contentMorph setText: anItem contents!