The Inbox: HelpSystem-Core-ct.160.mcz
[email protected] Wed, 1 Jul 2026 17:37:47 0000
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
Christoph Thiede uploaded a new version of HelpSystem-Core to project The Inbox:
http://source.squeak.org/inbox/HelpSystem-Core-ct.160.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.160
Author: ct
Time: 1 July 2026, 7:37:47.174011 pm
UUID: 724aa3e1-e956-4724-bec1-3e0a43fa3b95
Ancestors: HelpSystem-Core-ct.159
Adds GUI support for adding a top-level book in the help browser and updates "help on help" accordingly. Fixes tree updates when removing a top-level book.
=============== Diff against HelpSystem-Core-ct.159 ===============
Item was changed:
----- Method: ClassBasedHelpTopic>>addBook (in category 'editing') -----
addBook
+ ^ self addBookConfirmingDefinition: false!
- | title className |
- title := self requestTitleOrCancel: [^ nil].
-
- className := self makeUniqueClassNameFrom: title.
- ^ self
- addBookWithName: className
- title: title
- subtopics: #()!
Item was added:
+ ----- Method: ClassBasedHelpTopic>>addBookConfirmingDefinition: (in category 'editing') -----
+ addBookConfirmingDefinition: shouldConfirm
+
+ | title className |
+ title := self requestTitleOrCancel: [^ nil].
+
+ className := self makeUniqueClassNameFrom: title.
+ ^ self
+ addBookWithName: className
+ title: title
+ subtopics: #()
+ confirmingDefinition: shouldConfirm!
Item was removed:
- ----- Method: ClassBasedHelpTopic>>addBookWithName:title:subtopics: (in category 'editing - private') -----
- addBookWithName: initalClassName title: title subtopics: newSubtopics
-
- | className subclass book |
- className := self requestClassNameWithDefault: initalClassName orCancel: [^ nil].
- (self helpClass environment hasClassNamed: className) ifTrue: [
- self inform: 'Class already exists' translated.
- ^ nil].
-
- subclass := self helpClass subclass: className
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: self helpClass category.
- book := subclass asHelpTopic.
- book storeBookName: title.
- newSubtopics
- ifEmpty: [book storePages: #()]
- ifNotEmpty: [
- newSubtopics do: [:subtopic |
- book addSubtopic: subtopic confirming: true]].
-
- self refresh.
- ^ self subtopics detect: [:topic |
- topic isClassBasedHelpTopic and: [topic helpClass = subclass]]!
Item was added:
+ ----- Method: ClassBasedHelpTopic>>addBookWithName:title:subtopics:confirmingDefinition: (in category 'editing - private') -----
+ addBookWithName: initialClassName title: title subtopics: newSubtopics confirmingDefinition: shouldConfirm
+
+ | className classDefinition subclass book |
+ className := self requestClassNameWithDefault: initialClassName orCancel: [^ nil].
+ (self helpClass environment hasClassNamed: className) ifTrue: [
+ self inform: 'Class already exists' translated.
+ ^ nil].
+
+ classDefinition := '{1} subclass: {2}
+ instanceVariableNames: ''''
+ classVariableNames: ''''
+ poolDictionaries: ''''
+ category: {3}'
+ format:
+ {self helpClass name.
+ className storeString.
+ ((shouldConfirm and: [self helpClass = CustomHelp])
+ ifFalse: [self helpClass category]
+ ifTrue: [Categorizer default asString]) storeString}.
+ shouldConfirm ifTrue:
+ [classDefinition := Project uiManager multiLineRequest: 'Edit class definition' translated initialAnswer: classDefinition.
+ classDefinition isEmptyOrNil ifTrue: [^ nil].
+ className := Symbol readFromString:
+ ('(?<=((s|\p{L}+S)ubclass\:|named\:) )#\S+' asRegex
+ search: classDefinition;
+ subexpression: 1).
+ (self helpClass environment hasClassNamed: className) ifTrue: [
+ self inform: 'Class already exists' translated.
+ ^ nil]].
+ subclass := Compiler evaluate: classDefinition.
+ book := subclass asHelpTopic.
+ book storeBookName: title.
+ newSubtopics
+ ifEmpty: [book storePages: #()]
+ ifNotEmpty: [
+ newSubtopics do: [:subtopic |
+ book addSubtopic: subtopic confirming: true]].
+
+ self refresh.
+ ^ self subtopics detect: [:topic |
+ topic isClassBasedHelpTopic and: [topic helpClass = subclass]]!
Item was changed:
----- Method: ClassBasedHelpTopic>>addSubtopic:confirming: (in category 'editing') -----
addSubtopic: aHelpTopic confirming: shouldConfirm
aHelpTopic isClassBasedHelpTopic ifTrue: [
shouldConfirm ifFalse: [
aHelpTopic helpClass changeSuperclassTo: self helpClass.
self refresh.
^ aHelpTopic].
^ self
addBookWithName: aHelpTopic helpClass name
title: aHelpTopic title
+ subtopics: aHelpTopic subtopics
+ confirmingDefinition: true].
- subtopics: aHelpTopic subtopics].
^ self
addPageWithKey: aHelpTopic key
title: aHelpTopic title
contents: aHelpTopic contents!
Item was added:
+ ----- Method: HelpBrowser>>addTopLevelBook (in category 'actions') -----
+ addTopLevelBook
+
+ | book |
+ book := (self rootTopic addBookConfirmingDefinition: true) ifNil: [^ self].
+ self showTopicNamed: book key.!
Item was added:
+ ----- Method: HelpBrowser>>globalTreeListMenu: (in category 'menus') -----
+ globalTreeListMenu: aMenu
+ <treeListMenu>
+ <menuPriority: 600>
+
+ aMenu addLine.
+ aMenu add: 'add top-level book...' translated target: self selector: #addTopLevelBook.
+ ^ aMenu!
Item was changed:
----- Method: HelpBrowser>>rootTopic: (in category 'accessing') -----
rootTopic: aHelpTopic
"set the root topic and work out the top level sub-topics that it implies. Add the search topic at the end of the list"
+ self rootTopic ifNotNil: [:topic | topic removeDependent: self].
+
rootTopic := aHelpTopic asHelpTopic.
+ rootTopic ifNotNil: [rootTopic addDependent: self].
+
self toplevelTopics: ((rootTopic ifNil: [#()] ifNotNil: [rootTopic subtopics ifEmpty: [{rootTopic}]]) sorted, {self searchTopic}).
self changed: #windowTitle.!
Item was added:
+ ----- Method: HelpBrowser>>update: (in category 'updating') -----
+ update: aspect
+
+ (aspect == #subtopicsUpdated or: [aspect == #subtopicAdded]) ifTrue: [ "rootTopic changed"
+ | path |
+ path := self currentTopicPath.
+ self rootTopic updateSubtopics.
+ self rootTopic: self rootTopic.
+ self selectTopicLikePath: path].!
Item was changed:
----- Method: HelpOnHelp class>>writingYourOwnHelp (in category 'pages') -----
writingYourOwnHelp
"This method was automatically generated. Edit it using:"
"HelpOnHelp edit: #writingYourOwnHelp"
<generated>
^(HelpTopic
title: 'Writing your own help'
contents:
'WRITING YOUR OWN HELP
As described in the following pages, there are multiple ways to define help contents for the help system, but the most established format is to create a subclass of CustomHelp. While you can write and customize your help by implementing methods on this subclass, for most use cases it is easier to edit the help directly in the help browser:
+ - To add a new help book, open a context menu on the tree pane on the left and select "add top-level book...".
+ - To add a subtopic, open a context menu on any help topic in the tree and select "add subtopic".
- - To add a new help book, you still need to create a new class by hand:
- CustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp''
- - To add a subtopic, open a context menu on any help topic in the tree pane on the left and select "add subtopic".
- To edit a topic, type into the large text pane of the help browser and press Cmd + S to save your changes.
- To rename or remove a subtopic, use its context menu again.
- To move a topic under a different parent, you can drag''n''drop nodes in the tree.
At the time of writing, the following operations are not yet supported through the UI but must be performed by manually changing the code of your help class:
- Adding/editing a book blurb
- Adding/changing an icon
- Configuring automatic syntax highlighting
- Reordering of help topics within a parent node
On how to do this, please continue reading the following pages.!!
+ ]style[(368 23 60 1 27 18 80 16 93 31 31 41 411),b,,i,,b,,b,,b,,b,!!' readStream nextChunkText)
- ]style[(368 23 48 11 9 1 12 3 22 1 2 3 19 1 2 3 17 1 2 3 9 1 8 3 18 97 16 93 31 31 41 411),b,,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c000000120dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c000000120dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c000000120dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c120000120ndCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c000000120dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c120000120ndCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c000000120dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c120000120ndCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c000000120dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,dCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,c120000120ndCustomHelp subclass: #MyHelpTopic
- instanceVariableNames: ''''
- classVariableNames: ''''
- poolDictionaries: ''''
- category: ''MyHelp'';;,,b,,b,,b,,b,!!' readStream nextChunkText)
key: #writingYourOwnHelp;
shouldStyle: false;
yourself!
Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]