Search in sources :

Example 6 with Macro

use of com.willwinder.universalgcodesender.types.Macro in project Universal-G-Code-Sender by winder.

the class MacroPanel method update.

/**
 * Updates a macro and saves it in the settings.
 * @param index macro index
 * @param field field to update
 * @param text updated text
 */
private void update(int index, MACRO_FIELD field, String text) {
    Settings s = backend.getSettings();
    Macro macro = s.getMacro(index);
    switch(field) {
        case NAME:
            macro.setName(text);
            break;
        case CODE:
            macro.setGcode(text);
            break;
        case DESCRIPTION:
            macro.setDescription(text);
            break;
    }
    s.updateMacro(index, macro);
}
Also used : Macro(com.willwinder.universalgcodesender.types.Macro) Settings(com.willwinder.universalgcodesender.utils.Settings)

Aggregations

Macro (com.willwinder.universalgcodesender.types.Macro)6 Settings (com.willwinder.universalgcodesender.utils.Settings)3 MigLayout (net.miginfocom.swing.MigLayout)2 ActionRegistrationService (com.willwinder.ugs.nbp.lib.services.ActionRegistrationService)1 BackendAPI (com.willwinder.universalgcodesender.model.BackendAPI)1 ActionEvent (java.awt.event.ActionEvent)1 FileObject (org.openide.filesystems.FileObject)1