[squeak-dev] The Trunk: Morphic-mt.2096.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Mar 10 09:32:36 UTC 2023
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.2096.mcz
==================== Summary ====================
Name: Morphic-mt.2096
Author: mt
Time: 10 March 2023, 10:32:31.326811 am
UUID: 01b0d2b4-fd5f-6f4f-ae55-d36a0f05a72a
Ancestors: Morphic-mt.2095
Move ClockMorph as important tool in the world-main docking-bar from #MorphicExtras to #Morphic package. Maybe it should even be in #Tools at some point?
=============== Diff against Morphic-mt.2095 ===============
Item was added:
+ StringMorph subclass: #ClockMorph
+ instanceVariableNames: 'showSeconds show24hr'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Morphic-Demo'!
Item was added:
+ ----- Method: ClockMorph class>>authoringPrototype (in category 'scripting') -----
+ authoringPrototype
+ ^ super authoringPrototype contents: Time now printString!
Item was added:
+ ----- Method: ClockMorph class>>descriptionForPartsBin (in category 'parts bin') -----
+ descriptionForPartsBin
+ "Answer a description for use in parts bins."
+
+ ^ self partName: 'Digital Clock' translatedNoop
+ categories: {'Just for Fun' translatedNoop}
+ documentation: 'A digital clock' translatedNoop!
Item was added:
+ ----- Method: ClockMorph class>>initialize (in category 'class initialization') -----
+ initialize
+
+ self registerInFlapsRegistry. !
Item was added:
+ ----- Method: ClockMorph class>>registerInFlapsRegistry (in category 'class initialization') -----
+ registerInFlapsRegistry
+ "Register the receiver in the system's flaps registry"
+ self environment
+ at: #Flaps
+ ifPresent: [:cl | cl registerQuad: {#ClockMorph, #authoringPrototype. 'Clock' translatedNoop. 'A simple digital clock' translatedNoop}
+ forFlapNamed: 'Supplies'.
+ cl registerQuad: {#ClockMorph. #authoringPrototype. 'Clock' translatedNoop. 'A simple digital clock' translatedNoop}
+ forFlapNamed: 'PlugIn Supplies'.]!
Item was added:
+ ----- Method: ClockMorph class>>unload (in category 'class initialization') -----
+ unload
+ "Unload the receiver from global registries"
+
+ self environment at: #Flaps ifPresent: [:cl |
+ cl unregisterQuadsWithReceiver: self] !
Item was added:
+ ----- Method: ClockMorph>>addCustomMenuItems:hand: (in category 'menu') -----
+ addCustomMenuItems: aCustomMenu hand: aHandMorph
+ "Add toggles for showing-seconds and display-24-hrs to the halo menu"
+
+ "NB: intentionallyi no super call here!!"
+
+ aCustomMenu add: 'change font' translated action: #changeFont.
+
+ aCustomMenu addUpdating: #showingSecondsString action: #toggleShowingSeconds.
+ aCustomMenu addUpdating: #displaying24HourString action: #toggleShowing24hr!
Item was added:
+ ----- Method: ClockMorph>>balloonText (in category 'accessing') -----
+ balloonText
+
+ ^ Date current weekday, ', ', Date current printString!
Item was added:
+ ----- Method: ClockMorph>>initialize (in category 'initialization') -----
+ initialize
+ "initialize the state of the receiver"
+
+ super initialize.
+
+ showSeconds := true.
+ show24hr := false.
+ self font: Preferences standardMenuFont emphasis: 1.
+ self step!
Item was added:
+ ----- Method: ClockMorph>>initializeToStandAlone (in category 'parts bin') -----
+ initializeToStandAlone
+ super initializeToStandAlone.
+ showSeconds := false.
+ self font: (Preferences standardMenuFont emphasized: 1).
+ self step!
Item was added:
+ ----- Method: ClockMorph>>show24hr: (in category '24hr') -----
+ show24hr: aBoolean
+ show24hr := aBoolean!
Item was added:
+ ----- Method: ClockMorph>>showSeconds: (in category 'seconds') -----
+ showSeconds: aBoolean
+ showSeconds := aBoolean!
Item was added:
+ ----- Method: ClockMorph>>step (in category 'stepping and presenter') -----
+ step
+
+ | time |
+ super step.
+ time := String streamContents: [ :stream |
+ | t |
+ t := Time now.
+ t seconds: t asSeconds. "ignore nanoSeconds"
+ t
+ print24: (show24hr == true)
+ showSeconds: (showSeconds == true)
+ on: stream].
+ self contents: time!
Item was added:
+ ----- Method: ClockMorph>>stepTime (in category 'stepping and presenter') -----
+ stepTime
+ "Answer the desired time between steps in milliseconds."
+
+ ^999!
Item was added:
+ ----- Method: ClockMorph>>toggleShowing24hr (in category '24hr') -----
+ toggleShowing24hr
+ show24hr := (show24hr == true) not
+ !
Item was added:
+ ----- Method: ClockMorph>>toggleShowingSeconds (in category 'seconds') -----
+ toggleShowingSeconds
+ showSeconds := (showSeconds == true) not
+ !
More information about the Squeak-dev
mailing list
|