Re: [PD] [PD-dev] First complete keyboard navigation prototype

2019-08-20 Thread Christof Ressi

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 " 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

 

 


Gesendet: Dienstag, 20. August 2019 um 05:07 Uhr
Von: "Henri Augusto Bisognini" 
An: "pd-...@lists.iem.at" 
Betreff: Re: [PD-dev] First complete keyboard navigation prototype



Thanks a lot for your input Christof!

 

If i may let me ask a couple of question:

 

1) I've been wandering through the sources and i'm not sure: where should i put the "#def HAVE_KEYBOARDNAV"? Also this value will be set manually in the code or is there anyway to set it via some config file/some other way?

 

___

 

2) Also i've put a big portion of the code in a g_kbdnav.c file a long with it's forward declarations in g_kbdnav.h.

 

Why it was in g_editor? Because it uses canvas_connect_with_undo, for example, which is static.

 

What should i do? Change those methods so they're not static anymore?

 

Or maybe put a "helper function" inside g_editor.c?

in g_editor.c:

 

void kbdnav_connect_with_undo(t_canvas *x, t_float index1, t_float outno, t_float index2, t_float inno){

    connect_with_undo(x, index1,outno, index2, inno);

}

 

in g_kbdnav.c:

 

[...]

kbdnav_connect_with_undo(...)

[...]

 

Or should i do something else?
___

 

By the way i wanted to hear more from you guys about the experience when trying the kbdnav prototype! :)

Almost no one commented.

 

Best,

Henri.


 

 


From: Christof Ressi 

 





Hi,

 

> But it appears that actually the size of the struct is deduced  while compiling. So if you write an external it is going to think the canvas struct is the same size as it was in the pd header files that were used during compilation.

 

exactly.


 

> When using the pointer to implementation idiom, wouldn't the pointer itself change the size of the struct? 

 

yes, it will

 

> You've said something about that not being a problem when you add it as the last member of the struct but i don't understand why and how that would work.

 

usually, externals shouldn't care about the *size* the t_editor struct (at least I can't think of any use case), so you can get away with adding new fields at the end (although it's certainly not recommended). Note that those headers aren't really public anyway!

 

However, appending fields conditionally can lead to problems:

 

struct Foo {

    int a;

#ifdef FOO_EX

    int c;

#endif

};

 

Now let's say we need to add another member:

 


struct Foo {

    int a;

#ifdef FOO_EX

    int c;

#endif



    in b;

};


 

If the host compiles with FOO_EX defined and the client doesn't, the latter will assume a wrong offset for 'b'.

 

The solution is to add a field for private data *once*. The advantage is that a) we can hide the private data and b) we can extend it without worrying about compatibility:

 

struct Foo {

   int a;

   PrivateFoo *p;

};

 

We can still add public members if needed:

 

struct Foo {

    int a;

    void *private;

    int b;

};

 

'private' points to a private data structure that is not be visible to clients. There you can conditionally enable members without problems:

 

struct PrivateFoo {

#ifdef USE_BAR

    struct MyFeature feature;

#endif

};

 

MyFeature could be in a seperate source file together with your methods and it only gets compiled when needed.

 

Again, have a look at the "t_canvas_private" struct and the "gl_privatedata" member of "_glist" (aka "t_canvas") and do the same for "_editor", e.g.:

 

in g_canvas.h:

 

typedef struct _editor {

    ...

    void *e_privatedata;

} t_editor;

 

in g_editor.c:

 

#ifdef HAVE_KEYBOARDNAV

#include "g_keyboardnav.h"

#endif

 

typedef struct _editor_private {

#ifdef HAVE_KEYBOARDNAV

    t_keyboardnav keyboardnav;


Re: [PD] [PD-dev] First complete keyboard navigation prototype

2019-06-08 Thread Christof Ressi
Hi, this looks like wonderful! I'll try it out in a couple of days and give 
feedback. I can also help with code if needed.

My biggest issue with visual programming is the amount of mouse interaction 
needed in contrast to text based programming (especially when sitting in a 
shaky ÖBB-train with a tiny laptop). A keyboard workflow like yours could be 
extremely useful for power users.

Christof


Gesendet: Samstag, 08. Juni 2019 um 04:52 Uhr
Von: "Henri Augusto Bisognini" 
An: "pd-...@lists.iem.at" 
Betreff: [PD-dev] First complete keyboard navigation prototype

Hi!
 
I've finally managed to get time to finish a prototype for a keyboard 
navigation interface. I mixed some ideas i had with some I've seen in Desire 
Data's old screenshot gallery (http://artengine.ca/desiredata/).
 
I've recorded some gifs to demonstrate it. 
(https://imgur.com/gallery/WSB40P7[https://imgur.com/gallery/WSB40P7]). It 
shows me using the help patch (which i've put in 7.stuff/keyboard.navigation). 
You can read about which keys to use in the comments.
 
The source can be found on my GitHub, on the kbd_nav branch 
(https://github.com/HenriAugusto/pure-data/tree/kbd_nav[https://github.com/HenriAugusto/pure-data/tree/kbd_nav])
 
Basically I've wanted to try:
 
- navigating through objects/inelts connection with ctrl+arrows (cmd+arrows on 
Mac)
- automatically positioning new objects according to selected inlet/outlet
- a console bar to send messages to the focused patch
- ability to display each object index (to be used with the functionalities 
below)
- a new "goto" canvas message to select any object in the patch
- a "magnetic connector" that connects the selected in/outlet to the nearest 
ins/outs
- a "digit connectors" that displays indexes 0 to 9 for the 10 nearest possible 
connections. Just press the number and it will connect it for you
- pd can automatically fill for you a "connect" message in the console 
containing the info for the selected inlet/outlet. It will even select for you 
the part you need to fill
- You can click objects with shift+enter. Mostly useful for sending bangs and 
opening subpatches/abstractions
 
Everything is intended to be as minimal as possible and very easy to use. I 
wish to propose we study including it in vanilla.
 
Well, what do you guys think?
 
This is my first time working on a project this big so help me out if i did 
anything incorrectly. I've been testing the major functions on Win for a while 
now but couldn't test on mac/linux.
 
Cheers,
Henri.___ Pd-dev mailing list 
pd-...@lists.iem.at 
https://lists.puredata.info/listinfo/pd-dev[https://lists.puredata.info/listinfo/pd-dev]



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list