X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=4c662147d4304f42463603aa95332cf0aa1fa0fb;hb=8edebdd9789b2d93fb8f9db24b8be2c1e6317690;hp=588411e9935fc5880bd6a697727f6e88fce3c4a6;hpb=4a7adcc9f6c0d05e12f8ea5460b0c9372020b98a;p=jalview.git
diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java
index 588411e..4c66214 100644
--- a/src/jalview/gui/AlignmentPanel.java
+++ b/src/jalview/gui/AlignmentPanel.java
@@ -29,11 +29,14 @@ import jalview.datamodel.SearchResults;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.io.HTMLOutput;
import jalview.jbgui.GAlignmentPanel;
import jalview.math.AlignmentDimension;
import jalview.schemes.ResidueProperties;
import jalview.structure.StructureSelectionManager;
+import jalview.util.ImageMaker;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -305,7 +308,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public boolean scrollToPosition(SearchResults results)
{
- return scrollToPosition(results, true, false);
+ return scrollToPosition(results, 0, true, false);
}
/**
@@ -318,7 +321,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public boolean scrollToPosition(SearchResults searchResults, boolean redrawOverview)
{
- return scrollToPosition(searchResults, redrawOverview, false);
+ return scrollToPosition(searchResults, 0, redrawOverview, false);
}
/**
@@ -326,6 +329,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
* (if any)
*
* @param results
+ * @param verticalOffset
+ * if greater than zero, allows scrolling to a position below the
+ * first displayed sequence
* @param redrawOverview
* - when set, the overview will be recalculated (takes longer)
* @param centre
@@ -333,6 +339,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResults results,
+ int verticalOffset,
boolean redrawOverview, boolean centre)
{
int startv, endv, starts, ends;
@@ -391,6 +398,12 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
}
}
+
+ /*
+ * allow for offset of target sequence (actually scroll to one above it)
+ */
+ seqIndex = Math.max(0, seqIndex - verticalOffset);
+
if (!av.getWrapAlignment())
{
if ((startv = av.getStartRes()) >= start)
@@ -521,12 +534,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
/*
* Estimate available height in the AlignFrame for alignment +
- * annotations. Deduct an estimate of 75 for menu bar, scale panel,
+ * annotations. Deduct an estimate for title bar, menu bar, scale panel,
* hscroll, status bar (as these are not laid out we can't inspect their
- * actual heights). Insets gives borders including title bar.
+ * actual heights). Insets gives frame borders.
*/
+ int stuff = Platform.isAMac() ? 80 : 100;
Insets insets = alignFrame.getInsets();
- int availableHeight = alignFrame.getHeight() - 75 - insets.top
+ int availableHeight = alignFrame.getHeight() - stuff - insets.top
- insets.bottom;
/*
@@ -1225,7 +1239,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
return idwidth.intValue() + 4;
}
- void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file)
+ void makeAlignmentImage(ImageMaker.TYPE type, File file)
{
long progress = System.currentTimeMillis();
headless = (System.getProperty("java.awt.headless") != null && System
@@ -1241,14 +1255,14 @@ public class AlignmentPanel extends GAlignmentPanel implements
AlignmentDimension aDimension = getAlignmentDimension();
try
{
- jalview.util.ImageMaker im;
+ ImageMaker im;
final String imageAction, imageTitle;
- if (type == jalview.util.ImageMaker.TYPE.PNG)
+ if (type == ImageMaker.TYPE.PNG)
{
imageAction = "Create PNG image from alignment";
imageTitle = null;
}
- else if (type == jalview.util.ImageMaker.TYPE.EPS)
+ else if (type == ImageMaker.TYPE.EPS)
{
imageAction = "Create EPS file from alignment";
imageTitle = alignFrame.getTitle();
@@ -1259,7 +1273,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
imageTitle = alignFrame.getTitle();
}
- im = new jalview.util.ImageMaker(this, type, imageAction,
+ im = new ImageMaker(this, type, imageAction,
aDimension.getWidth(), aDimension.getHeight(), file,
imageTitle);
if (av.getWrapAlignment())
@@ -1345,7 +1359,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void makeEPS(File epsFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.TYPE.EPS, epsFile);
+ makeAlignmentImage(ImageMaker.TYPE.EPS, epsFile);
}
/**
@@ -1353,12 +1367,12 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void makePNG(File pngFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.TYPE.PNG, pngFile);
+ makeAlignmentImage(ImageMaker.TYPE.PNG, pngFile);
}
public void makeSVG(File svgFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.TYPE.SVG, svgFile);
+ makeAlignmentImage(ImageMaker.TYPE.SVG, svgFile);
}
public void makePNGImageMap(File imgMapFile, String imageName)
{
@@ -1378,7 +1392,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
.getAlignment().getWidth(), g, gSize, f, fSize, sy;
StringBuffer text = new StringBuffer();
PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
- out.println(jalview.io.HTMLOutput.getImageMapHTML());
+ out.println(HTMLOutput.getImageMapHTML());
out.println(""
+ "