* Only allow one scope to be created at a time, to avoid race conditions with modifying the activeScopes.
* Allow scopes to be created for the same model when a scope already exists. Use reference counting in this case.
* Change at what level several of the scopes are created at.
We previously drew each cell individually. Now, in certain cases (most of them), we draw all the glyphs of one type at the same time. For example, all green Consolas font size 16 non-italic text on line 12 gets dtrawn at the same time.
Also introduced ModelCacheScope, a short-term cache that can be created / destroyed using IDisposable. Right now it's only used for PLMRuns, since each run is relatively short but they all want to calculate the same information from the model (namely, the move names). Eventually it would be good to remove the local caches from other runs as well and use the CacheScope for things like tables and egg moves.
We're not actually drawing an entire row at once: we're taking one pass per type of format. So we're drawing all the green italicized 16-size text in a single go, and then going back later to do blue text and so on.
Make most of the drawing happen in a helper method, including the creation of FormattedText and the call to context.DrawText. This will let us change out the implementation easier.
Change CellWidth and CellHeight to be instance members of `HexContent` instead of static. This forces other components to look up the size (or get handed the size) instead of using a global. This will let us vary the width/height in the future.
Add 'ZoomLevel' concept to EditorViewModel, so we can save/load the zoom level. It doesn't currently connect to anything in the UI, but it will eventually map to font size, which will be used to calculate cell size.
* Don't let the table tool write runs. This matters if the pointer is bugged and not actually pointing to stream data.
* Use IStreamRun interface where possible.
Apparently some tool gives you moves at level 101 as padded filler. We should support decoding tables with moves learned at level 101 o_O
For known-length searches, we can keep looking to see if data is a match slightly after we find a bugged element. We can do this by expecting a certain percentage of errors in the data, somewhere between 1-2% is probably safe. This lets us find the right data even if the person editing the ROM made some mistakes.
Emerald didn't work because in Emerald, there's a false pointer at the start of one of the PLM runs. This is easy to correct: just add Pointer as a special case, since it is the only type of run that doesn't require having a name or pointer to it.
When I'm clearing format to add a dependent pointer format, clear all the space needed by the new run, not just space used by the run that starts at the same point. This matters in the case of a false pointer that thinks it's pointing to text which ends at the same spot.
In FireRed, we learned that there are some false pointers that were making the maxLength calculation cause the descriptions not to be found correctly.
In Ruby, the first item description is "" (length 1).
Found another bug for descriptions where we need to make sure to do a new binary search after removing pointers when changing table lengths.
When we call UpdateNewRunFromPointerFormat, it's possible that new runs could be added, or old runs can be removed. In that case, any index that we've calculated as to where in the list to put the new run could be incorrect. To keep the runs in order, we need to recalculate the index.
* call SearhcForPointersToAnchor as late as possible
* support PLMRuns as inner pointer formats
* only allow for PLM runs to be auto-added if the data is the correct format.
* trim excess spaces off of inner format parsing
*
I previously thought I'd need a different type of run for each type of stream, so I made a text specific one. But I realized that the ViewModel's for both PCSRuns and PLMRuns would have very similar interfaces. Mostly, they need to expose a function to push data to the model, or pull data to a text string. So I added an interface that does that, and now they can both use the same ViewModel.
The code for PCSRuns, EggMoveRuns, and PlmRuns was starting to look very similar. So I added the IStreamRun interface, to make adding new streams to the text tool easier in the future. This required giving PCSRun access to the model, which other streams already had.
Slight refactor: new string.Split variant. Got tired of all the code duplication / verbosity.
* allow the egg move limiter to be even more wrong (has to be within a given range, but doesn't have to point to FFFF)
* have pokenames and pokestats negotiate for a reasonable length, instead of pokenames always winning
* once a text table reaches length 100, allow for junk data in the bytes after the string closing FF.