Monday, November 30, 2009

Mucking around with delegates and dynamic methods. Trying to get some boilerplate code right before using it everywhere.

Need to test the performance of
Delegate.DynamicInvoke();
vs
dynamic blah = someDelegate;
blah.Invoke();
vs
someDelegate.Invoke();

Hopefully the 2nd option isn't much slower than the 3rd.

Sunday, November 29, 2009

Ballsed up usage of linked list for stems since I use them for stems linked by beams, not just all linked by position. Not linking stems outside of parsing yet. Fixed some shit.

Saturday, November 28, 2009

- Added buttons for navigating score. Need to actually make them work.
- I'll add functions to score panel, but hook buttons to commands in VM with try/catches etc.

Wednesday, November 25, 2009

Fixed a bunch of stuff and decreased parsing time. VS 2010 performance profiler is pretty nifty.

Next job is to add controls and functionality to turn pages and adjust page count.

Tuesday, November 24, 2009

Cleaning up last of refactoring. Trying to avoid infinite loop where Element looks to owner for a bar and the owner looks back to its element for a bar. Not quite sure how I want to handle this yet.

Monday, November 23, 2009

Fixed some bugs, found a problem with a certain font that I don't understand (used to work fine).

Need to check that tied notes are still working in Op 72 #1.

Cbf with proper notes tonight.

Sunday, November 22, 2009

My notes for today went away. Shouldn't this thing save drafts regularly?

Got line layout going using set page count and max line size to fit pages. I guess the user is better off with control over page count and margin sizes (between lines and between pages) than zoom level. A zoom level is required if (for example) the user has a wide screen but wants just one page. Hmm..

Page count could be main control with a zoom level from tiny up to that allowed by pages/screen (or turn off page count and just have as many pages as possible for current zoom level).

Saturday, November 21, 2009

- Line width could be based on zoom level (up to a max number of columns) or max zoom so as to fit on a fixed number of columns/pages. Will go with 2nd option first.
- MeasureOverride and ArrangeOverride really need to do much of the same stuff and it seems a bit silly to do it twice. For now I'll do it all in Arrange and have Measure just return the max available size. I guess I'll have to change this if the ScorePanel ever wants to be smaller than the maximum.
- ScoreLines shouldn't just stretch to fit since they have different widths. We pass available width in to line to get desired height, but the line might not use the whole available width. I guess the lines still need to use the zoom property.
- Padding between pages will be zoomed too.

Thursday, November 19, 2009

Going to assume that the set of line children are the same for all lines.

For now I will use the same margin above/below lines regardless of where they sit on the page (first, last or other).

'Rectangle' is a sealed class. What the fuck is wrong with letting someone derive from it? Fucking arseholes...

Got a panel to hold/measure/arrange all drawing panels/rectangles for a single line and a panel to build/measure/arrange collection of these panels. Placement and painting basics sorted.

Wednesday, November 18, 2009

The distances between scorelines in a pdf etc seems to be as much influenced by the number of lines on the page as the content of the lines.

I can lay out lines based on Y distance between staves, Y distance between lower/upper extremities or (maybe) min dist between lines where no elements overlap. I guess I'll need some combination of the above. (todo) For now I'll go with a simple algorithm.

Display thingies (lines, graphs) could be UIElements that can be used in XAML and bound to stuff. If the number of drawing elements are the same, increasing the UIElement couldn't hurt too much. LineGroups could derive from Panel.

Tuesday, November 17, 2009

Got some basic layout logic going for scorelines. The panel tells each line how big to be (based on zoom level), but doesn't allow the panel to respond. Ie it only works for scorelines and overlays might need more control. I might have to make a panel stack holder which contains scorelines and other children and queries them for sizing. I think I can implement this easily enough later.

Monday, November 16, 2009

Installed VS 2010 beta 2, looks pretty snazzy. Had to change target framework to 4.0 to fix an odd reference problem, but could've been something I'd done. Displaying keyboard shortcuts on context menus and pinning debug mouse over is great. The crashes aren't so great (but worth it).

- Setting ScoreLines on ScorePanel, got some parsed/packaged lines displaying (in a pile).
- Controls on a tab item get destroyed when the tab is deselected/hidden and recreated when it is reselected. All of my data lives in VMs so that should be cool.

Saturday, November 14, 2009

Took a good look at the 'Cinch' MVVM WPF framework. I got some ideas but will keep working with my own framework for now.

Got some basics of the edit view sorted.

Friday, November 13, 2009

Working on score display panel and score edit view simultaneously (to releave boredom really).

Edit view is more urgent really, but I'm not quite sure what it'll need yet. Score properties are a good start, but might warrant their own tab or something. I'll start with the score display (and associated page turn/display functions) and play/pause/stop/start stuff.

Installed MS Enterprise Library for logging.

Added action wrapper with exception handling and logging.

Need to tidy up MainVM and events.

Thursday, November 12, 2009

Cleaned up some stuff.

Going to make two main 'views': existing view for score parsing and new view for score editing/playback etc. All elements must be identified or discarded in parsing view (at this stage). The parsing view displays the score in pages as read in from XPS document. The edit view displays score in lines (dynamic pages) generated from parsing.

A score is not saved to a database until it is shifted to edit mode, and only data required for edit mode will be persisted. If the score is cleared from memory (ie closed), it can be opened again from the database for editing/playing but cannot go back to the parsing mode. This means that the score parsing must be done in one session. I'll move things from parsing mode to edit mode as required. I might not allow shifting back to parsing mode if it doesn't add much value and I can move important things to edit mode. I don't want to clutter the edit mode though... will see how it goes.

Objects loaded from the database will be superclasses of objects created during parsing to trim code and data not required during editing/playback.

The views will be based on separate VMs. The parsing VM must be retained in memory until the score is closed, and I might be able to display them simultaneously on separate tabs.

Just starting on edit mode VM and score display panel.

Wednesday, November 11, 2009

- Lines producing basic DrawingBrush. All child elements are individual drawings. I don't know how much this will affect performance (particularly for large scores).

Tuesday, November 10, 2009

Finished refactoring main objects, much happier. Midi generation seems to still work.

Monday, November 2, 2009

Cleaning up object model in preparation for post-data munge use. Trying some heavy use of generics and a granular inheritance hierarchy.

For example, I have a class:
public class DBObjectNodeEnum<P, T, C> : DBObjectNode<P, T>, ICollection<C> where T : DBObjectNode<P, T>

and Bar:
public class Bar : DBObjectNodeEnum
<ScoreLine, Bar, Stem>

which gives bars database CRUD, linked list node (next/prev bars etc) and children. I'll use this for Scores, ScoreLines, Bars, and Stems, DBObjectNode for Notes, and just inherit from IList for Staves and Chords. Maybe DBObjectNodeEnum for notes depending on how we polish voices.

I still want multiple inheritance in C#...


Next job after this is to generate scoreline drawing brushes.

Sunday, November 1, 2009

Finished score parsing for now. I'm sure that new scores will cause problems, but I'll fix them when it happens. The next major goal is to wrap up the data in a database and display it nicely. Since I have the data in memory I can skip the wrapping step for now.

The current display uses one surface per page with all surfaces displayed in a big scrolling thing (a grid of rectangles with DrawingBrushes). I guess I need to generate drawingBrushes for individual lines. I can keep the grid and rectangles and add/remove rects as required. I'll chuck a scrollbar somewhere bound to zoom.

I'm currently setting the size of the score by setting the width and height of the rects and letting the brush fill to fit. I guess the best solution is a custom layout panel. Alternatively I can add brushes to a group with translateTransforms and scale the whole thing. Going to start with custom panel.