Etoys: Etoys-kfr.132.mcz

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

Etoys: Etoys-kfr.132.mcz

commits-2
Karl Ramberg uploaded a new version of Etoys to project Etoys:
http://source.squeak.org/etoys/Etoys-kfr.132.mcz

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

Name: Etoys-kfr.132
Author: kfr
Time: 18 March 2012, 11:55:22 am
UUID: 18ff5a51-a7f6-0e4d-8148-47a717934518
Ancestors: Etoys-kfr.131

Adds 'button to show/hide this script' to the Scriptor menu. When chosen, this will produce a button which, when pressed, will show the Scriptor -- or, if the Scriptor is already showing, hide it. The resulting button can subsequently be edited via its halo in the usual ways, e.g. to change the name, the color, the balloon help.

=============== Diff against Etoys-kfr.131 ===============

Item was changed:
  ----- Method: MethodWithInterface>>renameScript:fromPlayer: (in category 'rename') -----
  renameScript: newSelector fromPlayer: aPlayer
  "The receiver's selector has changed to the new selector.  Get various things right, including the physical appearance of any Scriptor open on this method"
 
  self allScriptEditors do:
  [:aScriptEditor | aScriptEditor renameScriptTo: newSelector].
 
  (selector numArgs = 0 and: [newSelector numArgs = 1])
  ifTrue:
  [self argumentVariables: (OrderedCollection with:
  (Variable new name: #parameter type: #Number))].
  (selector numArgs = 1 and: [newSelector numArgs = 0])
  ifTrue:
  [self argumentVariables: OrderedCollection new].
 
  selector _ newSelector asSymbol.
  self bringUpToDate.
  self playerClass atSelector: selector putScript: self.
+ self allScriptGoverningButtons  do:
- self allScriptActivationButtons do:
  [:aButton | aButton bringUpToDate].
 
  !

Item was added:
+ ----- Method: ScriptEditorMorph>>buttonToOpenOrCloseThisScript (in category 'customevents-other') -----
+ buttonToOpenOrCloseThisScript
+ "Hand the user a button which, when clicked, will show or hide this scriptor"
+
+ | aButton |
+ aButton := ScriptOpeningButtonMorph new.
+ aButton affiliatedScriptor: self.
+ aButton label: aButton standardLabelForButton.
+ aButton color:  (Color r: 0.677 g: 0.935 b: 0.484).
+ aButton target: self; actionSelector: #openOrCloseScriptor.
+ aButton setBalloonText: ('show or hide the script named {1} ' translated format: {scriptName}).
+ aButton openInHand!

Item was changed:
  ----- Method: ScriptEditorMorph>>offerScriptorMenu (in category 'other') -----
  offerScriptorMenu
  "Put up a menu in response to the user's clicking in the menu-request area of the scriptor's heaer"
 
  | aMenu count |
 
  self modernize.
  ActiveHand showTemporaryCursor: nil.
 
  Preferences eToyFriendly ifTrue: [^ self offerSimplerScriptorMenu].
 
  aMenu _ MenuMorph new defaultTarget: self.
  aMenu addTitle: scriptName asString.
  aMenu addStayUpItem.  "NB:  the kids version in #offerSimplerScriptorMenu does not deploy the stay-up item"
 
  aMenu addList: (self hasParameter
  ifTrue: [{
  {'remove parameter' translated. #ceaseHavingAParameter}}]
  ifFalse: [{
  {'add parameter' translated. #addParameter}}]).
 
  self hasParameter ifFalse:
  [aMenu addTranslatedList: {
  {'button to fire this script' translatedNoop. #tearOfButtonToFireScript}.
  {'fires per tick...' translatedNoop. #chooseFrequency}.
  #-
  }].
 
  aMenu addUpdating: #showingCaretsString  target: self action: #toggleShowingCarets.
  aMenu addLine.
  aMenu addList: {
  {'edit balloon help for this script' translated. #editMethodDescription}.
  {'explain status alternatives' translated. #explainStatusAlternatives}.
+ {'button to show/hide this script' translated. #buttonToOpenOrCloseThisScript}.
  #-
  }.
 
 
  Preferences universalTiles ifFalse:
  [count _ self savedTileVersionsCount.
  self showingMethodPane
  ifFalse: "currently showing tiles"
  [aMenu add: 'show code textually' translated action: #toggleWhetherShowingTiles.
  count > 0 ifTrue:
  [aMenu add: 'revert to tile version...' translated action: #revertScriptVersion].
  aMenu add: 'save this version' translated action: #saveScriptVersion]
 
  ifTrue: "current showing textual source"
  [count >= 1 ifTrue:
  [aMenu add: 'revert to tile version' translated action: #toggleWhetherShowingTiles]]].
 
  "aMenu addLine.
  self addGoldBoxItemsTo: aMenu."
 
  aMenu addLine.
 
  aMenu add: 'grab this object' translated target: playerScripted selector: #grabPlayerIn: argument: ActiveWorld.
  aMenu balloonTextForLastItem: 'This will actually pick up the object bearing this script and hand it to you.  Click the (left) button to drop it' translated.
 
  aMenu add: 'reveal this object' translated target: playerScripted selector: #revealPlayerIn: argument: ActiveWorld.
  aMenu balloonTextForLastItem: 'If you have misplaced the object bearing this script, use this item to (try to) make it visible' translated.
 
  aMenu add: 'tile representing this object' translated target: playerScripted action: #tearOffTileForSelf.
  aMenu balloonTextForLastItem: 'choose this to obtain a tile which represents the object associated with this script' translated.
 
  aMenu addTranslatedList: {
  #-.
  {'open viewer' translatedNoop. #openObjectsViewer.  'open the viewer of the object to which this script belongs' translatedNoop}.
  {'detached method pane' translatedNoop. #makeIsolatedCodePane. 'open a little window that shows the Smalltalk code underlying this script.' translatedNoop}.
  #-.
  {'destroy this script' translatedNoop. #destroyScript}
  }.
 
 
  aMenu popUpInWorld: self currentWorld.
  !

Item was changed:
  ----- Method: ScriptEditorMorph>>offerSimplerScriptorMenu (in category 'other') -----
  offerSimplerScriptorMenu
  "Put up a menu in response to the user's clicking in the menu-request area of the scriptor's heaer.  This variant is used when eToyFriendly preference is true."
 
  | aMenu count |
 
  ActiveHand showTemporaryCursor: nil.
 
  aMenu _ MenuMorph new defaultTarget: self.
  aMenu addTitle: scriptName asString.
 
  aMenu addList: (self hasParameter
  ifTrue: [{
  {'remove parameter' translated. #ceaseHavingAParameter}}]
  ifFalse: [{
  {'add parameter' translated. #addParameter}}]).
 
  self hasParameter ifFalse:
  [aMenu addTranslatedList: #(
  ('button to fire this script' tearOfButtonToFireScript)
  -) translatedNoop].
 
  aMenu addUpdating: #showingCaretsString  target: self action: #toggleShowingCarets.
  aMenu addLine.
  aMenu addList: {
  {'edit balloon help for this script' translated. #editMethodDescription}.
  {'explain status alternatives' translated. #explainStatusAlternatives}.
+ {'button to show/hide this script' translated. #buttonToOpenOrCloseThisScript}.
  #-
  }.
 
 
  Preferences universalTiles ifFalse:
  [count _ self savedTileVersionsCount.
  self showingMethodPane
  ifFalse: "currently showing tiles"
  [aMenu add: 'show code textually' translated action: #toggleWhetherShowingTiles.
  count > 0 ifTrue:
  [aMenu add: 'revert to tile version...' translated action: #revertScriptVersion].
  aMenu add: 'save this version' translated action: #saveScriptVersion]
 
  ifTrue: "current showing textual source"
  [count >= 1 ifTrue:
  [aMenu add: 'revert to tile version' translated action: #toggleWhetherShowingTiles]]].
 
  aMenu addLine.
 
  aMenu add: 'grab this object' translated target: playerScripted selector: #grabPlayerIn: argument: ActiveWorld.
  aMenu balloonTextForLastItem: 'This will actually pick up the object bearing this script and hand it to you.  Click the (left) button to drop it' translated.
 
  aMenu add: 'reveal this object' translated target: playerScripted selector: #revealPlayerIn: argument: ActiveWorld.
  aMenu balloonTextForLastItem: 'If you have misplaced the object bearing this script, use this item to (try to) make it visible' translated.
 
  aMenu add: 'tile representing this object' translated target: playerScripted action: #tearOffTileForSelf.
  aMenu balloonTextForLastItem: 'choose this to obtain a tile which represents the object associated with this script' translated.
 
  aMenu addLine.
 
  aMenu addTranslatedList: #(
  -
  ('open viewer' openObjectsViewer  'open the viewer of the object to which this script belongs')
  -
  ('destroy this script' destroyScript)) translatedNoop.
 
 
  aMenu popUpInWorld: self currentWorld.
  !

Item was added:
+ ----- Method: ScriptEditorMorph>>openOrCloseScriptor (in category 'customevents-other') -----
+ openOrCloseScriptor
+ "Open up the scriptor on the screen"
+
+ self isInWorld
+ ifTrue:
+ [self delete]
+ ifFalse:
+ [self openInWorld; goHome; comeToFront]!

Item was added:
+ SimpleButtonMorph subclass: #ScriptOpeningButtonMorph
+ instanceVariableNames: 'affiliatedScriptor'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Etoys-Buttons'!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>affiliatedScriptor (in category 'accessing') -----
+ affiliatedScriptor
+ "Answer the affiliatedScriptor"
+
+ ^ affiliatedScriptor!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>affiliatedScriptor: (in category 'accessing') -----
+ affiliatedScriptor: aScriptor
+ "Set the value of affiliatedScriptor."
+
+ affiliatedScriptor := aScriptor!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>bringUpToDate (in category 'as yet unclassified') -----
+ bringUpToDate
+ "The object's name, or the script name, or both, may have changed.  Make sure I continue to look and act right"
+
+ (self hasProperty: #labelManuallyEdited) ifFalse:
+ [self label: self standardLabelForButton].
+ self setBalloonText: ('show or hide the script named {1} in the object named {2} ' translated format: {affiliatedScriptor scriptName.  affiliatedScriptor playerScripted externalName}).!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>isTileScriptingElement (in category 'accessing') -----
+ isTileScriptingElement
+ "Answer whether the receiver is a tile-scripting element."
+
+ ^ true!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>labelString: (in category 'accessing') -----
+ labelString: aString
+ "Set the labelString"
+
+ super labelString: aString.
+ self setProperty: #labelManuallyEdited toValue: true!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>setLabelStringInitially: (in category 'accessing') -----
+ setLabelStringInitially: aString
+ "Set the labelString initially"
+
+ self labelString: aString.
+ self removeProperty: #labelManuallyEdited!

Item was added:
+ ----- Method: ScriptOpeningButtonMorph>>standardLabelForButton (in category 'as yet unclassified') -----
+ standardLabelForButton
+ "Answer a string to serve as a prospective label for the receiver."
+
+ ^  affiliatedScriptor playerScripted externalName , ' ', affiliatedScriptor scriptName!

Item was added:
+ ----- Method: UniclassScript>>allScriptGoverningButtons (in category 'script editor') -----
+ allScriptGoverningButtons
+
+ "Answer all the script-activation and script-opening buttons that exist for this interface"
+
+ ^ (ScriptActivationButton allInstances select:
+ [:aButton | aButton uniclassScript == self]),
+
+ (ScriptOpeningButtonMorph allInstances select:
+ [:aButton | aButton affiliatedScriptor == currentScriptEditor])!

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev