X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=92b9a5065cd1b64168b5eb2ffa4a4b0a40023d33;hb=16d109024847af92482237e43f99b82fd997451a;hp=9cf01fae08b442ae602f6066bf624de4a258a6b7;hpb=6a18ba9e7e4bd4deee0337dfd072b959596ca4b5;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 9cf01fa..92b9a50 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -37,7 +37,6 @@ import jalview.schemes.ResidueProperties; import jalview.structure.StructureSelectionManager; import jalview.util.Comparison; import jalview.util.MessageManager; -import jalview.util.Platform; import jalview.viewmodel.ViewportListenerI; import jalview.viewmodel.ViewportRanges; @@ -329,12 +328,12 @@ public class AlignmentPanel extends GAlignmentPanel implements } /** - * Highlight the given results on the alignment. + * Highlight the given results on the alignment * */ public void highlightSearchResults(SearchResultsI results) { - boolean scrolled = scrollToPosition(results, 0, true, false); + boolean scrolled = scrollToPosition(results, 0, false); boolean noFastPaint = scrolled && av.getWrapAlignment(); @@ -346,13 +345,11 @@ public class AlignmentPanel extends GAlignmentPanel implements * (if any) * * @param searchResults - * @param redrawOverview * @return */ - public boolean scrollToPosition(SearchResultsI searchResults, - boolean redrawOverview) + public boolean scrollToPosition(SearchResultsI searchResults) { - return scrollToPosition(searchResults, 0, redrawOverview, false); + return scrollToPosition(searchResults, 0, false); } /** @@ -365,14 +362,12 @@ public class AlignmentPanel extends GAlignmentPanel implements * @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 * if true, try to centre the search results horizontally in the view * @return */ protected boolean scrollToPosition(SearchResultsI results, - int verticalOffset, boolean redrawOverview, boolean centre) + int verticalOffset, boolean centre) { int startv, endv, starts, ends; ViewportRanges ranges = av.getRanges(); @@ -478,7 +473,7 @@ public class AlignmentPanel extends GAlignmentPanel implements scrollNeeded = ranges.scrollToWrappedVisible(start); } - paintAlignment(redrawOverview, false); + paintAlignment(false, false); return scrollNeeded; } @@ -537,7 +532,7 @@ public class AlignmentPanel extends GAlignmentPanel implements addNotify(); // TODO: many places call this method and also paintAlignment with various // different settings. this means multiple redraws are triggered... - paintAlignment(true, false); + paintAlignment(true, av.needToUpdateStructureViews()); } /** @@ -547,37 +542,10 @@ public class AlignmentPanel extends GAlignmentPanel implements protected void validateAnnotationDimensions(boolean adjustPanelHeight) { int annotationHeight = getAnnotationPanel().adjustPanelHeight(); + annotationHeight = getAnnotationPanel() + .adjustForAlignFrame(adjustPanelHeight, annotationHeight); - if (adjustPanelHeight) - { - int rowHeight = av.getCharHeight(); - int alignmentHeight = rowHeight * av.getAlignment().getHeight(); - - /* - * Estimate available height in the AlignFrame for alignment + - * annotations. Deduct an estimate for title bar, menu bar, scale panel, - * hscroll, status bar, insets. - */ - int stuff = Platform.isAMac() ? 120 : 140; - int availableHeight = alignFrame.getHeight() - stuff; - - /* - * If not enough vertical space, maximize annotation height while keeping - * at least two rows of alignment visible - */ - if (annotationHeight + alignmentHeight > availableHeight) - { - annotationHeight = Math.min(annotationHeight, - availableHeight - 2 * rowHeight); - } - } - else - { - // maintain same window layout whilst updating sliders - annotationHeight = annotationScroller.getSize().height; - } hscroll.addNotify(); - annotationScroller.setPreferredSize( new Dimension(annotationScroller.getWidth(), annotationHeight)); @@ -616,6 +584,7 @@ public class AlignmentPanel extends GAlignmentPanel implements { annotationScroller.setVisible(true); annotationSpaceFillerHolder.setVisible(true); + validateAnnotationDimensions(false); } int canvasWidth = getSeqPanel().seqCanvas.getWidth(); @@ -668,16 +637,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } else { - int width = av.getAlignment().getWidth(); + int width = av.getAlignment().getVisibleWidth(); int height = av.getAlignment().getHeight(); - if (av.hasHiddenColumns()) - { - // reset the width to exclude hidden columns - width = av.getAlignment().getHiddenColumns() - .absoluteToVisibleColumn(width); - } - hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(); vextent = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(); @@ -989,8 +951,8 @@ public class AlignmentPanel extends GAlignmentPanel implements final int totalSeq = (pageHeight - scaleHeight) / charHeight - 1; - final int alignmentWidth = av.getAlignment().getWidth(); - final int pagesWide = (alignmentWidth / totalRes) + 1; + final int alignmentWidth = av.getAlignment().getVisibleWidth(); + int pagesWide = (alignmentWidth / totalRes) + 1; final int startRes = (pageIndex % pagesWide) * totalRes; final int endRes = Math.min(startRes + totalRes - 1, @@ -1107,12 +1069,7 @@ public class AlignmentPanel extends GAlignmentPanel implements int idWidth = getVisibleIdWidth(false); - int maxwidth = av.getAlignment().getWidth(); - if (av.hasHiddenColumns()) - { - maxwidth = av.getAlignment().getHiddenColumns() - .absoluteToVisibleColumn(maxwidth) - 1; - } + int maxwidth = av.getAlignment().getVisibleWidth(); int resWidth = getSeqPanel().seqCanvas .getWrappedCanvasWidth(pageWidth - idWidth); @@ -1124,6 +1081,12 @@ public class AlignmentPanel extends GAlignmentPanel implements g.setFont(av.getFont()); g.setColor(Color.black); + /* + * method: print the whole wrapped alignment, but with a clip region that + * is restricted to the requested page; this supports selective print of + * single pages or ranges, (at the cost of some repeated processing in + * the 'normal' case, when all pages are printed) + */ g.translate(0, -pageNumber * pageHeight); g.setClip(0, pageNumber * pageHeight, pageWidth, pageHeight); @@ -1268,12 +1231,7 @@ public class AlignmentPanel extends GAlignmentPanel implements public AlignmentDimension getAlignmentDimension() { - int maxwidth = av.getAlignment().getWidth(); - if (av.hasHiddenColumns()) - { - maxwidth = av.getAlignment().getHiddenColumns() - .absoluteToVisibleColumn(maxwidth); - } + int maxwidth = av.getAlignment().getVisibleWidth(); int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight()) + getScalePanel().getHeight(); @@ -1588,7 +1546,7 @@ public class AlignmentPanel extends GAlignmentPanel implements @Override public String getViewName() { - return av.viewName; + return av.getViewName(); } /** @@ -1719,7 +1677,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ protected void scrollToCentre(SearchResultsI sr, int verticalOffset) { - scrollToPosition(sr, verticalOffset, true, true); + scrollToPosition(sr, verticalOffset, true); } /**