'From etoys2.3 of 28 November 2007 [latest update: #1843] on 14 December 2007 at 10:09 pm'! "Change Set: AudioChatGUIUI-yo Date: 14 December 2007 Author: Your Name Minimum facelift for AudioChatGUI. The UI is bad, but at least for demo, the buttons and and boxes should be easier to push. We can just assume push-to-talk model (or better, the telephone model), and set the values for these checkboxes (so we can eliminate them). Also, these indicators are not needed. The UI could be different when isRunningInSugar is true or false."! SimpleButtonMorph subclass: #ChatButtonMorph instanceVariableNames: 'actionDownSelector actionUpSelector labelDown labelUp font ' classVariableNames: '' poolDictionaries: '' category: 'Nebraska-Audio Chat'! !AudioChatGUI methodsFor: 'initialization' stamp: 'yo 12/14/2007 17:24'! connectButton ^SimpleButtonMorph new label: 'Connect' font: Preferences standardButtonFont; color: self buttonColor; target: self; actWhen: #buttonUp; actionSelector: #connect; setBalloonText: 'Press to connect to another audio chat user.' ! ! !AudioChatGUI methodsFor: 'initialization' stamp: 'yo 12/14/2007 21:41'! messageWaitingAlertIndicator | messageCounter | myalert _ AlertMorph new socketOwner: self. messageCounter _ UpdatingStringMorph on: self selector: #objectsInQueue. messageCounter font: Preferences standardEToysFont. myalert addMorph: messageCounter. messageCounter contents: '0'; color: Color white. messageCounter align: messageCounter center with: myalert center. myalert setBalloonText: 'New messages indicator. This will flash and show the number of messages when there are messages that you haven''t listened to. You can click here to play the next message.'. myalert on: #mouseUp send: #playNextMessage to: self. ^myalert! ! !AudioChatGUI methodsFor: 'initialization' stamp: 'yo 12/14/2007 17:24'! playButton ^SimpleButtonMorph new label: 'Play' font: Preferences standardButtonFont; color: self buttonColor; target: self; actWhen: #buttonUp; actionSelector: #playNextMessage; setBalloonText: 'Play the next new message.' ! ! !AudioChatGUI methodsFor: 'initialization' stamp: 'yo 12/14/2007 22:02'! start2 Socket initializeNetwork. myrecorder initialize. self addARow: { self inAColumn: { ( self inARow: { self inAColumn: {self toggleForSendWhileTalking}. self inAColumn: {self toggleForHandsFreeTalking}. self inAColumn: {self toggleForPlayOnArrival}. } ) hResizing: #shrinkWrap. self inARow: { self talkBacklogIndicator. (Morph new color: Color transparent; extent: 8@0). self messageWaitingAlertIndicator. }. }. self inAColumn: { theConnectButton _ self connectButton. self playButton. theTalkButton _ self talkButton. }. }. ! ! !AudioChatGUI methodsFor: 'initialization' stamp: 'yo 12/14/2007 21:41'! talkBacklogIndicator ^(UpdatingStringMorph on: self selector: #talkBacklog) font: Preferences standardEToysFont; setBalloonText: 'Approximate number of seconds of delay in your messages getting to the other end.'! ! !ChatButtonMorph methodsFor: 'accessing' stamp: 'yo 12/14/2007 17:19'! font: aFont font _ aFont. ! ! !ChatButtonMorph methodsFor: 'event handling' stamp: 'yo 12/14/2007 17:28'! label: aString ^ self label: aString font: font. ! ! !ChatButtonMorph methodsFor: 'initialization' stamp: 'yo 12/14/2007 17:19'! initialize super initialize. font _ Preferences standardButtonFont. ! ! !EtoyUpdatingThreePhaseButtonMorph class methodsFor: 'as yet unclassified' stamp: 'yo 12/14/2007 21:49'! setForms: size | c | UncheckedForm _ Form extent: size@size depth: 16. c _ UncheckedForm getCanvas asBalloonCanvas. c frameRectangle: UncheckedForm boundingBox width: (size // 12) color: Color black. MouseDownForm _ UncheckedForm deepCopy. CheckedForm _ UncheckedForm deepCopy. c _ CheckedForm getCanvas asBalloonCanvas. c line: ((size*0.2)@(size*0.5)) asIntegerPoint to: ((size*0.4)@(size*0.7)) asIntegerPoint width: 2 color: Color gray darker. c line: ((size*0.4)@(size*0.7)) asIntegerPoint to: ((size*0.9)@(size*0.2)) asIntegerPoint width: 2 color: Color gray darker. ! ! !EtoyUpdatingThreePhaseButtonMorph class methodsFor: 'instance creation' stamp: 'yo 12/14/2007 21:40'! checkBox "Answer a button pre-initialized with checkbox images." "(Form extent: 12@12 depth: 32) morphEdit" CheckedForm ifNil: [ self setForms: 24 ]. ^self new onImage: CheckedForm; pressedImage: MouseDownForm; offImage: UncheckedForm; extent: CheckedForm extent; yourself ! ! SimpleButtonMorph subclass: #ChatButtonMorph instanceVariableNames: 'actionDownSelector actionUpSelector labelDown labelUp font' classVariableNames: '' poolDictionaries: '' category: 'Nebraska-Audio Chat'! !ChatButtonMorph reorganize! ('accessing' actionDownSelector: actionUpSelector: font: labelDown: labelUp:) ('event handling' label: mouseDown: mouseUp:) ('initialization' initialize) ('events' doButtonDownAction doButtonUpAction) ! "Postscript: " EtoyUpdatingThreePhaseButtonMorph classPool at: #CheckedForm put: nil. EtoyUpdatingThreePhaseButtonMorph classPool at: #UncheckedForm put: nil. EtoyUpdatingThreePhaseButtonMorph classPool at: #MouseDownForm put: nil. AudioChatGUI classPool at: #PlayOnArrival put: true. !