On Wednesday 23 February 2005 21:17, Chris Cannam wrote:
> On Wednesday 23 Feb 2005 13:31, Guillaume Laurent wrote:
> > No, the -1 is here to correct the off-by-1 error.
>
> Well, I'm not sure about this at the moment, but I do feel there's
> probably a fundamental misdesign contributing to this.  I don't think
> the position and width of objects that represent things on the canvas
> should be stored as integer coordinates; I think they should be stored
> in time units, and only converted when rendered.  Every horizontal
> measure should be a timeT internally.

No graphic objects are really stored, but your point about integers still 
stands.

> The new design isn't completely obvious to me on first glance so I might
> be missing some details, but I'm pretty confident of the general gist.
> This is one of the things we do wrong in the 1.0 segment canvas code,
> and it'd be a pity to keep the same irritating deficiencies around in
> the new code.

Basically, it's a Model-View pattern. There's a model on the Composition 
(CompositionModel), which only computes what rectangles represent a given 
time segment. The view (CompositionView, basically a QScrollView) asks the 
model for the rectangles and draws them depending on which part it has to 
refresh. The central method is CompositionModel::getRectanglesIn(), which 
returns a set of rectangles which are discarded right away. The idea being 
that we no longer have to worry with keeping Segment<->CanvasItem relation.

It's quite conceivable to have those rects bear double coordinates rather than 
int, though.

I've been trying to adapt the same pattern over the matrix but it's proven 
much harder than I thought, partly because I tried to leave the notation 
working but there's quite a lot of common code between them (the whole Staff 
system).

-- 
      Guillaume.
      http://www.telegraph-road.org


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to