import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.ComponentAdapter;
private AnnotationLabels alabels;
- // this value is set false when selection area being dragged
- boolean fastPaint = true;
-
private int hextent = 0;
private int vextent = 0;
alignFrame.updateEditMenuBar();
- paintAlignment(true);
+ // no idea if we need to update structure
+ paintAlignment(true, true);
}
getIdPanel().getIdCanvas().setPreferredSize(d);
hscrollFillerPanel.setPreferredSize(d);
- if (this.alignFrame.getSplitViewContainer() != null)
- {
- ((SplitFrame) this.alignFrame.getSplitViewContainer()).adjustLayout();
- }
-
repaint();
}
{
boolean scrolled = scrollToPosition(results, 0, true, false);
- boolean noFastPaint = scrolled && av.getWrapAlignment();
+ boolean fastPaint = !(scrolled && av.getWrapAlignment());
- getSeqPanel().seqCanvas.highlightSearchResults(results, noFastPaint);
+ getSeqPanel().seqCanvas.highlightSearchResults(results, fastPaint);
}
/**
if (av.hasHiddenColumns())
{
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
- start = hidden.findColumnPosition(start);
- end = hidden.findColumnPosition(end);
+ start = hidden.absoluteToVisibleColumn(start);
+ end = hidden.absoluteToVisibleColumn(end);
if (start == end)
{
if (!hidden.isVisible(r[0]))
scrollNeeded = ranges.scrollToWrappedVisible(start);
}
- paintAlignment(redrawOverview);
+ paintAlignment(redrawOverview, false);
return scrollNeeded;
}
}
validateAnnotationDimensions(true);
addNotify();
- paintAlignment(true);
+ // TODO: many places call this method and also paintAlignment with various
+ // different settings. this means multiple redraws are triggered...
+ paintAlignment(true, false);
}
/**
/*
* Estimate available height in the AlignFrame for alignment +
* 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 frame borders.
+ * hscroll, status bar, insets.
*/
- int stuff = Platform.isAMac() ? 80 : 100;
- Insets insets = alignFrame.getInsets();
- int availableHeight = alignFrame.getHeight() - stuff - insets.top
- - insets.bottom;
+ int stuff = Platform.isAMac() ? 120 : 140;
+ int availableHeight = alignFrame.getHeight() - stuff;
/*
* If not enough vertical space, maximize annotation height while keeping
}
else
{
- int widthInRes = (canvasWidth / av.getCharWidth()) - 1;
+ int widthInRes = (canvasWidth / av.getCharWidth());
int heightInSeq = (getSeqPanel().seqCanvas.getHeight()
- / av.getCharHeight()) - 1;
+ / av.getCharHeight());
ranges.setViewportWidth(widthInRes);
ranges.setViewportHeight(heightInSeq);
{
// reset the width to exclude hidden columns
width = av.getAlignment().getHiddenColumns()
- .findColumnPosition(width);
+ .absoluteToVisibleColumn(width);
}
hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
}
ranges.setViewportStartAndHeight(y, height);
}
- if (!fastPaint)
- {
- repaint();
- }
+ repaint();
}
/**
repaint();
}
- /**
- * Repaint the alignment including the annotations and overview panels (if
- * shown).
+ /* (non-Javadoc)
+ * @see jalview.api.AlignmentViewPanel#paintAlignment(boolean)
*/
@Override
- public void paintAlignment(boolean updateOverview)
+ public void paintAlignment(boolean updateOverview,
+ boolean updateStructures)
{
final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
av.isShowAutocalculatedAbove());
av.getSortAnnotationsBy());
repaint();
- if (updateOverview)
+ if (updateStructures)
{
- // TODO: determine if this paintAlignment changed structure colours
av.getStructureSelectionManager().sequenceColoursChanged(this);
+ }
+ if (updateOverview)
+ {
if (overviewPanel != null)
{
@Override
public void paintComponent(Graphics g)
{
- invalidate();
+ invalidate(); // needed so that the id width adjuster works correctly
Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
idPanelHolder.setPreferredSize(d);
hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
- validate();
+
+ validate(); // needed so that the id width adjuster works correctly
/*
- * set scroll bar positions
+ * set scroll bar positions - tried to remove but necessary for split panel to resize correctly
+ * though I still think this call should be elsewhere.
*/
ViewportRanges ranges = av.getRanges();
setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
if (av.hasHiddenColumns())
{
maxwidth = av.getAlignment().getHiddenColumns()
- .findColumnPosition(maxwidth) - 1;
+ .absoluteToVisibleColumn(maxwidth) - 1;
}
int resWidth = getSeqPanel().seqCanvas
if (av.hasHiddenColumns())
{
maxwidth = av.getAlignment().getHiddenColumns()
- .findColumnPosition(maxwidth);
+ .absoluteToVisibleColumn(maxwidth);
}
int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight())
if (av.hasHiddenColumns())
{
maxwidth = av.getAlignment().getHiddenColumns()
- .findColumnPosition(maxwidth) - 1;
+ .absoluteToVisibleColumn(maxwidth) - 1;
}
int height = ((maxwidth / chunkWidth) + 1) * cHeight;
if (annotationPanel != null)
{
annotationPanel.dispose();
+ annotationPanel = null;
}
if (av != null)
*/
protected void closeChildFrames()
{
+ if (overviewPanel != null)
+ {
+ overviewPanel.dispose();
+ overviewPanel = null;
+ }
if (calculationDialog != null)
{
calculationDialog.closeFrame();
+ calculationDialog = null;
}
}
*/
protected void scrollToCentre(SearchResultsI sr, int verticalOffset)
{
- /*
- * To avoid jumpy vertical scrolling (if some sequences are gapped or not
- * mapped), we can make the scroll-to location a sequence above the one
- * actually mapped.
- */
- SequenceI mappedTo = sr.getResults().get(0).getSequence();
- List<SequenceI> seqs = av.getAlignment().getSequences();
-
- /*
- * This is like AlignmentI.findIndex(seq) but here we are matching the
- * dataset sequence not the aligned sequence
- */
- boolean matched = false;
- for (SequenceI seq : seqs)
- {
- if (mappedTo == seq.getDatasetSequence())
- {
- matched = true;
- break;
- }
- }
- if (!matched)
- {
- return; // failsafe, shouldn't happen
- }
-
- /*
- * Scroll to position but centring the target residue.
- */
scrollToPosition(sr, verticalOffset, true, true);
}
if (adjustHeight)
{
// sort, repaint, update overview
- paintAlignment(true);
+ paintAlignment(true, false);
}
else
{