Roassal3 icon indicating copy to clipboard operation
Roassal3 copied to clipboard

RSAthensMorph doesn't draw border according to border style when set

Open StewMacLean opened this issue 3 years ago • 10 comments

Bug description If a border style is set on a RSAthensMorph, the drawOn: method doesn't use it.

To Reproduce Steps to reproduce the behavior: Set a border style on a RSAthensMorph and observe that no border is drawn according to the style

Expected behavior The morph should be drawn with a border according to the set style.

Version information:

OS: MacOs Monterey Version: 12.0.1 Pharo Version 9

Please see fix below:

RSAthensMorph>>drawOn: aCanvas "SIM 16/3/22 - Modify to draw the border according to styles"

"Draw the whole visualization"
isDrawing ifTrue: [ ^ self ].
isDrawing := true.
[ 
	self checkSession.
	self recreateSurfaceIfNecessary.
	"SIM - Draw the border using the borderStyle, which is either the default, or has been set by the application using styles."
	aCanvas 
		fillRectangle: self bounds 
		fillStyle: roassalCanvas color 
		borderStyle: self borderStyle.
	"SIM Original - doesn't draw the border.
	aCanvas fillRectangle: bounds color: roassalCanvas color."
	roassalCanvas playAnimations.
	self drawShapes.

	surface hasBeenFreed
		ifTrue: [ self createSurface ].
	[ aCanvas
		image: surface asForm
		at: self bounds origin asIntegerPoint
		sourceRect: (0 @ 0 extent: surface extent)
		rule: 34 ]
	on: Exception
	do: [ :ex |  ] ] 
ensure: [ 
	isDrawing := false ]

StewMacLean avatar Mar 25 '22 05:03 StewMacLean

Hello @StewMacLean Roassal does not use directly the athens api, to draw thing. Each box(RSBox) defines its attributes, the drawing process is managed by RSAthensRenderer. But this is something that we are going to change in a future to reuse, resources, like fonts, matrices, color styles, etc.

Let me know if this solves your issue

akevalion avatar Mar 25 '22 08:03 akevalion

Hi Milton,

Thanks for getting back to me. It's not the actual Rossal rendering that I'm addressing, it is the rendering of the enclosing Morph that I've embedded in the UI.

I am embedding Roassal drawings using SpRoassalPresenter.

treePanel := self instantiate: SpRoassalPresenter. treePanel

  • script: [: aCanvas |*

  • aCanvas color: treeBackgroundColor.*

  • self renderTreeOn: aCanvas].*

I create a container style:

.containerGray [ Container { #padding: 0, #borderWidth: 1, #borderColor: #veryLightGray} ],

and then set that on the presenter:

treePanel addStyle: 'labelStyle1'; addStyle: 'containerGray'; addStyle: 'lightBlue'.

The contents of the RSAthensMorph is rendered using RSAthensRenderer, but the Morph itself is rendered using RSAthenMorph>>drawOn:.

In order to get the border style to work, I had to modify drawOn: accordingly.

I realise this is a slightly different usage of Roassal. My interface consists of a tree and a bunch of custom drawn buttons using Roassal/Cairo.

Thanks for creating such an awesome piece of software. I'm migrating a project from VisualWorks that I've spent years on, only to find that it looks like they won't be supporting the M1 Mac anything soon. Roassal has made my job considerably easier! I've still got a long way to go though!

BTW, I've heard that Pharo 10 will support native interfaces. I have some dialogs that I need to develop and, unfortunately, the current Pharo rendering looks dated and clunky. Do you know Pharo 10 will support native widgets and where to go for some more info?

I've also tried to fix the text rendering by using Pango. This has given me access to a range of fonts, but the rendering still isn't as crisp as the VisualWorks version. I don't fully understand, but I think it is to do with the underlying rendering of Pharo, as people are calling out for HiDPI.

Anyway, please find attached my code for a RSPangoLabel that I put together. It introduces a dependency on Pango (I've adapted https://github.com/estebanlm/pharo-pango). Maybe useful for Roassal?

Cheers,

Stewart

On Fri, Mar 25, 2022 at 9:45 PM Milton Mamani Torres < @.***> wrote:

Hello @StewMacLean https://github.com/StewMacLean Roassal does not use directly the athens api, to draw thing. Each box(RSBox) defines its attributes, the drawing process is managed by RSAthensRenderer. But this is something that we are going to change in a future to reuse, resources, like fonts, matrices, color styles, etc.

Let me know if this solves your issue

— Reply to this email directly, view it on GitHub https://github.com/ObjectProfile/Roassal3/issues/437#issuecomment-1078788860, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGQYQYCCMSHOZQBXK4G3NDVBV4MJANCNFSM5RTDKO7Q . You are receiving this because you were mentioned.Message ID: @.***>

StewMacLean avatar Mar 25 '22 20:03 StewMacLean

Hello @StewMacLean, I have updated drawOn: with your code. Thank you very much for your feed back. About RSPangoLabel, I need that file to test it, let me know if we can close this issue

akevalion avatar Mar 28 '22 09:03 akevalion

Hi Milton,

The class RSPangoLabel is contained within the Pango-Extensions package, along with some additional Pango code required to support it.

I've attached it below.

Please note, it is not completely finished. The markUp needs a little bit of work, but it does integrate with Roassal OK.

Cheers,

Stewart

On Mon, Mar 28, 2022 at 10:40 PM Milton Mamani Torres < @.***> wrote:

Hello @StewMacLean https://github.com/StewMacLean, I have updated drawOn: with your code. Thank you very much for your feed back. About RSPangoLabel, I need that file to test it, let me know if we can close this issue

— Reply to this email directly, view it on GitHub https://github.com/ObjectProfile/Roassal3/issues/437#issuecomment-1080429853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGQYQZH7QNUEGA54PV3LXLVCF5BLANCNFSM5RTDKO7Q . You are receiving this because you were mentioned.Message ID: @.***>

StewMacLean avatar Mar 28 '22 19:03 StewMacLean

Hello @StewMacLean is this issue still valid? can we close it?

By other hand I have tried RSPangoLabel with @tinchodias we have test it a lilttle bit the pango library, the main repository is not in Esteban github page.

akevalion avatar May 04 '22 07:05 akevalion

Hi,

Apologies for the late reply. Yes, please close this one off.

Regarding Pango, I'm not quite sure what you mean by "the main repository is not in Esteban github page.".

You can find Esteban's Pango code here https://github.com/estebanlm/pharo-pango. You'll also need the Roassal code as well.

Please see below the scripts I use to load these.

There is also a more complete Pango package that is within Gtk3.

It would be good to separate this out to make it more accessible.

Please let me know if you have any questions etc.

Cheers,

Stew

Metacello new baseline: 'Roassal3'; repository: 'github://ObjectProfile/Roassal3:v0.9.9f'; load] on: MCMergeOrLoadWarning do: [: warning | warning load].

Metacello new repository: 'github://estebanlm/pharo-pango/src'; baseline: 'Pango'; load

On Wed, May 4, 2022 at 7:40 PM Milton Mamani Torres < @.***> wrote:

Hello @StewMacLean https://github.com/StewMacLean is this issue still valid? can we close it?

By other hand I have tried RSPangoLabel with @tinchodias https://github.com/tinchodias we have test it a lilttle bit the pango library, the main repository is not in Esteban github page.

— Reply to this email directly, view it on GitHub https://github.com/ObjectProfile/Roassal3/issues/437#issuecomment-1117014707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGQYQ7IIZPMYM6SKJB4DTLVIISWBANCNFSM5RTDKO7Q . You are receiving this because you were mentioned.Message ID: @.***>

StewMacLean avatar May 07 '22 23:05 StewMacLean

Hello @StewMacLean I have tried this version on pharo11 in macos m1 pro.

But this does not work, I will try on a mac with intel processor, maybe this is the issue.

@bergel can we close this issue?

akevalion avatar May 10 '22 08:05 akevalion

Hi Milton,

I am running Pango on a M1 Silicon machine, Monterey., so I don't think this is the problem.

When you say it doesn't work, what are the symptoms? It could be an issue with the libraries, as I recall it took me a bit to get those configured. I seem to recall that I had to download them using Homebrew.

Let me know what the problem is and I'll see what I can do.

Cheers,

Stew

On Tue, May 10, 2022 at 8:22 PM Milton Mamani Torres < @.***> wrote:

Hello @StewMacLean https://github.com/StewMacLean I have tried this version on pharo11 in macos m1 pro.

But this does not work, I will try on a mac with intel processor, maybe this is the issue.

@bergel https://github.com/bergel can we close this issue?

— Reply to this email directly, view it on GitHub https://github.com/ObjectProfile/Roassal3/issues/437#issuecomment-1122081844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGQYQ2JBYLKQ2I6ZKVSV33VJIMELANCNFSM5RTDKO7Q . You are receiving this because you were mentioned.Message ID: @.***>

StewMacLean avatar May 10 '22 09:05 StewMacLean

This is the main repository https://github.com/pharo-spec/gtk-bindings @tinchodias is currently working on Pango implementation for pharo

In my case I can not run pango examples because pharo does not find the libraries, maybe I did not installed correctly. but I used brew install pango

akevalion avatar May 10 '22 12:05 akevalion

Hi Milton,

I think I installed Pango using brew then later installed Gtk via brew as well (sorry it was a while ago and there was quite a bit of trial and error!).

Anyway, please find attached a package that has all the library paths that I use. This may give some clues?

Let me know how you get on...

Cheers,

Stewart

On Wed, May 11, 2022 at 12:52 AM Milton Mamani Torres < @.***> wrote:

This is the main repository https://github.com/pharo-spec/gtk-bindings @tinchodias https://github.com/tinchodias is currently working on Pango implementation for pharo

In my case I can not run pango examples because pharo does not find the libraries, maybe I did not installed correctly. but I used brew install pango

— Reply to this email directly, view it on GitHub https://github.com/ObjectProfile/Roassal3/issues/437#issuecomment-1122351458, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGQYQYHKMMUTGZ2WUH2GNDVJJLZFANCNFSM5RTDKO7Q . You are receiving this because you were mentioned.Message ID: @.***>

StewMacLean avatar May 10 '22 23:05 StewMacLean