* The panel containing the sequence ruler (when not in wrapped mode), and
* supports a range of mouse operations to select, hide or reveal columns.
*/
+@SuppressWarnings("serial")
public class ScalePanel extends JPanel
implements MouseMotionListener, MouseListener, ViewportListenerI
{
});
pop.add(item);
- if (av.getAlignment().getHiddenColumns().hasMultiHiddenColumnRegions())
+ if (av.getAlignment().getHiddenColumns()
+ .hasMultiHiddenColumnRegions())
{
item = new JMenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
// todo res calculation should be a method on AlignViewport
int xCords = Math.max(0, evt.getX()); // prevent negative X coordinates
ViewportRanges ranges = av.getRanges();
- int res = (xCords / av.getCharWidth())
- + ranges.getStartRes();
+ int res = (xCords / av.getCharWidth()) + ranges.getStartRes();
res = Math.min(res, ranges.getEndRes());
if (av.hasHiddenColumns())
{
@Override
public void paintComponent(Graphics g)
{
- //super.paintComponent(g); // BH 2019
+
+ // super.paintComponent(g); // BH 2019
/*
* shouldn't get called in wrapped mode as the scale above is
gg.fillPolygon(
new int[]
- { -1 + res * avCharWidth - avCharHeight / 4,
- -1 + res * avCharWidth + avCharHeight / 4,
- -1 + res * avCharWidth }, new int[]
- { y, y, y + 2 * yOf }, 3);
+ { -1 + res * avCharWidth - avCharHeight / 4,
+ -1 + res * avCharWidth + avCharHeight / 4,
+ -1 + res * avCharWidth },
+ new int[]
+ { y, y, y + 2 * yOf }, 3);
}
}
}
// Here we only want to fastpaint on a scroll, with resize using a normal
// paint, so scroll events are identified as changes to the horizontal or
// vertical start value.
- if (evt.getPropertyName().equals(ViewportRanges.STARTRES)
- || evt.getPropertyName().equals(ViewportRanges.STARTRESANDSEQ)
- || evt.getPropertyName().equals(ViewportRanges.MOVE_VIEWPORT))
+ switch (evt.getPropertyName())
{
+ case ViewportRanges.STARTRES:
+ case ViewportRanges.STARTRESANDSEQ:
+ case ViewportRanges.MOVE_VIEWPORT:
// scroll event, repaint panel
-
- // Call repaint on alignment panel so that repaints from other alignment
- // panel components can be aggregated. Otherwise performance of the overview
- // window and others may be adversely affected.
- av.getAlignPanel().repaint();
+ // TODO: check this?
+ // BH: This is actually quite strange. AlignmentPanel is taking care of
+ // all of
+ // this with fast paint, so why indirectly trigger a repaint from the
+ // ScalePanel?
+
+ // Call repaint on alignment panel so that repaints from other alignment
+ // panel components can be aggregated. Otherwise performance of the
+ // overview
+ // window and others may be adversely affected.
+ // av.getAlignPanel().repaint();
+ System.out.println("ScalePanel propertyChange disabled "
+ + evt.getPropertyName());
+ break;
}
}