Saturday, March 28, 2015

FMod - Essential Manipulator

Today, I actually wrote the code for the new Essential Manipulator tool that will be the main visible focus of the v2.5 update.

Its goal is to be a one-stop tool for casual Abiathar use, rolling up the most useful aspects of the Copier, Paster, and Tile Placer. Right-dragging copies a rectangular region, clicking or left-dragging pastes the stamp into the level. (It's the same clipboard as the Copier, Paster, and Palette Copier use. I took advantage of the ClipboardChangeNotifier object and its event to make both the Paster and the EM refresh their stamp when the Palette Copier is used.)

Writing the tool was fairly easy, but debugging turned out to be a formidable challenge. The switcheroo it has to pull on the drag translator seems to have some unusual effects on what clicks it receives and when. I had to slightly adjust the order in which the translator does its bookkeeping so that strange stuff doesn't happen. This was made even more complicated by the possibility of chording - holding both left and right, which no tool will ever use but causes extra events to be raised.

I noticed that the "cut" mode of the Copier doesn't push an IUndoableAction onto the undo stack, which means that there's a possibility of undo corruption depending on temporally adjacent modifications of the region. This was fixed, though I did seriously consider removing "cut" mode. (Right-clicking with the Paster nulls the stamp area as well.)

I should do some more testing of the new UseDrag configuration option, but I think most of the major changes for v2.5 are done. I still have to find a nice color for the under-mouse highlight though...

No comments:

Post a Comment