<commit_before>"
I am a class for pharo platform
"
Class {
	#name : #TRPharoPlatform,
	#superclass : #TRPlatform,
	#category : #'Trachel-MorphSpecific'
}

{ #category : #testing }
TRPharoPlatform class >> isActivePlatform [
	^ true.
	"^ SmalltalkImage current vm isPharoVM".
]

{ #category : #'accessing-classes' }
TRPharoPlatform >> affineTransformClass [
	^ AthensAffineTransform
]

{ #category : #public }
TRPharoPlatform >> browseClass: aClass [
	^ Nautilus openOnClass: aClass
	
]

{ #category : #public }
TRPharoPlatform >> colorFormClass [
	^ ColorForm
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeArcPathFor: aShape [
	| i e aAngle bAngle aSin aCos bSin bCos |
	aShape canvas ifNil: [ ^ nil ].
	aAngle:=aShape alphaAngle value degreesToRadians.
	bAngle:=aShape betaAngle value degreesToRadians.
	i := aShape innerRadius value.
	e := aShape externalRadius value.
	aCos := aAngle cos.
	aSin := aAngle sin negated.
	bCos := bAngle cos.
	bSin := bAngle sin negated.
	^ aShape athensCanvas
			createPath: [ :builder | 
				builder
					absolute;
					moveTo: ((i * (bCos)) @ (i * (bSin)));
					arcTo:  ((i * (aCos)) @ (i * (aSin))) angle: bAngle - aAngle cw: true;
					ccwArcTo: ((e * (aCos)) @ (e * (aSin))) angle: 0;
					ccwArcTo: ((e * (bCos)) @ (e * (bSin))) angle: bAngle  - aAngle;
					ccwArcTo: ((i * (bCos)) @ (i * (bSin))) angle: 0 ]
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeCircleHeadPathFor: shape [
	| vector r unit radius center endPoint |
	vector := shape to - shape from.
	r := vector r.
	r = 0
		ifTrue: [ ^ false ].
	unit := vector / r.
	radius := unit / 2 * shape mySize.
	endPoint := shape to - (vector * (1-shape percentage)).
	center := endPoint - radius.
	^  shape athensCanvas
		createPath: [ :builder | 
			builder
				absolute;
				moveTo: center + radius;
				ccwArcTo: center + radius leftRotated angle: 90 degreesToRadians;
				ccwArcTo: center - radius angle: 90 degreesToRadians;
				ccwArcTo: center - radius leftRotated angle: 90 degreesToRadians;
				ccwArcTo: center + radius angle: 90 degreesToRadians ]
	
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeEllipsePathFor: aShape [
	| halfWidth halfHeight rectangle |
	aShape canvas ifNil: [ ^ nil ].
	rectangle := aShape basicEncompassingRectangle.
	halfWidth := rectangle width / 2 asFloat.
	halfHeight := rectangle height / 2 asFloat.

	^ aShape athensCanvas
		createPath: [ :builder | 
			builder
				relative;
				moveTo: halfWidth negated @ 0;
				curveVia: 0 @ (halfHeight negated * 0.55)
					and: (0.45 * halfWidth) @ halfHeight negated
					to: halfWidth @ halfHeight negated;
				curveVia: (halfWidth * 0.55) @ 0 
					and: halfWidth @ (0.45 * halfHeight) 
					to: halfWidth @ halfHeight;
				curveVia: 0 @ (halfHeight * 0.55) 
					and: (0.45 * halfWidth negated) @ halfHeight 
					to: halfWidth negated @ halfHeight;
				curveVia: (halfWidth negated * 0.55) @ 0
					and: halfWidth negated @ (halfHeight negated * 0.45)
					to: halfWidth negated @ halfHeight negated ]
				
			
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeRoundBoxPathFor: aShape [
	| r vr hr rectangle |
	aShape canvas ifNil: [ ^ nil ].
	r := aShape borderRadius.
	vr := 0 @ r.
	hr := r @ 0.
	rectangle := aShape basicEncompassingRectangle.
	^ aShape athensCanvas
		createPath: [ :builder | 
			builder
				absolute;
				moveTo: rectangle topLeft + hr;
				lineTo: rectangle topRight - hr;
				cwArcTo: rectangle topRight + vr angle: Float halfPi;
				lineTo: rectangle bottomRight - vr;
				cwArcTo: rectangle bottomRight - hr angle: Float halfPi;
				lineTo: rectangle bottomLeft + hr;
				cwArcTo: rectangle bottomLeft - vr angle: Float halfPi;
				lineTo: rectangle topLeft + vr;
				cwArcTo: rectangle topLeft + hr angle: Float halfPi;
				closePath ]
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeSVGPathFor: aShape [
	^ aShape athensCanvas createPath: [ :builder |
		aShape curves do: [ :each | 
			builder perform: each first withArguments: each second ]
		]
	
]

{ #category : #public }
TRPharoPlatform >> createPopupFor: aMorph in: aPoint background: aColor string: aString [
	| popup tm vertices xdelta ydelta world position |
	tm := SimpleBalloonMorph getTextMorph: aString for: aMorph.
	tm composeToBounds.
	vertices := SimpleBalloonMorph getVertices: tm bounds.
	popup := SimpleBalloonMorph new color: aColor;
		addMorph: tm; 
		setTarget: nil;
		setVertices: vertices.
	world := aMorph world 
		ifNil: [ ^ popup ].
	position := aPoint + aMorph position.
	xdelta := ydelta := 0.
	
	(position x + popup width) > world width 
		ifTrue: [ xdelta := popup width negated ].
	(position y + popup height) > world height 
		ifTrue: [ ydelta := popup height negated ].
	popup lock;
		fullBounds;
		setProperty: #morphicLayerNumber toValue: popup morphicLayerNumber.
	popup position: position + (xdelta @ydelta).
	aMorph world addMorphFront: popup.
	
	aMorph world activeHand balloonHelp: popup.
	^ popup
]

{ #category : #public }
TRPharoPlatform >> dateAndTime [
	^ DateAndTime
]

{ #category : #public }
TRPharoPlatform >> dateAndTimeClass [
	^ DateAndTime
]

{ #category : #public }
TRPharoPlatform >> dateAndTimeFromString: aString [
	^ DateAndTime fromString: aString.
]

{ #category : #utilities }
TRPharoPlatform >> dateTimeStringExample [
	^ 'Ebola2.1,POINT (-9.696645 9.945587),2014-01-01T00:00:00,2015-01-01T00:00:00,Guinea,9.945587,-9.696645,ZEBOV,528,337,64%,"Outbreak is currently ongoing in southeastern Guinea, including the capital?Conakry?and the neighbour countries?Sierra Leone?andLiberia"
Ebola2.2,POINT (32.290275 1.373333),2012-01-01T00:00:00,-0002-12-29T00:00:00,Uganda,1.373333,32.290275,SEBOV,24,17,71%,Outbreak occurred in the?Kibaale District.[34]
Ebola2.6,POINT (21.758664 -4.038333),2008-01-01T00:00:00,2009-01-01T00:00:00,Democratic Republic of Congo,-4.038333,21.758664,ZEBOV,32,14,45%,Outbreak occurred in the Mweka and Luebo health zones of the Province of?Kasai-Occidental.[33]' 
]

{ #category : #fonts }
TRPharoPlatform >> defaultFont [
	^ StandardFonts defaultFont
]

{ #category : #public }
TRPharoPlatform >> deletePopup: popup [
	popup ifNil: [ ^ self ].
	popup delete.
]

{ #category : #public }
TRPharoPlatform >> dialogChooseFrom: options values: values [
	^ UIManager default chooseFrom: options values: values.
]

{ #category : #windows }
TRPharoPlatform >> dialogConfirm: question [
	^ UIManager default confirm: question
]

{ #category : #public }
TRPharoPlatform >> dialogInform: aMessage [
	self inform: aMessage<commit_msg>Update TRPharoPlatform to access to dialog choose file of the system<commit_after>"
I am a class for pharo platform
"
Class {
	#name : #TRPharoPlatform,
	#superclass : #TRPlatform,
	#category : #'Trachel-MorphSpecific'
}

{ #category : #testing }
TRPharoPlatform class >> isActivePlatform [
	^ true.
	"^ SmalltalkImage current vm isPharoVM".
]

{ #category : #'accessing-classes' }
TRPharoPlatform >> affineTransformClass [
	^ AthensAffineTransform
]

{ #category : #public }
TRPharoPlatform >> browseClass: aClass [
	^ Nautilus openOnClass: aClass
	
]

{ #category : #public }
TRPharoPlatform >> colorFormClass [
	^ ColorForm
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeArcPathFor: aShape [
	| i e aAngle bAngle aSin aCos bSin bCos |
	aShape canvas ifNil: [ ^ nil ].
	aAngle:=aShape alphaAngle value degreesToRadians.
	bAngle:=aShape betaAngle value degreesToRadians.
	i := aShape innerRadius value.
	e := aShape externalRadius value.
	aCos := aAngle cos.
	aSin := aAngle sin negated.
	bCos := bAngle cos.
	bSin := bAngle sin negated.
	^ aShape athensCanvas
			createPath: [ :builder | 
				builder
					absolute;
					moveTo: ((i * (bCos)) @ (i * (bSin)));
					arcTo:  ((i * (aCos)) @ (i * (aSin))) angle: bAngle - aAngle cw: true;
					ccwArcTo: ((e * (aCos)) @ (e * (aSin))) angle: 0;
					ccwArcTo: ((e * (bCos)) @ (e * (bSin))) angle: bAngle  - aAngle;
					ccwArcTo: ((i * (bCos)) @ (i * (bSin))) angle: 0 ]
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeCircleHeadPathFor: shape [
	| vector r unit radius center endPoint |
	vector := shape to - shape from.
	r := vector r.
	r = 0
		ifTrue: [ ^ false ].
	unit := vector / r.
	radius := unit / 2 * shape mySize.
	endPoint := shape to - (vector * (1-shape percentage)).
	center := endPoint - radius.
	^  shape athensCanvas
		createPath: [ :builder | 
			builder
				absolute;
				moveTo: center + radius;
				ccwArcTo: center + radius leftRotated angle: 90 degreesToRadians;
				ccwArcTo: center - radius angle: 90 degreesToRadians;
				ccwArcTo: center - radius leftRotated angle: 90 degreesToRadians;
				ccwArcTo: center + radius angle: 90 degreesToRadians ]
	
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeEllipsePathFor: aShape [
	| halfWidth halfHeight rectangle |
	aShape canvas ifNil: [ ^ nil ].
	rectangle := aShape basicEncompassingRectangle.
	halfWidth := rectangle width / 2 asFloat.
	halfHeight := rectangle height / 2 asFloat.

	^ aShape athensCanvas
		createPath: [ :builder | 
			builder
				relative;
				moveTo: halfWidth negated @ 0;
				curveVia: 0 @ (halfHeight negated * 0.55)
					and: (0.45 * halfWidth) @ halfHeight negated
					to: halfWidth @ halfHeight negated;
				curveVia: (halfWidth * 0.55) @ 0 
					and: halfWidth @ (0.45 * halfHeight) 
					to: halfWidth @ halfHeight;
				curveVia: 0 @ (halfHeight * 0.55) 
					and: (0.45 * halfWidth negated) @ halfHeight 
					to: halfWidth negated @ halfHeight;
				curveVia: (halfWidth negated * 0.55) @ 0
					and: halfWidth negated @ (halfHeight negated * 0.45)
					to: halfWidth negated @ halfHeight negated ]
				
			
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeRoundBoxPathFor: aShape [
	| r vr hr rectangle |
	aShape canvas ifNil: [ ^ nil ].
	r := aShape borderRadius.
	vr := 0 @ r.
	hr := r @ 0.
	rectangle := aShape basicEncompassingRectangle.
	^ aShape athensCanvas
		createPath: [ :builder | 
			builder
				absolute;
				moveTo: rectangle topLeft + hr;
				lineTo: rectangle topRight - hr;
				cwArcTo: rectangle topRight + vr angle: Float halfPi;
				lineTo: rectangle bottomRight - vr;
				cwArcTo: rectangle bottomRight - hr angle: Float halfPi;
				lineTo: rectangle bottomLeft + hr;
				cwArcTo: rectangle bottomLeft - vr angle: Float halfPi;
				lineTo: rectangle topLeft + vr;
				cwArcTo: rectangle topLeft + hr angle: Float halfPi;
				closePath ]
]

{ #category : #'drawing - helpers' }
TRPharoPlatform >> computeSVGPathFor: aShape [
	^ aShape athensCanvas createPath: [ :builder |
		aShape curves do: [ :each | 
			builder perform: each first withArguments: each second ]
		]
	
]

{ #category : #public }
TRPharoPlatform >> createPopupFor: aMorph in: aPoint background: aColor string: aString [
	| popup tm vertices xdelta ydelta world position |
	tm := SimpleBalloonMorph getTextMorph: aString for: aMorph.
	tm composeToBounds.
	vertices := SimpleBalloonMorph getVertices: tm bounds.
	popup := SimpleBalloonMorph new color: aColor;
		addMorph: tm; 
		setTarget: nil;
		setVertices: vertices.
	world := aMorph world 
		ifNil: [ ^ popup ].
	position := aPoint + aMorph position.
	xdelta := ydelta := 0.
	
	(position x + popup width) > world width 
		ifTrue: [ xdelta := popup width negated ].
	(position y + popup height) > world height 
		ifTrue: [ ydelta := popup height negated ].
	popup lock;
		fullBounds;
		setProperty: #morphicLayerNumber toValue: popup morphicLayerNumber.
	popup position: position + (xdelta @ydelta).
	aMorph world addMorphFront: popup.
	
	aMorph world activeHand balloonHelp: popup.
	^ popup
]

{ #category : #public }
TRPharoPlatform >> dateAndTime [
	^ DateAndTime
]

{ #category : #public }
TRPharoPlatform >> dateAndTimeClass [
	^ DateAndTime
]

{ #category : #public }
TRPharoPlatform >> dateAndTimeFromString: aString [
	^ DateAndTime fromString: aString.
]

{ #category : #utilities }
TRPharoPlatform >> dateTimeStringExample [
	^ 'Ebola2.1,POINT (-9.696645 9.945587),2014-01-01T00:00:00,2015-01-01T00:00:00,Guinea,9.945587,-9.696645,ZEBOV,528,337,64%,"Outbreak is currently ongoing in southeastern Guinea, including the capital?Conakry?and the neighbour countries?Sierra Leone?andLiberia"
Ebola2.2,POINT (32.290275 1.373333),2012-01-01T00:00:00,-0002-12-29T00:00:00,Uganda,1.373333,32.290275,SEBOV,24,17,71%,Outbreak occurred in the?Kibaale District.[34]
Ebola2.6,POINT (21.758664 -4.038333),2008-01-01T00:00:00,2009-01-01T00:00:00,Democratic Republic of Congo,-4.038333,21.758664,ZEBOV,32,14,45%,Outbreak occurred in the Mweka and Luebo health zones of the Province of?Kasai-Occidental.[33]' 
]

{ #category : #fonts }
TRPharoPlatform >> defaultFont [
	^ StandardFonts defaultFont
]

{ #category : #public }
TRPharoPlatform >> deletePopup: popup [
	popup ifNil: [ ^ self ].
	popup delete.
]

{ #category : #windows }
TRPharoPlatform >> dialogChooseFile: pattern label: title [
	^ UIManager default chooseFullFileNameMatching: pattern label: title.
]

{ #category : #public }
TRPharoPlatform >> dialogChooseFrom: options values: values [
	^ UIManager default chooseFrom: options values: values.
]

{ #category : #windows }
TRPharoPlatform >> dialogConfirm: question [
	^ UIManager default confirm: question
]

{ #category : #public }
TRPharoPlatform >> dialogInform: aMessage [
	self inform: aMessage
{'fraction_non_alphanumeric': 0.11743959177547651, 'fraction_numerical': 0.037370553804592525, 'mean_word_length': 3.9068483063328423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3502160', 'n_tokens_mistral': 5310, 'n_tokens_neox': 4598, 'n_words': 1242}