On Wed, Apr 20, 2011 at 1:03 AM, Mariano Martinez Peck < marianopeck@gmail.com> wrote:
On Tue, Apr 19, 2011 at 11:39 PM, Mariano Martinez Peck < marianopeck@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:
- 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/
- 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/
- 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.
Now...the questions:
- 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'.
- 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 )
thanks for any help
mariano
Thanks
Thanks in advance
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com