How to do it WITHOUT editing the ScratchSkin.
Go to Scratch-UI-Panes -> ScratchViewerMorph -> initialization -> rebuildCategorySelectors.
Then replace the code there with this:
rebuildCategorySelectors
| catList nameList maxExtent buttons label offForm onForm overForm b pad leftColumnX rightColumnX x y count |
catList _ #(
motion control
looks sensing
sound operators
pen variables).
nameList _ #(
custom1 custom2
custom3 custom4
custom5 custom6
custom7 custom8).
"First, delete the old category buttons"
submorphs do: [:m | (m isKindOf: ResizableToggleButton2) ifTrue: [m delete]].
"Create new buttons, keeping track of the maximum extent."
maxExtent _ 75@0.
count _ 0.
buttons _ catList collect: [:cat |
count _ count + 1.
label _ (ScratchTranslator translationFor: (nameList at: count)) capitalized.
offForm _ (ScratchFrameMorph skinAt: cat).
onForm _ (ScratchFrameMorph skinAt: (cat, 'Pressed')).
overForm _ (ScratchFrameMorph skinAt: (cat, 'Over')).
ScratchTranslator isRTL
ifTrue:[
b _ ResizableToggleButton2 new
offForm: (offForm flipBy: #horizontal centerAt: offForm center)
onForm: (onForm flipBy: #horizontal centerAt: onForm center)
overForm: (overForm flipBy: #horizontal centerAt: overForm center)]
ifFalse:[
b _ ResizableToggleButton2 new
offForm: offForm
onForm: onForm
overForm: overForm].
b
label: label font: (ScratchFrameMorph getFont: #Category);
setLabelColor: Color white;
target: self;
actionSelector: #currentCategory:;
arguments: (Array with: cat);
toggleButtonMode: true;
toggleMode: false.
ScratchTranslator isRTL
ifTrue:[b rightJustifyInset: 10]
ifFalse:[b leftJustifyInset: 10].
maxExtent _ maxExtent max: (b extent + (3 @ -6)).
b].
"calculate catButtonsExtent"
pad _ 15. "padding on left, right, and betwen the button columns"
catButtonsExtent _ ((2 * maxExtent x) + (3 * pad)) @ (((catList size // 2) * (maxExtent y + 6)) + 25).
"place the buttons"
leftColumnX _ self left + 12 + pad.
rightColumnX _ leftColumnX + maxExtent x + pad.
x _ leftColumnX.
y _ self top + 17.
1 to: buttons size do: [:i |
b _ buttons at: i.
b extent: maxExtent.
self addMorph: (b position: x@y).
i even
ifTrue: [x _ leftColumnX. y _ y + b height + 6]
ifFalse: [x _ rightColumnX]].
self width: catButtonsExtent x.
pageViewer position: self position + (0@catButtonsExtent y).
topSectionHeight _ catButtonsExtent y - 4.That is for the source version. For the non-source version, well, if you want that, either work it out yourself or post a request.
NOTE: You cannot add categories using this. I might try and find a shortcut for that some time that doesn't use the ScratchSkin. For the moment, just wait...
Offline
Request!!!!!
Offline
Hey, It works with the non-source code version too!
Offline