PresetButtonView - ReadMe Presetting GUI Utility PresetButtonView store / set NamePresetButtonView store and name preset / set PresetSaveButtonView save to file NamePresetSaveButtonView save to named file PresetLoadButtonView load from file / set NamePresetLoadButtonView load from file with GetFileDialog / set PresetLoadSetButtonView load from file and set at once NamePresetLoadSetButtonView load from file with GetFileDialog and set at once RandSetButtonView set with random values SuperPresetSaveButtonView save a superpreset SuperPresetLoadButtonView load a superpreset and restore PresetButtonViewArray just an array PresetButtonViewBox the ultimate thing The PresetButtonViews are supposed to make presetting of GuiWindows possible in a convinient way. Located in a GuiWindow with controlViews around it, the PBVs can store preset information of them and set them at a later time. You can save presets to file with the PSaveBV and load from file with PLoadBV. You can have multiple PBVs in one Gui and 'play' with different settings, or simply have one to get started with the right settings. Like this you might run your patch and at any time, save a preset to file. Presetting basicly makes sence only for sliders, checkboxes, numericals, radiobuttons and RangeButtons. As the last one carries 2 values to be set, i throught it out of the presetting list. i hardly use it anyway. you may have to use two sliders instead. The slightly modified View.sc you have to use with PBVs uses a different 'keydown' method. The GlobalKeydown.action is called before the action defined for the certain View. Like this you can have any one action assigned to all views in a GUI. i stole this idea from crucial who uses it in his basic tools. Now how does it work?: To store or save the preset information, one View after the other in the Gui is checked if it is a presetable View. If this is the case, the next one is checked. The values of Views that are presetable are stored in the class variable 'sets'. To set the Views, all the Views are checked in the same way as above and get set with values from 'sets'. To keep certain Views from beeing set you have different options. NPViews are simply copies of SliderView, CheckboxView, RadioButtonView and NumericalView but responding to a noSet method, which keeps them from beeing set. NRViews are copies that dont get set from a RandSetButtonView. You can simply prefix a View in your GUI (e.g. SliderView.new(...) --> NPSliderView.new(...)) . And any PresetButton will ignore it. Same with the NRView, keeping Views only from beeing randomly preset from a RandSetBV. You can imagine that there is confusion if one preset is used for a Gui with a different number or order of Views. So be shure to keep track of your preset files. Handling: As PBVs are all child classes of ButtonView, you can simply drop them in your Gui in the Edit mode. Installing: To get to use the PresetButtonViews, you have to put the ButtonClasses folder in the DefaultLibrary folder in your scfolder. Be shure there are no other modified versions of View.sc in DefaultLibrary. Path: The 'load'- and 'save'-classes expect to find preset_ files in the scfolder. If you feel like you may create a Preset folder in your sc-folder and change the path in the classes like this: file = File("preset_" ++ preName,"r"); --> file = File(":Presets:preset_" ++ preName,"r"); // in PLoadBV.sc file = File("preset_" ++ preName,"w"); --> file = File(":Presets:preset_" ++ preName,"w"); // in PSaveBV.sc and PNSaveBV.sc The classes: PresetButtonView On "Store" the presets are stored and label changes to "Set". On "Set" the Views are set. To store again: focus the button (tab/shift-tab) and type "r" NamePresetButtonView On "Store" a GetStringDialog lets you specify a "name" for the preset; the presets are stored and label changes to given "name". On "name" the Views are set. To store again: focus the button (tab/shift-tab) and type "r" PresetSaveButtonView On "Save" the presets are saved to file and label changes to "*Save*". The name for the preset_file is "preset_" with a suffix that can be specified with a set method: PresetSaveButtonView.new( w, Rect.newBy(33, 97, 128, 20), "Save", 0, 0, 1, 0, 'linear').preName_("test"); Default is "", which means no suffix at all. On "*Save*" the former preset file gets overwritten. NamePresetSaveButtonView On "N-Save" a GetStringDialog lets you specify the preName suffix by hand; the presets are saved to file and label changes to "*N-Save*". The name for the preset_file is "preset_" with the given suffix. a former specified preName (see PSaveBV) comes as default string in the Dialog. On "*N-Save*" a new name can be specified. presets with the same name get overwritten. PresetLoadButtonView On "Load" the presets are loaded from file and label changes to "Set". The name for the preset_file is "preset_" with a suffix that can be specified with a set method: PresetLoadButtonView.new( w, Rect.newBy(33, 97, 128, 20), "Save", 0, 0, 1, 0, 'linear').preName_("test"); Default is "", which means no suffix at all: the preset file "preset_" is loaded. On "Set" the Views are set. To load again: focus the button (tab/shift-tab) and type "r" NamePresetLoadButtonView On "N-Load" a GetFileDialog lets you choose a preset_file; the presets are loaded from file and label changes to "Set". On "Set" the Views are set. To load again: focus the button (tab/shift-tab) and type "r" PresetLoadSetButtonView On "Load&Set" the presets are loaded from file and Views get set at once. The name for the preset_file is "preset_" with a suffix that can be specified with a set method: PresetLoadButtonView.new( w, Rect.newBy(33, 97, 128, 20), "Save", 0, 0, 1, 0, 'linear').preName_("test"); Default is "", which means no suffix at all: the preset file "preset_" is loaded. NamePresetLoadSetButtonView On "Load&Set" a GetFileDialog lets you choose a preset_file; the presets are loaded from file and Views get set at once. RandSetButtonView On "Panik" all presetable Views get set with random values. NPViews are not set. Further more you can keep Views from beeing randset by using NRViews. SuperPresetSaveButtonView Saves the presets of all PresetButtonViews in a superpreset_ file SuperPresetLoadButtonView Loads from a superpreset_ file and restores all PresetButtonViews PresetButtonViewArray Just an array of PresetButtonViews PresetButtonViewBox A combination of an array of PresetButtonViews and a set of SuperPresetButtons. That's what you really want to use in your GUI. // sc.solar 6.11.02