#N canvas 2303 29 799 979 10; #X declare -lib ofelia; #X obj 27 399 ofHead; #X obj 652 29 declare -lib ofelia; #X obj 27 363 ofSetBgColor white; #X text 38 116 - sending a float(0/1) to the first inlet disables/enables the mouse/touch event. (default: 1); #X text 38 146 - the last inlet/outlet is used to update/output the value which gui stores.; #X text 391 341 load fonts for [pdgui/numbox].; #X text 29 27 pdgui is a collection of gui abstractions written with ofelia which emulates pd's built-in gui objects.; #X obj 201 342 ofLoadFont \; @fonts \; ../data/Sansation.ttf 20 \; ../data/DejaVuSansMono.ttf 20 \;; #X obj 27 546 pdgui/bang 30; #X obj 27 567 ofTrans 50 0; #X obj 27 630 pdgui/toggle 30; #X obj 27 420 ofSetColor black; #X obj 27 462 ofDrawTextAsShapes @fonts[0] 12 [pdgui] abstractions example; #X obj 108 567 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 114 652 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X text 116 545 arg: size.; #X text 129 630 arg: size.; #X obj 27 483 ofTrans 0 30; #X obj 27 525 ofSetColor gold; #X obj 27 504 ofSepMatrix 2, f 42; #X floatatom 441 651 5 0 0 0 - - -, f 5; #X text 454 629 arg: width \, height \, fontName \, (step \, minVal \, maxVal).; #X floatatom 441 610 5 0 0 0 - - -, f 5; #X obj 114 672 ofSnd @subviewNum; #N canvas 641 243 774 356 subviewExample 0; #X floatatom 161 220 5 0 0 0 - - -, f 5; #X floatatom 477 220 5 0 0 0 - - -, f 5; #X text 174 200 arg: size \, numCells.; #X text 492 199 arg: width \, height \, (minVal \, maxVal).; #X obj 56 199 pdgui/hradio 30 16; #X obj 56 178 spigot; #X obj 89 157 == 0; #X obj 330 178 spigot; #X obj 363 157 == 1; #X obj 89 136 ofRcv @subviewNum; #X obj 363 136 ofRcv @subviewNum; #X obj 56 51 inlet; #X obj 330 199 pdgui/hslider 480 30 -1 1; #X obj 477 157 loadbang; #X msg 477 178 0; #X text 507 177 init slider value.; #X obj 56 72 ofTrans 50 0; #X obj 56 93 ofSetColor orange; #X text 176 47 you can hide/show a gui abstraction by blocking/unblocking the rendering chain. you would also want to disable/enable the mouse/touch event accordingly by sending either 0 or 1 to the first inlet.; #X connect 4 1 0 0; #X connect 5 0 4 0; #X connect 6 0 5 1; #X connect 6 0 4 0; #X connect 7 0 12 0; #X connect 8 0 7 1; #X connect 8 0 12 0; #X connect 9 0 6 0; #X connect 10 0 8 0; #X connect 11 0 16 0; #X connect 12 1 1 0; #X connect 13 0 14 0; #X connect 14 0 12 5; #X connect 16 0 17 0; #X connect 17 0 5 0; #X connect 17 0 7 0; #X restore 27 693 pd subviewExample; #X obj 114 588 loadbang; #X msg 114 609 1; #X obj 276 630 pdgui/numbox 80 30 @fonts[1]; #X text 143 609 init toggle value.; #X obj 276 774 ofTrans 50 0; #X obj 276 795 pdgui/vradio 30 7; #X obj 276 525 ofTrans 0 50; #X obj 276 588 ofTrans 10 10; #X floatatom 393 774 5 0 0 0 - - -, f 5; #X floatatom 375 816 5 0 0 0 - - -, f 5; #X obj 276 546 ofSetColor grey; #X obj 276 609 ofSetColor white; #N canvas 641 271 681 389 cloneExample 0; #X obj 49 53 inlet; #X msg 214 158 all bang; #X obj 49 300 bang; #X obj 49 74 ofTrans 100 0; #X obj 49 95 ofSepMatrix 2, f 28; #X msg 49 137 all bang; #X obj 49 250 clone 12 pdgui/vslider; #X msg 69 199 all set 30 170; #X obj 214 250 clone 12 pdgui/toggle; #X obj 214 137 ofTrans 0 180; #X obj 69 178 loadbang; #X obj 234 179 loadbang; #X floatatom 90 301 5 0 0 0 - - -, f 5; #X text 127 301 set the x gap.; #X obj 49 321 ofTrans 39 0; #X msg 234 200 all set 30; #X text 309 200 set the size for all cloned toggles.; #X obj 337 271 print toggleValue; #X text 450 271 outputs "index value" as a list.; #X obj 178 271 print vsliderValue; #X obj 49 116 ofSetColor lightSteelBlue; #X obj 214 116 ofSetColor lightPink; #X msg 337 229 4 1; #X text 239 25 using [clone] \, you can effectively create and draw multiple gui abstractions at once. you need to send a "all set" message followed by a list of arguments to the first inlet of cloned abstraction in order to set the creation arguments.; #X text 370 229 turn on the toggle at index '4'; #X connect 0 0 3 0; #X connect 1 0 8 0; #X connect 2 0 14 0; #X connect 3 0 4 0; #X connect 4 0 20 0; #X connect 4 1 21 0; #X connect 5 0 6 0; #X connect 6 0 2 0; #X connect 6 1 19 0; #X connect 7 0 6 0; #X connect 8 0 2 0; #X connect 8 1 17 0; #X connect 9 0 1 0; #X connect 10 0 7 0; #X connect 11 0 15 0; #X connect 12 0 14 1; #X connect 15 0 8 0; #X connect 20 0 5 0; #X connect 21 0 9 0; #X connect 22 0 8 2; #X restore 441 693 pd cloneExample; #X obj 276 672 ofSepMatrix 2, f 28; #X obj 276 693 ofSetColor lightGreen; #X text 464 750 arg: width \, height \, (minVal \, maxVal).; #X text 388 795 arg: size \, numCells.; #X floatatom 299 504 5 0 0 0 - - -, f 5; #X text 335 504 move all guis on the canvas.; #X obj 27 441 ofTrans 30 20; #X msg 440 588 @fonts[0]; #X text 506 588 change the font.; #X text 38 206 - [ofTranslate] : position the gui. (do not move z-axis) ; #X text 38 226 - [ofSetColor] : set the back color of the gui.; #X text 38 246 - [ofSetLineWidth] : set the line width of the gui. ; #X text 29 67 common inlet/outlet operations.; #X text 29 187 objects that can be used to change position/look of the gui.; #X text 398 462 draw the text.; #X text 29 267 note: do not use [ofRotate] or [ofScale] to change the look of the gui as the mouse/touch event won't work correctly.; #X floatatom 70 609 5 0 0 0 - - -, f 5; #X text 38 86 - sending a "set" message followed by a list of arguments to the first inlet sets/updates the creation arguments.; #N canvas 1301 238 641 587 pdgui.public.properties 1; #X obj 47 261 ofSnd @pdgui.frontColor; #N canvas 322 149 558 681 about_variable 0; #X obj 47 279 ofSend @foo; #X floatatom 47 253 5 0 0 0 - - -, f 5; #X obj 246 253 ofReceive @foo; #X floatatom 246 282 5 0 0 0 - - -, f 5; #X floatatom 138 253 5 0 0 0 - - -, f 5; #X floatatom 358 282 5 0 0 0 - - -, f 5; #X obj 138 279 send v\$0_foo; #X obj 358 253 receive v\$0_foo; #X text 39 192 the first prefix is the "@" symbol which is used to make the variable name local within the same patch. the prefix "@" is internally replaced with "v\$0_".; #X text 39 322 the second prefix is the "#" symbol which is used to make the variable name local within the same canvas. the prefix "#" is internally replaced with "v(unique-canvas-name)_".; #X floatatom 350 471 5 0 0 0 - - -, f 5; #X floatatom 188 383 5 0 0 0 - - -, f 5; #X obj 188 470 send; #X obj 350 448 ofReceive #foo; #X obj 215 426 ofGetCanvasName; #X msg 215 448 symbol v\$1_foo; #X obj 188 402 t f b; #X obj 350 402 ofValue #foo; #X obj 350 383 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X floatatom 350 424 5 0 0 0 - - -, f 5; #X text 39 132 for these reasons \, in ofelia we provide special prefix symbols to easily localize variable names. (note: this only applies to ofelia objects and not the original pd object); #X text 39 512 you can use these prefixes in all ofelia objects that use variable names.; #X obj 47 552 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 177 552 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X floatatom 177 609 5 0 0 0 - - -, f 5; #X obj 320 574 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 320 616 print; #X obj 47 574 ofDefine \; @hello = 3 \; #world = 7 \;; #X obj 177 574 ofExpr \; @hello + #world \;; #X obj 320 552 ofLoadFloat @myList 1 2 3 4; #X obj 320 594 ofGetFloats @myList; #X text 39 32 in pd \, \$0 is commonly used in variable names for localization purpose. (e.g. \$0-name) however \, using \$0 for variable names can sometimes be inconvenient to write and hard to read especially when used in expressions using [expr]. further more \, you cannot use \$0 based variable names in a message box.; #X floatatom 47 383 5 0 0 0 - - -, f 5; #X obj 47 402 t f b, f 6; #X msg 80 448 symbol #foo; #X obj 47 470 ofSend; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 4 0 6 0; #X connect 7 0 5 0; #X connect 11 0 16 0; #X connect 13 0 10 0; #X connect 14 0 15 0; #X connect 15 0 12 1; #X connect 16 0 12 0; #X connect 16 1 14 0; #X connect 17 0 19 0; #X connect 18 0 17 0; #X connect 22 0 27 0; #X connect 23 0 28 0; #X connect 25 0 30 0; #X connect 28 0 24 0; #X connect 30 0 26 0; #X connect 32 0 33 0; #X connect 33 0 35 0; #X connect 33 1 34 0; #X connect 34 0 35 1; #X restore 496 35 pd about_variable; #X text 42 91 using the "@" prefix for the send name will send value to all guis exist in the same patch.; #X text 42 121 using the "#" prefix for the send name will send value to all guis exist in the same canvas.; #X obj 47 321 ofSnd @pdgui.flashTime; #X floatatom 47 422 5 0 1 0 - - -, f 5; #X obj 47 441 ofSnd @pdgui.cellScale; #X obj 47 193 ofPack 0 0 0 255; #X floatatom 47 174 5 0 0 0 - - -, f 5; #X floatatom 87 174 5 0 0 0 - - -, f 5; #X floatatom 127 174 5 0 0 0 - - -, f 5; #X msg 67 214 red; #X text 154 193 r \, g \, b \, a.; #X text 99 214 color name.; #X floatatom 167 174 5 0 0 0 - - -, f 5; #X floatatom 47 482 5 0 1 0 - - -, f 5; #X obj 47 501 ofSnd @pdgui.fontScale; #X text 85 422 value between 0 and 1; #X text 85 482 value between 0 and 1; #X floatatom 47 362 5 0 0 0 - - -, f 5; #X obj 47 381 ofSnd @pdgui.thumbWidth; #X floatatom 47 302 5 0 0 0 - - -, f 5; #X msg 67 235 0x3293ef; #X text 129 235 hex color code.; #X text 42 31 the gui abstractions internally have receivers that allow you to further change the look or behavior of the gui. you can change these public properties by sending a value to the send name "pdgui.propertyName" prepended with "@" or "#".; #X text 85 302 should be longer than the frame time.; #X text 198 261 change the front color of all guis. (default: black) ; #X text 191 321 change the flash time(ms) for [pdgui/bang]. (default: 250); #X text 197 381 change the thumb width of [pdgui/vslider] and [pdgui/hslider]. (default: 4); #X text 191 441 change the cell scale of [pdgui/vradio] and [pdgui/hradio]. (default: 0.6); #X text 191 501 change the font scale of [pdgui/numbox]. (default: 0.5); #X connect 5 0 6 0; #X connect 7 0 0 0; #X connect 8 0 7 0; #X connect 9 0 7 1; #X connect 10 0 7 2; #X connect 11 0 0 0; #X connect 14 0 7 3; #X connect 15 0 16 0; #X connect 19 0 20 0; #X connect 21 0 4 0; #X connect 22 0 0 0; #X restore 27 306 pd pdgui.public.properties; #X obj 276 567 ofRect 580 270; #X text 371 567 this works like a canvas.; #X obj 399 724 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 276 651 ofTrans 0 40; #X obj 276 753 pdgui/vslider2 30 210 0 100 1; #X obj 276 843 ofTrans -60 260; #X obj 276 894 ofTrans 340 0; #X obj 276 917 ofSetColor lightGreen; #X obj 276 939 pdgui/multislider 40 200 6 0 100 @fonts[1]; #X obj 27 342 ofWindow 640 650 LEFT TOP; #X obj 276 870 pdgui/multislider 5 200 64 0 100 @fonts[1]; #X connect 0 0 11 0; #X connect 8 0 9 0; #X connect 8 1 13 0; #X connect 9 0 10 0; #X connect 10 0 24 0; #X connect 10 1 14 0; #X connect 11 0 44 0; #X connect 12 0 17 0; #X connect 14 0 23 0; #X connect 17 0 19 0; #X connect 18 0 8 0; #X connect 19 0 18 0; #X connect 19 1 31 0; #X connect 22 0 27 7; #X connect 25 0 26 0; #X connect 26 0 10 2; #X connect 27 0 60 0; #X connect 27 1 20 0; #X connect 29 0 30 0; #X connect 30 0 62 0; #X connect 30 1 34 0; #X connect 31 0 35 0; #X connect 32 0 36 0; #X connect 35 0 57 0; #X connect 36 0 27 0; #X connect 38 0 39 0; #X connect 38 1 37 0; #X connect 39 0 61 0; #X connect 42 0 31 1; #X connect 44 0 12 0; #X connect 45 0 27 3; #X connect 54 0 10 1; #X connect 57 0 32 0; #X connect 59 0 61 6; #X connect 60 0 38 0; #X connect 61 0 29 0; #X connect 61 1 33 0; #X connect 62 0 67 0; #X connect 63 0 64 0; #X connect 64 0 65 0; #X connect 66 0 2 0; #X connect 67 0 63 0;