import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.bin.Jalview;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SequenceI;
import jalview.gui.ImageExporter.ImageWriterI;
import jalview.io.HTMLOutput;
+import jalview.io.exceptions.ImageOutputException;
import jalview.jbgui.GAlignmentPanel;
import jalview.math.AlignmentDimension;
import jalview.schemes.ResidueProperties;
import jalview.util.Comparison;
import jalview.util.ImageMaker;
import jalview.util.MessageManager;
+import jalview.util.imagemaker.BitmapImageSizing;
import jalview.viewmodel.ViewportListenerI;
import jalview.viewmodel.ViewportRanges;
// to prevent drawing old image
FontMetrics fm = getFontMetrics(av.getFont());
+ // update the flag controlling whether the grid is too small to render the
+ // font
+ av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
+
scalePanelHolder.setPreferredSize(
new Dimension(10, av.getCharHeight() + fm.getDescent()));
idSpaceFillerPanel1.setPreferredSize(
Dimension r = null;
if (av.getIdWidth() < 0)
{
- int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
- int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3);
- int maxwidth = Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth);
- r = calculateIdWidth(maxwidth);
+ r = calculateDefaultAlignmentIdWidth();
av.setIdWidth(r.width);
}
else
return r;
}
+ public Dimension calculateDefaultAlignmentIdWidth()
+ {
+ int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
+ int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3);
+ int maxwidth = Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth);
+ return calculateIdWidth(-1);
+ }
+
/**
* Calculate the width of the alignment labels based on the displayed names
* and any bounds on label width set in preferences.
// could not be validated and it is not clear if it is now being
// called. Log warning here in case it is called and unforeseen
// problems occur
- Cache.log.warn(
+ Console.warn(
"Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
// scroll to start of panel
*/
alignmentGraphics.translate(alignmentGraphicsOffset,
alignmentDrawnHeight);
+ updateLayout();
getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
alignmentGraphics, -1, startRes, endRes + 1);
}
return (w > 0 ? w : calculateIdWidth().width);
}
+ void makeAlignmentImage(ImageMaker.TYPE type, File file, String renderer)
+ throws ImageOutputException
+ {
+ makeAlignmentImage(type, file, renderer,
+ BitmapImageSizing.nullBitmapImageSizing());
+ }
+
/**
* Builds an image of the alignment of the specified type (EPS/PNG/SVG) and
* writes it to the specified file
*
* @param type
* @param file
+ * @param textrenderer
+ * @param bitmapscale
*/
- void makeAlignmentImage(ImageMaker.TYPE type, File file)
+ void makeAlignmentImage(ImageMaker.TYPE type, File file, String renderer,
+ BitmapImageSizing userBis) throws ImageOutputException
{
final int borderBottomOffset = 5;
int imageWidth = aDimension.getWidth();
int imageHeight = aDimension.getHeight() + borderBottomOffset;
String of = MessageManager.getString("label.alignment");
- exporter.doExport(file, this, imageWidth, imageHeight, of);
+ exporter.doExport(file, this, imageWidth, imageHeight, of, renderer,
+ userBis);
}
/**
}
public void makePNGImageMap(File imgMapFile, String imageName)
+ throws ImageOutputException
{
// /////ONLY WORKS WITH NON WRAPPED ALIGNMENTS
// ////////////////////////////////////////////
} catch (Exception ex)
{
- ex.printStackTrace();
+ throw new ImageOutputException(
+ "couldn't write ImageMap due to unexpected error", ex);
}
} // /////////END OF IMAGE MAP
}
else
{
- if (Cache.log.isDebugEnabled())
+ if (Console.isDebugEnabled())
{
- Cache.log.warn("Closing alignment panel which is already closed.");
+ Console.warn("Closing alignment panel which is already closed.");
}
}
}
} catch (Exception ex)
{
}
-
if (b)
{
- alignFrame.setDisplayedView(this);
+ setAlignFrameView();
}
}
+ public void setAlignFrameView()
+ {
+ alignFrame.setDisplayedView(this);
+ }
+
@Override
public StructureSelectionManager getStructureSelectionManager()
{
return overviewTitle;
}
+ /**
+ * If this alignment panel has an Overview panel open, closes it
+ */
+ public void closeOverviewPanel()
+ {
+ if (overviewPanel != null)
+ {
+ overviewPanel.close();
+ overviewPanel = null;
+ }
+ }
+
}