Compare commits

..

18 Commits

Author SHA1 Message Date
6b07a8e90b menu_mode and recall_filled 2025-03-05 17:10:28 +01:00
aa2359c468 umenu update with set instead of setsymbol 2024-12-18 15:39:05 +01:00
69cbe9b235 folder name 2024-12-18 15:29:20 +01:00
76ad31163f fix issue when resyncing with out-of-grid new presets 2024-12-18 15:15:01 +01:00
4df1c2b7e1 prevent updating slotname when locked ; coll-compatible filled_slots dict 2024-12-04 10:51:42 +01:00
5b3b12e613 send_name attribute 2024-11-29 22:20:51 +01:00
f9a3711507 fix names as symboles in filled_slots_dict 2024-11-29 19:04:38 +01:00
af803d109e autowatch 2024-11-29 16:58:23 +01:00
3214f0c673 small perf improvements (less paint_base calls) ; create and maintain a Dict with filled slots info 2024-11-29 16:53:26 +01:00
65dd0ca8e0 Max 9 v8ui ready 2024-10-31 00:25:52 +01:00
83dc04b993 fix umenu set to item 0 when paint_base in layout 1 2024-08-23 00:45:13 +02:00
6f7ac37a05 fix false error when receiving write messages 2024-08-23 00:35:34 +02:00
5792689842 clean 2024-08-20 12:28:16 +02:00
1f6e2b5c5a fix preset disapearing if pushed away from displayed slot after a preset have been drag onto another 2024-08-20 12:24:40 +02:00
3b387c66d2 grid layout scrollable, auto-scroll when drag outside of window 2024-08-20 12:09:19 +02:00
e07e8ef9ca fix regression not interpreting recall feedback correctlty 2024-08-20 01:45:13 +02:00
8b91c7ad5d new snippet with color selector 2024-08-20 01:17:43 +02:00
f0a41a6687 maxref update 2024-08-20 00:49:17 +02:00
7 changed files with 895 additions and 165 deletions

View File

@@ -68,6 +68,7 @@
With 4 float arguments, the currently selected preset is set to a custom color defined by the four arguments (in RGBA format).
With 1 integer followed by 4 float arguments, the preset number defined by first argument is set to a custom color defined by the four arguments (in RGBA format).
The integer argument, between 1 and 6, defines which color in being modifier, and next the four floats define the color in the RGBA format.
With no argument, it resets colors for the select preset to default values.
</description>
</method>
<method name="pattrstorage">
@@ -77,6 +78,11 @@
If the word `pattrstorage`is sent alone, the jsui is unlinked from any pattrstorage.
</description>
</method>
<method name="recall_filled">
<digest>Recalls nth filled preset</digest>
<description>Recalls the nth filled preset. Example: 'recall_filled 3' will recall the third available filled preset from the preset list, regardless of its slot number.
</description>
</method>
<method name="resync">
<digest>Resync the jsui to the pattrstorage</digest>
<description>The word 'resync' will repopulate the jsui with the current preset list from the pattrstorage. It is usefull in case you add/remove/edit presets without using the jsui.
@@ -173,6 +179,10 @@
<digest>Object margin</digest>
<description>Defines the size, in pixels, of the margin between the jsui border and the preset slots.</description>
</attribute>
<attribute name='menu_mode' get='1' set='1' type='int' size='1' >
<digest>Menu mode</digest>
<description>Populates the umenu connected to 2nd outlet with preset number and name (0), preset number only (1), or name only (2). See recall_filled when using mode 2</description>
</attribute>
<attribute name='min_rows' get='1' set='1' type='int' size='1' >
<digest>Minimum number of rows to display</digest>
<description>Defines the minimum number of rows to display if scrollable is enabled and layout is set to 1.
@@ -181,7 +191,7 @@
</attribute>
<attribute name='scrollable' get='1' set='1' type='int' size='1' >
<digest>Scroll through your presets</digest>
<description>When set to 1, you can through the jsui to see all your presets, or at least up to the slot number defined by the min_rows attributes. Currently only works with the list layout.
<description>When set to 1, you can through the jsui to see all your presets, or at least up to the row defined by the min_rows attributes.
</description>
</attribute>
<attribute name='select_mode' get='1' set='1' type='int' size='1' >

View File

@@ -4,7 +4,7 @@
"appversion" : {
"major" : 8,
"minor" : 6,
"revision" : 3,
"revision" : 4,
"architecture" : "x64",
"modernui" : 1
}
@@ -26,7 +26,7 @@
"toptoolbarpinned" : 2,
"righttoolbarpinned" : 2,
"bottomtoolbarpinned" : 2,
"toolbars_unpinned_last_save" : 0,
"toolbars_unpinned_last_save" : 15,
"tallnewobj" : 0,
"boxanimatetime" : 200,
"enablehscroll" : 0,
@@ -80,7 +80,7 @@
}
, {
"box" : {
"embedstate" : [ [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "autowriteagain", 0 ], [ "layout", 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "color_mode", 0 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "margin", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "fontsize", 14 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "scrollable", 1 ], [ "fontname", "Arial" ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 50 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "display_interp", 1 ], [ "bubblesize", 14 ], [ "spacing", 4 ], [ "select_mode", 0 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 1 ] ],
"filename" : "tc.preset",
"id" : "obj-8",
"maxclass" : "jsui",
@@ -134,7 +134,7 @@
}
, {
"box" : {
"embedstate" : [ [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "color_mode", 0 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "margin", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "fontsize", 14 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "scrollable", 1 ], [ "fontname", "Arial" ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 50 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "display_interp", 1 ], [ "bubblesize", 14 ], [ "spacing", 4 ], [ "select_mode", 0 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ] ],
"filename" : "tc.preset",
"id" : "obj-3",
"maxclass" : "jsui",

View File

@@ -814,7 +814,7 @@
, {
"box" : {
"border" : 0,
"embedstate" : [ [ "bubblesize", 14 ], [ "spacing", 4 ], [ "scrollable", 1 ], [ "ignoreslotzero", 1 ], [ "layout", 0 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "min_rows", 50 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "color_mode", 0 ], [ "display_interp", 1 ], [ "margin", 4 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontsize", 14 ], [ "select_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "autowriteagain", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_1", 0.743, 0.41, 0.501, 1 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ] ],
"filename" : "tc.preset.js",
"id" : "obj-10",
"maxclass" : "jsui",
@@ -1187,7 +1187,7 @@
, {
"box" : {
"border" : 0,
"embedstate" : [ [ "bubblesize", 14 ], [ "spacing", 4 ], [ "scrollable", 1 ], [ "ignoreslotzero", 1 ], [ "layout", 0 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "min_rows", 50 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "color_mode", 0 ], [ "display_interp", 1 ], [ "margin", 4 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontsize", 14 ], [ "select_mode", 1 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "autowriteagain", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_1", 0.743, 0.41, 0.501, 1 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 1 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ] ],
"filename" : "tc.preset.js",
"id" : "obj-10",
"maxclass" : "jsui",
@@ -1266,7 +1266,7 @@
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 288.0, 282.0, 249.0, 60.0 ],
"patching_rect" : [ 332.0, 262.0, 249.0, 60.0 ],
"text" : "Makes displayed previous active slot and interpolation status to ignore slot 0. Can be convenient when using slot 0 as a temporary step for interpolation. It is enabled by default."
}
@@ -1279,7 +1279,7 @@
"numoutlets" : 1,
"outlettype" : [ "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 268.0, 87.0, 24.0, 24.0 ]
"patching_rect" : [ 312.0, 67.0, 24.0, 24.0 ]
}
}
@@ -1291,7 +1291,7 @@
"numoutlets" : 1,
"outlettype" : [ "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 288.0, 227.0, 24.0, 24.0 ]
"patching_rect" : [ 332.0, 207.0, 24.0, 24.0 ]
}
}
@@ -1302,7 +1302,7 @@
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 268.0, 142.0, 241.0, 60.0 ],
"patching_rect" : [ 312.0, 122.0, 241.0, 60.0 ],
"text" : "When enabled, sends writeagain to pattrstrage when a preset has been stored/renamed/deleted/moved/(un)locked, keeping the json file always up to date."
}
@@ -1316,7 +1316,7 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"parameter_enable" : 0,
"patching_rect" : [ 268.0, 118.0, 122.0, 22.0 ]
"patching_rect" : [ 312.0, 98.0, 122.0, 22.0 ]
}
}
@@ -1329,7 +1329,7 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"parameter_enable" : 0,
"patching_rect" : [ 288.0, 258.0, 121.0, 22.0 ]
"patching_rect" : [ 332.0, 238.0, 121.0, 22.0 ]
}
}
@@ -1954,7 +1954,7 @@
, {
"box" : {
"border" : 0,
"embedstate" : [ [ "bubblesize", 14 ], [ "spacing", 4 ], [ "scrollable", 1 ], [ "ignoreslotzero", 1 ], [ "layout", 0 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "min_rows", 50 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "color_mode", 0 ], [ "display_interp", 1 ], [ "margin", 4 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontsize", 14 ], [ "select_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "fontname", "Arial" ], [ "pattrstorage", "mypat" ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "autowriteagain", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_1", 0.743, 0.41, 0.501, 1 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "mypat" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ] ],
"filename" : "tc.preset.js",
"id" : "obj-10",
"maxclass" : "jsui",
@@ -2109,7 +2109,7 @@
}
,
"classnamespace" : "box",
"rect" : [ 0.0, 26.0, 678.0, 554.0 ],
"rect" : [ 100.0, 126.0, 678.0, 554.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
@@ -2146,21 +2146,10 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 10.0, 294.0, 129.0, 22.0 ],
"patching_rect" : [ 10.0, 298.0, 129.0, 22.0 ],
"text" : "loadmess savemode 0"
}
}
, {
"box" : {
"id" : "obj-5",
"maxclass" : "preset",
"numinlets" : 1,
"numoutlets" : 5,
"outlettype" : [ "preset", "int", "preset", "int", "" ],
"patching_rect" : [ 466.0, 399.0, 100.0, 40.0 ]
}
}
, {
"box" : {
@@ -2210,7 +2199,7 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 229.0, 192.0, 77.0, 22.0 ],
"text" : "loadmess 50"
"text" : "loadmess 10"
}
}
@@ -2276,7 +2265,7 @@
, {
"box" : {
"border" : 0,
"embedstate" : [ [ "bubblesize", 14 ], [ "spacing", 4 ], [ "scrollable", 1 ], [ "ignoreslotzero", 1 ], [ "layout", 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "min_rows", 50 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "color_mode", 0 ], [ "display_interp", 1 ], [ "margin", 4 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontsize", 14 ], [ "select_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "autowriteagain", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_1", 0.743, 0.41, 0.501, 1 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 1 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 1 ] ],
"filename" : "tc.preset.js",
"id" : "obj-10",
"maxclass" : "jsui",
@@ -2333,7 +2322,7 @@
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 427.0, 107.0, 231.0, 91.0 ],
"patching_rect" : [ 448.0, 74.0, 231.0, 91.0 ],
"text" : "...and: bgcolor, empty_slot_color, stored_slot_color, interp_slot_color, active_slot_color, fontname, fontsize, text_bg_color, text_color\n(see the tc.preset attributes in the inspector or in its Reference page)"
}
@@ -2341,24 +2330,23 @@
, {
"box" : {
"id" : "obj-65",
"linecount" : 6,
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 278.0, 181.0, 153.0, 87.0 ],
"text" : "Minimum number of slots to display when scrollable is enabled. If a preset is stored in a slot higher than that value, then it is ignored."
"patching_rect" : [ 278.0, 218.5, 196.0, 33.0 ],
"text" : "Minimum number of rows to display when scrollable is enabled."
}
}
, {
"box" : {
"id" : "obj-62",
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 172.0, 81.0, 211.0, 33.0 ],
"text" : "Enable to scroll through your presets! (Only work in list mode currently)"
"patching_rect" : [ 172.0, 87.5, 211.0, 20.0 ],
"text" : "Enable to scroll through your presets! "
}
}
@@ -2482,7 +2470,7 @@
"numoutlets" : 2,
"outlettype" : [ "", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 304.0, 294.0, 50.0, 22.0 ]
"patching_rect" : [ 303.0, 294.0, 50.0, 22.0 ]
}
}
@@ -2754,7 +2742,7 @@
}
,
"classnamespace" : "box",
"rect" : [ 100.0, 126.0, 678.0, 554.0 ],
"rect" : [ 0.0, 26.0, 678.0, 554.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
@@ -4008,7 +3996,7 @@
"numoutlets" : 3,
"outlettype" : [ "", "", "" ],
"patching_rect" : [ 322.0, 400.0, 40.0, 22.0 ],
"restore" : [ 0.43, 0.34, -0.47, 0.92, -0.77, -0.56, -0.16, -0.03, -0.74, 0.06, -0.81, 0.97, -0.39, 0.47, 0.73, -0.63 ],
"restore" : [ -0.51, -0.05, 0.22, 0.9, -0.21, -0.87, -0.33, -0.81, 0.41, -0.74, 0.67, -0.85, -0.15, -0.92, -0.6, 0.05 ],
"saved_object_attributes" : {
"parameter_enable" : 0,
"parameter_mappable" : 0
@@ -4346,7 +4334,7 @@
, {
"box" : {
"border" : 0,
"embedstate" : [ [ "bubblesize", 14 ], [ "spacing", 4 ], [ "scrollable", 1 ], [ "ignoreslotzero", 1 ], [ "layout", 0 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "min_rows", 50 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "color_mode", 3 ], [ "display_interp", 1 ], [ "margin", 4 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontsize", 14 ], [ "select_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "fontname", "Arial" ], [ "pattrstorage", "colors" ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "autowriteagain", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_1", 0.743, 0.41, 0.501, 1 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 1 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "colors" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ] ],
"filename" : "tc.preset.js",
"id" : "obj-10",
"maxclass" : "jsui",
@@ -4632,7 +4620,7 @@
, {
"box" : {
"border" : 0,
"embedstate" : [ [ "bubblesize", 14 ], [ "spacing", 4 ], [ "scrollable", 1 ], [ "ignoreslotzero", 1 ], [ "layout", 0 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "min_rows", 50 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "color_mode", 0 ], [ "display_interp", 1 ], [ "margin", 4 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontsize", 14 ], [ "select_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "autowriteagain", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_1", 0.743, 0.41, 0.501, 1 ] ],
"embedstate" : [ [ "spacing", 4 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "select_mode", 0 ], [ "scrollable", 0 ], [ "bubblesize", 14 ], [ "margin", 4 ], [ "fontsize", 14 ], [ "color_mode", 0 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "ignoreslotzero", 1 ], [ "min_rows", 10 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "test" ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "display_interp", 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "slot_round", 0 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "autowriteagain", 0 ], [ "layout", 0 ] ],
"filename" : "tc.preset.js",
"id" : "obj-10",
"maxclass" : "jsui",

View File

@@ -1,2 +1,2 @@
max objectfile tc.preset tc.preset;
max definesubstitution tc.preset jsui @filename tc.preset
max definesubstitution tc.preset jsui @filename tc.preset;

View File

@@ -70,11 +70,12 @@ var layout = 0; // 0: grid mode (same as [preset]). 1: list mode
var display_interp = 1; // Enable/disable the UI feedback when interpolating between presets
var ignore_slot_zero = 1; // Makes previous_active_slot and interpolation display to ignore slot 0. Can be usefull when using slot 0 as a temporary step for interpolation.
var auto_writeagain = 0; // When enabled, will send a "writeagain" to pattrstorage any time a preset is stored/deleted/moved/renamed/(un)locked
var menu_number_only = 0; // Populates the umenu connected to 2nd outlet with stored preset number only, instead of number and name
var scrollable = 1; // Defines weither the object can be scrolled or not
var min_rows = 50; // Minimum number of rows to display if scrollable is enabled
var menu_mode = 0; // Populates the umenu connected to 2nd outlet with preset number and name (0), preset number only (1), or name only (2)
var scrollable = 0; // Defines weither the object can be scrolled or not
var min_rows = 10; // Minimum number of rows to display if scrollable is enabled
var color_mode = 0; // Change the way the filled slots (stored presets) color is handeld. 0: stored_slot_color. 1: looping through color_1 to color_6. 2: Freely assign colors 1 to 6. 3: Set any color to any preset
var select_mode = 0; // 0: single click to select and recall the slot. 1: single click to select the slot, double click to recall it.
var send_name = "none"; // The global name to send presets dict name to (received by the [receive] object)
// (WORK)
var pattrstorage_name, pattrstorage_obj = null;
@@ -84,6 +85,7 @@ var slots = []; // Stores on screen box, name, lock and interpol
var slots_highest = 0; // Highest filled preset slot number
var slots_count_display = 0; // Number of slots to be displayed
var filled_slots = []; // List of stored slots
var filled_slots_dict = new Dict();
var active_slot = 0; //Last recalled slot
var previous_active_slot = 0; //Previously recalled slot
@@ -101,6 +103,7 @@ var is_painting_base = 0;
var half_slot_size, half_margin, half_spacing;
var last_x, last_y, last_hovered = -1;
var y_offset = 0; // handle scrolling
var drag_scroll = 0; // handle scrolling when dragging outside of boundaries
var shift_hold, option_hold = 0;
var is_interpolating = 0;
var is_dragging = 0; // Drag flag
@@ -174,15 +177,17 @@ function calc_rows_columns() {
if (layout == 0) {
columns = Math.floor((ui_width - margin + spacing) / (slot_size + spacing));
rows = Math.floor((ui_height - margin + spacing) / (slot_size + spacing));
slots_count_display = columns * rows;
if (scrollable) {
rows = Math.max(rows, Math.max(min_rows, Math.ceil(slots_highest/columns)));
}
} else {
columns = 1;
rows = Math.floor((ui_height - margin + spacing) / (slot_size + spacing));
if (scrollable) {
rows = Math.max(rows, Math.max(min_rows, slots_highest));
}
slots_count_display = columns * rows;
}
slots_count_display = columns * rows;
for (var i = 0; i < rows; i++) {
var top = margin + i * (spacing+slot_size);
@@ -192,28 +197,13 @@ function calc_rows_columns() {
var right = left + slot_size;
var cur = 1 + i * columns + j;
// var prev_name = null;
// var prev_lock = 0;
// var prev_interp = -1;
var prev_state = new slot();
prev_state.init();
if (typeof slots[cur] !== 'undefined') {
prev_state = slots[cur];
// prev_name = slots[cur].name;
// prev_lock = slots[cur].lock;
// prev_interp = slots[cur].interp;
}
slots[cur] = new slot(left, top, right, bottom, prev_state.name, prev_state.lock, prev_state.interp, prev_state.color_index, prev_state.color_custom);
}
}
if (slots_count_display < slots_highest) {
for (var i = slots_count_display + 1; i <= slots_highest; i++) {
slots[i] = new slot();
slots[i].init();
}
}
paint_base();
}
@@ -386,10 +376,6 @@ function paint()
// Previous active slot
if (is_dragging == 0 && previous_active_slot > 0 && previous_active_slot <= slots_count_display) {
// set_source_rgba(active_slot_color);
// draw_slot_bubble(slots[previous_active_slot][0]+0.75, slots[previous_active_slot][1]+0.75, slot_size-1.5, slot_size-1.5);
// set_line_width(1.5);
// stroke();
set_source_rgba(active_slot_color[0], active_slot_color[1], active_slot_color[2], active_slot_color[3] * 0.5);
if (color_mode) {
draw_slot_bubble(slots[previous_active_slot].left+1.5, slots[previous_active_slot].top+1.5, slot_size-3, slot_size-3);
@@ -401,6 +387,13 @@ function paint()
}
}
//Hide dragged slot
if (is_dragging) {
set_source_rgba(empty_slot_color);
draw_slot_bubble(slots[drag_slot].left, slots[drag_slot].top, slot_size, slot_size);
fill();
}
// Selected slot
if (selected_slot > 0 && selected_slot <= slots_count_display) {
set_source_rgba(active_slot_color);
@@ -439,6 +432,7 @@ function paint()
fill();
}
}
// Slot border
set_source_rgba(1, 1, 1, 0.8);
draw_slot_bubble(slots[last_hovered].left, slots[last_hovered].top, slot_size, slot_size);
@@ -521,7 +515,7 @@ function paint()
}
}
}
paint.local = 1;
paint.local = 0;
function color_wheel() {
// Rather than using an array of colors, each color has its own variable, so they can be declared as attributes and saved with the patch
@@ -597,6 +591,7 @@ function setcolor() {
slots[slot_nb].color_custom = [args[1], args[2], args[3], args[4]];
}
update_preset_color_pattr(slot_nb);
update_filled_slots_dict();
paint_base();
trigger_writeagain();
}
@@ -681,21 +676,23 @@ function anything() {
} else if (previous_active_slot == v) {
previous_active_slot = 0;
}
// to_pattrstorage("getslotname", v);
to_pattrstorage("delete", v);
to_pattrstorage("getslotlist");
paint_base();
set_active_slot(active_slot);
if (!is_dragging) {
outlet(0, "delete", v);
if (selected_slot == v) {
selected_slot == 0
outlet(2, 'set');
outlet(3, 'set', 0);
if (is_dragging == 0) {
to_pattrstorage("delete", v);
to_pattrstorage("getslotlist");
paint_base();
set_active_slot(active_slot);
if (!is_dragging) {
outlet(0, "delete", v);
if (selected_slot == v) {
selected_slot == 0
outlet(2, 'set');
outlet(3, 'set', 0);
}
}
trigger_writeagain();
}
trigger_writeagain();
}
}
} else {
@@ -746,7 +743,9 @@ function slotlist() {
for (var i = 0; i < filled_slots.length; i++) {
to_pattrstorage("getslotname", filled_slots[i]);
}
get_all_preset_colors();
update_filled_slots_dict();
}
}
@@ -759,15 +758,20 @@ function slotname() {
function setslotname() {
// Because [pattrstorage] doesn't output anything when renaming presets with "slotname", we use a custom "setslotname" instead, that will rename the active preset
if (active_slot > 0) {
var sname = arrayfromargs(arguments).join(' ');
slotname(selected_slot, sname);
to_pattrstorage("slotname", selected_slot, sname);
update_umenu();
select(selected_slot);
trigger_writeagain();
if (layout == 1) {
paint_base();
if (selected_slot > 0) {
if (slots[selected_slot].lock == 0) {
var sname = arrayfromargs(arguments).join(' ');
slotname(selected_slot, sname);
to_pattrstorage("slotname", selected_slot, sname);
update_umenu();
update_filled_slots_dict();
select(selected_slot);
trigger_writeagain();
if (layout == 1) {
paint_base();
}
} else {
error('Cannot set name of locked slot\n');
}
}
}
@@ -783,68 +787,70 @@ function recall() {
is_interpolating = 0;
set_active_slot(args[0]);
outlet(0, 'recall', args[0]);
} else if (args.length == 2) {
if (typeof(args[0]) == 'number') {
var src_slot = args[0];
var trg_slot = args[1];
for (var i = 0; i < filled_slots.length; i++) {
slots[filled_slots[i]].interp = -1;
}
if (slots[src_slot].name != null && slots[trg_slot].name != null) {
if (ignore_slot_zero == 1 && src_slot == 0) {
// Set src_slot as if we were interpolating from the last recalled preset different than 0
// This way we can monitor which preset we come from even if we used preset 0 as intermediary preset
if (previous_target != active_slot) {
// If the last target preset was through interpollation or direct recall
src_slot = previous_active_slot;
} else {
src_slot = active_slot;
}
}
var interp = Math.min( 1, Math.max(0, args[2]));
if (interp == 0.0) {
slots[src_slot].interp = -1;
slots[trg_slot].interp = -1;
is_interpolating = 0;
if (previous_target != active_slot) {
previous_active_slot = active_slot;
} else if (args[0] != 0) {
previous_active_slot = args[0];
} else {
previous_active_slot = previous_target;
}
set_active_slot(src_slot);
} else if (interp == 1.0) {
slots[src_slot].interp = -1;
slots[trg_slot].interp = -1;
is_interpolating = 0;
previous_target = trg_slot;
set_active_slot(trg_slot);
} else {
slots[src_slot].interp = 1 - interp;
slots[trg_slot].interp = interp;
is_interpolating = 1;
active_slot = 0;
// set_active_slot(0);
}
outlet(0, "recall", src_slot, trg_slot, interp);
}
} else if (args.length == 3) {
var src_slot = args[0];
var trg_slot = args[1];
for (var i = 0; i < filled_slots.length; i++) {
slots[filled_slots[i]].interp = -1;
}
if (slots[src_slot].name != null && slots[trg_slot].name != null) {
if (ignore_slot_zero == 1 && src_slot == 0) {
// Set src_slot as if we were interpolating from the last recalled preset different than 0
// This way we can monitor which preset we come from even if we used preset 0 as intermediary preset
if (previous_target != active_slot) {
// If the last target preset was through interpollation or direct recall
src_slot = previous_active_slot;
} else {
src_slot = active_slot;
}
}
var interp = Math.min( 1, Math.max(0, args[2]));
if (interp == 0.0) {
slots[src_slot].interp = -1;
slots[trg_slot].interp = -1;
is_interpolating = 0;
if (previous_target != active_slot) {
previous_active_slot = active_slot;
} else if (args[0] != 0) {
previous_active_slot = args[0];
} else {
previous_active_slot = previous_target;
}
set_active_slot(src_slot);
} else if (interp == 1.0) {
slots[src_slot].interp = -1;
slots[trg_slot].interp = -1;
is_interpolating = 0;
previous_target = trg_slot;
set_active_slot(trg_slot);
} else {
slots[src_slot].interp = 1 - interp;
slots[trg_slot].interp = interp;
is_interpolating = 1;
active_slot = 0;
}
outlet(0, "recall", src_slot, trg_slot, interp);
}
// else {
// //typeof(args[0]) == 'string', so user just recalled a single parameter.
// }
}
mgraphics.redraw();
}
function recall_filled() {
// Recalling preset by its number in the filled_slots list. Useful when used menu_mode 2
var args = arrayfromargs(arguments);
var index = args[0];
if (index < filled_slots.length) {
to_pattrstorage('recall', filled_slots[args[0]]);
}
}
function recallmulti() {
var args = arrayfromargs(arguments);
var interp_slots = [];
@@ -877,13 +883,13 @@ function recallmulti() {
function store(v) {
v = Math.floor(v);
if (v >= 0) {
if (slots[v].lock > 0) {
if (slots[v] && slots[v].lock > 0) {
error('cannot overwrite locked slot ' + v + '\n');
} else {
var recalc_rows_flag = scrollable && v > slots_highest;
if (color_pattr) {
//Initialize preset color to default for new preset
//Initialize preset color pattr to default for new preset (otherwise, previously set color is used)
color_pattr.message(0);
}
@@ -919,6 +925,7 @@ function lock() {
to_pattrstorage("lock", args[0], args[1]);
to_pattrstorage("getlockedslots");
outlet(0, "lock", args[0], args[1]);
update_filled_slots_dict();
trigger_writeagain();
if (layout == 1) {
paint_base();
@@ -942,9 +949,9 @@ function lockedslots() {
}
function write() {
var args = arrayfromargs(arguments);
if (is_writing) {
is_writing = 0;
var args = arrayfromargs(arguments);
var filename = args[0];
var state = args[1];
if (state) {
@@ -953,7 +960,9 @@ function write() {
error(pattrstorage_name + ': error while writing ' + filename + '\n');
}
} else {
error("Send your write messages directly to the pattrstorage instead.\n");
if (args.length < 2) {
error("Send your write messages directly to the pattrstorage instead.\n");
}
}
}
@@ -966,6 +975,11 @@ function read() {
}
}
// Given that v8ui has a new read method that cannot be overriden, we need to use [substitute read readfile] between [pattrstorage] and [tc.prest]
function readfile(f, s) {
read(f, s);
}
function subscriptionlist() {
var client = arrayfromargs(arguments)[0];
if (is_listening_to_subscriptionlist) {
@@ -1030,7 +1044,6 @@ find_pattrstorage.local = 1;
function to_pattrstorage() {
if (pattrstorage_obj !== null) {
// post('To pattrstorage:', arrayfromargs(arguments), '\n');
pattrstorage_obj.message(arrayfromargs(arguments));
}
}
@@ -1087,25 +1100,55 @@ function update_umenu() {
for (var i=0; i < filled_slots.length; i++) {
var nb = filled_slots[i];
var txt = null;
if (!menu_number_only) {
txt = slots[filled_slots[i]].name;
var txt = slots[filled_slots[i]].name;
switch(menu_mode){
case 0:
outlet(1, "append", nb, txt);
break;
case 1:
outlet(1, "append", nb);
break;
case 2:
outlet(1, "append", txt);
break;
}
outlet(1, "append", nb, txt);
}
if (layout == 1) {
set_umenu(selected_slot);
}
}
}
update_umenu.local = 1;
function update_filled_slots_dict() {
// Creates a coll-compatible dict containing slot id, name, lock, color index and color_custom for all existing presets
// And sends the dict name to a receive.
// Best would be to allow for single slot updates, but for that we need to be able to know which at index of filled_slot is a slot id.
filled_slots_dict.clear();
for (var i = 0; i < filled_slots.length; i++) {
var slot_index = filled_slots[i];
var tmp_color_custom = slots[slot_index].color_custom;
filled_slots_dict.set(slot_index, slots[slot_index].name, slots[slot_index].lock, slots[slot_index].color_index, tmp_color_custom[0], tmp_color_custom[1], tmp_color_custom[2], tmp_color_custom[3]);
}
// Non coll-compatible, but with proper keys:
// filled_slots_dict.set('filled_slots');
// for (var i = 0; i < filled_slots.length; i++) {
// if (i > 0) filled_slots_dict.append('filled_slots', '');
// var tmp_color_custom = slots[filled_slots[i]].color_custom;
// filled_slots_dict.setparse('filled_slots[' + i + ']', 'slot:', filled_slots[i], 'name:', '"' + slots[filled_slots[i]].name + '"', 'lock:', slots[filled_slots[i]].lock, 'color_index:', slots[filled_slots[i]].color_index, 'color_custom:', tmp_color_custom[0], tmp_color_custom[1], tmp_color_custom[2], tmp_color_custom[3]);
// }
var tmp_send_name = send_name == "none" ? pattrstorage_name + '_presets_dict' : send_name;
messnamed(tmp_send_name, 'dictionary', filled_slots_dict.name);
}
update_filled_slots_dict.local = 1;
function set_umenu(v) {
outlet(1, "clearchecks");
var item = filled_slots.indexOf(v);
outlet(1, "checkitem", item);
if (menu_number_only) {
outlet(1, "setsymbol", v);
} else {
outlet(1, "setsymbol", v + ' ' + slots[v].name);
}
outlet(1, "set", item);
}
function trigger_writeagain() {
@@ -1201,13 +1244,10 @@ function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
if (dist_from_start > 10) {
is_dragging = 1;
drag_slot = last_hovered;
paint_base();
}
} else if (is_dragging == 1) {
last_hovered = get_slot_index(x, y);
last_x = x;
last_y = y;
if (!but) {
// When the button is released, the dragging ceases
if (last_hovered > 0 && last_hovered != drag_slot) {
@@ -1216,12 +1256,17 @@ function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
var offset = ((last_hovered <= drag_slot) && slots[last_hovered].name != null) ? 1 : 0;
var offset_others = slots[last_hovered].name != null ? 1 : 0;
var drag_slot_lock = slots[drag_slot].lock;
var recalc_rows_flag = 0
// If the slot we wan to drag is locked, we need to temporarily unlock it.
if (drag_slot_lock) {
lock(drag_slot, 0);
}
// If new slot is empty we just move the drag preset here. If it's not, we move al next slots to the right
if (slots[last_hovered].name !== null) {
if (slots_highest == slots_count_display) {
// If there's a stored preset in the last displayed slot, it will be pushed to a new row at insert, so we need to add a new row at redraw
recalc_rows_flag = 1;
}
to_pattrstorage("insert", last_hovered);
}
@@ -1255,9 +1300,14 @@ function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
outlet(0, "drag", drag_slot, last_hovered, offset);
is_dragging = 0;
drag_slot = -1;
paint_base();
select(last_hovered);
select(last_hovered);
if (recalc_rows_flag) {
calc_rows_columns();
} else {
paint_base();
}
trigger_writeagain();
@@ -1269,8 +1319,24 @@ function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
}
} else {
// Click still hold, we keep dragging
if (scrollable) {
// Auto-scroll if mouse out of bounds
if (y+y_offset < 0 && y-(last_y-drag_scroll) < 0) {
drag_scroll = 2;
} else if (y+y_offset > ui_height && y-(last_y-drag_scroll) > 0) {
drag_scroll = -2;
} else {
drag_scroll = 0;
}
y_offset += drag_scroll;
y_offset = Math.min(y_offset, 0);
y_offset = Math.max(y_offset, -1 * (bg_height - ui_height));
}
mgraphics.redraw();
}
last_x = x;
last_y = y;
}
}
}
@@ -1547,6 +1613,17 @@ function setfontname(v){
}
}
declareattribute("menu_mode", "getmenu_mode", "setmenu_mode", 1);
function getmenu_mode() {
return menu_mode;
}
function setmenu_mode(v){
if (arguments.length == 1) {
menu_mode = Math.min(Math.max(0, parseInt(v)), 2);
update_umenu();
}
}
declareattribute("autowriteagain", "getautowriteagain", "setautowriteagain", 1);
function getautowriteagain() {
return auto_writeagain;
@@ -1757,6 +1834,18 @@ function setcolor6(){
}
}
declareattribute("send_name", "getsendname", "setsendname", 1);
function getsendname() {
return send_name;
}
function setsendname(){
if (arguments.length > 0) {
send_name = arguments[0];
} else {
send_name = "none";
}
}
// UTILITY
function post_keys(obj) {
post('Keys of obj: ', obj, '\n');

File diff suppressed because one or more lines are too long

View File

@@ -400,7 +400,7 @@
"numinlets" : 1,
"filename" : "tc.preset.js",
"numoutlets" : 4,
"embedstate" : [ [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "mypat" ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "layout", 0 ], [ "spacing", 4 ], [ "autowriteagain", 0 ], [ "scrollable", 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "ignoreslotzero", 1 ], [ "slot_round", 0 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "bubblesize", 14 ], [ "min_rows", 50 ], [ "display_interp", 1 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "margin", 4 ], [ "select_mode", 0 ], [ "fontsize", 14 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_mode", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ] ]
"embedstate" : [ [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "fontname", "Arial" ], [ "pattrstorage", "mypat" ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "layout", 0 ], [ "spacing", 4 ], [ "autowriteagain", 0 ], [ "scrollable", 0 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "ignoreslotzero", 1 ], [ "slot_round", 0 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "bubblesize", 14 ], [ "min_rows", 10 ], [ "display_interp", 1 ], [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "margin", 4 ], [ "select_mode", 0 ], [ "fontsize", 14 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "color_mode", 0 ], [ "color_6", 0.316, 0.616, 0.377, 1 ] ]
}
}