use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class MeshGenController method removeFlamePanel.
private void removeFlamePanel(JPanel pRootPanel) {
FlamePanel flamePanel = flamepanels.get(pRootPanel);
if (flamePanel != null) {
pRootPanel.remove(flamePanel);
flamepanels.remove(pRootPanel);
}
}
use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class TinaSWFAnimatorController method getFlamePanel.
private FlamePanel getFlamePanel() {
if (flamePanel == null) {
int width = swfAnimatorPreviewRootPanel.getWidth();
int height = swfAnimatorPreviewRootPanel.getHeight();
SimpleImage img = new SimpleImage(width, height);
img.fillBackground(0, 0, 0);
flamePanel = new FlamePanel(prefs, img, 0, 0, swfAnimatorPreviewRootPanel.getWidth(), this, null);
ResolutionProfile resProfile = getResolutionProfile();
flamePanel.setRenderWidth(resProfile.getWidth());
flamePanel.setRenderHeight(resProfile.getHeight());
flamePanel.setFocusable(true);
swfAnimatorPreviewRootPanel.add(flamePanel, BorderLayout.CENTER);
swfAnimatorPreviewRootPanel.getParent().validate();
swfAnimatorPreviewRootPanel.repaint();
flamePanel.requestFocusInWindow();
}
return flamePanel;
}
use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class TinaController method getFlamePanel.
@Override
public FlamePanel getFlamePanel() {
if (flamePanel == null) {
int width = centerPanel.getParent().getWidth();
int height = centerPanel.getParent().getHeight();
SimpleImage img = new SimpleImage(width, height);
img.fillBackground(0, 0, 0);
flamePanel = new FlamePanel(prefs, img, 0, 0, centerPanel.getParent().getWidth(), this, this);
flamePanel.getConfig().setWithColoredTransforms(prefs.isTinaEditorControlsWithColor());
flamePanel.getConfig().setProgressivePreview(prefs.isTinaEditorProgressivePreview());
flamePanel.setFlamePanelTriangleMode(prefs.getTinaEditorControlsStyle());
flamePanel.importOptions(prevFlamePanel);
prevFlamePanel = null;
flamePanel.setUndoManagerHolder(this);
ResolutionProfile resProfile = getResolutionProfile();
flamePanel.setRenderWidth(resProfile.getWidth());
flamePanel.setRenderHeight(resProfile.getHeight());
flamePanel.setFocusable(true);
flamePanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
flamePanel_mouseDragged(e);
dragging = true;
}
});
flamePanel.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
flamePanel_mousePressed(e);
}
@Override
public void mouseClicked(java.awt.event.MouseEvent e) {
flamePanel_mouseClicked(e);
flamePanel.requestFocusInWindow();
}
@Override
public void mouseReleased(MouseEvent e) {
if (dragging) {
refreshFlameImage(true, false, 1, true, false);
flamePanel_mouseReleased(e);
}
dragging = false;
}
});
flamePanel.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
flamePanel_mouseWheelEvent(e);
}
});
flamePanel.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (keypressing) {
return;
}
keypressing = true;
try {
// || e.isAltGraphDown());
boolean altPressed = e.isAltDown();
boolean shiftPressed = e.isShiftDown();
boolean ctrlPressed = e.isControlDown();
switch(e.getKeyCode()) {
// left
case 37:
if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.MOVE_TRIANGLE) {
if (altPressed) {
xForm_rotateLeft();
} else if (ctrlPressed) {
xForm_moveLeft(0.1);
} else if (shiftPressed) {
xForm_moveLeft(10.0);
} else {
xForm_moveLeft(1.0);
}
} else if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.GRADIENT) {
gradientMarker_move(0, -1);
}
break;
// right
case 39:
if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.MOVE_TRIANGLE) {
if (altPressed) {
xForm_rotateRight();
} else if (ctrlPressed) {
xForm_moveRight(0.1);
} else if (shiftPressed) {
xForm_moveRight(10.0);
} else {
xForm_moveRight(1.0);
}
} else if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.GRADIENT) {
gradientMarker_move(0, 1);
}
break;
// up
case 38:
if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.MOVE_TRIANGLE) {
if (altPressed) {
xForm_enlarge();
} else if (ctrlPressed) {
xForm_moveUp(0.1);
} else if (shiftPressed) {
xForm_moveUp(10.0);
} else {
xForm_moveUp(1.0);
}
} else if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.GRADIENT) {
gradientMarker_move(1, 1);
}
break;
// down
case 40:
if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.MOVE_TRIANGLE) {
if (altPressed) {
xForm_shrink();
} else if (ctrlPressed) {
xForm_moveDown(0.1);
} else if (shiftPressed) {
xForm_moveDown(10.0);
} else {
xForm_moveDown(1.0);
}
} else if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.GRADIENT) {
gradientMarker_move(1, -1);
}
break;
// 1
case 49:
if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.GRADIENT) {
gradientMarker_selectColor(0);
}
break;
// 1
case 50:
if (flamePanel.getConfig().getMouseDragOperation() == MouseDragOperation.GRADIENT) {
gradientMarker_selectColor(1);
}
break;
}
} finally {
flamePanel.requestFocus();
keypressing = false;
}
}
});
flamePanel.setSelectedXForm(getCurrXForm());
if (firstFlamePanel) {
try {
centerPanel.getParent().remove(0);
} catch (Exception ex) {
ex.printStackTrace();
}
firstFlamePanel = false;
}
centerPanel.add(flamePanel, BorderLayout.CENTER);
centerPanel.getParent().validate();
centerPanel.repaint();
flamePanel.requestFocusInWindow();
}
return flamePanel;
}
Aggregations