You're a saint! The code in TrackPanel is horribly hacked up,
mainly because I toyed with so many different looks and feels
for the tracks before settling (sort of) on the current design.
As a result, the code to draw the tracks is not modular at all
and is full of code duplication and magic constants.
When I first started writing Audacity, I thought of making each
track into a wxWindow, and therefore letting wxWindows and the
OS handle clipping and coordinate translation. Unfortunately
due to a combination of bugs in wxWindows (which have since been
fixed) and my own lack of experience with it, I couldn't get that
to work, and so I made TrackPanel monolithic.
So as you're going through TrackPanel, think about making it
modular. Just because we have a wxWindow for every track (and
maybe every widget in the track, like the pop-up title bar, the
close box, etc) doesn't mean we need a zillion new classes -
many of these could be one generic class of some sort that
takes on slightly different behaviors.
Anyway, just some ideas. Play around, have fun.
BTW, if you want to see parts of the program that are relatively
well-designed and clean, I'd suggest:
Mixer class (in Mix.cpp)
prefs/PrefsDialog class (and subclasses)
effects/Effect class (and subclasses)
Not surprisingly, these are the parts of the program that have
been rewritten from scratch once we figured out exactly how
they should REALLY work.
Augustus Saunders wrote:
> I'm just poking through some of the code to figure out what it does.
> Right now I'm in TrackPanel, as it seemed relevant to what we were
> talking about before. Oh, and I moved Preferences to the Edit menu,
> where it's more common (we can debate that, but nobody that I know of
> has that in the File menu). I think just as an excersize, I'm going
> to make tracks drag-and-dropable, and I want to play around some with
> context menues. Oh, and I'm trying to figure out what some of the
> magic numbers in the code are and eradicate them :) How many other
> people are actively hacking any of the GUI code? Ok, I'll get back
> to you in a day or two with results. Cheers-
> PS: For those not in the know, I have finally gotten Linux setup with
> some help from Dom (thanks again!) after I gave up my attempts at
> getting Audacity to run under Cygwin (I may return to this later).
> Anyway, I expect to do some serious hacking until I get a job, at
> which time I'll manage like the rest a y'all :) Oh, and since my
> soundcard manufacturer won't cooperate with Linux driver projects
> (Echo Audio for those wondering whom to avoid...), I'll probably be
> focusing more on GUI stuff since I won't be able to record (except
> with a long round trip of giving code to someone who compiles on
> windows and sends me back a binary...).
> Do You Yahoo!?
> Find a job, post your resume.
> Audacity-devel mailing list