Implemented ProgressBar for PaSiMap
[jalview.git] / src / jalview / gui / FontChooser.java
index 92cc4c6..853d4aa 100755 (executable)
  */
 package jalview.gui;
 
-import jalview.bin.Cache;
-import jalview.jbgui.GFontChooser;
-import jalview.util.MessageManager;
-
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.geom.Rectangle2D;
@@ -31,6 +27,10 @@ import java.awt.geom.Rectangle2D;
 import javax.swing.JInternalFrame;
 import javax.swing.JLayeredPane;
 
+import jalview.bin.Cache;
+import jalview.jbgui.GFontChooser;
+import jalview.util.MessageManager;
+
 /**
  * DOCUMENT ME!
  * 
@@ -43,6 +43,8 @@ public class FontChooser extends GFontChooser
 
   TreePanel tp;
 
+  CutAndPasteTransfer cap;
+
   /*
    * The font on opening the dialog (to be restored on Cancel)
    */
@@ -109,29 +111,44 @@ public class FontChooser extends GFontChooser
     init();
   }
 
+  /**
+   * Creates a new FontChooser for a CutAndPasteTransfer
+   * @param cap
+  */
+  public FontChooser(CutAndPasteTransfer cap)
+  {
+    oldFont = new Font("Monospaced", Font.PLAIN, 12);
+    this.cap = cap;
+    init();
+  }
+
   void init()
   {
     frame = new JInternalFrame();
+    frame.setFrameIcon(null);
     frame.setContentPane(this);
 
-    smoothFont.setSelected(ap.av.antiAlias);
-
-    /*
-     * Enable 'scale protein as cDNA' in a SplitFrame view. The selection is
-     * stored in the ViewStyle of both dna and protein Viewport. Also enable
-     * checkbox for copy font changes to other half of split frame.
-     */
-    boolean inSplitFrame = ap.av.getCodingComplement() != null;
-    if (inSplitFrame)
+    if (!isCapFont())
     {
-      oldComplementFont = ((AlignViewport) ap.av.getCodingComplement())
-              .getFont();
-      oldComplementSmooth = ((AlignViewport) ap.av
-              .getCodingComplement()).antiAlias;
-      scaleAsCdna.setVisible(true);
-      scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna());
-      fontAsCdna.setVisible(true);
-      fontAsCdna.setSelected(ap.av.isProteinFontAsCdna());
+      smoothFont.setSelected(ap.av.antiAlias);
+  
+      /*
+       * Enable 'scale protein as cDNA' in a SplitFrame view. The selection is
+       * stored in the ViewStyle of both dna and protein Viewport. Also enable
+       * checkbox for copy font changes to other half of split frame.
+       */
+      boolean inSplitFrame = ap.av.getCodingComplement() != null;
+      if (inSplitFrame)
+      {
+        oldComplementFont = ((AlignViewport) ap.av.getCodingComplement())
+                .getFont();
+        oldComplementSmooth = ((AlignViewport) ap.av
+                .getCodingComplement()).antiAlias;
+        scaleAsCdna.setVisible(true);
+        scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna());
+        fontAsCdna.setVisible(true);
+        fontAsCdna.setSelected(ap.av.isProteinFontAsCdna());
+      }
     }
 
     if (isTreeFont())
@@ -268,6 +285,10 @@ public class FontChooser extends GFontChooser
     return tp != null;
   }
 
+  private boolean isCapFont()
+  {
+    return cap != null;
+  }
   /**
    * DOCUMENT ME!
    */
@@ -349,6 +370,10 @@ public class FontChooser extends GFontChooser
         splitFrame.repaint();
       }
     }
+    else if (isCapFont())
+    {
+      cap.setFont(newFont);
+    }
 
     monospaced.setSelected(mw == iw);