Receiving notification of theme changes or changes to syntax highlighting properties

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Receiving notification of theme changes or changes to syntax highlighting properties

monty-3
How can you receive notification of a theme change (like going to or from the Dark theme), or even better, notification of a change to some property of syntax highlighting (like the styling used for string literals)?

And what is the preferred way of querying the current syntax highlighting properties? I am using "SHTextStylerST80 new attributesFor: aProperty" now (SHPreferences doesn't provide enough), but there is talk of Shout being removed.

Reply | Threaded
Open this post in threaded view
|

Re: Receiving notification of theme changes or changes to syntax highlighting properties

CyrilFerlicot


On 20/03/2016 03:12, monty wrote:
> How can you receive notification of a theme change (like going to or from the Dark theme), or even better, notification of a change to some property of syntax highlighting (like the styling used for string literals)?
>

Hi,

For the theme change part, morphs should implement a #themeChanged
method that should update the colours and send the method to his submorphs.


> And what is the preferred way of querying the current syntax highlighting properties? I am using "SHTextStylerST80 new attributesFor: aProperty" now (SHPreferences doesn't provide enough), but there is talk of Shout being removed.
>

--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France


signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Receiving notification of theme changes or changes to syntax highlighting properties

monty-3
Yeah, I saw themeChanged, but what about non-morphs? How do they get notified? There should be some announcement that you can subscribe to. Should I add one?

> Sent: Saturday, March 19, 2016 at 10:20 PM
> From: "Cyril Ferlicot Delbecque" <[hidden email]>
> To: [hidden email]
> Subject: Re: [Pharo-dev] Receiving notification of theme changes or changes to syntax highlighting properties
>
>
>
> On 20/03/2016 03:12, monty wrote:
> > How can you receive notification of a theme change (like going to or from the Dark theme), or even better, notification of a change to some property of syntax highlighting (like the styling used for string literals)?
> >
>
> Hi,
>
> For the theme change part, morphs should implement a #themeChanged
> method that should update the colours and send the method to his submorphs.
>
>
> > And what is the preferred way of querying the current syntax highlighting properties? I am using "SHTextStylerST80 new attributesFor: aProperty" now (SHPreferences doesn't provide enough), but there is talk of Shout being removed.
> >
>
> --
> Cyril Ferlicot
>
> http://www.synectique.eu
>
> 165 Avenue Bretagne
> Lille 59000 France
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Receiving notification of theme changes or changes to syntax highlighting properties

Henrik Nergaard
themeChanged is the hook method which is called from World and then by default recursively traverses the tree.
If you have anything in a morph which is theming dependent, then this method should be implemented.
Currently it is the morphs job to update its other parts when the theme changed (non morph objects which is theming dependent), using an announcement for this would mean that one has to subscribe to a global which brings its own set of problems.
 
ConfigurationOfRubric 2.12 includes support for themeChanged which will reapply the syntaxHighlighting as well.


Since each textStyler object has a reference to its view one could use that to update them when the styleTable is changed:

SHTextStylerST80 >>#StyleTableChanged

 self allSubInstancesDo: [ :i |
    i view themeChanged
]


Best regards,
Henrik

-----Original Message-----
From: Pharo-dev [mailto:[hidden email]] On Behalf Of monty
Sent: Sunday, March 20, 2016 6:53 AM
To: [hidden email]
Subject: Re: [Pharo-dev] Receiving notification of theme changes or changes to syntax highlighting properties

Yeah, I saw themeChanged, but what about non-morphs? How do they get notified? There should be some announcement that you can subscribe to. Should I add one?

> Sent: Saturday, March 19, 2016 at 10:20 PM
> From: "Cyril Ferlicot Delbecque" <[hidden email]>
> To: [hidden email]
> Subject: Re: [Pharo-dev] Receiving notification of theme changes or
> changes to syntax highlighting properties
>
>
>
> On 20/03/2016 03:12, monty wrote:
> > How can you receive notification of a theme change (like going to or from the Dark theme), or even better, notification of a change to some property of syntax highlighting (like the styling used for string literals)?
> >
>
> Hi,
>
> For the theme change part, morphs should implement a #themeChanged
> method that should update the colours and send the method to his submorphs.
>
>
> > And what is the preferred way of querying the current syntax highlighting properties? I am using "SHTextStylerST80 new attributesFor: aProperty" now (SHPreferences doesn't provide enough), but there is talk of Shout being removed.
> >
>
> --
> Cyril Ferlicot
>
> http://www.synectique.eu
>
> 165 Avenue Bretagne
> Lille 59000 France
>
>