Okay i've managed to test "optionally compiling" kbdnav by using a #define HAVE_KBDNAV and #ifdefs in the code and everything is working as expected. Most of the code is in it's own file.
I still got to learn how to add an option to configure, though. Is there any other optional PD feature that could serve as an example to speed my learning? heh :)
One thing i wanted to ask beforehand: if one adds an option to "configure" it should also remove the #define from the code? Or could we do something like: leave it in the code (so it's enable by default) and the option removes it?
BTW i've used the gl_private_data as an example and already managed to implement kbdnav with the pimlp idiom succesfully!
I'll finish some adjustments and probably tomorrow i should upload the updated version so you can give a try.
Best, Henri.
De: Christof Ressi christof.ressi@gmx.at Enviado: terça-feira, 20 de agosto de 2019 11:06 Para: Henri Augusto Bisognini msndohenri@hotmail.com; Pd-List pd-list@lists.iem.at Assunto: Aw: Re: [PD-dev] First complete keyboard navigation prototype
Hi,
Also this value will be set manually in the code or is there anyway to set it via some config file/some other way?
here's what you usually do:
#ifndef HAVE_KEYBOARDNAV #define HAVE_KEYBOARDNAV 0 /* pick your default value */ #endif
This makes sure that HAVE_KEYBOARDNAV is always set to a value, but you can override it at compile time by adding "-DHAVE_KEYBOARDNAV <value>" to the preprocessor flags. Since we're using autotools, you (or someone else :-) would also add an option to "configure", e.g. "--enable-keyboardnav" and "--disable-keyboardnav".
What should i do? Change those methods so they're not static anymore?
That's totally fine! Making it non-static just means that other implementation files can use it by forward declaring it (we do this quite a bit in Pd). In your case, you can add the declaration to your header file. Note that there's a risk that evil Pd external developers will find it, so better add a big disclaimer that the implementation may change anytime :-)
By the way i wanted to hear more from you guys about the experience when trying the kbdnav prototype! :) Almost no one commented.
To be honest, I forgot about it because I got sucked up in other things, but I'll try it out when I have time! Thanks for the reminder!
Christof