From: Joe E. <jo...@em...> - 2005-03-11 02:53:19
|
Bill Zwicky wrote: > Joe Emenaker wrote: > >> From a brief look at the ParamModel class, it looks like it's not >> really going to help me here. As a result, I suspect that the *Widget >> system is, likewise, not available to me, correct? > > In-correct, Widgets will work just fine for you, but you need to make > your own model classes. This is really easy, there's even > instructions on jsl.org. I had to crank out a whole buncha custom > model classes for my CZ; it's annoying, but easy. Well, I just tried a different approach... and I'm interested in its potential. I made a "DataModel" interface. The idea behind it is that it handles all of the nuisance of stripping off leading bytes (ie, F0, manufID, devID, etc) and trailing F0 and it handles any conversion to/from 8-bit bytes or whatnot. Then, I made a new ParamModel which, when it needs data, asks the DataModel for it. So, the ParamModel and addWidget never need to see the actual Patch. The beauty here (well, *I* think it's pretty neat, anyway) is that the DataModel would be able to handle multi-byte values. It would know whether to use LSB-first or MSB-first. It would also know how strings are stored (ASCII... 0-terminated... whatever). So the ParamModel would be able to just ask for multi-byte values by asking for the offset and the number of bytes: dataModel.getInt(0x245,4); // Get a 4-byte int or.... dataModel.setInt(0x245,4,somevalue); - Joe |