Changeset 3077 for trunk


Ignore:
Timestamp:
08/10/07 15:33:37 (13 years ago)
Author:
curtis
Message:

Reorganize display controls to be tabbed instead of sprawling.
This will pave the way for more, better use of tabs later.

Location:
trunk/loci/visbio/view
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/view/CaptureHandler.java

    r3070 r3077  
    8787  /** Gets positions on the list. */ 
    8888  public Vector getPositions() { 
    89     return panel == null ? positions : panel.getCaptureWindow().getPositions(); 
     89    return panel == null ? positions : panel.getPositions(); 
    9090  } 
    9191 
    9292  /** Gets movie speed. */ 
    9393  public int getSpeed() { 
    94     return panel == null ? movieSpeed : panel.getCaptureWindow().getSpeed(); 
     94    return panel == null ? movieSpeed : panel.getSpeed(); 
    9595  } 
    9696 
    9797  /** Gets movie frames per second. */ 
    9898  public int getFPS() { 
    99     return panel == null ? movieFPS : panel.getCaptureWindow().getFPS(); 
     99    return panel == null ? movieFPS : panel.getFPS(); 
    100100  } 
    101101 
    102102  /** Gets whether transitions use a smoothing sine function. */ 
    103103  public boolean isSmooth() { 
    104     return panel == null ? movieSmooth : panel.getCaptureWindow().isSmooth(); 
     104    return panel == null ? movieSmooth : panel.isSmooth(); 
    105105  } 
    106106 
     
    116116  /** Saves a snapshot of the display to a file specified by the user. */ 
    117117  public void saveSnapshot() { 
    118     CaptureWindow captureWindow = panel.getCaptureWindow(); 
    119     int rval = imageBox.showSaveDialog(captureWindow); 
     118    int rval = imageBox.showSaveDialog(window); 
    120119    if (rval != JFileChooser.APPROVE_OPTION) return; 
    121120 
     
    142141    } 
    143142    if (!tiff && !jpeg) { 
    144       JOptionPane.showMessageDialog(captureWindow, "Invalid filename (" + 
     143      JOptionPane.showMessageDialog(window, "Invalid filename (" + 
    145144        file + "): extension must indicate TIFF or JPEG format.", 
    146145        "Cannot export snapshot", JOptionPane.ERROR_MESSAGE); 
     
    179178    int framesPerSec, boolean sine, boolean movie) 
    180179  { 
    181     CaptureWindow captureWindow = panel.getCaptureWindow(); 
    182180    final int size = matrices.size(); 
    183181    if (size < 1) { 
    184       JOptionPane.showMessageDialog(captureWindow, "Must have at least " + 
     182      JOptionPane.showMessageDialog(window, "Must have at least " + 
    185183        "two display positions on the list.", "Cannot record movie", 
    186184        JOptionPane.ERROR_MESSAGE); 
     
    190188    final DisplayImpl d = window.getDisplay(); 
    191189    if (d == null) { 
    192       JOptionPane.showMessageDialog(captureWindow, "Display not found.", 
     190      JOptionPane.showMessageDialog(window, "Display not found.", 
    193191        "Cannot record movie", JOptionPane.ERROR_MESSAGE); 
    194192      return; 
     
    204202    boolean tiff = false, jpeg = false; 
    205203    if (movie) { 
    206       int rval = movieBox.showSaveDialog(captureWindow); 
     204      int rval = movieBox.showSaveDialog(window); 
    207205      if (rval != JFileChooser.APPROVE_OPTION) return; 
    208206      name = movieBox.getSelectedFile().getPath(); 
     
    210208    } 
    211209    else { 
    212       int rval = imageBox.showSaveDialog(captureWindow); 
     210      int rval = imageBox.showSaveDialog(window); 
    213211      if (rval != JFileChooser.APPROVE_OPTION) return; 
    214212      name = imageBox.getSelectedFile().getPath(); 
     
    346344 
    347345    // set capture window state to match 
    348     CaptureWindow captureWindow = panel.getCaptureWindow(); 
    349     captureWindow.setPositions(positions); 
    350     captureWindow.setSpeed(movieSpeed); 
    351     captureWindow.setFPS(movieFPS); 
    352     captureWindow.setSmooth(movieSmooth); 
     346    panel.setPositions(positions); 
     347    panel.setSpeed(movieSpeed); 
     348    panel.setFPS(movieFPS); 
     349    panel.setSmooth(movieSmooth); 
    353350  } 
    354351 
     
    357354  /** Writes the current state to the given DOM element ("Display"). */ 
    358355  public void saveState(Element el) throws SaveException { 
    359     CaptureWindow captureWindow = panel.getCaptureWindow(); 
    360     Vector pos = captureWindow.getPositions(); 
    361     int speed = captureWindow.getSpeed(); 
    362     int fps = captureWindow.getFPS(); 
    363     boolean smooth = captureWindow.isSmooth(); 
     356    Vector pos = panel.getPositions(); 
     357    int speed = panel.getSpeed(); 
     358    int fps = panel.getFPS(); 
     359    boolean smooth = panel.isSmooth(); 
    364360 
    365361    // save display positions 
     
    430426    Util.invoke(false, new Runnable() { 
    431427      public void run() { 
    432         CaptureWindow window = panel.getCaptureWindow(); 
    433         window.setProgressValue(value); 
    434         if (msg != null) window.setProgressMessage(msg); 
     428        panel.setProgressValue(value); 
     429        if (msg != null) panel.setProgressMessage(msg); 
    435430      } 
    436431    }); 
  • trunk/loci/visbio/view/CapturePanel.java

    r3070 r3077  
    2424package loci.visbio.view; 
    2525 
     26import com.jgoodies.forms.builder.ButtonStackBuilder; 
     27import com.jgoodies.forms.builder.PanelBuilder; 
     28import com.jgoodies.forms.layout.CellConstraints; 
     29import com.jgoodies.forms.layout.FormLayout; 
    2630import java.awt.BorderLayout; 
    27 import java.awt.event.ActionEvent; 
    28 import java.awt.event.ActionListener; 
    29 import javax.swing.JButton; 
    30 import javax.swing.JPanel; 
    31 import loci.visbio.WindowManager; 
    32 import loci.visbio.util.LAFUtil; 
     31import java.awt.event.*; 
     32import java.rmi.RemoteException; 
     33import java.util.Hashtable; 
     34import java.util.Vector; 
     35import javax.swing.*; 
     36import javax.swing.event.*; 
     37import loci.visbio.VisBioFrame; 
     38import loci.visbio.util.*; 
     39import visad.*; 
    3340 
    3441/** 
     
    3946 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/loci/visbio/view/CapturePanel.java">SVN</a></dd></dl> 
    4047 */ 
    41 public class CapturePanel extends JPanel implements ActionListener { 
     48public class CapturePanel extends JPanel implements ActionListener, 
     49  ChangeListener, ItemListener, ListSelectionListener 
     50{ 
    4251 
    4352  // -- Fields -- 
    4453 
    45   /** Capture handler upon which GUI controls operate. */ 
     54  /** Capture handler for this capture window. */ 
    4655  protected CaptureHandler handler; 
    4756 
    48   /** Capture window. */ 
    49   protected CaptureWindow captureWindow; 
     57  /** Position list. */ 
     58  protected JList posList; 
     59 
     60  /** Position list model. */ 
     61  protected DefaultListModel posListModel; 
     62 
     63  /** Button for removing selected position. */ 
     64  protected JButton remove; 
     65 
     66  /** Button for moving selected position upward. */ 
     67  protected JButton moveUp; 
     68 
     69  /** Button for moving selected position downward. */ 
     70  protected JButton moveDown; 
     71 
     72  /** Slider for adjusting movie speed. */ 
     73  protected JSlider speed; 
     74 
     75  /** Output movie frames per second. */ 
     76  protected JSpinner fps; 
     77 
     78  /** Check box for animation smoothness. */ 
     79  protected JCheckBox smooth; 
     80 
     81  /** Progress bar for movie capture operation. */ 
     82  protected JProgressBar progress; 
    5083 
    5184  // -- Constructor -- 
    5285 
    53   /** Creates a panel containing capture handler GUI controls. */ 
     86  /** Constructs a window for capturing display screenshots and movies. */ 
    5487  public CapturePanel(CaptureHandler h) { 
    5588    super(); 
    5689    handler = h; 
    57     captureWindow = new CaptureWindow(handler); 
    58     WindowManager wm = (WindowManager) 
    59       h.getWindow().getVisBio().getManager(WindowManager.class); 
    60     wm.addWindow(captureWindow); 
    61  
    62     // capture button 
    63     JButton capture = new JButton("Capture"); 
    64     if (!LAFUtil.isMacLookAndFeel()) capture.setMnemonic('p'); 
    65     capture.setToolTipText("Creates display screenshots or movies"); 
    66     capture.addActionListener(this); 
     90 
     91    // positions list 
     92    posListModel = new DefaultListModel(); 
     93    posList = new JList(posListModel); 
     94    posList.setFixedCellWidth(120); 
     95    posList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 
     96    posList.addListSelectionListener(this); 
     97    posList.setToolTipText("List of captured display positions"); 
     98 
     99    // add button 
     100    JButton add = new JButton("Add"); 
     101    add.setActionCommand("Add"); 
     102    add.addActionListener(this); 
     103    if (!LAFUtil.isMacLookAndFeel()) add.setMnemonic('a'); 
     104    add.setToolTipText("Adds the current display position to the list"); 
     105 
     106    // remove button 
     107    remove = new JButton("Remove"); 
     108    remove.setActionCommand("Remove"); 
     109    remove.addActionListener(this); 
     110    if (!LAFUtil.isMacLookAndFeel()) remove.setMnemonic('r'); 
     111    remove.setToolTipText("Removes the selected position from the list"); 
     112    remove.setEnabled(false); 
     113 
     114    // up button 
     115    moveUp = new JButton("Up"); 
     116    moveUp.setActionCommand("Up"); 
     117    moveUp.addActionListener(this); 
     118    if (!LAFUtil.isMacLookAndFeel()) moveUp.setMnemonic('u'); 
     119    moveUp.setToolTipText("Moves the selected position up in the list"); 
     120    moveUp.setEnabled(false); 
     121 
     122    // down button 
     123    moveDown = new JButton("Down"); 
     124    moveDown.setActionCommand("Down"); 
     125    moveDown.addActionListener(this); 
     126    if (!LAFUtil.isMacLookAndFeel()) moveDown.setMnemonic('d'); 
     127    moveDown.setToolTipText("Moves the selected position down in the list"); 
     128    moveDown.setEnabled(false); 
     129 
     130    // snapshot button 
     131    JButton snapshot = new JButton("Snapshot"); 
     132    snapshot.setActionCommand("Snapshot"); 
     133    snapshot.addActionListener(this); 
     134    if (!LAFUtil.isMacLookAndFeel()) snapshot.setMnemonic('n'); 
     135    snapshot.setToolTipText("Saves display snapshot to an image file"); 
     136 
     137    // send to ImageJ button 
     138    JButton sendToImageJ = new JButton("Send to ImageJ"); 
     139    sendToImageJ.setActionCommand("SendImageJ"); 
     140    sendToImageJ.addActionListener(this); 
     141    if (!LAFUtil.isMacLookAndFeel()) sendToImageJ.setMnemonic('j'); 
     142    sendToImageJ.setToolTipText("Sends display snapshot to ImageJ program"); 
     143 
     144    // speed slider 
     145    speed = new JSlider(0, 16, 8); 
     146    speed.setAlignmentY(JSlider.TOP_ALIGNMENT); 
     147    speed.setMajorTickSpacing(4); 
     148    speed.setMinorTickSpacing(1); 
     149    Hashtable speedHash = new Hashtable(); 
     150    speedHash.put(new Integer(0), new JLabel("4 (slow)")); 
     151    speedHash.put(new Integer(4), new JLabel("2")); 
     152    speedHash.put(new Integer(8), new JLabel("1")); 
     153    speedHash.put(new Integer(12), new JLabel("1/2")); 
     154    speedHash.put(new Integer(16), new JLabel("1/4 (fast)")); 
     155    speed.setLabelTable(speedHash); 
     156    speed.setSnapToTicks(true); 
     157    speed.setPaintTicks(true); 
     158    speed.setPaintLabels(true); 
     159    speed.addChangeListener(this); 
     160    speed.setToolTipText("Adjusts seconds per transition"); 
     161 
     162    // frames per second spinner 
     163    fps = new JSpinner(new SpinnerNumberModel(10, 1, 600, 1)); 
     164    fps.addChangeListener(this); 
     165    fps.setToolTipText("Adjusts output movie's frames per second"); 
     166 
     167    // smoothness checkbox 
     168    smooth = new JCheckBox( 
     169      "Emphasize transition at each display position", true); 
     170    smooth.addItemListener(this); 
     171    if (!LAFUtil.isMacLookAndFeel()) smooth.setMnemonic('e'); 
     172    smooth.setToolTipText("Use smooth sine function transitions"); 
     173 
     174    // record button 
     175    JButton record = new JButton("Record >"); 
     176    record.setActionCommand("Record"); 
     177    record.addActionListener(this); 
     178    if (!LAFUtil.isMacLookAndFeel()) record.setMnemonic('r'); 
     179    record.setToolTipText( 
     180      "Records a movie of transitions between display positions"); 
     181 
     182    // progress bar 
     183    progress = new JProgressBar(0, 100); 
     184    progress.setString(""); 
     185    progress.setStringPainted(true); 
     186    progress.setToolTipText("Displays movie recording progress"); 
     187 
     188    // lay out buttons 
     189    ButtonStackBuilder bsb = new ButtonStackBuilder(); 
     190    bsb.addGridded(add); 
     191    bsb.addRelatedGap(); 
     192    bsb.addGridded(remove); 
     193    bsb.addUnrelatedGap(); 
     194    bsb.addGridded(moveUp); 
     195    bsb.addRelatedGap(); 
     196    bsb.addGridded(moveDown); 
     197    JPanel buttons = bsb.getPanel(); 
     198 
     199    // lay out position list 
     200    PanelBuilder positionList = new PanelBuilder(new FormLayout( 
     201      "default:grow, 3dlu, pref", "fill:pref:grow")); 
     202    CellConstraints cc = new CellConstraints(); 
     203    JScrollPane posScroll = new JScrollPane(posList); 
     204    SwingUtil.configureScrollPane(posScroll); 
     205    positionList.add(posScroll, cc.xy(1, 1)); 
     206    positionList.add(buttons, cc.xy(3, 1)); 
     207 
     208    // lay out transition speed slider 
     209    PanelBuilder transitionSpeed = new PanelBuilder(new FormLayout( 
     210      "pref, 3dlu, pref, 3dlu, pref:grow, 3dlu, pref", "pref")); 
     211    JLabel speedLabel = 
     212      transitionSpeed.addLabel("&Seconds per transition", cc.xy(1, 1)); 
     213    speedLabel.setLabelFor(speed); 
     214    transitionSpeed.add(speed, cc.xy(5, 1)); 
     215 
     216    // lay out movie recording button and progress bar 
     217    PanelBuilder movieRecord = new PanelBuilder(new FormLayout( 
     218      "pref, 3dlu, pref:grow", "pref")); 
     219    movieRecord.add(record, cc.xy(1, 1)); 
     220    movieRecord.add(progress, cc.xy(3, 1)); 
    67221 
    68222    // lay out components 
     223    JPanel pane = FormsUtil.makeColumn(new Object[] { 
     224      "Display positions", positionList.getPanel(), 
     225      "Screenshots", FormsUtil.makeRow(snapshot, sendToImageJ), 
     226      "Movies", FormsUtil.makeRow("&Frames per second", fps), 
     227      transitionSpeed.getPanel(), smooth, movieRecord.getPanel()}, 
     228      "pref:grow", false); 
    69229    setLayout(new BorderLayout()); 
    70     add(capture); 
     230    add(pane); 
    71231  } 
    72232 
    73233  // -- CapturePanel API methods -- 
    74234 
    75   /** Displays the capture window pane onscreen. */ 
    76   public void showCaptureWindow() { 
    77     WindowManager wm = (WindowManager) 
    78       handler.getWindow().getVisBio().getManager(WindowManager.class); 
    79     wm.showWindow(captureWindow); 
    80   } 
    81  
    82   /** Gets the capture pane. */ 
    83   public CaptureWindow getCaptureWindow() { return captureWindow; } 
     235  /** Sets the progress bar's value. */ 
     236  public void setProgressValue(int value) { progress.setValue(value); } 
     237 
     238  /** Sets the progress bar's message. */ 
     239  public void setProgressMessage(String msg) { progress.setString(msg); } 
     240 
     241  /** Sets positions on the list. */ 
     242  public void setPositions(Vector v) { 
     243    posListModel.removeAllElements(); 
     244    if (v == null) return; 
     245    int size = v.size(); 
     246    for (int i=0; i<size; i++) posListModel.addElement(v.elementAt(i)); 
     247  } 
     248 
     249  /** Sets movie speed. */ 
     250  public void setSpeed(int speed) { 
     251    if (speed != getSpeed()) this.speed.setValue(speed); 
     252  } 
     253 
     254  /** Sets movie frames per second. */ 
     255  public void setFPS(int fps) { 
     256    if (fps != getFPS()) { 
     257      SpinnerNumberModel fpsModel = (SpinnerNumberModel) this.fps.getModel(); 
     258      fpsModel.setValue(new Integer(fps)); 
     259    } 
     260  } 
     261 
     262  /** Sets whether transitions use a smoothing sine function. */ 
     263  public void setSmooth(boolean smooth) { 
     264    if (smooth != isSmooth()) this.smooth.setSelected(smooth); 
     265  } 
     266 
     267  /** Gets positions on the list. */ 
     268  public Vector getPositions() { 
     269    int size = posListModel.size(); 
     270    Vector v = new Vector(size); 
     271    for (int i=0; i<size; i++) v.add(posListModel.elementAt(i)); 
     272    return v; 
     273  } 
     274 
     275  /** Gets movie speed. */ 
     276  public int getSpeed() { return speed.getValue(); } 
     277 
     278  /** Gets movie frames per second. */ 
     279  public int getFPS() { return ((Integer) fps.getValue()).intValue(); } 
     280 
     281  /** Gets whether transitions use a smoothing sine function. */ 
     282  public boolean isSmooth() { return smooth.isSelected(); } 
    84283 
    85284  // -- ActionListener API methods -- 
    86285 
    87   /** Handles button presses and combo box selections. */ 
    88   public void actionPerformed(ActionEvent e) { showCaptureWindow(); } 
     286  /** Called when a button is pressed. */ 
     287  public void actionPerformed(ActionEvent e) { 
     288    DisplayWindow display = handler.getWindow(); 
     289    VisBioFrame bio = display.getVisBio(); 
     290 
     291    String cmd = e.getActionCommand(); 
     292    if (cmd.equals("Add")) { 
     293      DisplayImpl d = display.getDisplay(); 
     294      if (d == null) return; 
     295      ProjectionControl pc = d.getProjectionControl(); 
     296      double[] matrix = pc.getMatrix(); 
     297      String nextPos = "position" + (posListModel.getSize() + 1); 
     298      String value = (String) JOptionPane.showInputDialog(this, 
     299        "Position name:", "Add display position", 
     300        JOptionPane.INFORMATION_MESSAGE, null, null, nextPos); 
     301      if (value == null) return; 
     302      posListModel.addElement(new DisplayPosition(value, matrix)); 
     303      bio.generateEvent(bio.getManager(DisplayManager.class), 
     304        "position addition for " + display.getName(), true); 
     305    } 
     306    else if (cmd.equals("Remove")) { 
     307      int ndx = posList.getSelectedIndex(); 
     308      if (ndx >= 0) { 
     309        posListModel.removeElementAt(ndx); 
     310        if (posListModel.size() > ndx) posList.setSelectedIndex(ndx); 
     311        else if (ndx > 0) posList.setSelectedIndex(ndx - 1); 
     312      } 
     313      bio.generateEvent(bio.getManager(DisplayManager.class), 
     314        "position removal for " + display.getName(), true); 
     315    } 
     316    else if (cmd.equals("Up")) { 
     317      int ndx = posList.getSelectedIndex(); 
     318      if (ndx >= 1) { 
     319        Object o = posListModel.getElementAt(ndx); 
     320        posListModel.removeElementAt(ndx); 
     321        posListModel.insertElementAt(o, ndx - 1); 
     322        posList.setSelectedIndex(ndx - 1); 
     323      } 
     324      bio.generateEvent(bio.getManager(DisplayManager.class), 
     325        "position list modification for " + display.getName(), true); 
     326    } 
     327    else if (cmd.equals("Down")) { 
     328      int ndx = posList.getSelectedIndex(); 
     329      if (ndx >= 0 && ndx < posListModel.size() - 1) { 
     330        Object o = posListModel.getElementAt(ndx); 
     331        posListModel.removeElementAt(ndx); 
     332        posListModel.insertElementAt(o, ndx + 1); 
     333        posList.setSelectedIndex(ndx + 1); 
     334      } 
     335      bio.generateEvent(bio.getManager(DisplayManager.class), 
     336        "position list modification for " + display.getName(), true); 
     337    } 
     338    else if (cmd.equals("Snapshot")) handler.saveSnapshot(); 
     339    else if (cmd.equals("SendImageJ")) handler.sendToImageJ(); 
     340    else if (cmd.equals("Record")) { 
     341      // build popup menu 
     342      JPopupMenu menu = new JPopupMenu(); 
     343 
     344      JMenuItem aviMovie = new JMenuItem("AVI movie..."); 
     345      aviMovie.setMnemonic('m'); 
     346      aviMovie.setActionCommand("AviMovie"); 
     347      aviMovie.addActionListener(this); 
     348      menu.add(aviMovie); 
     349 
     350      JMenuItem imageSequence = new JMenuItem("Image sequence..."); 
     351      imageSequence.setMnemonic('s'); 
     352      imageSequence.setActionCommand("ImageSequence"); 
     353      imageSequence.addActionListener(this); 
     354      menu.add(imageSequence); 
     355 
     356      // show popup menu 
     357      JButton source = (JButton) e.getSource(); 
     358      menu.show(source, source.getWidth(), 0); 
     359    } 
     360    else if (cmd.equals("AviMovie") || cmd.equals("ImageSequence")) { 
     361      int size = posListModel.size(); 
     362      Vector matrices = new Vector(size); 
     363      for (int i=0; i<size; i++) { 
     364        DisplayPosition pos = (DisplayPosition) posListModel.elementAt(i); 
     365        matrices.add(pos.getMatrix()); 
     366      } 
     367      double secPerTrans = Math.pow(2, 2 - speed.getValue() / 4.0); 
     368      int framesPerSec = getFPS(); 
     369      boolean sine = smooth.isSelected(); 
     370      boolean movie = cmd.equals("AviMovie"); 
     371      handler.captureMovie(matrices, secPerTrans, framesPerSec, sine, movie); 
     372    } 
     373  } 
     374 
     375  // -- ChangeListener API methods -- 
     376 
     377  /** Called when slider or spinner is adjusted. */ 
     378  public void stateChanged(ChangeEvent e) { 
     379    DisplayWindow display = handler.getWindow(); 
     380    VisBioFrame bio = display.getVisBio(); 
     381 
     382    Object src = e.getSource(); 
     383    if (src == speed) { 
     384      if (!speed.getValueIsAdjusting()) { 
     385        bio.generateEvent(bio.getManager(DisplayManager.class), 
     386          "transition speed adjustment for " + display.getName(), true); 
     387      } 
     388    } 
     389    else if (src == fps) { 
     390      bio.generateEvent(bio.getManager(DisplayManager.class), 
     391        "capture FPS adjustment for " + display.getName(), true); 
     392    } 
     393  } 
     394 
     395  // -- ItemListener API methods -- 
     396 
     397  /** Called when check box is toggled. */ 
     398  public void itemStateChanged(ItemEvent e) { 
     399    DisplayWindow display = handler.getWindow(); 
     400    VisBioFrame bio = display.getVisBio(); 
     401    bio.generateEvent(bio.getManager(DisplayManager.class), 
     402      (smooth.isSelected() ? "en" : "dis") + 
     403      "able transition emphasis for " + display.getName(), true); 
     404  } 
     405 
     406  // -- ListSelectionListener API methods -- 
     407 
     408  /** Called when the a new display position is selected. */ 
     409  public void valueChanged(ListSelectionEvent e) { 
     410    int ndx = posList.getSelectedIndex(); 
     411    remove.setEnabled(ndx >= 0); 
     412    moveUp.setEnabled(ndx > 0); 
     413    moveDown.setEnabled(ndx < posListModel.getSize() - 1); 
     414    if (ndx < 0) return; 
     415    DisplayPosition pos = (DisplayPosition) posListModel.getElementAt(ndx); 
     416    double[] matrix = pos.getMatrix(); 
     417    DisplayWindow display = handler.getWindow(); 
     418    VisBioFrame bio = display.getVisBio(); 
     419    DisplayImpl d = display.getDisplay(); 
     420    if (d == null) return; 
     421    ProjectionControl pc = d.getProjectionControl(); 
     422    try { pc.setMatrix(matrix); } 
     423    catch (VisADException exc) { exc.printStackTrace(); } 
     424    catch (RemoteException exc) { exc.printStackTrace(); } 
     425  } 
    89426 
    90427} 
  • trunk/loci/visbio/view/DisplayControls.java

    r3070 r3077  
    6464  protected JButton show; 
    6565 
    66   /** Button for capturing display screenshots and movies. */ 
    67   protected JButton capture; 
    68  
    6966  /** Button for removing a display from the list. */ 
    7067  protected JButton remove; 
     
    105102    show.setEnabled(false); 
    106103 
    107     // capture button 
    108     capture = new JButton("Capture"); 
    109     capture.addActionListener(this); 
    110     if (!LAFUtil.isMacLookAndFeel()) capture.setMnemonic('p'); 
    111     capture.setToolTipText( 
    112       "Creates screenshots and movies for the selected display"); 
    113     capture.setEnabled(false); 
    114  
    115104    // remove data button 
    116105    remove = new JButton("Remove"); 
     
    128117    bsb.addGridded(show); 
    129118    bsb.addRelatedGap(); 
    130     bsb.addGridded(capture); 
    131     bsb.addRelatedGap(); 
    132119    bsb.addGridded(remove); 
    133120    JPanel buttons = bsb.getPanel(); 
     
    175162    DisplayWindow d = (DisplayWindow) displayList.getSelectedValue(); 
    176163    show.setEnabled(isShowable(d)); 
    177     capture.setEnabled(isShowable(d)); 
    178164    remove.setEnabled(d != null); 
    179165  } 
     
    188174    else if (src == add3D) dm.createDisplay(this, true); 
    189175    else if (src == show) showDisplay(); 
    190     else if (src == capture) { 
    191       DisplayWindow d = (DisplayWindow) displayList.getSelectedValue(); 
    192       d.getCaptureHandler().getPanel().showCaptureWindow(); 
    193     } 
    194176    else if (src == remove) { 
    195177      dm.removeDisplay((DisplayWindow) displayList.getSelectedValue()); 
  • trunk/loci/visbio/view/DisplayWindow.java

    r3070 r3077  
    2828import java.awt.event.*; 
    2929import java.rmi.RemoteException; 
    30 import javax.swing.JFrame; 
    31 import javax.swing.JPanel; 
     30import javax.swing.*; 
     31import javax.swing.border.EmptyBorder; 
    3232import loci.formats.ReflectedUniverse; 
    3333import loci.formats.ReflectException; 
     
    383383      // lay out components 
    384384      pane.add(display.getComponent(), BorderLayout.CENTER); 
    385       Object[] rows = { 
    386         viewHandler.getPanel(), 
    387         FormsUtil.makeRow(new Object[] {captureHandler.getPanel()}), 
    388         "Data", 
    389         transformHandler.getPanel(), 
    390         sliders 
    391       }; 
     385 
     386      JPanel viewPanel = viewHandler.getPanel(); 
     387      JPanel capturePanel = captureHandler.getPanel(); 
     388      JPanel transformPanel = transformHandler.getPanel(); 
     389 
     390      viewPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); 
     391      capturePanel.setBorder(new EmptyBorder(10, 10, 10, 10)); 
     392      transformPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); 
     393      sliders.setBorder(new EmptyBorder(12, 0, 0, 0)); 
     394 
     395      JTabbedPane tabs = new JTabbedPane(); 
     396      tabs.addTab("Appearance", viewPanel); 
     397      tabs.addTab("Capture", capturePanel); 
     398      tabs.addTab("Data", transformPanel); 
     399 
     400      Object[] rows = {tabs, sliders}; 
    392401      controls.setContentPane(FormsUtil.makeColumn(rows, null, true)); 
    393402      pack(); 
  • trunk/loci/visbio/view/ViewPanel.java

    r3070 r3077  
    6969    // lay out components 
    7070    setLayout(new BorderLayout()); 
    71     add(FormsUtil.makeColumn(new Object[] {"Appearance", doOrientationPanel(), 
     71    add(FormsUtil.makeColumn(new Object[] {doOrientationPanel(), 
    7272      doAspectPanel(), doAppearancePanel()}, "pref:grow", false)); 
    7373  } 
Note: See TracChangeset for help on using the changeset viewer.