|
|
|
|
@@ -74,6 +74,11 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
private static final ImageIcon NO_FILL_COLOR_ICON;
|
|
|
|
|
private static final ImageIcon NO_FILL_COLOR_HOVER_ICON;
|
|
|
|
|
|
|
|
|
|
private static final ImageIcon LABEL_ICON;
|
|
|
|
|
private static final ImageIcon LABEL_HOVER_ICON;
|
|
|
|
|
private static final ImageIcon NO_LABEL_ICON;
|
|
|
|
|
private static final ImageIcon NO_LABEL_HOVER_ICON;
|
|
|
|
|
|
|
|
|
|
private static final ImageIcon VISIBLE_ICON;
|
|
|
|
|
private static final ImageIcon VISIBLE_HOVER_ICON;
|
|
|
|
|
private static final ImageIcon INVISIBLE_ICON;
|
|
|
|
|
@@ -87,6 +92,7 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
|
|
|
|
|
private final JLabel borderColorIndicator = new JLabel();
|
|
|
|
|
private final JLabel fillColorIndicator = new JLabel();
|
|
|
|
|
private final JLabel labelIndicator = new JLabel();
|
|
|
|
|
private final JLabel visibilityLabel = new JLabel();
|
|
|
|
|
private final JLabel deleteLabel = new JLabel();
|
|
|
|
|
|
|
|
|
|
@@ -99,6 +105,7 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
private final JSpinner thicknessSpinner = new JSpinner(spinnerModel);
|
|
|
|
|
|
|
|
|
|
private boolean visible;
|
|
|
|
|
private boolean showLabel;
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
|
{
|
|
|
|
|
@@ -118,6 +125,14 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
NO_FILL_COLOR_ICON = new ImageIcon(fillImgHover);
|
|
|
|
|
NO_FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(fillImgHover, -100));
|
|
|
|
|
|
|
|
|
|
final BufferedImage labelImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "label_icon.png");
|
|
|
|
|
final BufferedImage labelImgHover = ImageUtil.luminanceOffset(labelImg, -150);
|
|
|
|
|
LABEL_ICON = new ImageIcon(labelImg);
|
|
|
|
|
LABEL_HOVER_ICON = new ImageIcon(labelImgHover);
|
|
|
|
|
|
|
|
|
|
NO_LABEL_ICON = new ImageIcon(labelImgHover);
|
|
|
|
|
NO_LABEL_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(labelImgHover, -100));
|
|
|
|
|
|
|
|
|
|
final BufferedImage visibleImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "visible_icon.png");
|
|
|
|
|
VISIBLE_ICON = new ImageIcon(visibleImg);
|
|
|
|
|
VISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -100));
|
|
|
|
|
@@ -136,6 +151,7 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
this.plugin = plugin;
|
|
|
|
|
this.marker = marker;
|
|
|
|
|
this.visible = marker.getMarker().isVisible();
|
|
|
|
|
this.showLabel = marker.getMarker().isLabelled();
|
|
|
|
|
|
|
|
|
|
setLayout(new BorderLayout());
|
|
|
|
|
setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
|
|
|
|
@@ -320,8 +336,30 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
thicknessSpinner.addChangeListener(ce -> updateThickness(true));
|
|
|
|
|
thicknessSpinner.setToolTipText("Border thickness");
|
|
|
|
|
|
|
|
|
|
labelIndicator.addMouseListener(new MouseAdapter()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void mousePressed(MouseEvent mouseEvent)
|
|
|
|
|
{
|
|
|
|
|
toggleLabelling(!showLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void mouseEntered(MouseEvent mouseEvent)
|
|
|
|
|
{
|
|
|
|
|
labelIndicator.setIcon(showLabel ? LABEL_HOVER_ICON : NO_LABEL_HOVER_ICON);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void mouseExited(MouseEvent mouseEvent)
|
|
|
|
|
{
|
|
|
|
|
labelIndicator.setIcon(showLabel ? LABEL_ICON : NO_LABEL_ICON);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
leftActions.add(borderColorIndicator);
|
|
|
|
|
leftActions.add(fillColorIndicator);
|
|
|
|
|
leftActions.add(labelIndicator);
|
|
|
|
|
leftActions.add(thicknessSpinner);
|
|
|
|
|
|
|
|
|
|
JPanel rightActions = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0));
|
|
|
|
|
@@ -391,7 +429,7 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
updateFill();
|
|
|
|
|
updateBorder();
|
|
|
|
|
updateBorder();
|
|
|
|
|
|
|
|
|
|
updateLabelling();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void preview(boolean on)
|
|
|
|
|
@@ -412,6 +450,14 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
updateVisibility();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void toggleLabelling(boolean on)
|
|
|
|
|
{
|
|
|
|
|
showLabel = on;
|
|
|
|
|
marker.getMarker().setLabelled(showLabel);
|
|
|
|
|
plugin.updateConfig();
|
|
|
|
|
updateLabelling();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void save()
|
|
|
|
|
{
|
|
|
|
|
marker.getMarker().setName(nameInput.getText());
|
|
|
|
|
@@ -460,6 +506,12 @@ class ScreenMarkerPanel extends JPanel
|
|
|
|
|
visibilityLabel.setToolTipText(visible ? "Hide screen marker" : "Show screen marker");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateLabelling()
|
|
|
|
|
{
|
|
|
|
|
labelIndicator.setIcon(showLabel ? LABEL_ICON : NO_LABEL_ICON);
|
|
|
|
|
labelIndicator.setToolTipText(showLabel ? "Hide label" : "Show label");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateFill()
|
|
|
|
|
{
|
|
|
|
|
final boolean isFullyTransparent = marker.getMarker().getFill().getAlpha() == 0;
|
|
|
|
|
|