#415 move cord drawing from pd to Tcl procs in pd-gui

puredata (385)

This patch replaces the raw Tcl code in the 'pd' process' C code with two Tcl procs in pdtk_canvas: draw_signal_cord and draw_message_cord. This allows for customization of the cords from GUI plugins and Pd patches. This also is a step in the direction of making the 'pd' --> 'pd-gui' communications Pd messages rather than Tcl code.


  • IOhannes m zmölnig

    i haven't had a look yet, but wouldn't it be better to use a single tcl-proc "connect" (or "draw_cords") and specify the type of connection as an argument?
    this way it can be more easily expanded to other connection types.

  • Hans-Christoph Steiner

    I think having separate procs/messages for each connection type makes it easier to customize. And its just as easy to add a proc for any new connection type as it is to add a block to a switch or something like that. Given that no new connection types have been added to Pd since its inception, I don't think its a high priority concern.

  • Jonathan Wilkes

    Jonathan Wilkes - 2011-08-31

    I think you just need one proc with an arg corresponding to control/signal. All customization can be done elsewhere by referring to the tags. I can't think of any divergences between messagecord (controlcord?) and signalcord that would require different initial drawing instructions; all future features I can think of-- segmented cords or new cord selection/deletion/edition-- would be handled identically for both cases, no? If you disagree, could you give an example of a way in which a signalcord would ever require different drawing instructions than a controlwire?

  • Jonathan Wilkes

    Jonathan Wilkes - 2011-08-31

    Oops, I guess "drawing instructions" is an ambiguous term. I just mean the coordinates: startx/y and endx/y. All the other options could be done with a conditional.

    BTW-- any reason you are hardcoding a width of "2" in that proc? Shouldn't it be something like -width $::signalcordwidth, with ::signalcordwidth being defined in pd-gui.tcl? (Could also use the options database but that's probably overkill.)

  • Nobody/Anonymous

    You just answered your question :) The line width is one difference between signal and message cords. Another would be to have different colors, different line ending treatments, different patterns, etc. Some people might want to make Pd look like Max/MSP for example, and that has weird stripey cords. Another reason to have the signal/message conditional in C is speed. It'll execute much faster there.

    And really, I don't see the difference between adding a proc and adding another block in a if/then/else statement. Both are very straightforward and easy.

  • Hans-Christoph Steiner

    (oops that was me not logged in)

  • Jonathan Wilkes

    Jonathan Wilkes - 2011-08-31

    Right-- when I said "drawing instructions" I really just meant where the line begins and ends. I can't see a case where this would be different between signal and control cords.

    Still, I wouldn't hard code values for the various options in those procs. Use variables.



Cancel  Add attachments

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks