The Inbox: MorphicExtras-ct.358.mcz
[email protected] Sat, 20 Jun 2026 17:24:15 0000
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
Christoph Thiede uploaded a new version of MorphicExtras to project The Inbox: http://source.squeak.org/inbox/MorphicExtras-ct.358.mcz ==================== Summary ==================== Name: MorphicExtras-ct.358 Author: ct Time: 20 June 2026, 7:24:14.591892 pm UUID: 6fd2a139-81ee-4009-8406-67c9b85c81ed Ancestors: MorphicExtras-ct.357 Makes it possible to switch the camera of WebCamMorph via the menu. Adds workaround for device enumeration on Linux. Slightly revises existing menu labels. =============== Diff against MorphicExtras-ct.357 =============== Item was changed: ----- Method: CameraInterface class>>cameraDevices (in category 'utilities') ----- cameraDevices "CameraInterface cameraDevices" ^Array streamContents: + [:s| Smalltalk platformName = 'unix' + ifFalse: + [| i | + i := 1. + [(self cameraName: i) + ifNotNil: [:cameraName| s nextPut: cameraName. true] + ifNil: [false]] whileTrue: [i := i + 1]] + ifTrue: + [| lastIndex | + self flag: #workaround. "ct: CameraPlugin for linux currently exposes auxiliary nodes as cameras" + lastIndex := 0. + 1 to: 1024 do: [:i | + (self cameraName: i) + ifNotNil: [:cameraName | + lastIndex + 1 to: i - 1 do: [:j | + s nextPut: #'<unavailable>']. + lastIndex := i. + s nextPut: cameraName]]]]! - [:s| | i | - i := 1. - [(self cameraName: i) - ifNotNil: [:cameraName| s nextPut: cameraName. true] - ifNil: [false]] whileTrue: [i := i + 1]]! Item was changed: ----- Method: WebCamMorph>>addCustomMenuItems:hand: (in category 'menu') ----- addCustomMenuItems: aMenu hand: aHandMorph super addCustomMenuItems: aMenu hand: aHandMorph. aMenu + addLine; addUpdating: #cameraToggleString action: #toggleCameraOnOff; + add: 'choose device' translated subMenu: ([:menu | + CameraInterface cameraDevices withIndexDo: [:name :number | + name ~= #'<unavailable>' ifTrue: + [menu + add: (number = self cameraNumber ifTrue: ['<on>'] ifFalse: ['<off>']), name + selector: #cameraNumber: + argument: number]]. + menu] value: (aMenu class new defaultTarget: aMenu defaultTarget)); addLine; + add: 'resolution' translated subMenu: ([:menu | - add: 'resolution...' translated subMenu: ([:menu | WebCamResolution resolutions do: [:res | menu add: (resolution == res ifTrue: ['<on>'] ifFalse: ['<off>']), res translated selector: #setWebCamResolution: argument: res]. menu] value: (aMenu class new defaultTarget: aMenu defaultTarget)); + add: 'orientation' translated subMenu: ([:menu | - add: 'orientation...' translated subMenu: ([:menu | WebCamOrientation orientations do: [:ori | menu add: (orientation == ori ifTrue: ['<on>'] ifFalse: ['<off>']), ori translated selector: #setWebCamOrientation: argument: ori]. menu] value: (aMenu class new defaultTarget: aMenu defaultTarget)); addUpdating: #frameSizeToggleString action: #toggleUseFrameSize; addUpdating: #showFPSToggleString action: #toggleShowFPS; yourself ! Item was changed: ----- Method: WebCamMorph>>cameraNumber: (in category 'accessing') ----- cameraNumber: anInteger + | on | + camNum = anInteger ifTrue: [^ self]. + (on := self cameraIsOn) ifTrue: [self off]. + camNum := anInteger. + self initializeDisplayForm. + on ifTrue: [self on].! - camNum ~= anInteger ifTrue: - [camNum := anInteger. - self initializeDisplayForm]! Item was changed: ----- Method: WebCamMorph>>cameraToggleString (in category 'menu') ----- cameraToggleString + ^ (camIsOn + ifTrue: ['<on>'] + ifFalse: ['<off>']) + , 'enable camera' translated - ^ camIsOn - ifTrue: ['<on>', 'turn camera off' translated] - ifFalse: ['<off>', 'turn camera on' translated]. - ! Squeak-dev mailing list -- [email protected] To unsubscribe send an email to [email protected]