Merge branch 'develop' into merge/big_merge_of_bens_stuff_before_2_11_3_0
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 62e48d2..39039eb 100755 (executable)
@@ -343,7 +343,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
         }
       }
 
-      // System.err.println(">>> FastPaint to " + transX + " " + transY + " "
+      // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " + transY + " "
       // + horizontal + " " + vertical + " " + startRes + " " + endRes
       // + " " + startSeq + " " + endSeq);
 
@@ -362,7 +362,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
       // Call repaint on alignment panel so that repaints from other alignment
       // panel components can be aggregated. Otherwise performance of the
       // overview window and others may be adversely affected.
-      // System.out.println("SeqCanvas fastPaint() repaint() request...");
+      // jalview.bin.Console.outPrintln("SeqCanvas fastPaint() repaint() request...");
       av.getAlignPanel().repaint();
     } finally
     {
@@ -550,6 +550,20 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     return (canvasWidth - labelWidthEast - labelWidthWest) / charWidth;
   }
 
+  public int getMinimumWrappedCanvasWidth()
+  {
+    int charWidth = av.getCharWidth();
+    FontMetrics fm = getFontMetrics(av.getFont());
+    int labelWidth = 0;
+    if (av.getScaleRightWrapped() || av.getScaleLeftWrapped())
+    {
+      labelWidth = getLabelWidth(fm);
+    }
+    labelWidthEast = av.getScaleRightWrapped() ? labelWidth : 0;
+    labelWidthWest = av.getScaleLeftWrapped() ? labelWidth : 0;
+    return labelWidthEast + labelWidthWest + charWidth;
+  }
+
   /**
    * Returns a pixel width sufficient to show the largest sequence coordinate
    * (end position) in the alignment, calculated as the FontMetrics width of
@@ -1665,7 +1679,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
   public void propertyChange(PropertyChangeEvent evt)
   {
     String eventName = evt.getPropertyName();
-    // System.err.println(">>SeqCanvas propertyChange " + eventName);
+    // jalview.bin.Console.errPrintln(">>SeqCanvas propertyChange " + eventName);
     if (eventName.equals(SequenceGroup.SEQ_GROUP_CHANGED))
     {
       fastPaint = true;
@@ -1675,7 +1689,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI
     else if (eventName.equals(ViewportRanges.MOVE_VIEWPORT))
     {
       fastPaint = false;
-      // System.err.println("!!!! fastPaint false from MOVE_VIEWPORT");
+      // jalview.bin.Console.errPrintln("!!!! fastPaint false from MOVE_VIEWPORT");
       repaint();
       return;
     }