Browse Source

Proper launch patcher

main
TFLCL 4 months ago
parent
commit
4792644b03
  1. 27
      code/tc.preset.js
  2. 218
      extras/tc.preset Launch.maxpat
  3. 4
      package-info.json
  4. 0
      patchers/tc.preset_demo.maxpat

27
code/tc.preset.js

@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
*/
autowatch = 1;
autowatch = 0;
// When developping, autowatch = 1 isn't enough. You also need to manually call the loadbang function, and then re-binding the pattrstorage.
// A "loadbang, pattrstorage test" message does the trick.
@ -108,18 +108,6 @@ var drag_slot = -1; // Stores the slot that's being dragged
var has_loaded = false;
// RESIZING
// 64x64 is the default jsui size. We use that to know if the object has just been created,
// in which case we resize it to a more convenient size to start with.
if (ui_width == 64 && ui_height == 64) {
box.setboxattr("patching_rect", box.rect[0], box.rect[1], 130, 58);
}
// Allows for dynamic resizing even in presentation mode (addressing the limitation of onresize())
var pres_rect = new MaxobjListener(this.box,"presentation_rect",get_prect);
function get_prect(prect) {
onresize(prect.value[2], prect.value[3])
}
if (jsarguments.length>1) { // Depreciated, use "pattrstorage" attribute instead of jsarguments.
pattrstorage_name = jsarguments[1];
}
@ -1102,6 +1090,7 @@ function onwheel(x, y, wheel_inc_x, wheel_inc_y, cmd, shift, caps, opt, ctrl)
}
onwheel.local = 1;
// RESIZING
function onresize(w,h)
{
ui_width = w;
@ -1112,6 +1101,18 @@ function onresize(w,h)
}
onresize.local = 1;
// 64x64 is the default jsui size. We use that to know if the object has just been created,
// in which case we resize it to a more convenient size to start with.
if (ui_width == 64 && ui_height == 64) {
box.setboxattr("patching_rect", box.rect[0], box.rect[1], 130, 58);
}
// Allows for dynamic resizing even in presentation mode (addressing the limitation of onresize())
var pres_rect = new MaxobjListener(this.box,"presentation_rect",get_prect);
function get_prect(prect) {
onresize(prect.value[2], prect.value[3])
}
get_prect.local = 1;
// ATTRIBUTES DECLARATION
declareattribute("pattrstorage", "getpattrstorage", "setpattrstorage", 1);
function getpattrstorage() {

218
extras/tc.preset Launch.maxpat

@ -0,0 +1,218 @@
{
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 8,
"minor" : 6,
"revision" : 3,
"architecture" : "x64",
"modernui" : 1
}
,
"classnamespace" : "box",
"rect" : [ 59.0, 119.0, 483.0, 443.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 1,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 1,
"objectsnaponopen" : 1,
"statusbarvisible" : 2,
"toolbarvisible" : 1,
"lefttoolbarpinned" : 0,
"toptoolbarpinned" : 0,
"righttoolbarpinned" : 0,
"bottomtoolbarpinned" : 0,
"toolbars_unpinned_last_save" : 0,
"tallnewobj" : 0,
"boxanimatetime" : 200,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"style" : "",
"subpatcher_template" : "",
"assistshowspatchername" : 0,
"boxes" : [ {
"box" : {
"hidden" : 1,
"id" : "obj-17",
"linecount" : 5,
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 9.0, 354.0, 116.0, 76.0 ],
"text" : ";\rmax launchbrowser https://glucose47.gumroad.com/l/tc_preset"
}
}
, {
"box" : {
"id" : "obj-13",
"linecount" : 3,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 166.5, 373.0, 150.0, 47.0 ],
"presentation_linecount" : 3,
"text" : "GPL 3.0\n© Théophile Clet, 2024\nClick here to support",
"textcolor" : [ 0.0, 0.0, 0.0, 0.5 ],
"textjustification" : 1
}
}
, {
"box" : {
"fontsize" : 16.0,
"id" : "obj-11",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 99.0, 81.0, 285.0, 24.0 ],
"text" : "A jsui replacement for the preset object"
}
}
, {
"box" : {
"embedstate" : [ [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "scrollable", 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "color_mode", 0 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "bubblesize", 14 ], [ "spacing", 4 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "min_rows", 50 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "fontsize", 14 ], [ "display_interp", 1 ], [ "fontname", "Arial" ], [ "select_mode", 0 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "ignoreslotzero", 1 ], [ "margin", 4 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "layout", 1 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "autowriteagain", 0 ] ],
"filename" : "tc.preset",
"id" : "obj-8",
"maxclass" : "jsui",
"numinlets" : 1,
"numoutlets" : 4,
"outlettype" : [ "", "", "", "" ],
"parameter_enable" : 0,
"patching_rect" : [ 254.0, 153.0, 130.0, 58.0 ]
}
}
, {
"box" : {
"hidden" : 1,
"id" : "obj-7",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 9.0, 301.0, 51.0, 22.0 ],
"text" : "pcontrol"
}
}
, {
"box" : {
"hidden" : 1,
"id" : "obj-6",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 9.0, 274.0, 129.0, 22.0 ],
"text" : "load tc.preset.maxhelp"
}
}
, {
"box" : {
"fontsize" : 20.0,
"id" : "obj-4",
"maxclass" : "textbutton",
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "", "", "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 162.0, 282.0, 159.0, 41.0 ],
"text" : "Open helper file"
}
}
, {
"box" : {
"embedstate" : [ [ "color_5", 0.283, 0.606, 0.559, 1 ], [ "color_3", 0.527, 0.459, 0.756, 1 ], [ "scrollable", 1 ], [ "empty_slot_color", 0.349, 0.349, 0.349, 1 ], [ "color_mode", 0 ], [ "active_slot_color", 0.808, 0.898, 0.91, 1 ], [ "stored_slot_color", 0.502, 0.502, 0.502, 1 ], [ "bubblesize", 14 ], [ "spacing", 4 ], [ "color_6", 0.316, 0.616, 0.377, 1 ], [ "min_rows", 50 ], [ "text_color", 0.129, 0.129, 0.129, 1 ], [ "interp_slot_color", 1, 1, 1, 0.8 ], [ "fontsize", 14 ], [ "display_interp", 1 ], [ "fontname", "Arial" ], [ "select_mode", 0 ], [ "color_1", 0.743, 0.41, 0.501, 1 ], [ "bgcolor", 0.2, 0.2, 0.2, 1 ], [ "ignoreslotzero", 1 ], [ "margin", 4 ], [ "text_bg_color", 1, 1, 1, 0.5 ], [ "layout", 0 ], [ "color_2", 0.679, 0.405, 0.669, 1 ], [ "color_4", 0.367, 0.542, 0.712, 1 ], [ "slot_round", 0 ], [ "autowriteagain", 0 ] ],
"filename" : "tc.preset",
"id" : "obj-3",
"maxclass" : "jsui",
"numinlets" : 1,
"numoutlets" : 4,
"outlettype" : [ "", "", "", "" ],
"parameter_enable" : 0,
"patching_rect" : [ 99.0, 153.0, 130.0, 58.0 ]
}
}
, {
"box" : {
"fontface" : 1,
"fontsize" : 48.0,
"id" : "obj-2",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 137.0, 16.0, 209.0, 60.0 ],
"text" : "tc.preset",
"textjustification" : 1
}
}
, {
"box" : {
"bgcolor" : [ 0.2, 0.2, 0.2, 0.0 ],
"fontsize" : 20.0,
"id" : "obj-15",
"maxclass" : "textbutton",
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "", "", "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 166.5, 373.0, 150.0, 47.0 ],
"text" : "Open helper file",
"textoncolor" : [ 0.807843137254902, 0.898039215686275, 0.909803921568627, 0.0 ],
"textovercolor" : [ 0.929411764705882, 0.929411764705882, 0.352941176470588, 0.0 ]
}
}
],
"lines" : [ {
"patchline" : {
"destination" : [ "obj-17", 0 ],
"hidden" : 1,
"source" : [ "obj-15", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-6", 0 ],
"hidden" : 1,
"source" : [ "obj-4", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-7", 0 ],
"hidden" : 1,
"source" : [ "obj-6", 0 ]
}
}
],
"dependency_cache" : [ {
"name" : "tc.preset.js",
"bootpath" : "~/Documents/Max 8/Packages/tc.preset/code",
"patcherrelativepath" : "../../../Max 8/Packages/tc.preset/code",
"type" : "TEXT",
"implicit" : 1
}
],
"autosave" : 0
}
}

4
package-info.json

@ -6,7 +6,7 @@
"authors" : [ ],
"description" : "A jsui replacement for the preset object",
"tags" : ["preset", "pattrstorage", "jsui"],
"website" : "",
"website" : "https://github.com/Teufeuleu/tc.preset/",
"extends" : "",
"extensible" : 0,
"max_version_min" : "8.6.2",
@ -24,5 +24,5 @@
}
,
"homepatcher" : "tc.preset_demo.maxpat"
"homepatcher" : "tc.preset Launch.maxpat"
}

0
extra/tc.preset_demo.maxpat → patchers/tc.preset_demo.maxpat

Loading…
Cancel
Save