pico:
eried:
Thanks for the info pico, I would like to have the modified code.
Your wish is my command. I will send you the changes presently.
OK, first we put a new JCheckBox in "Preferences".
In Preferences.java, at line 184, insert declaration for new JCheckBox "dontGenProtosBox":
JCheckBox verifyUploadBox;
JCheckBox dontGenProtosBox;
JCheckBox externalEditorBox;
In Preferences.java, at line 429, insert code to display new JCheckBox "dontGenProtosBox" (between "Verify..." and "Use external...":
// [ ] Verify code after upload
verifyUploadBox = new JCheckBox(_("Verify code after upload"));
pain.add(verifyUploadBox);
d = verifyUploadBox.getPreferredSize();
verifyUploadBox.setBounds(left, top, d.width + 10, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// [ ] Do not attempt to generate prototypes
dontGenProtosBox = new JCheckBox(_("Do not attempt to generate prototypes"));
pain.add(dontGenProtosBox);
d = dontGenProtosBox.getPreferredSize();
dontGenProtosBox.setBounds(left, top, d.width + 10, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// [ ] Use external editor
In Preferences.java, at line 672, insert line "setBoolean("preproc.dontGenProtos",..." before "setBoolean("editor.external", ..."
setBoolean("preproc.dontGenProtos", dontGenProtosBox.isSelected());
setBoolean("editor.external", externalEditorBox.isSelected());
setBoolean("update.check", checkUpdatesBox.isSelected());
Finally, in Preferences.java, at line 736, insert line "dontGenProtosBox.setSelected(..." before "externalEditorBox.setSelected(..."
sketchbookLocationField.
setText(get("sketchbook.path"));
dontGenProtosBox.
setSelected(getBoolean("preproc.dontGenProtos"));
externalEditorBox.
setSelected(getBoolean("editor.external"));
and that's the changes to Preferences.java.
For PdeProcessor.java, in function "public ArrayList prototypes(..."
(right at end of file)
Replace:
// Remove generated prototypes that exactly match ones found in the source file
for (int functionIndex=functionMatches.size() - 1; functionIndex >= 0; functionIndex--) {
for (int prototypeIndex=0; prototypeIndex < prototypeMatches.size(); prototypeIndex++) {
if (functionMatches.get(functionIndex)).equals(prototypeMatches.get(prototypeIndex)) {
functionMatches.remove(functionIndex);
break;
}
}
}
with:
boolean dontGenProtos = Preferences.getBoolean("preproc.dontGenProtos");
// Remove generated prototypes that exactly match ones found in the source file
for (int functionIndex=functionMatches.size() - 1; functionIndex >= 0; functionIndex--) {
for (int prototypeIndex=0; prototypeIndex < prototypeMatches.size(); prototypeIndex++) {
if (dontGenProtos || (functionMatches.get(functionIndex)).equals(prototypeMatches.get(prototypeIndex))) {
functionMatches.remove(functionIndex);
break;
}
}
}
And that's it (famous last words!
(Obviously the last bit where I rip out all the generated prototypes after going to trouble of building the list could be accomplished more efficiently, but it works fine, and was a minimal disturbance of the original code.)
Let me know if anything is unclear or there are any issues.
Thanks once again, eried, for all your great work, BTW.