Skip to content

Commit

Permalink
browser plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
porres committed Jun 6, 2024
1 parent fb604d7 commit 795cc4e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 3 deletions.
12 changes: 10 additions & 2 deletions cyclone_objects/binaries/cyclone_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ static int min_minor = 55;
static int min_bugfix = 0;

static int cyclone_major = 0;
static int cyclone_minor = 8;
static int cyclone_bugfix = 1;
static int cyclone_minor = 9;
static int cyclone_bugfix = 0;

void print_cyclone(t_cyclone *x){
int major = 0, minor = 0, bugfix = 0;
Expand Down Expand Up @@ -665,6 +665,10 @@ void print_cyclone(t_cyclone *x){
post(":: you need to add 'cyclone' to the \"preferences=>path\"");
post(":: or use [declare -path cyclone] (this guarantees search priority)");
post("--------------------------------------------------------------------");
post("-------------------------------------------------------------------");
post("- NOTE: Loading this binary did install an object browser");
post("plugin for Cyclone objects when right clicking on a canvas.");
post("-------------------------------------------------------------------");
post("");
}

Expand Down Expand Up @@ -852,6 +856,10 @@ CYCLONE_API void cyclone_setup(void)
class_addbang(plusequals_class, plusequals_bang);
class_addmethod(plusequals_class, (t_method)plusequals_set, gensym("set"), A_FLOAT, 0);
class_sethelpsymbol(plusequals_class, gensym("plusequals~"));

char plugin[MAXPDSTRING];
sprintf(plugin, "%s/browser-cyclone.tcl", cyclone_class->c_externdir->s_name);
pdgui_vmess("load_plugin_script", "s", plugin);

#if CYCLONE_SINGLE_LIBRARY
setup_single_lib();
Expand Down
1 change: 1 addition & 0 deletions documentation/extra_files/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
cyclone 0.9-0 (needs at least Pd Vanilla 0.55-0):
--------------------------------------------------

- added a browser plugin for objects on right click on an empty spot of the patch
- Compilation and binaries in double precision is now supported and provided
- added support for 64-bit audio files in [buffer~] (Pd 0.55 in double precision is requiered for this)
- fixed regression bugs in [offer], list input works now and other things that were funny seems ok now (we introduced this bug in 0.3)
Expand Down
4 changes: 3 additions & 1 deletion documentation/extra_files/README.deken.pd
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#N canvas 439 57 484 373 12;
#N canvas 439 57 533 539 12;
#X text 169 240 <-- check its help file;
#X obj 94 34 cnv 15 250 42 empty empty Cyclone 70 13 0 18 #7c7c7c #e0e4dc 0;
#X obj 107 66 cnv 5 5 5 empty empty Objects\ cloned\ from\ MAX/MSP 10 0 0 13 #7c7c7c #e0e4dc 0;
#X obj 108 239 cyclone;
#X obj 204 299 All_about_cyclone;
#X text 121 299 see also:;
#X text 45 107 Hey \, you downloaded the 'cylone' library from 'deken' \, nice! This library comes with separate binaries and a sub library. You need to add its path to your search paths and you should also load the 'cyclone' binary as a library \, which will give you some information on the terminal and install a subset of non-alphanumeric objects. You can also do this by creating the [cyclone] external as below., f 58;
#X text 68 349 To use the browser plugin \, right click on an empty space on the patch canvas and check entry menus for 'cyclone' \, which will allow you to choose and add the desired object in the spot you right clicked on., f 52;
#X text 55 436 Note: - If you already had an earlier version of Cyclone installed when you downloaded this version \, you have to restart Pure Data for some changes to take effect!!!;
65 changes: 65 additions & 0 deletions documentation/extra_files/browser-cyclone.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# generate menu tree for native objects for the canvas right click popup
# code by Porres and Seb Shader

package require pd_menus

namespace eval category_cyclone_menu {
}

proc menu_send_cyclone_obj {w x y item} {
if {$item eq "cyclone"} {
pdsend "$w obj $x $y $item"
} else {
pdsend "$w obj $x $y cyclone/$item"
set abslist {buffer~ number~}
foreach abstraction $abslist {
if {$item eq $abstraction} {
pdsend "pd-$item.pd loadbang"
break
}
}
}
}


# set nested list
proc category_cyclone_menu::load_menutree {} {
set menutree {
{cyclone
{lib
{cyclone}}
{max
{accum acos acosh active anal append asin asinh atanh atodb bangbang bondo borax bucket buddy capture cartopol clip coll comment cosh counter cycle dbtoa decide decode drunk flush forward fromsymbol funbuff funnel gate grab histo iter join linedrive listfunnel loadmess match maximum mean midiflush midiformat midiparse minimum mousefilter mousestate mtr next offer onebang pak past peak poltocar pong prepend prob pv rdiv rminus round scale seq sinh speedlim spell split spray sprintf substitute sustain switch table tanh thresh togedge tosymbol trough universal unjoin urn uzi xbendin xbendin2 xbendout xbendout2 xnotein xnoteout zl}}
{msp
{acos~ acosh~ allpass~ asin~ asinh~ atan~ atan2~ atanh~ atodb~ average~ avg~ bitand~ bitnot~ bitor~ bitsafe~ bitshift~ bitxor~ buffer~ buffir~ capture~ cartopol~ change~ click~ clip~ comb~ cosh~ cosx~ count~ cross~ curve~ cycle~ dbtoa~ degrade~ delay~ delta~ deltaclip~ downsamp~ edge~ equals~ frameaccum~ framedelta~ gate~ greaterthan~ greaterthaneq~ index~ kink~ lessthan~ lessthaneq~ line~ lookup~ lores~ matrix~ maximum~ minimum~ minmax~ modulo~ mstosamps~ notequals~ number~ onepole~ overdrive~ peakamp~ peek~ phaseshift~ phasewrap~ pink~ play~ plusequals~ poke~ poltocar~ pong~ pow~ rampsmooth~ rand~ rdiv~ record~ reson~ rminus~ round~ sah~ sampstoms~ scale~ scope_dialog~ scope~ selector~ sinh~ sinx~ slide~ snapshot~ spike~ svf~ tanh~ tanx~ teeth~ thresh~ train~ trapezoid~ triangle~ trunc~ vectral~ wave~ zerox~}}
}
}
return $menutree
}

proc category_cyclone_menu::create {cmdstring code result op} {
set mymenu [lindex $cmdstring 1]
set x [lindex $cmdstring 3]
set y [lindex $cmdstring 4]
set menutree [load_menutree]
$mymenu add separator
foreach categorylist $menutree {
set category [lindex $categorylist 0]
menu $mymenu.$category
$mymenu add cascade -label $category -menu $mymenu.$category
foreach subcategorylist [lrange $categorylist 1 end] {
set subcategory [lindex $subcategorylist 0]
menu $mymenu.$category.$subcategory
$mymenu.$category add cascade -label $subcategory -menu $mymenu.$category.$subcategory
foreach item [lindex $subcategorylist end] {
# replace the normal dash with a Unicode minus so that Tcl does not
# interpret the dash in the -label to make it a separator
$mymenu.$category.$subcategory add command \
-label [regsub -all {^\-$} $item {−}] \
-command "menu_send_cyclone_obj \$::focused_window $x $y {$item}"
}
}
}
}

trace add execution ::pdtk_canvas::create_popup leave category_cyclone_menu::create

0 comments on commit 795cc4e

Please sign in to comment.