Changeset 8744


Ignore:
Timestamp:
03/07/05 19:47:54 (16 years ago)
Author:
piso
Message:

startMacro(), endMacro()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/Macro.java

    r8136 r8744  
    22 * Macro.java
    33 *
    4  * Copyright (C) 1998-2004 Peter Graves
    5  * $Id: Macro.java,v 1.6 2004-11-07 15:37:51 piso Exp $
     4 * Copyright (C) 1998-2005 Peter Graves
     5 * $Id: Macro.java,v 1.7 2005-03-07 19:47:54 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424import java.util.ArrayList;
    2525import javax.swing.undo.CompoundEdit;
    26 import org.armedbear.lisp.Lisp;
    2726import org.armedbear.lisp.LispObject;
    2827import org.armedbear.lisp.LispThread;
     
    4544            macro = new Macro(editor);
    4645            Editor.setRecordingMacro(true);
     46        }
     47    }
     48
     49    public static synchronized void startMacro()
     50    {
     51        if (Editor.isRecordingMacro()) {
     52            MessageDialog.showMessageDialog(
     53                Editor.currentEditor(),
     54                "Command ignored (already recording a macro)",
     55                "Start Macro");
     56        } else {
     57            final Editor editor = Editor.currentEditor();
     58            if (macro != null && !macro.isEmpty()) {
     59                if (!editor.confirm("Start Macro",
     60                                    "Overwrite existing keyboard macro?"))
     61                    return;
     62            }
     63            macro = new Macro(editor);
     64            Editor.setRecordingMacro(true);
     65        }
     66    }
     67
     68    public static synchronized void endMacro()
     69    {
     70        if (Editor.isRecordingMacro()) {
     71            Editor.setRecordingMacro(false);
     72        } else {
     73            MessageDialog.showMessageDialog(
     74                Editor.currentEditor(),
     75                "Command ignored (not recording a macro)",
     76                "End Macro");
    4777        }
    4878    }
     
    84114    public static synchronized void record(Editor editor, Object command)
    85115    {
     116        if (command == "recordMacro" || command == "playbackMacro" ||
     117            command == "startMacro" || command == "endMacro")
     118            return;
    86119        if (macro != null && macro.getEditor() == editor)
    87120            macro.record(command);
Note: See TracChangeset for help on using the changeset viewer.