[Cuis-dev] Theme customization ... browser buttons

Alexandre Rousseau yalexr at gmail.com
Sat Mar 18 07:03:52 PDT 2023


Mariano and Gerald, thanks. a lot. It's not in. my muscle memory but,
thanks to your explanations, I was able to go from question (where does
this come from?) to relevant method code in 5 steps:

1. halo down to morph of interest
2. halo > menu > debug > "browse morph class"
3. hierarchy browser for class in question
4. Identify class and method nearest to client class
5. explore call chain if method code does not correspond to manifestation
you were interested in

I wrote the last 2 steps away from my desk, from memory. I might come back
to refine them.

But thanks a lot, I feel winglets growing on my back  🙂

On Sat, Mar 18, 2023 at 7:28 AM Gerald Klix <cuis.01 at klix.ch> wrote:

> Please see below.
>
> On 3/18/23 1:55 AM, Alexandre Rousseau wrote:
> > I need to pick someone's brains.
> >
> > I'm trying to find the code (for purposes of theming) used to build
> > this row of browser buttons (see attached).
> >
> > I doubt that clicking on every selector and reading its code in the hope
> of
> > landing on the answer -- as I have done -- is the most efficient way.
> It normally is, but not in this case.
> > If you wanted to find the code that built this row of buttons, what
> tool(s)
> > or actions would you take?
> I don't remember what I did to find that code, AFAIR I opened
> about 100 hundred method browsers with senders and implementors,
> at least it felt that way.
>
> I started with BrowserWindow>>#buildMorphicWidget and
> looked at the implementation of the various #buildSuchAndSuch
> message sends. After some search I came across #buildLowerPanes,
> which contains a message send of #optionalButtonRow. This method
> in turn creates all the PluggableButtonMorph instances from the
> result of #optionalButtonTuples. The later being the method to look at.
> That's the generic and tedious Smalltalk approach.
>
> A slightly faster approach is to browse PluggableButtonMorph.
> The ClassList-menu provides an option named "class refs (N)",
> that opens a method browser on all the references of
> PluggableButtonMorph. In this window you may find
> CodeWindow>>#optionalButtonRow, provided you are aware that
> BrowserWindow is a subclass of CodeWindow. This approach should
> also work with every Smalltalk.
>
> The fastest approach is to make use Morphic's introspection
> capabilities. Shift-Middle-Click on one of the buttons, say
> "Implementors", in the morphic halo, press the explore button, right
> below the halo's close button. An explorer will open. In this
> explorer you will find the buttons instance variable named
> actionSelector. It is bound to #browseMessages.
> Now comes the critical part: Find the implementation of
> #browseMessages. You use "WorldMenu -> Open -> Message Names" to
> search for it. This will open a method browser with one result:
> CodeWindow>>#browseMessages. You use that browser window to
> find the senders of #browseMessages. This will yield three
> senders of which one is CodeWindow>>#optionalButtonRow.
>
> Tip: As you can see by looking at the code of
> CodeWindow>>#optionalButtonRow
> "Senders" and "Implementors" have a so called secondary selector,
> which is invoked when you press a button morph with the right mouse button.
> In the case of "Senders" it directly opens a method browser for the
> senders of the method you browse, without opening a menu of
> all message sends. You can also right click on the "Browse" and
> "Inheritance", which opens a full browser or inheritance browser
> like the left click on that button, but it also closes the existing
> browser window after placing the new window at the same
> location the old window occupied. In a nutshell: You can
> virtually convert a Browser to an Inheritance Browser
> or a Method Browser to a (Full) Browser with one mouse click.
>
> I suppose this is not documented in the the Cuis book,
> because the lazy author of these short cuts, namely me,
> did not do it, sorry.
>
>
> HTH,
>
> Gerald
>
> >
> > [image: Screenshot 2023-03-17 at 8.49.11 PM.png]
> >
> > On Fri, Mar 17, 2023 at 12:52 PM Alexandre Rousseau <yalexr at gmail.com>
> > wrote:
> >
> >> Thanks !
> >>
> >> I'm rather new at this but I will try. News apace.
> >>
> >> On Fri, Mar 17, 2023 at 12:48 PM Gerald Klix <cuis.01 at klix.ch> wrote:
> >>
> >>> Hi Alexandre,
> >>>
> >>> Subclassing BrowserWindow and PluggableButtonMorph is one possible
> >>> solution.
> >>>
> >>> The other solution is to provide a proper change set for the base
> image,
> >>> containing the added preference and the changed PluggableButtonMorph
> >>> code. I presume that this is a rather simple change, meaning it does
> not
> >>> create a big review effort for Juan, therefore he might accept such a
> >>> change.
> >>> I am strongly in favor of such a solution, because I want a better
> >>> contrast
> >>> of the buttons wrt. to the window background.
> >>>
> >>> While you are at it, you may also try to unify the code that calculates
> >>> the color of the browser's inheritance button and the code that
> calculates
> >>> the color of this very button's balloon help. The balloon help code
> >>> is a rather bad hack (of mine).
> >>>
> >>>
> >>> HTH and Best Regards,
> >>>
> >>> Gerald
> >>>
> >>>
> >>> On 3/17/23 2:23 PM, Alexandre Rousseau via Cuis-dev wrote:
> >>>> Hi.
> >>>>
> >>>> I'm subclassing ClassicTheme to define my own theme, drawing examples
> >>> from
> >>>> ClassicTheme and its parent class (Theme).
> >>>>
> >>>> I now want to customize the colors of Browser buttons (instances of
> >>>> PluggableButtonMorph), i.e., I do not want their background color to
> be
> >>>> taken from the defaultWindowColor theme variable, but rather from a
> new
> >>>> one, say, defaultButtonBackgroundColor.
> >>>>
> >>>> Does this imply that I have to subclass Browser and
> >>> PluggableButtonMorph,
> >>>> or is there a more expedient solution?
> >>>>
> >>>> Thanks!
> >>>>
> >>>> [image: Screenshot 2023-03-17 at 9.16.26 AM.png]
> >>>>
> >>>>
> >>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230318/7d407250/attachment-0001.htm>


More information about the Cuis-dev mailing list