Search in sources :

Example 21 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class ZakLineListTableModel method setValueAt.

/**
 * Sets value stored in table, difference from base class being the 2nd
 * column is zak channel
 */
@Override
public void setValueAt(Object value, int row, int col) {
    if (col == 1) {
        Line line = lines.get(row);
        String strChannel = (String) value;
        try {
            int tempChannel = Integer.parseInt(strChannel);
            if (tempChannel < 0) {
                throw new NumberFormatException("Zak Channel numbers must be 0 or greater");
            }
            line.setChannel(tempChannel);
            fireTableCellUpdated(row, col);
        } catch (NumberFormatException e) {
            String errorMessage = BlueSystem.getString("message.line.channelParseErr");
            JOptionPane.showMessageDialog(null, errorMessage, BlueSystem.getString("message.line.badChannel"), JOptionPane.ERROR_MESSAGE);
        }
    } else {
        super.setValueAt(value, row, col);
    }
}
Also used : Line(blue.components.lines.Line)

Example 22 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class ZakLineListTableModel method getValueAt.

/**
 * Gets value stored in table, difference from base class being the 2nd
 * column is zak channel
 */
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    if (lines == null) {
        return null;
    }
    if (columnIndex == 1) {
        Line line = lines.get(rowIndex);
        Integer tempChannel = new Integer(line.getChannel());
        return tempChannel.toString();
    } else {
        return super.getValueAt(rowIndex, columnIndex);
    }
}
Also used : Line(blue.components.lines.Line)

Example 23 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class AbstractLineObject method generateFTables.

public void generateFTables(CompileData compileData, HashMap ftableNumMap) {
    StringBuilder buffer = new StringBuilder();
    // TODO - need to grab from tables in static var
    Object obj = compileData.getCompilationVariable(LINE_OBJECT_CACHE);
    if (obj == null) {
        HashMap map = new HashMap();
        compileData.setCompilationVariable(LINE_OBJECT_CACHE, map);
        obj = map;
    }
    HashMap stringTables = (HashMap) obj;
    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
        Line line = (Line) iter.next();
        String table = createTable(line);
        int tableNum;
        if (stringTables.containsKey(table)) {
            tableNum = ((Integer) stringTables.get(table)).intValue();
        } else {
            tableNum = compileData.getOpenFTableNumber();
            stringTables.put(table, new Integer(tableNum));
            buffer.append("f").append(tableNum);
            buffer.append(table).append("\n");
        }
        ftableNumMap.put(line.getUniqueID(), new Integer(tableNum));
    }
    compileData.appendTables(buffer.toString());
}
Also used : Line(blue.components.lines.Line) HashMap(java.util.HashMap) Iterator(java.util.Iterator) LinePoint(blue.components.lines.LinePoint)

Example 24 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class AbstractLineObject method generateInstruments.

public void generateInstruments(CompileData compileData, Integer[] instrLineArray, HashMap ftableNumMap) {
    int i = 0;
    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
        Line line = (Line) iter.next();
        String lineName;
        if (line.isZak()) {
            lineName = "zak" + line.getChannel();
        } else {
            lineName = line.getVarName();
        }
        String lineId = line.getUniqueID();
        String key = "AbstractLineObject." + lineName;
        Object val = compileData.getCompilationVariable(key);
        int instrNum = -1;
        Integer lineNum = (Integer) ftableNumMap.get(lineId);
        if (val == null) {
            String instrText = generateLineInstrument(line);
            GenericInstrument instr = new GenericInstrument();
            instr.setText(instrText);
            instrNum = compileData.addInstrument(instr);
            compileData.setCompilationVariable(key, new Integer(instrNum));
        } else {
            instrNum = ((Integer) val).intValue();
        }
        instrLineArray[i++] = new Integer(instrNum);
        instrLineArray[i++] = lineNum;
    }
}
Also used : Line(blue.components.lines.Line) Iterator(java.util.Iterator) GenericInstrument(blue.orchestra.GenericInstrument) LinePoint(blue.components.lines.LinePoint)

Example 25 with Line

use of blue.components.lines.Line 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)

Aggregations

Line (blue.components.lines.Line)35 LinePoint (blue.components.lines.LinePoint)22 Point (java.awt.Point)11 SoundObjectParameterLine (blue.components.lines.SoundObjectParameterLine)4 Color (java.awt.Color)4 Iterator (java.util.Iterator)4 Graphics2D (java.awt.Graphics2D)3 RenderingHints (java.awt.RenderingHints)3 ModeManager (blue.ui.core.score.ModeManager)2 Element (electric.xml.Element)2 Elements (electric.xml.Elements)2 Rectangle (java.awt.Rectangle)2 BigDecimal (java.math.BigDecimal)2 GraphicsContext (javafx.scene.canvas.GraphicsContext)2 Color (javafx.scene.paint.Color)2 StrBuilder (org.apache.commons.lang3.text.StrBuilder)2 GenericInstrument (blue.orchestra.GenericInstrument)1 LineSelector (blue.orchestra.editor.blueSynthBuilder.jfx.LineSelector)1 ParameterLineView (blue.soundObject.editor.sound.ParameterLineView)1 TimeBar (blue.soundObject.editor.sound.TimeBar)1