Draft: Canvas-local options
Jonathan, a while ago you asked for a canvas-local version of the global -legacy-bendin flag, which would facilitate porting vanilla patches involving bendins. Well, here it is. :) You can now just add a declare -bendin 1
object to a patch to have all bendin objects operate in vanilla-like fashion (using the zero-based range instead of signed bendin values, which is our default). Conversely, if you have -legacy-bendin
in your startup flags to enable vanilla bug compatibility by default, you can override this in a patch with declare -bendin 0
to enforce the pd-l2ork default range.
While I was at it, I did the same for the global sys_zoom option in the gui prefs, which enables saving and loading zoom factors in a patch. declare -zoom 1
now ensures that the zoom level is saved and restored with a patch, even if the global option is off, and declare -zoom 0
does the opposite.
Note that I used the declare option rather than a message to the canvas for these options, as declare
is more convenient and easier to remember, and in any case just seems to be the right way to manage these kinds of canvas-local flags. Other canvas-local flags could be handled in an analogous fashion in the future (you might also want to redo your hex color compatibility option that way, so that it could be a canvas-local setting).
Finally, as a bonus I also added a little cosmetic improvement to declare's error reporting, so that an unrecognized option such as in declare -junk 1
will give a proper error message like:
declare: -junk: unknown declaration
declare: 1: unknown argument
instead of the weird-looking message below:
declare: -junk: unknown declaration
declare: : unknown declaration
Note the empty flag that declare is complaining about there, which is actually the numeric option argument. Vanilla does it the same way, but I'd say that my fix in rev. 8409f7d9 makes that message look much more sensible and meaningful. ;-)