From: Joe E. <jo...@em...> - 2005-05-09 23:51:11
|
If you have a patch in your library that isn't recognized by JSL, it says the driver is "Unknown" and sets the comment to "Probably a ##### patch. Size: ####". If you try to *receive* a patch that isn't recognized *into* your library, JSLis supposed to do that as well, but doesn't even get that far. It throws an exception. When searching through the code, I discovered that there are *two* places where the "Probably a ##### patch..." comment is set, depending upon whether the patch was loaded from a library, or received via sysex: in AbstractLibraryFrame: private void chooseDriver(IPatch patch) { patch.setDriver(); if (patch.hasNullDriver()) { // Unkown patch, try to guess at least the manufacturer patch.setComment("Probably a " + patch.lookupManufacturer() + " Patch, Size: " + patch.getSize()); } } and in Driver.fixPatch: // driver not found pk.setDriver(null); //reset pk.setComment("Probably a " + pk.lookupManufacturer() + " Patch, Size: " + pk.getByteArray().length); JOptionPane.showMessageDialog(null, "You requested a " + this.toString() + " patch!" + "\nBut you got a not supported patch!\n" + pk.getComment(), "Warning", JOptionPane.WARNING_MESSAGE); This (having two bits of code trying to do the same type of job) is probably not a good idea. I propose a few changes which could clean this up: - If no driver accepts a patch, instead of setting the driver to null, it is set to the GenericDriver. - The GenericDriver will have the code that sets the comment to "Probably a ##### patch..." - Joe |