2. Right-click and choose Select All from the context menu.
3. Right-click and choose View Selection Source from the context menu.
4. Type Ctrl-S/Cmd-S to save the SVG to a new file.
5. Load the new file into Inkscape.
6. In Inkscape, select File >> Export Bitmap There are probably better ways of doing this, especially if you find yourself doing it repeatedly. For example, Vlad suggests that an entirely JavaScript-based solution is possible using the <canvas> element and the drawWindow() method. That, as they say, is left as an exercise to the reader.
hist find cpp
hist find cpp viewsource The last command corresponds to something like history | grep -i find | grep -i cpp | grep -i viewsource which is a pain to type in full. I've been using hist for a while now, and I've found it very useful, so I thought I'd share it in case there are other Bash users out there who might find it handy. If you want to use it just paste the following into your .bash_profile: # Quick and dirty case-insensitive filtered history command.
# "hist" ==> "history"
# "hist foo" ==> "history | grep -i foo"
# "hist foo bar" ==> "history | grep -i foo | grep -i bar"
# etc.
# Note that quotes are ignored, e.g.
# <<<hist "foo bar">>> is equivalent to <<<hist foo bar>>>
hist()
{
HISTORYCMD="history $@" # "foo bar" ==> "history foo bar"
HISTORYCMD="${HISTORYCMD% }" # "history " ==> "history" (no trailing space)
eval "${HISTORYCMD// / | grep -i }" # "history foo bar" ==>
# "history | grep -i foo | grep -i bar"
}
fileurl ../test.html
might print
file:///Users/cbartley/dev/mozilla/test.html I can invoke my test build with something like
ffz `fileurl ../test.html`
and have it reliably open the file every time. I haven't yet rolled fileurl into the ffz script, but that's the logical next step. I should also acknowledge that there may well be better ways to do this than the approach I've used -- I am no bash expert. Finally, for all those other amateur bash programmers out there, the magical Google phrase for finding documentation on the weird things you can do with variables in bash is "variable mangling". # Given a path to a file (relative or absolute), print a "file://" URL for
# that file.
fileurl()
{
# Split the directory name out of the argument path.
# "/dir/subdir/file" ==> "/dir/subdir"
# "dir/subdir/file" ==> "dir/subdir"
# "subdir/file" ==> "subdir"
# "file" ==> "."
TEMP="/$1" # Hack: Prepend a slash so there's at least one
TEMP="${TEMP%/*}" # Chop off the trailing "/file"
TEMP="${TEMP#/}" # Remove the leading slash if it's stil there
DIRNAME="${TEMP:-.}" # If DIRNAME is empty, set it to "." # Get the base file name from the argument path.
BASENAME="${1##*/}" # Remove everything up to the last slash, inclusive # Convert the directory name to an absolute path.
ABSDIRNAME=$(cd "$DIRNAME"; pwd) # Echo the file URL built from the components.
echo "file://$ABSDIRNAME/$BASENAME"
}
If this is a common scenario (and I suspect that it is), then this argues for a tabs-on-top design, which is what I'm going to look at in this post.
There's a link to the prototype at the end of the post if you want to try it out. In the meantime, here's a screenshot.
A screenshot of the Firebug UI with panel tabs at the top. The Script panel is selected.
One of my goals with the previous tabs-on-the-bottom design was to reduce the "busyness" of having the toolbar and main panel tabs right next to each other. This design doesn't do much to address the busyness angle, but it still seems cleaner than the current Firebug layout. For example, in this design the tab strip for the main panel bar is at the top of Firebug's UI, and all it has on it is tabs, and the tabs are largely static -- the selected tab can change, but that's it. It's a much simpler UI element than the toolbar.
The toolbar is placed such that it appears to be inside the currently selected panel, which seems logical since so many of the toolbar controls are dependent on which panel that is. In this particular variation, the toolbar extends all the way across the window, so I call it the "long toolbar" version. One negative of this design is that the side panel looses a line of vertical real estate.
There's another advantage of having the tabs on top. In Firebug, the major functional units correspond to individual panels in the main panel bar. In the tabs-on-top layout, the tabs for these panels is the most obvious thing you see. I think that's probably a good thing.
Moving the Search Box
A mockup with the Search Box and window controls moved from the toolbar to the tab strip.
One possible variation on the tabs-on-top layout is to move the Search Box and adjacent window buttons from the toolbar to the right end of the tab strip. Since the Search Box and window buttons don't change with the active panel, it makes sense to pull them "out" of the panel. This clutters up the tab strip a little bit, but as long as there's some reasonable amount of blank space between the rightmost tab and the search box, it doesn't really seem to hurt that much. One advantage is that it substantially reduces the clutter on the toolbar and another is that it frees up a lot of space for the "object path", which, unfortunately, you can't see in this screenshot. (In the Script panel the object path is the call stack in horizontal layout. In the HTML panel, the object path is the HTML containment hierarchy.)
The short toolbar version.
With the Search Box and window controls on the tab strip, we can also do a "short toolbar" layout as mentioned above. In this layout, the toolbar is only as long as the left sub-panel. The side panel bar (containing the Watch, Stack, and Breakpoints panels) now tops out just below the tab strip, reclaiming that line of vertical real estate that we'd lost in the first two layouts. Of course the short toolbar reduces area available to the object path by quite a bit.
Conclusion
I think putting the tabs on top and above the toolbar makes for a much nicer UI. Although I think my earlier tabs-on-the-bottom UI offered some advantage by completely separating the toolbar and the tab strip, I think the tabs-on-top design offers some clear advantages.
- The tabs are the major organizational principle in the Firebug UI
and putting them on top makes them stand out as the most prominent UI
element.
- The toolbar appears like it belongs to the current tab page, almost like you're tabbing between different toolbars as well as different panels. This seems logical since the toolbar changes with the panel anyway (The ever present Firebug-icon-menu and Inspect button do muddy the water a bit, though).
- Selecting a tab and then selecting something on the toolbar (e.g. selecting the Script tab and then selecting a JavaScript file from the drop down) is still convenient. It feels a little more natural to select something on the tab strip and then move down one line to carry out the next step. In the current UI with the toolbar on top, the flow is up rather than down.
Try it out
A link to the Firebug "tabs-on-top" prototype extension is at the bottom of this post. The standard disclaimer applies. It's prototype code built on 1.3 pre-release code, so although it's OK to play around with, you probably don't want to leave it installed.
A screenshot from Firebug 1.2.1. The Script panel is currently selected.
The same screenshot as above with the major UI components labeled.
One of the things I don't like about the current UI is just how busy it looks. The toolbar is already pretty complex, and it's stacked right on top of the tabs for the two panel bars. That's not the biggest problem however. Take a look at this next screenshot.
A screenshot from Firebug 1.2.1. The HTML panel is currently selected.
In this screenshot, the HTML panel has been selected. Look carefully at the toolbar, and compare it with the first screenshot above where the Script panel was selected. The Inspect button and the find textbox are the same, but everything in between has changed. Now look at the side panel bar. That's right, it's completely different. Changing panels in the main panel bar essentially causes the whole Firebug UI to change, not just the main panel.
I think you can make a case that the toolbar and the side panel bar belong inside the current panel since they are so dependent on which panel that is. The argument is stronger for the side panel bar since it is completely dependent on the main panel bar. The argument is weaker for the toolbar since the toolbar doesn't completely change, but I think you can still make a case there.
Tabs on the bottom
So I have two problems that I'd like to solve. I'd like to make the user interface less "busy", especially with regard to the toolbar. I'd also like to promote the illusion that both the toolbar and the side panel bar are inside the currently selected main panel, since both those UI elements are so dependent on which panel that is.
I've built an experimental variant of Firebug to test out an alternative UI that I think addresses these issues.
To address the busyness issue I've moved the main panel tabs from the top of the panel bar to the bottom. This also helps differentiate the main panel bar from the side panel bar, where I've retained the tabs on the top. I think this helps a little bit with the illusion that the side panel bar is actually inside the main panel since the two panel bars now look different. Then I've tweaked the UI so that the main panel bar tabs appear to extend all the way across the window and all the way around both panels and the toolbar. This effect is perhaps more subtle than I'd like, but it still feels like an improvement.
Below is a screenshot of this alternative UI.
A screenshot from an experimental version of Firebug with the main panel bar tabs on the bottom.
It might also be useful to evaluate the design where the main panel bar tabs are moved above the toolbar. This won't do anything for the busyness issue but it might make a stronger statement that the toolbar is dependent upon the currently selected panel. (Firebug issue 222 suggests making exactly this change.)
Take it for a spin
I've attached the XPI file for my experimental Firebug build so you can try it out yourself. That will give you a much better feel for the proposed change than just looking at static screenshots. The experimental build is probably a little bit buggy, both due to my changes and the fact that it's built on Firebug 1.3 pre-release code. It should be OK to take for a test-drive, but you probably don't want to leave it installed for a prolonged period of time.
MemTrack is a library for tracking memory allocations in C++ programs. I had two goals with MemTrack. The first was a simple demonstration of the classic C/C++ preprocessor-based technique for instrumenting memory allocations, which I'm sure a lot of people have done, but few people have documented. The second was as a testbed for a rather novel technique for tagging each memory allocation with type information, something that is not normally possible with the preprocessor macro-based approach.
For exampe:
#ifdef MEMTRACK_NEW //:memtrack! #undef new //:memtrack!#endif //:memtrack! void* operator new(size_t aSize, nsIPresShell* aHost) {#ifdef MEMTRACK_NEW //:memtrack! #define new MEMTRACK_NEW //:memtrack!#endif //:memtrack!
There aren't that many files that declare or define operator new but for expediency I ended up wrapping any preprocessor directives that include system headers. This is probably not a big deal either way, since one would rarely do much debugging or development against an instrumented build. Nevertheless the amount of explicit instrumentations could probably be reduced, and that would be a good thing.
To sum up the current state of this exercise: I have to statically pre-process the Firefox codebase in order to use MemTrack. This preprocessing step is pretty much completely automatic on the Mac although it's still pretty crude. To make it actually useful, MemTrack's tracking layer should be stripped out and the MemTrack instrumentation layer should be piggy-backed on top of the existing memory instrumentation code. The required static preprocessing step is somewhat of a hassle, but it's not really all that onerous. If one has to do a special build of Firefox to instrument memory usage anyway, it's probably not a big deal to include a static source preprocessing step as well. The key question is whether the extra type information that can be gathered by MemTrack is sufficiently useful. I think that it might be, but I'll need to do some more investigation before I can say for sure. For future reference, the regular expression I'm using is: newIgnorePat = re.compile(r"operator new|include NEW_H|NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW|::new[ (]|include [<]|[)] *new[ (]|[*] new[ (]|!new[ (]|include.*nsILocalFileMac|include.*nsIInternetConfigService|new PathChar") This pattern includes common cases like occurrences of "operator new" (not just "new") and include directives for system headers as well as some special cases like "new PathChar", which is specific to Firefox on the Mac.
Mozilla issued me a new MacBook, and I've been trying to get it set up for development. In particular I wanted to get it set up for Firebug development since that's my primary focus right now. This should be easy -- Firebug is just an extension written in JavaScript. However, one thing I wanted to do is set up a build script that will automatically launch Firefox using a specific profile just for testing. It's not at all hard to launch Firefox from the command-line in OS X, except that I was getting really bizarre behavior: A Firefox window would appear, but there would be no menu bar, and indeed, Firefox didn't show up in the applications list when you hit command-tab. Even worse, there was no way to get keyboard focus into the window. You could close the window by clicking on it, but then you'd have a zombie Firefox process that you couldn't quit, and you couldn't Force-Quit it, because it didn't show up in that list either. It was necessary to kill it from the command-line.
I tried everything I could think of, and a handful of times, everything worked, and then it went back to being broken. Eventually I discovered that the path to the executable that I typed out differed from the path in the filesystem by the case of a single letter. I had /Applications/Firefox.app/Contents/MacOs/firefox-bin, when what I really wanted was /Applications/Firefox.app/Contents/MacOS/firefox-bin (MacOs ==> MacOS). That was it.Addendum: This is now bug #453913 in Bugzilla.