aboutsummaryrefslogtreecommitdiff
path: root/packages/patches/fix_max.pat_exporting-0.41.4.patch
blob: 5da90baafcf3fa3a1150a53043aca58eef038e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
--- branches/pd-extended/0.41/pd/src/m_binbuf.c	2009/01/24 05:10:36	10609
+++ branches/pd-extended/0.41/pd/src/m_binbuf.c	2009/02/12 01:09:11	10760
@@ -952,14 +952,15 @@
     t_binbuf *newb = binbuf_new();
     t_atom *vec = oldb->b_vec;
     t_int n = oldb->b_n, nextindex, stackdepth = 0, stack[MAXSTACK],
-        nobj = 0, i;
+        nobj = 0, i, gotfontsize = 0;
     t_atom outmess[MAXSTACK], *nextmess;
+    t_float fontsize = 10;
     if (!maxtopd)
         binbuf_addv(newb, "ss;", gensym("max"), gensym("v2"));
     for (nextindex = 0; nextindex < n; )
     {
         int endmess, natom;
-        char *first, *second;
+        char *first, *second, *third;
         for (endmess = nextindex; endmess < n && vec[endmess].a_type != A_SEMI;
             endmess++)
                 ;
@@ -1146,11 +1147,49 @@
                 }
                 else if (!strcmp(second, "user"))
                 {
-                    binbuf_addv(newb, "ssffs;",
-                        gensym("#X"), gensym("obj"),
-                        atom_getfloatarg(3, natom, nextmess),
-                        atom_getfloatarg(4, natom, nextmess),
-                        atom_getsymbolarg(2, natom, nextmess)); 
+                    third = (nextmess+2)->a_w.w_symbol->s_name;
+                    if (!strcmp(third, "hslider"))
+                    {
+                        t_float range = atom_getfloatarg(7, natom, nextmess);
+                        t_float multiplier = atom_getfloatarg(8, natom, nextmess);
+                        t_float offset = atom_getfloatarg(9, natom, nextmess);
+                        binbuf_addv(newb, "ssffsffffffsssfffffffff;",
+                                    gensym("#X"), gensym("obj"),
+                                    atom_getfloatarg(3, natom, nextmess),
+                                    atom_getfloatarg(4, natom, nextmess),
+                                    gensym("hsl"),
+                                    atom_getfloatarg(6, natom, nextmess),
+                                    atom_getfloatarg(5, natom, nextmess),
+                                    offset,
+                                    range + offset,
+                                    0., 0.,
+                                    gensym("empty"), gensym("empty"), gensym("empty"),
+                                    0., -8., 0., 8., -262144., -1., -1., 0., 1.); 
+                   }
+                    else if (!strcmp(third, "uslider"))
+                    {
+                        t_float range = atom_getfloatarg(7, natom, nextmess);
+                        t_float multiplier = atom_getfloatarg(8, natom, nextmess);
+                        t_float offset = atom_getfloatarg(9, natom, nextmess);
+                        binbuf_addv(newb, "ssffsffffffsssfffffffff;",
+                                    gensym("#X"), gensym("obj"),
+                                    atom_getfloatarg(3, natom, nextmess),
+                                    atom_getfloatarg(4, natom, nextmess),
+                                    gensym("vsl"),
+                                    atom_getfloatarg(5, natom, nextmess),
+                                    atom_getfloatarg(6, natom, nextmess),
+                                    offset,
+                                    range + offset,
+                                    0., 0.,
+                                    gensym("empty"), gensym("empty"), gensym("empty"),
+                                    0., -8., 0., 8., -262144., -1., -1., 0., 1.);
+                    }
+                    else
+                        binbuf_addv(newb, "ssffs;",
+                                    gensym("#X"), gensym("obj"),
+                                    atom_getfloatarg(3, natom, nextmess),
+                                    atom_getfloatarg(4, natom, nextmess),
+                                    atom_getsymbolarg(2, natom, nextmess));
                     nobj++;
                 }
                 else if (!strcmp(second, "connect")||
@@ -1179,12 +1218,17 @@
                     stack[stackdepth] = nobj;
                     stackdepth++;
                     nobj = 0;
+                    if(!gotfontsize) { /* only the first canvas sets the font size */
+                        fontsize = atom_getfloatarg(6, natom, nextmess);
+                        gotfontsize = 1;
+                    }
+                    t_float x = atom_getfloatarg(2, natom, nextmess);
+                    t_float y = atom_getfloatarg(3, natom, nextmess);
                     binbuf_addv(newb, "ssffff;", 
                         gensym("#N"), gensym("vpatcher"),
-                            atom_getfloatarg(2, natom, nextmess),
-                            atom_getfloatarg(3, natom, nextmess),
-                            atom_getfloatarg(4, natom, nextmess),
-                            atom_getfloatarg(5, natom, nextmess));
+                            x, y,
+                            atom_getfloatarg(4, natom, nextmess) + x,
+                            atom_getfloatarg(5, natom, nextmess) + y);
                 }
             }
             if (!strcmp(first, "#X"))
@@ -1193,12 +1237,17 @@
                     && (ISSYMBOL (&nextmess[4], "pd")))
                 {
                     binbuf_addv(newb, "ss;", gensym("#P"), gensym("pop"));
-                    binbuf_addv(newb, "ssffffss;",
-                        gensym("#P"), gensym("newobj"),
-                        atom_getfloatarg(2, natom, nextmess),
-                        atom_getfloatarg(3, natom, nextmess), 50., 1.,
-                        gensym("patcher"),
-                            atom_getsymbolarg(5, natom, nextmess));
+                    SETSYMBOL(outmess, gensym("#P"));
+                    SETSYMBOL(outmess + 1, gensym("newobj"));
+                    outmess[2] = nextmess[2];
+                    outmess[3] = nextmess[3];
+                    SETFLOAT(outmess + 4, 50.*(natom-5));
+                    SETFLOAT(outmess + 5, fontsize);
+                    SETSYMBOL(outmess + 6, gensym("p"));
+                    for (i = 5; i < natom; i++)
+                        outmess[i+2] = nextmess[i];
+                    SETSEMI(outmess + natom + 2);
+                    binbuf_add(newb, natom + 3, outmess);
                     if (stackdepth) stackdepth--;
                     nobj = stack[stackdepth];
                     nobj++;
@@ -1212,25 +1261,25 @@
                             gensym("inlet"),
                             atom_getfloatarg(2, natom, nextmess),
                             atom_getfloatarg(3, natom, nextmess),
-                            15.);
+                            10. + fontsize);
                     else if (classname == gensym("inlet~"))
                         binbuf_addv(newb, "ssffff;", gensym("#P"),
                             gensym("inlet"),
                             atom_getfloatarg(2, natom, nextmess),
                             atom_getfloatarg(3, natom, nextmess),
-                            15., 1.);
+                            10. + fontsize, 1.);
                     else if (classname == gensym("outlet"))
                         binbuf_addv(newb, "ssfff;", gensym("#P"),
                             gensym("outlet"),
                             atom_getfloatarg(2, natom, nextmess),
                             atom_getfloatarg(3, natom, nextmess),
-                            15.);
+                            10. + fontsize);
                     else if (classname == gensym("outlet~"))
                         binbuf_addv(newb, "ssffff;", gensym("#P"),
                             gensym("outlet"),
                             atom_getfloatarg(2, natom, nextmess),
                             atom_getfloatarg(3, natom, nextmess),
-                            15., 1.);
+                            10. + fontsize, 1.);
                     else if (classname == gensym("bng"))
                         binbuf_addv(newb, "ssffff;", gensym("#P"),
                             gensym("button"),
@@ -1255,16 +1304,65 @@
                                     (atom_getfloatarg(6, natom, nextmess) == 1? 1 :
                                          atom_getfloatarg(6, natom, nextmess) - 1),
                             atom_getfloatarg(7, natom, nextmess));
+                    else if (classname == gensym("hsl")) 
+                    {
+                        t_float slmin = atom_getfloatarg(7, natom, nextmess);
+                        t_float slmax = atom_getfloatarg(8, natom, nextmess);
+                        binbuf_addv(newb, "sssffffffff;", gensym("#P"),
+                            gensym("user"),
+                            gensym("hslider"),
+                            atom_getfloatarg(2, natom, nextmess),
+                            atom_getfloatarg(3, natom, nextmess),
+                            atom_getfloatarg(6, natom, nextmess),
+                            atom_getfloatarg(5, natom, nextmess),
+                            slmax - slmin + 1, /* range */
+                            1.,            /* multiplier */
+                            slmin,         /* offset */
+                            0.);
+                    }
+                    else if ( (classname == gensym("trigger")) ||
+                              (classname == gensym("t")) )
+                    {
+                        SETSYMBOL(outmess, gensym("#P"));
+                        SETSYMBOL(outmess + 1, gensym("newex"));
+                        outmess[2] = nextmess[2];
+                        outmess[3] = nextmess[3];
+                        SETFLOAT(outmess + 4, 50.*(natom-4));
+                        SETFLOAT(outmess + 5, fontsize);
+                        outmess[6] = nextmess[4];
+                        t_symbol *arg;
+                        for (i = 5; i < natom; i++) {
+                            arg = atom_getsymbolarg(i, natom, nextmess);
+                            if (arg == gensym("a"))
+                                SETSYMBOL(outmess + i + 2, gensym("l"));
+                            else if (arg == gensym("anything"))
+                                SETSYMBOL(outmess + i + 2, gensym("l"));
+                            else if (arg == gensym("bang"))
+                                SETSYMBOL(outmess + i + 2, gensym("b"));
+                            else if (arg == gensym("float"))
+                                SETSYMBOL(outmess + i + 2, gensym("f"));
+                            else if (arg == gensym("list"))
+                                SETSYMBOL(outmess + i + 2, gensym("l"));
+                            else if (arg == gensym("symbol"))
+                                SETSYMBOL(outmess + i + 2, gensym("s"));
+                            else 
+                                outmess[i+2] = nextmess[i];
+                        }
+                        SETSEMI(outmess + natom + 2);
+                        binbuf_add(newb, natom + 3, outmess);
+                    }
                     else
                     {
                         SETSYMBOL(outmess, gensym("#P"));
                         SETSYMBOL(outmess + 1, gensym("newex"));
                         outmess[2] = nextmess[2];
                         outmess[3] = nextmess[3];
-                        SETFLOAT(outmess + 4, 50);
-                        SETFLOAT(outmess + 5, 1);
+                        SETFLOAT(outmess + 4, 50.*(natom-4));
+                        SETFLOAT(outmess + 5, fontsize);
                         for (i = 4; i < natom; i++)
                             outmess[i+2] = nextmess[i];
+                        if (classname == gensym("osc~"))
+                            SETSYMBOL(outmess + 6, gensym("cycle~"));
                         SETSEMI(outmess + natom + 2);
                         binbuf_add(newb, natom + 3, outmess);
                     }
@@ -1279,8 +1377,8 @@
                         (strcmp(second, "msg") ? "comment" : "message")));
                     outmess[2] = nextmess[2];
                     outmess[3] = nextmess[3];
-                    SETFLOAT(outmess + 4, 50);
-                    SETFLOAT(outmess + 5, 1);
+                    SETFLOAT(outmess + 4, 50.*(natom-4));
+                    SETFLOAT(outmess + 5, fontsize);
                     for (i = 4; i < natom; i++)
                         outmess[i+2] = nextmess[i];
                     SETSEMI(outmess + natom + 2);
@@ -1289,10 +1387,13 @@
                 }
                 else if (!strcmp(second, "floatatom"))
                 {
+                    t_float width = atom_getfloatarg(4, natom, nextmess)*fontsize;
+                    if(width<8) width = 150; /* if pd width=0, set it big */
                     binbuf_addv(newb, "ssfff;",
                         gensym("#P"), gensym("flonum"),
                         atom_getfloatarg(2, natom, nextmess),
-                        atom_getfloatarg(3, natom, nextmess), 35);
+                        atom_getfloatarg(3, natom, nextmess),
+                        width);
                     nobj++;
                 }
                 else if (!strcmp(second, "connect"))