On Wed, Apr 20, 2011 at 10:28 AM, Tudor Girba <tudor.girba(a)gmail.com> wrote:
Hi Mariano,
On 20 Apr 2011, at 01:10, Mariano Martinez Peck wrote:
On Wed, Apr 20, 2011 at 1:03 AM, Mariano Martinez
Peck <marianopeck(a)gmail.com> wrote:
On Tue, Apr 19, 2011 at 11:39 PM, Mariano Martinez Peck <marianopeck(a)gmail.com>
wrote:
Hi guys. Since several months, I wanted to create a little browser for learning VM and
related stuff. I never did anything because I was lazy. Last week, I took Glamour and
without knowing almost anything about it, in less than 3 hours (that includes everything,
downloading the image, browsing examples, searching for something similar to what I need,
and code the browsers I needed) , I come up with what I want to share with you. Basically,
I only have the browsers for the moment. My knowledge is very limited in the Slang to C
translator, or machine code simulation. However, the "real VM hackers" will try
to provide me such functionalities.
Having said that, there are 3 browsers:
1) VMBrowserSlang: shows only packages and classes which are written in slang. When you
select a method, you have 2 panels: smalltalk code and C translated code.
Screenshot:
http://img857.imageshack.us/i/vmbrowserslang.png/
2) VMBrowserMethods: shows all packages and classes of the system and for every method,
you have 3 panels: smalltalk code, bytecodes and machine code (using the simple mapping)
Screenshot:
http://img862.imageshack.us/i/vmbrowsermethods.png/
3) VMBrowserMappings: this is for you Eliot!! Basically, it shows all packages and
classes of the system and for every method, you have 5 panels: smalltalk code and one
panel per strategy to map to machine code (simple cogit, sista, etc).
Screenshot:
http://img4.imageshack.us/f/vmbrowsermappings.png/
As you can see the idea is to see the different stages of our code at the same time:
smalltalk code, bytecodes, machine code, etc. The idea is to easily learn.
Sounds great. This is exactly the spirit of Moose.
Could you add a post on your shiny new blog about this? Maybe some code as well? I would
love to link to it from the Moose website.
Yes, it is planned. But I am waiting for the "backend". I mean, I am waiting
for some Eliot changes to be able to get the simulated machine code, and hopefully the
same from Dave about C code.
As soon as I have one of those, I post it.
Now...the questions:
1) how can I put a title to the browsers ? In this case, they all are subclasses from
GLMGlobalBrowserTemplate.
I answer my self
buildBrowser
browser := GLMTabulator new.
browser title: 'A Cool title'.
:)
2) Is there a way to easily "close"
and auto-adjust subpanes? For example, look this screenshot:
http://img4.imageshack.us/f/vmbrowsermappings.png/
there are 5 panes that are rendered when a method is selected. I would love that somehow
(which a little X in the tab title, or a checkbox somewhere with the available panes), one
or more of those panes can be automatically removed (and if added again even better). And
when I remove one of them, the others auto-adjust to ocupy the full container. It is
really difficult to explain by email..
Ok...I found the method populate: #selection icon: GLMUIThemeExtraIcons glamorousCancel
entitled: 'Close' with: [:text :aClass | self halt. ].
so that I can use it like this:
sourceCodeIn: a
| lintBrowser |
(a text)
title: 'Method source';
display: [ :class :method | class sourceCodeAt: method ];
forSmalltalk: [ :class | class ];
populate: #selection icon: GLMUIThemeExtraIcons glamorousCancel entitled:
'Close' with: [:text :aClass | self halt. ].
but still, I don't know how to remove the current code pane from the super
container.
I found something similar, but still don't know how to make it work:
removePaneIndex: i
| paneRemoved |
paneRemoved := self panes removeAt: i.
paneRemoved unregisterFromAllAnnouncements.
self announce: (GLMPaneRemoved pane: paneRemoved fromBrowser: self )
You are trying to reason about your browser from a user interface perspective.
Yes, in fact I was doing that ;)
Glamour is at a higher level of abstraction and it is meant to not mix the browsing model
with rendering.
ok...
It looks to me like what you are trying to achieve is that you want to present the same
object in 5 different ways, and only look at some of them as you wish.
Yes. If you imagine that "the same object" is a method, then yes. The problem
is that imageine this:
http://img862.imageshack.us/i/vmbrowsermethods.png/
Maybe at some point I only need the smalltalk code and the machine code (I don't need
the machine code). Tomorrow I may need only the bytecodes and the machine code. Etc...so,
creating a new browser for each possible combination is not a good idea. Even more in this
case:
http://img4.imageshack.us/f/vmbrowsermappings.png/
where I have 5 panels.
But notice that when I need some panels, I need them at the same time, because this is
exactly for learning how to map from smalltalk to bytecodes, or from btyecodes to machine
code, or from....so tabs doesn't work in this case.
It looks to me like you basically want to parameterize the structure of the browser and
you are mainly worried for code reuse.
If this is the case, the bottom part should probably become one single pane and in there
you could put a separate browser. Like that you could implement multiple browsers for the
lower part and compose them programatically.
You could also use a DynamicPresentation that decides what presentations should go inside
at runtime, but it is less likely that you will need that.
The straightforward way to achieve this would be by
using multiple presentations (like you did for Class list / Hierarchy).
I didn't get it. I didn't do anything special by myself in Class list /
Hierarchy
I just change #classCategoriesIn: to list certain packages instead of all of the image.
You would still not have the ability of removing a presentation, but you could put them
in tabs.
But tabs doesn't work in this case.
GLMPaneRemoved is an internal announcement and it should not be used through scripting.
If you need a user interface interaction that does not match your desire, you should
create your own browser or presentation type. Just do not mix the UI with the conceptual
browser.
Thanks, it is a good point. Any "recommendation" of where I can take a look to
customize that? Should I create a subclass from GLMTabulator and you that from my
browsers instead ?
Should I add stuff like #removeColumn to my subclass of GLMTabulator ? Sorry for the
newbie question..I am just getting started ;)
No, the GLMTabulator is not what you want.
Please, read the Glamour chapter from the Moose Book first, and then we can resume the
discussion on what can be done.
Cheers,
Doru
Cheers
Mariano
Cheers,
Doru
thanks for any help
mariano
Thanks
Thanks in advance
--
Mariano
http://marianopeck.wordpress.com
--
Mariano
http://marianopeck.wordpress.com
--
Mariano
http://marianopeck.wordpress.com
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"No matter how many recipes we know, we still value a chef."
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Mariano
http://marianopeck.wordpress.com
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
"We can create beautiful models in a vacuum.
But, to get them effective we have to deal with the inconvenience of reality."