Search in sources :

Example 1 with ModeManager

use of blue.ui.core.score.ModeManager in project blue by kunstmusik.

the class ParameterLinePanel method paintComponent.

@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (paramList == null || paramList.size() == 0) {
        return;
    }
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(STROKE2);
    RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHints(hints);
    Color currentColor = null;
    ModeManager modeManager = ModeManager.getInstance();
    boolean editing = (modeManager.getMode() == ScoreMode.SINGLE_LINE);
    // boolean multiLineMode = (modeManager.getMode() == ModeManager.MODE_MULTI_LINE);
    boolean multiLineMode = !editing;
    for (Parameter param : paramList) {
        Line line = param.getLine();
        if (multiLineMode) {
            g2d.setColor(line.getColor().darker());
            drawSelectionLine(g2d, param);
        } else if (editing && param == currentParameter) {
            currentColor = line.getColor();
        } else {
            g2d.setColor(line.getColor().darker());
            drawLine(g2d, param, false);
        }
    }
    if (multiLineMode) {
        return;
    }
    if (currentColor != null) {
        g2d.setColor(currentColor);
        if (editing && marquee.isVisible() && marquee.intersects(this)) {
            drawSelectionLine(g2d, currentParameter);
        } else {
            drawLine(g2d, currentParameter, true);
        }
    }
    if (editing && selectedPoint != null) {
        double min = currentParameter.getMin();
        double max = currentParameter.getMax();
        int x = doubleToScreenX(selectedPoint.getX());
        int y = doubleToScreenY(selectedPoint.getY(), min, max);
        g2d.setColor(Color.red);
        g2d.fillOval(x - 3, y - 3, 7, 7);
        g2d.setStroke(STROKE1);
        g2d.drawOval(x - 3, y - 3, 7, 7);
        g2d.setStroke(STROKE2);
        if (currentParameter != null) {
            drawPointInformation(g2d, x, y);
        }
    }
}
Also used : Line(blue.components.lines.Line) Color(java.awt.Color) RenderingHints(java.awt.RenderingHints) Point(java.awt.Point) LinePoint(blue.components.lines.LinePoint) Graphics2D(java.awt.Graphics2D) ModeManager(blue.ui.core.score.ModeManager)

Example 2 with ModeManager

use of blue.ui.core.score.ModeManager in project blue by kunstmusik.

the class TempoEditor method paintComponent.

@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (this.tempo == null) {
        return;
    }
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(STROKE2);
    RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHints(hints);
    Color currentColor = null;
    ModeManager modeManager = ModeManager.getInstance();
    Line tempoLine = this.tempo.getLine();
    boolean enabled = this.tempo.isEnabled();
    if (enabled) {
        if (tempo.isVisible()) {
            g2d.setColor(Color.GREEN);
        } else {
            g2d.setColor(Color.GREEN.darker().darker());
        }
        drawLine(g2d, tempoLine, this.tempo.isVisible());
    } else {
        g2d.setColor(Color.DARK_GRAY);
        drawLine(g2d, tempoLine, false);
        g2d.setColor(Color.WHITE);
        g2d.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
        return;
    }
    if (enabled && selectedPoint != null) {
        double min = tempoLine.getMin();
        double max = tempoLine.getMax();
        int x = doubleToScreenX(selectedPoint.getX());
        int y = doubleToScreenY(selectedPoint.getY(), min, max);
        g2d.setColor(Color.red);
        paintPoint(g2d, x, y);
        drawPointInformation(g2d, x, y);
    }
    g2d.setColor(Color.WHITE);
    g2d.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
}
Also used : Line(blue.components.lines.Line) Color(java.awt.Color) RenderingHints(java.awt.RenderingHints) Point(java.awt.Point) LinePoint(blue.components.lines.LinePoint) Graphics2D(java.awt.Graphics2D) ModeManager(blue.ui.core.score.ModeManager)

Aggregations

Line (blue.components.lines.Line)2 LinePoint (blue.components.lines.LinePoint)2 ModeManager (blue.ui.core.score.ModeManager)2 Color (java.awt.Color)2 Graphics2D (java.awt.Graphics2D)2 Point (java.awt.Point)2 RenderingHints (java.awt.RenderingHints)2