Commit dc451d33 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Preview window can be zoomed.

parent f0ab41ff
......@@ -7,6 +7,7 @@ Changelog:
- Resources/windows/layouts can be duplicated easily
- XML output is now indented
- Slider backgrounds can be generated in a wizard
- Improved preview of skin (can be zoomed now)
0.6.1b - Critical bufix for the Preview Window
- Bugfix for slider points parsing and XML parsing
0.6.0b - Resources/windows/layouts/items can be edited by
......
......@@ -78,9 +78,9 @@ public abstract class Item {
/** Creates the XML code representing the item */
public abstract String returnCode(String indent);
/** Draws the item to a graphics context */
public abstract void draw(Graphics2D g);
public abstract void draw(Graphics2D g, int z);
/** Draws the item to a graphics context with the offset x,y */
public abstract void draw(Graphics2D g, int x, int y);
public abstract void draw(Graphics2D g, int x, int y, int z);
/** Creates a DefaultMutableTreeNode to be displayed in the items tree */
public abstract DefaultMutableTreeNode getTreeNode();
/** If the given id is that of this item or one of the item's contained items the fitting item will be returned, else null **/
......
......@@ -355,10 +355,11 @@ public class Layout implements ActionListener{
/**
* Draws the Layout.
* @param g The Graphics2D context onto which the Layout will be drawn.
* @param z The zoom factor
*/
public void draw(Graphics2D g) {
public void draw(Graphics2D g, int z) {
for(Item i:items) {
i.draw(g);
i.draw(g, z);
}
}
/**
......
......@@ -947,15 +947,14 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="About">
else if(e.getSource().equals(m_help_about)) {
JOptionPane.showMessageDialog(this,"Copyright 2007 Daniel Dreibrodt\n" +
"daniel.dreibrodt@gmx.de\n" +
"http://www.d-gfx.net.tc\n" +
"http://www.videolan.org\n" +
JOptionPane.showMessageDialog(this,"Copyright 2007-2008 The VideoLAN Team\n" +
"Lead programmer: Daniel Dreibrodt (daniel.dreibrodt@googlemail.com)\n" +
"http://www.videolan.org/vlc/skineditor.php\n" +
"Released under terms of the GPL 2+\n\n" +
"Credits:\n" +
"Timothy Gerard Endres (time@gjt.org) for registry access and tar support (Public Domain)\n" +
"Timothy Gerard Endres for registry access and TAR support (Public Domain)\n" +
"The Tango! Desktop Project (http://tango.freedesktop.org/) for some icons (Creative Commons BY-SA 2.5)\n" +
"The VideoLAN Team for the Boolean Expression Evaluator and Bezier code (GPL 2+)",
"Cyril Deguet (asmax@via.ecp.fr) and Olivier Teuliere (ipkiss@via.ecp.fr) for the Boolean Expression Evaluator and Bezier code (GPL 2+)",
"About VLC Skin Editor", JOptionPane.INFORMATION_MESSAGE,icon);
}
// </editor-fold>
......
......@@ -35,12 +35,17 @@ import vlcskineditor.history.*;
* Handles the preview window and user interaction with it.
* @author Daniel Dreibrodt
*/
public class PreviewWindow extends JPanel implements MouseListener, MouseMotionListener {
public class PreviewWindow extends JPanel implements MouseListener, MouseMotionListener, ActionListener {
/**
* The JFrame in which a Layout of a Skin will be shown.
*/
public JInternalFrame frame;
JScrollPane scroll_pane;
JPanel zoom_panel;
JButton zoom_more, zoom_less;
JLabel zoom_label;
int z = 1;
Layout l;
FrameUpdater fu;
Item selected_item;
......@@ -53,13 +58,30 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
/**
* Creates a new PreviewWindow that is initially hidden.
* @param m_ the Main instance of the running Skin Editor
*/
public PreviewWindow(Main m_) {
m = m_;
frame = new JInternalFrame("No Layout selected");
frame.add(this);
frame.setLayout(new BorderLayout());
zoom_panel = new JPanel();
zoom_panel.setLayout(new FlowLayout());
zoom_less = new JButton("-");
zoom_less.addActionListener(this);
zoom_panel.add(zoom_less);
zoom_label = new JLabel("Zoom factor: 1x");
zoom_panel.add(zoom_label);
zoom_more = new JButton("+");
zoom_more.addActionListener(this);
zoom_panel.add(zoom_more);
zoom_panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
frame.add(zoom_panel, BorderLayout.PAGE_START);
scroll_pane = new JScrollPane(this);
frame.add(scroll_pane,BorderLayout.CENTER);
frame.pack();
frame.setMinimumSize(zoom_panel.getPreferredSize());
frame.setVisible(false);
frame.setResizable(false);
frame.setResizable(true);
frame.setFrameIcon(createIcon("icons/preview.png"));
addMouseListener(this);
addMouseMotionListener(this);
......@@ -88,12 +110,11 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
return;
}
l=l_;
//Somehow there are always added 4 pixels to the actual height of the layout
setPreferredSize(new Dimension(l.width,l.height-4));
setMinimumSize(new Dimension(l.width,l.height-4));
setMaximumSize(new Dimension(l.width,l.height-4));
setSize(l.width,l.height-4);
frame.setTitle("Window: "+w_.id + " - Layout: " + l.id);
setPreferredSize(new Dimension(l.width,l.height));
int spane_w = l.width+scroll_pane.getBorder().getBorderInsets(scroll_pane).left+scroll_pane.getBorder().getBorderInsets(scroll_pane).right;
int spane_h = l.height+scroll_pane.getBorder().getBorderInsets(scroll_pane).top+scroll_pane.getBorder().getBorderInsets(scroll_pane).bottom;
scroll_pane.setPreferredSize(new Dimension(spane_w, spane_h));
frame.setTitle("Window: "+w_.id + " - Layout: " + l.id);
frame.pack();
frame.setVisible(true);
if(fu==null) {
......@@ -115,6 +136,7 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
* Paints the selected layout into the window.
* @param g The Graphics context into which is drawn.
*/
@Override
public void paint(Graphics g) {
if(l==null) return;
BufferedImage bi = (BufferedImage) createImage(getWidth(),getHeight());
......@@ -129,27 +151,49 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
g2d.fillRect(x+10,y+10,10,10);
}
}
l.draw(g2d);
try {
l.draw(g2d, z);
}
//In case any exception occurs while trying to draw the layout (e.g. missing bitmap/negative or zero width of items)
catch(Exception e) {
e.printStackTrace();
}
g.drawImage(bi, 0, 0, this);
}
@Override
public void update(Graphics g) {
//Needs to be overriden so that repainting is smooth
paint(g);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(zoom_less)) {
if(z>1) z--;
zoom_label.setText("Zoom factor: "+z+"x");
setSize(l.width*z, l.height*z);
setPreferredSize(new Dimension(l.width*z, l.height*z));
}
else if(e.getSource().equals(zoom_more)) {
if(z<16) z++;
zoom_label.setText("Zoom factor: "+z+"x");
setSize(l.width*z, l.height*z);
setPreferredSize(new Dimension(l.width*z, l.height*z));
}
}
public void mouseClicked(MouseEvent e) {
}
public void mouseDragged(MouseEvent e) {
if(selected_item==null) return;
if(!starteddragging && selected_item.contains(e.getX(),e.getY())) {
dragstartx=e.getX();
dragstarty=e.getY();
if(!starteddragging && selected_item.contains(e.getX()/z,e.getY()/z)) {
dragstartx=e.getX()/z;
dragstarty=e.getY()/z;
ime = new ItemMoveEvent(selected_item);
dragstartitemx=selected_item.x;
dragstartitemy=selected_item.y;
starteddragging=true;
}
else if(starteddragging) {
selected_item.x=dragstartitemx+e.getX()-dragstartx;
selected_item.y=dragstartitemy+e.getY()-dragstarty;
selected_item.x=dragstartitemx+e.getX()/z-dragstartx;
selected_item.y=dragstartitemy+e.getY()/z-dragstarty;
}
}
public void mouseEntered(MouseEvent e) {
......@@ -160,7 +204,7 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
}
public void mouseMoved(MouseEvent e) {
if(selected_item==null) return;
if(selected_item.contains(e.getX(),e.getY())) {
if(selected_item.contains(e.getX()/z,e.getY()/z)) {
selected_item.setHover(true);
setCursor(new Cursor(Cursor.MOVE_CURSOR));
}
......@@ -229,7 +273,7 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
public void savePNG(File f) {
BufferedImage bi = new BufferedImage(l.width, l.height, BufferedImage.TYPE_INT_ARGB);
if(selected_item!=null) selected_item.setSelected(false);
l.draw(bi.createGraphics());
l.draw(bi.createGraphics(), 1);
if(selected_item!=null) selected_item.setSelected(true);
try {
ImageIO.write(bi, "png", f);
......@@ -238,5 +282,5 @@ public class PreviewWindow extends JPanel implements MouseListener, MouseMotionL
JOptionPane.showMessageDialog(m,"Could not save image!\n"+e.toString(),"Exception caught!",JOptionPane.ERROR_MESSAGE);
return;
}
}
}
}
......@@ -279,20 +279,21 @@ public class Anchor extends Item implements ActionListener{
//if (id!=ID_DEFAULT) code+="<!-- id=\""+id+"\" -->";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
public void draw(Graphics2D g,int x_,int y_) {
public void draw(Graphics2D g,int x_,int y_, int z) {
if(!created) return;
if(selected) {
g.setColor(Color.RED);
for(float f=0f;f<=1f;f=f+0.1f) {
Point2D.Float p1 = b.getPoint(f);
Point2D.Float p2 = b.getPoint(f+0.1f);
g.drawLine((int)p1.getX()+x+x_,(int)p1.getY()+y+y_,(int)p2.getX()+x+x_,(int)p2.getY()+y+y_);
g.drawLine((int)(p1.getX()+x+x_)*z,(int)(p1.getY()+y+y_)*z,(int)(p2.getX()+x+x_)*z,(int)(p2.getY()+y+y_)*z);
}
g.setColor(Color.YELLOW);
for(int i=0;i<xpos.length;i++) {
g.fillOval(xpos[i]+x+x_-1,ypos[i]+y+y_-1,3,3);
g.fillOval((xpos[i]+x+x_-1)*z,(ypos[i]+y+y_-1)*z,3,3);
}
}
}
......
......@@ -390,19 +390,26 @@ public class Button extends Item implements ActionListener{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
java.awt.image.BufferedImage bi = s.getBitmapImage(up);
if(!hovered || ( (over.equals("none") && !clicked)||(clicked && down.equals("none")) ) ) g.drawImage(bi,x+x_,y+y_,null);
else if(!clicked || down.equals("none"))g.drawImage(s.getBitmapImage(over),x+x_,y+y_,null);
else g.drawImage(s.getBitmapImage(down),x+x_,y+y_,null);
java.awt.image.BufferedImage bi;
if(!hovered || ( (over.equals("none") && !clicked)||(clicked && down.equals("none")) ) ) {
bi = s.getBitmapImage(up);
}
else if(!clicked || down.equals("none")) {
bi = s.getBitmapImage(over);
}
else {
bi = s.getBitmapImage(down);
}
g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,bi.getWidth()-1,bi.getHeight()-1);
g.drawRect((x+x_)*z,(y+y_)*z,bi.getWidth()*z-1,bi.getHeight()*z-1);
}
}
@Override
......
......@@ -530,26 +530,27 @@ public class Checkbox extends Item implements ActionListener{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
java.awt.image.BufferedImage bi = s.getBitmapImage(up2);
java.awt.image.BufferedImage bi = null;
if(s.gvars.parseBoolean(state)) {
if(!hovered || ( (over2.equals("none") && !clicked)||(clicked && down2.equals("none")) )) g.drawImage(bi,x+x_,y+y_,null,null);
else if(!clicked || down2.equals("none")) g.drawImage(s.getBitmapImage(over2),x+x_,y+y_,null);
else g.drawImage(s.getBitmapImage(down2),x+x_,y+y_,null);
if(!hovered || ( (over2.equals("none") && !clicked)||(clicked && down2.equals("none")) )) bi = s.getBitmapImage(up2);
else if(!clicked || down2.equals("none")) bi = s.getBitmapImage(over2);
else bi = s.getBitmapImage(down2);
}
else {
if(!hovered || ( (over1.equals("none") && !clicked)||(clicked && down1.equals("none")) )) g.drawImage(s.getBitmapImage(up1),x+x_,y+y_,null);
else if(!clicked || down1.equals("none")) g.drawImage(s.getBitmapImage(over1),x+x_,y+y_,null);
else g.drawImage(s.getBitmapImage(down1),x+x_,y+y_,null);
if(!hovered || ( (over1.equals("none") && !clicked)||(clicked && down1.equals("none")) )) bi = s.getBitmapImage(up1);
else if(!clicked || down1.equals("none")) bi = s.getBitmapImage(over2);
else bi = s.getBitmapImage(down2);
}
g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,bi.getWidth()-1,bi.getHeight()-1);
g.drawRect((x+x_)*z,(y+y_)*z,bi.getWidth()*z-1,bi.getHeight()*z-1);
}
}
@Override
......
......@@ -257,12 +257,12 @@ public class Group extends Item implements ActionListener{
code+="\n"+indent+"</Group>";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
public void draw(Graphics2D g,int x_,int y_) {
public void draw(Graphics2D g,int x_,int y_, int z) {
for(Item i:items) {
i.draw(g,x+x,y+y_);
i.draw(g,x+x,y+y_,z);
i.setOffset(x+offsetx,y+offsety);
}
}
......
......@@ -373,16 +373,16 @@ public class Image extends Item implements ActionListener{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety, z);
}
public void draw(Graphics2D g,int x_, int y_) {
public void draw(Graphics2D g,int x_, int y_, int z) {
if(!created) return;
java.awt.image.BufferedImage bi = s.getBitmapImage(image);
g.drawImage(bi,x+x_,y+y_,null);
g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,bi.getWidth()-1,bi.getHeight()-1);
g.drawRect((x+x_)*z,(y+y_)*z,bi.getWidth()*z-1,bi.getHeight()*z-1);
}
}
@Override
......
......@@ -369,12 +369,12 @@ public class Panel extends Item implements ActionListener{
code+="\n"+indent+"</Panel>";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx, offsety, z);
}
public void draw(Graphics2D g,int x_,int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
for(Item i:items) {
i.draw(g,x+x,y+y_);
i.draw(g, x+x, y+y_, z);
i.setOffset(x+offsetx,y+offsety);
}
if(selected) {
......
......@@ -629,27 +629,31 @@ public class Playtree extends Item implements ActionListener{
code+="\n"+indent+"</Playtree>";
return code;
}
public void draw(Graphics2D g) {
draw(g,0,0);
public void draw(Graphics2D g, int z) {
draw(g,0,0,z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g_, int x_, int y_, int z) {
if(width<=0||height<=0) return;
BufferedImage buffi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D)(buffi.getGraphics());
g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
Font f = s.getFont(font);
g.setFont(f);
FontMetrics fm = g.getFontMetrics();
if(!bgimage.equals("none")) {
g.drawImage(s.getBitmapImage(bgimage).getSubimage(0, 0, width, height),x+x_,y+y_,null);
g.drawImage(s.getBitmapImage(bgimage).getSubimage(0, 0, width, height),0,0,null);
}
else {
g.setColor(Color.decode(bgcolor1));
g.fillRect(x+x_,y+y_,width,height);
g.fillRect(0,0,width,height);
for(int i=fm.getHeight();i<height;i=i+fm.getHeight()*2) {
g.setColor(Color.decode(bgcolor2));
g.fillRect(x,y+y_+i,width,fm.getHeight());
g.fillRect(x,0+i,width,fm.getHeight());
}
}
int liney = y+y_;
int liney = 0;
BufferedImage cfi = s.getBitmapImage(closedimage);
BufferedImage ofi = s.getBitmapImage(openimage);
BufferedImage iti = s.getBitmapImage(itemimage);
......@@ -671,67 +675,69 @@ public class Playtree extends Item implements ActionListener{
g.setColor(Color.decode(fgcolor));
if(cfi!=null && !flat) {
g.drawImage(cfi,x+x_,liney+cfi_offset,null);
g.drawImage(cfi,0,liney+cfi_offset,null);
liney+=lineheight;
g.drawString("Closed folder",x+x_+cfi.getWidth()+2,liney-text_offset);
g.drawString("Closed folder",0+cfi.getWidth()+2,liney-text_offset);
}
if(ofi!=null && !flat) {
g.drawImage(ofi,x+x_,liney+ofi_offset,null);
g.drawImage(ofi,0,liney+ofi_offset,null);
liney+=lineheight;
g.drawString("Open folder",x+x_+ofi.getWidth()+2,liney-text_offset);
g.drawString("Open folder",0+ofi.getWidth()+2,liney-text_offset);
}
if(ofi!=null && iti!=null && !flat) {
g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null);
g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Normal item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
g.drawString("Normal item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
}
else if(iti!=null) {
g.drawImage(iti,x+x_,liney+iti_offset,null);
g.drawImage(iti,0,liney+iti_offset,null);
liney+=fm.getHeight();
g.drawString("Normal item",x+x_+iti.getWidth()+4,liney-text_offset);
g.drawString("Normal item",0+iti.getWidth()+4,liney-text_offset);
}
else {
liney+=fm.getHeight();
g.drawString("Normal item",x+x_,liney-text_offset);
g.drawString("Normal item",0,liney-text_offset);
}
g.setColor(Color.decode(playcolor));
if(ofi!=null && iti!=null && !flat) {
g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null);
g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Playing item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
g.drawString("Playing item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
}
else if(iti!=null) {
g.drawImage(iti,x+x_,liney+iti_offset,null);
g.drawImage(iti,0,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Playing item",x+x_+iti.getWidth()+2,liney-text_offset);
g.drawString("Playing item",0+iti.getWidth()+2,liney-text_offset);
}
else {
liney+=lineheight;
g.drawString("Playing item",x+x_,liney-text_offset);
g.drawString("Playing item",0,liney-text_offset);
}
g.setColor(Color.decode(selcolor));
g.fillRect(x+x_,liney,width,lineheight);
g.fillRect(0,liney,width,lineheight);
g.setColor(Color.decode(fgcolor));
if(ofi!=null && iti!=null && !flat) {
g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null);
g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Selected item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
g.drawString("Selected item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
}
else if(iti!=null) {
g.drawImage(iti,x+x_,liney+iti_offset,null);
g.drawImage(iti,0,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Selected item",x+x_+iti.getWidth()+2,liney-text_offset);
g.drawString("Selected item",0+iti.getWidth()+2,liney-text_offset);
}
else {
liney+=lineheight;
g.drawString("Selected item",x+x_,liney-text_offset);
g.drawString("Selected item",0,liney-text_offset);
}
slider.draw(g);
slider.draw(g,1);
g_.drawImage(buffi, (x+x_)*z, (y+y_)*z, width*z, height*z, null);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,width,height);
g_.setColor(Color.RED);
g_.drawRect((x+x_)*z,(y+y_)*z,width*z-1,height*z-1);
}
}
@Override
......
......@@ -94,10 +94,10 @@ public class RadialSlider extends Item{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
public void draw(Graphics2D g, int z) {
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
}
public DefaultMutableTreeNode getTreeNode() {
......
......@@ -542,31 +542,32 @@ public class Slider extends Item implements ActionListener{
}
return code;
}
public void draw(Graphics2D g) {
draw(g,0,0);
public void draw(Graphics2D g, int z) {
draw(g,0,0,z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
offsetx=x_;
offsety=y_;
if(s.gvars.parseBoolean(visible)==false) return;
if(sbg!=null) {
sbg.draw(g,x+x_,y+y_);
sbg.draw(g,x+x_,y+y_,z);
sbg.setOffset(x+offsetx,y+offsety);
}
java.awt.image.BufferedImage si = s.getBitmapImage(up);
if(si==null) return;
Point2D.Float p = b.getPoint(s.gvars.getSliderValue());
g.drawImage(si,(int)p.getX()+x+x_-si.getWidth()/2,(int)p.getY()+y+y_-si.getHeight()/2,null);
g.drawImage(si,(int)(p.getX()+x+x_-si.getWidth()/2)*z,(int)(p.getY()+y+y_-si.getHeight()/2)*z,si.getWidth()*z,si.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
for(float f=0f;f<=1f;f=f+0.1f) {
Point2D.Float p1 = b.getPoint(f);
Point2D.Float p2 = b.getPoint(f+0.1f);
g.drawLine((int)p1.getX()+x+x_,(int)p1.getY()+y+y_,(int)p2.getX()+x+x_,(int)p2.getY()+y+y_);
g.drawLine((int)(p1.getX()+x+x_)*z,(int)(p1.getY()+y+y_)*z,(int)(p2.getX()+x+x_)*z,(int)(p2.getY()+y+y_)*z);
}
g.setColor(Color.YELLOW);
for(int i=0;i<xpos.length;i++) {
g.fillOval(xpos[i]+x+x_-1,ypos[i]+y+y_-1,3,3);
g.fillOval((xpos[i]+x+x_-1)*z,(ypos[i]+y+y_-1)*z,3,3);
}
}
}
......
......@@ -262,10 +262,10 @@ public class SliderBackground extends Item implements ActionListener{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
draw(g,0,0);
public void draw(Graphics2D g, int z) {
draw(g,0,0,z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
bi = (BufferedImage)s.getBitmapImage(image);
if(bi==null) return;
......@@ -279,10 +279,10 @@ public class SliderBackground extends Item implements ActionListener{
int fxpos = n%nbhoriz;
if (fxpos<0) fxpos=0;
bi = bi.getSubimage(fxpos*fwidth+fxpos*padhoriz, fypos*fheight+fypos*padvert ,fwidth,fheight);
g.drawImage(bi,x+x_,y+y_,null);
g.drawImage(bi,(x+x_)*z,(y+y_)*z, bi.getWidth()*z, bi.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,bi.getWidth()-1,bi.getHeight()-1);
g.drawRect((x+x_)*z,(y+y_)*z,bi.getWidth()*z-1,bi.getHeight()*z-1);
}
}
@Override
......
......@@ -402,10 +402,10 @@ public class Text extends Item implements ActionListener{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
draw(g,0,0);
public void draw(Graphics2D g, int z) {
draw(g,0,0,z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created || font==null) return;
if(s.gvars.parseBoolean(visible)==false) return;
Font f = s.getFont(font);
......@@ -440,10 +440,10 @@ public class Text extends Item implements ActionListener{
else {
g2d.drawString(ptext,0,0+g2d.getFontMetrics().getAscent());
}
g.drawImage(bi,x+x_,y+y_,null);
g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z, bi.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,width,f.getSize());
g.drawRect((x+x_)*z,(y+y_)*z,width*z,f.getSize()*z);
}
}
@Override
......
......@@ -343,17 +343,17 @@ public class Video extends Item implements ActionListener{
code+="/>";
return code;
}
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety, z);
}
public void draw(Graphics2D g, int x_, int y_) {
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
g.setColor(Color.BLACK);
g.fillRect(x+x_,y+y_,width,height);
g.fillRect((x+x_)*z,(y+y_)*z,width*z,height*z);
if(selected) {
g.setColor(Color.RED);
g.drawRect(x+x_,y+y_,width-1,height-1);
g.drawRect((x+x_)*z,(y+y_)*z,width*z-1,height*z-1);
}
}
@Override
......