From c24571b69627539261cc01b763ed3ad25ea27208 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 8 Aug 2023 12:37:54 +0100 Subject: [PATCH 1/1] JAL-244 Added light grey marks to indicate regions to resize the margins --- src/jalview/gui/AnnotationLabels.java | 16 ++++++++++++++-- src/jalview/gui/IdwidthAdjuster.java | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 56efe53..6006026 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -88,7 +88,7 @@ public class AnnotationLabels extends JPanel /** * height in pixels for allowing height adjuster to be active */ - private static int HEIGHT_ADJUSTER_HEIGHT = 10; + public static int HEIGHT_ADJUSTER_HEIGHT = 10; private static final Font font = new Font("Arial", Font.PLAIN, 11); @@ -138,6 +138,8 @@ public class AnnotationLabels extends JPanel private int annotationIdWidth = -1; + public static final String RESIZE_MARGINS_MARK_PREF = "RESIZE_MARGINS_MARK"; + /** * Creates a new AnnotationLabels object * @@ -1167,7 +1169,6 @@ public class AnnotationLabels extends JPanel } drawComponent(g2, true, width); - } /** @@ -1309,6 +1310,17 @@ public class AnnotationLabels extends JPanel { g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); + + if (!Cache.getDefault(RESIZE_MARGINS_MARK_PREF, false) + && !av.getWrapAlignment()) + { + g.setColor(Color.LIGHT_GRAY); + g.drawLine(0, HEIGHT_ADJUSTER_HEIGHT / 4, HEIGHT_ADJUSTER_WIDTH / 4, + HEIGHT_ADJUSTER_HEIGHT / 4); + g.drawLine(0, 3 * HEIGHT_ADJUSTER_HEIGHT / 4, + HEIGHT_ADJUSTER_WIDTH / 4, 3 * HEIGHT_ADJUSTER_HEIGHT / 4); + + } } if (actuallyDraw) diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 8a6c7eb..4596e1f 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -30,6 +30,7 @@ import java.awt.event.MouseMotionListener; import javax.swing.JPanel; import jalview.api.AlignViewportI; +import jalview.bin.Cache; /** * DOCUMENT ME! @@ -199,8 +200,21 @@ public class IdwidthAdjuster extends JPanel @Override public void paintComponent(Graphics g) { + int width = getWidth(); + int height = getHeight(); g.setColor(Color.white); - g.fillRect(0, 0, getWidth(), getHeight()); + g.fillRect(0, 0, width, height); + + if (!Cache.getDefault(AnnotationLabels.RESIZE_MARGINS_MARK_PREF, false)) + // && !ap.getAlignViewport().getWrapAlignment()) // now allowing adjustment + // in wrap mode + { + int spacer = Math.max(2, AnnotationLabels.HEIGHT_ADJUSTER_HEIGHT / 4); + g.setColor(Color.LIGHT_GRAY); + g.drawLine(width - 3 * spacer, 0, width - 3 * spacer, height / 2); + g.drawLine(width - spacer, 0, width - spacer, height / 2); + } + setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); } } -- 1.7.10.2