Saturday, February 27, 2010

Added canvas to LinePanel to contain UI overlays, but it needs to have inverse scale transform to scale back to normal size; feels wrong.

Will try making LinePanel contain nothing but scoreLine drawing and wrap it in a parent panel. This will move some complexity out of scorePanel too.

Friday, February 26, 2010

Next job is to finish bar overlays.
- Do overlays live in LinePanel, ScorePanel or a new child of ScorePanel?
- Overlays must go away when mouse movement stops for a while or piano things happen.

The problem with overlays on the LinePanel is they could be better positioned by the ScorePanel (since it knows where other things live relative to the linePanel). Also, they are affected by the LinePanel's scaleTransform.

I'll put them in ScorePanel. All mouseover overlays should go away when the mouse leaves the panel.

Translating mouseMove point to linePanels. Transforms have a 'Point Transform(Point fromPoint)' method and an Inverse property (returning another Transform) which come in very handy.

Thursday, February 25, 2010

When arranging visuals, you need to specify a location and size.

Getting the size of a visual (that has already been measured, arranged and rendered) is easy; myVisual.RenderSize. Getting the location isn't quite as obvious; you have to use the TransformToAncestor(Visual) or VisualTreeHelper.GetOffset(myVisual) (which an extension method would help). Either way it doesn't quite seem right.

I've decided that visuals will be arranged to (0, 0) and a TranslateTransform will be applied to position them. Getting the location is no harder than before, and animating the position of the visuals is done through the transform. Managing the transforms will be a little tricky since all transforms applied to a visual (translates, scales etc) must be inside a TransformGroup transform. Objects that manipulate this group can't step on each others' toes.

I don't seem to have much luck with the LayoutTransform property, only RenderTransform. Maybe there's a bug somewhere...

I just found out that "A TranslateTransform in a LayoutTransform has no effect". There's your problem. I could apply a scaleTransform in layout and translate in render.

Nope, that failed (weird behaviour). LayoutTransform seems to be more trouble than its worth. Putting scale and translate into a groupTransform in RenderTransform works, so I'll throw some properties to get/set them in child panel.

To change the value of a dependencyProperty that has been animated (such as TranslateTransform.XProperty), you have to clear the animation by "animating" the property again with a null animation. Calling ClearValue() or SetCurrentValue() don't work.

Sunday, February 21, 2010

I'm now officially self employed. Hopefully there won't be a need to change that any time soon.

Some changes I'd like to make to the exisiting score parser:
- Make sure that it can roll back or run forward to any step in the process via the UI
- Store template XAML
- Store numbers
- Compare elements against other elements within the score (group paths so they're more like glyphs, perhaps even replace redundant instances). This might make handling characters easier.