[Cuis-dev] Erudite and DrGeo

Mariano Montone marianomontone at gmail.com
Thu Oct 27 07:14:21 PDT 2022


El 27/10/22 a las 09:58, Mariano Montone escribió:
>>
>> Things I want to explore:
>>
>>   * a bloc [[[]]] could have several actions (I should check if it is
>>     possible). For example to copy, to render the result, etc.
>>
> Possible. If all DrGeo blocks have the same set of actions, then it is 
> easier. In the code I sent to you in last email, note that I create a 
> button. So, instead of creating one button, N buttons should be 
> created. So, instead of having a '[[[]]] copyToDrGeo' action, you 
> would have something like '[[[]]] withDrGeoActions' that shows the 
> buttons. If you want different set of buttons for each block, then it 
> can be a bit more difficult.
>>
>>   * replacing the action text button by a small icon with dedicated
>>     tool tip, it will be less verbose, especialy when combining
>>     several command. Is it possible?
>>
> Should be possible. Note that I insert text with a text action . 
> Instead of that, I would try to insert a Form (the icon) and attach a 
> tooltip text and click handler on it. I will have a look at that.

I attach the code for the icons.


Hope it helps.

Cheers,

       Mariano

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20221027/31652ab9/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eruditedrgeoicons.png
Type: image/png
Size: 11238 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20221027/31652ab9/attachment-0001.png>
-------------- next part --------------
'From Cuis 6.0 [latest update: #5494] on 27 October 2022 at 11:11:10 am'!
'Description '!
!provides: 'DrGeoErudite' 1 4!
!requires: 'Erudite' 1 223 nil!
SystemOrganization addCategory: 'DrGeoErudite'!


!classDefinition: #DrGeoErudite category: 'DrGeoErudite'!
Object subclass: #DrGeoErudite
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'DrGeoErudite'!
!classDefinition: 'DrGeoErudite class' category: 'DrGeoErudite'!
DrGeoErudite class
	instanceVariableNames: ''!


!DrGeoErudite commentStamp: 'MM 10/22/2022 19:01:47' prior: 0!
Erudite extension for Dr Geo.


Adds copyToDrGeo as action to code blocks.!

!DrGeoErudite class methodsFor: 'as yet unclassified' stamp: 'MM 10/27/2022 10:35:59'!
initialize

	"self initialize"

	EruditeMarkupGrammar addCodeAction: 'withDrGeoActions'! !

!MorphicEruditeDocRenderer methodsFor: '*DrGeoErudite' stamp: 'MM 10/27/2022 10:43:05'!
copyToDrGeo: aCodeDoc

	self halt: 'Copy aCodeDoc contents to DrGeo here'! !

!MorphicEruditeDocRenderer methodsFor: '*DrGeoErudite' stamp: 'MM 10/27/2022 11:00:56'!
createButton: aForm action: aBlock balloonText: balloonText

	| button |
	
	button _ ImageMorph new image: aForm; yourself.
	button setBalloonText: balloonText.
	button setProperty: #handlesMouseDown: toValue: true.
	button setProperty: #'mouseButton1Down:localPosition:' toValue: [:keyEvent :pos | aBlock value].
	
	^ button

	! !

!MorphicEruditeDocRenderer methodsFor: '*DrGeoErudite' stamp: 'MM 10/27/2022 10:38:59'!
renderCodeCopyToDrGeo: aCodeDoc

	self deprecatedMethod .
	^ self renderCodeWithDrGeoActions: aCodeDoc
	
	! !

!MorphicEruditeDocRenderer methodsFor: '*DrGeoErudite' stamp: 'MM 10/27/2022 11:10:56'!
renderCodeWithDrGeoActions: aDocCode

	|text button textModel |
	
	text _ Text string: aDocCode code.							.
							
	textModel _ EruditeSmalltalkTextModel withText: text.
	textModel formatAndStyle.
		
	stream nextPut: textModel actualContents.
	stream nextPut: ' '.
	
	"Add as many buttons as you need here: "
	
	button _ self createButton: Theme current openIcon 
			action: [ self copyToDrGeo: aDocCode]
			balloonText: 'Copy to DrGeo'. 
	stream nextPut: (Text streamContents: [:s | button printOn: s]).
	
	stream nextPut: ' '. "separation between buttons"
	
	button _ self createButton: Theme current clockIcon 
			action: [ self someDrGeoAction: aDocCode]
			balloonText: 'Copy to DrGeo'. 
	stream nextPut: (Text streamContents: [:s | button printOn: s]).! !

!MorphicEruditeDocRenderer methodsFor: '*DrGeoErudite' stamp: 'MM 10/27/2022 11:09:27'!
someDrAction: aDocCode

	^ self shouldBeImplemented ! !
DrGeoErudite initialize!


More information about the Cuis-dev mailing list