menu_mode and recall_filled
This commit is contained in:
		@@ -78,6 +78,11 @@
 | 
				
			|||||||
				If the word `pattrstorage`is sent alone, the jsui is unlinked from any pattrstorage.
 | 
									If the word `pattrstorage`is sent alone, the jsui is unlinked from any pattrstorage.
 | 
				
			||||||
			</description>
 | 
								</description>
 | 
				
			||||||
		</method>
 | 
							</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">
 | 
							<method name="resync">
 | 
				
			||||||
			<digest>Resync the jsui to the pattrstorage</digest>
 | 
								<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.
 | 
								<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.
 | 
				
			||||||
@@ -174,6 +179,10 @@
 | 
				
			|||||||
			<digest>Object margin</digest>
 | 
								<digest>Object margin</digest>
 | 
				
			||||||
			<description>Defines the size, in pixels, of the margin between the jsui border and the preset slots.</description>
 | 
								<description>Defines the size, in pixels, of the margin between the jsui border and the preset slots.</description>
 | 
				
			||||||
		</attribute>
 | 
							</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' >
 | 
							<attribute name='min_rows' get='1' set='1'  type='int' size='1' >
 | 
				
			||||||
			<digest>Minimum number of rows to display</digest>
 | 
								<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.
 | 
								<description>Defines the minimum number of rows to display if scrollable is enabled and layout is set to 1.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@ 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 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 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 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 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 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 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 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
 | 
				
			||||||
@@ -842,6 +842,15 @@ function recall() {
 | 
				
			|||||||
	mgraphics.redraw();
 | 
						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() {
 | 
					function recallmulti() {
 | 
				
			||||||
    var args = arrayfromargs(arguments);
 | 
					    var args = arrayfromargs(arguments);
 | 
				
			||||||
    var interp_slots = [];
 | 
					    var interp_slots = [];
 | 
				
			||||||
@@ -1091,11 +1100,18 @@ function update_umenu() {
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        for (var i=0; i < filled_slots.length; i++) {
 | 
					        for (var i=0; i < filled_slots.length; i++) {
 | 
				
			||||||
            var nb = filled_slots[i];
 | 
					            var nb = filled_slots[i];
 | 
				
			||||||
            var txt = null;
 | 
					            var txt = slots[filled_slots[i]].name;
 | 
				
			||||||
            if (!menu_number_only) {
 | 
					            switch(menu_mode){
 | 
				
			||||||
                txt = slots[filled_slots[i]].name;
 | 
					                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) {
 | 
					        if (layout == 1) {
 | 
				
			||||||
@@ -1597,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);
 | 
					declareattribute("autowriteagain", "getautowriteagain", "setautowriteagain", 1);
 | 
				
			||||||
function getautowriteagain() {
 | 
					function getautowriteagain() {
 | 
				
			||||||
	return auto_writeagain;
 | 
						return auto_writeagain;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user