Changeset 2427


Ignore:
Timestamp:
03/13/07 10:39:09 (13 years ago)
Author:
melissa
Message:

Improved macro propagation logic.

Location:
trunk/loci/plugins/browser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/browser/CustomWindow.java

    r2425 r2427  
    2929import ij.macro.MacroRunner; 
    3030import ij.measure.Calibration; 
     31import ij.process.*; 
    3132import java.awt.*; 
    3233import java.awt.event.*; 
     
    6465  protected CacheIndicator zIndicator,tIndicator; 
    6566  protected OptionsWindow ow; 
     67  
    6668  private String zString = Z_STRING; 
    6769  private String tString = T_STRING; 
    6870  private int fps = 10; 
    6971  private int z = 1, t = 1, c = 1; 
    70  
     72  
    7173  // -- Fields - widgets -- 
    7274 
     
    342344 
    343345    if (db.manager != null) { 
    344       imp.setProcessor(patternTitle, db.manager.getSlice(index - 1)); 
    345       // now execute macros as needed  
    346   
     346      index--; 
     347      ImageProcessor clone = db.manager.getSlice(index).duplicate(); 
     348      imp.setProcessor(patternTitle, clone); 
     349      // now execute macros as needed 
     350 
    347351      Vector macros = db.macro.getMacros(); 
    348352      for (int i=0; i<macros.size(); i++) { 
    349353        MacroRunner runner = new MacroRunner((String) macros.get(i)); 
    350354      } 
     355       
    351356      index = 1; 
    352357      return; 
     
    366371   
    367372    // now execute macros as needed  
    368   
     373 
    369374    Vector macros = db.macro.getMacros(); 
    370375    for (int i=0; i<macros.size(); i++) { 
    371376      MacroRunner runner = new MacroRunner((String) macros.get(i)); 
    372377    } 
     378     
    373379    repaint(); 
    374380  } 
     
    408414 
    409415      int nSlices = db.numZ * db.numT * db.numC; 
    410       int currentSlice = imp.getCurrentSlice(); 
     416      int current = imp.getCurrentSlice(); 
    411417      if (db.manager != null) { 
    412         currentSlice = db.manager.getSlice(); 
    413         currentSlice++; 
     418        current = db.manager.getSlice(); 
     419        current++; 
    414420      } 
    415421 
    416422      StringBuffer sb = new StringBuffer(); 
    417       sb.append(currentSlice); 
     423      sb.append(current); 
    418424      sb.append("/"); 
    419425      sb.append(nSlices); 
     
    436442      } 
    437443      if (db.names != null) { 
    438         String name = db.names[currentSlice - 1]; 
     444        String name = db.names[current - 1]; 
    439445        if (name != null) { 
    440446          sb.append(name); 
  • trunk/loci/plugins/browser/MacroManager.java

    r2425 r2427  
    4242  private String previousText; 
    4343 
     44  /** Macro recorder. */ 
     45  private Recorder r; 
     46 
    4447  // -- Constructor -- 
    4548 
    4649  public MacroManager() { 
    4750    macros = new Vector(); 
    48    
    49     Recorder r = new Recorder(); 
    50     r.hide(); 
     51    r = new Recorder(); 
    5152 
    5253    Component[] components = r.getComponents(); 
     
    5455      if (components[i] instanceof TextArea) { 
    5556        textBox = (TextArea) components[i]; 
     57        break;  
    5658      } 
    5759    } 
     60    r.setVisible(false); 
    5861  } 
    5962 
     
    6770        for (int i=0; i<macros.size(); i++) st.nextToken(); 
    6871        while (st.hasMoreTokens()) { 
    69           macros.add(st.nextToken()); 
     72          String macro = st.nextToken();  
     73          if (macro.equals("run(\"Undo\")")) { 
     74            macros.removeElementAt(macros.size() - 1); 
     75          } 
     76          else macros.add(macro); 
    7077        } 
    7178        previousText = cmds;  
Note: See TracChangeset for help on using the changeset viewer.