gnupic: gpsim - New GUI Source Browser
Subject:
gpsim - New GUI Source Browser
From:
Scott Dattalo ####@####.####
Date:
27 Feb 2006 19:41:12 +0000
Message-Id: <440355CB.2060102@dattalo.com>
I rewrote gpsim's source browser to take advantage of the newer API
offered by gtk+-2.X. The reasons for this are two-fold: 1) I've been
wanting to simplify the source browser code for a long time, 2) The
deprecated gtk+-1.X API is truly broken in gtk+-2.8.11 and later, making
gpsim unusable. If you want to experiment with this new code, then check
out the code from CVS and uncomment the line in gui/gui_processor.h line 25:
#define NEW_SOURCE_BROWSER
These changes have been tested for gtk+-2.6 and gtk+-2.8.
----
The new version of the browser does have a slightly different look. For
example, indicators for the current program counter and breakpoints have
been changed (and are likely to change again). In the previous version,
pixmaps were used to indicated this information, while in the newer
version background highlighting is used. Also, this version shows line
numbers and opcodes along with the source. Here's a screen shot from the
gtk+-2.6 build:
http://www.dattalo.com/gnupic/newbrowser.png
All of the keyboard hotkeys are still the same, however new ones have
been added. The old keys were: 's' - step, 'o' - step over, 'r' - run,
'f' - finish (i.e. run until return) and '<ESC>' to halt. The new keys
are the numbers 1 through 9 and 'b'. Pressing a number key will single
step the simulation for this many instruction cycles. Pressing 'b' will
toggle an execution breakpoint at the line under the cursor.
A couple of bugs have been fixed in this new version. First, in the
previous browser it wasn't possible to set a breakpoint at the very last
instruction in a file. (Actually, this fix applies to both browsers).
Next, it wasn't possible to scroll the old source browser unless the
cursor was placed on the scroll bar. Finally, there was an issue where
the breakpoint indicators and the source code would get misaligned.
Near term plans:
For the near term I'd like the gpsim early adopters to try this new code
and tell me everything that's wrong or what should be improved. That
shouldn't be too hard because I can see several problems already. Here
are some things I'll be working on:
-- User interacting:
This new code leverages off the powerful text processing provided by
GTK. At the moment I'm only scratching the surface of the capabilities.
For example, as code is read from a source file and parsed into the
syntax highlighted version you see in the source browser window, there
are tags (actually 'GtkTextTags') embedded in the text. At the moment
these tags are only used to change the text colors or background.
However, I have the code set up such that when you move the mouse or
cursor over one of these tags, gpsim knows about it. So for example, it
should be possible to know when the mouse is hovering over a variable
and to then
-- Current PC and breakpoints
I'm going to continue making improvements. For example, I don't like the
way the PC and breakpoints are shown. I like the way the older version
indicated these. I'll gladly take any suggestions!
-- Preferences and configuration
I have created a dialog for configuring the source browser. However in
this latest version it's been temporarily disabled. I'm going to go back
and re-enable it.
-- Line numbers and opcodes
Some people don't care to clutter their screen with line numbers and
opcodes (like me). So I plan to make this something that can be
selectively enabled. (Note this will require that the Current PC and
breakpoint indication problem be solved).
-- List file
The list file is currently not shown in the browser. I think it should be.
-- Opcode viewer/disassembler
Remove these and add a new view in the source browser for a disassembler.
-- High-level source
I'd like to re-introduce high level source code browsing (i.e. C and
JAL). It's possible to also intersperse assembly with the source.
Once these changes settle I'll make a new major release.
Scott