Commit af69821f authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Release 0.3.5a finished

All items are rendered more or less properly (except sliders, there only the background is rendered)
parent 271ce7ca
VLC Skin Editor release 0.3.0b
VLC Skin Editor release 0.3.5a
-----------------------------------------------------------
Changelog:
-----------------------------------------------------------
0.3.5a - Preview of Layouts
- XML parsing/generating fixes
0.3.0b - All items can be edited
- Theme attributes can be edited
- VLT packages can be exported
......@@ -25,19 +27,16 @@ Changelog:
-----------------------------------------------------------
System Requirements
-----------------------------------------------------------
Java Runtime Environment 6+ (java.sun.com)
at least 256MB RAM and a half-decent cpu
Java SE RE 6 or later (DL at java.sun.com)
approximately at least 256MB RAM and a 500-1000MHz CPU
-----------------------------------------------------------
Usage:
-----------------------------------------------------------
To run the skin editor simply open the jar file.
Or manually run "java -jar VLCSkinEditor.jar".
To edit things select the item in the trees and click on
the edit button. To add things use the add buttons. Self-
explanatory isn't it?
-----------------------------------------------------------
Copyright:
-----------------------------------------------------------
(c)2007 Daniel "aLtgLasS" Dreibrodt (altglass@nurfuerspam.de)
(c)2007 Daniel "aLtgLasS" Dreibrodt
(altglass@nurfuerspam.de)
See LICENSE.TXT for further details
\ No newline at end of file
......@@ -25,6 +25,7 @@ package vlcskineditor.Items;
import vlcskineditor.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.tree.*;
......@@ -66,7 +67,6 @@ public class Playtree extends Item implements ActionListener{
Slider slider = null;
JFrame frame = null;
JTextField id_tf, x_tf, y_tf, help_tf, visible_tf, width_tf, height_tf;
JTextField font_tf, bgimage_tf, itemimage_tf, openimage_tf, closedimage_tf;
......@@ -546,7 +546,7 @@ public class Playtree extends Item implements ActionListener{
Font f = s.getFont(font);
g.setFont(f);
FontMetrics fm = g.getFontMetrics();
if(!bgimage.startsWith("none")) {
if(!bgimage.equals("none")) {
g.drawImage(s.getBitmapImage(bgimage),x+x_,y+y_,null);
}
else {
......@@ -557,6 +557,83 @@ public class Playtree extends Item implements ActionListener{
g.fillRect(x,y+y_+i,width,fm.getHeight());
}
}
int liney = y+y_;
BufferedImage cfi = s.getBitmapImage(closedimage);
BufferedImage ofi = s.getBitmapImage(openimage);
BufferedImage iti = s.getBitmapImage(itemimage);
int lineheight = fm.getHeight();
if(cfi!=null) {
if(cfi.getHeight()>lineheight) lineheight=cfi.getHeight();
}
if(ofi!=null) {
if(ofi.getHeight()>lineheight) lineheight=ofi.getHeight();
}
if(iti!=null) {
if(iti.getHeight()>lineheight) lineheight=iti.getHeight();
}
int text_offset = (lineheight-fm.getAscent())/2;
int cfi_offset = (lineheight-cfi.getHeight())/2;
int ofi_offset = (lineheight-ofi.getHeight())/2;
int iti_offset = (lineheight-iti.getHeight())/2;
g.setColor(Color.decode(fgcolor));
if(cfi!=null && !flat) {
g.drawImage(cfi,x+x_,liney+cfi_offset,null);
liney+=lineheight;
g.drawString("Closed folder",x+x_+cfi.getWidth()+2,liney-text_offset);
}
if(ofi!=null && !flat) {
g.drawImage(ofi,x+x_,liney+ofi_offset,null);
liney+=lineheight;
g.drawString("Open folder",x+x_+ofi.getWidth()+2,liney-text_offset);
}
if(ofi!=null && iti!=null && !flat) {
g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Normal item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
}
else if(iti!=null) {
g.drawImage(iti,x+x_,liney+iti_offset,null);
liney+=fm.getHeight();
g.drawString("Normal item",x+x_+iti.getWidth()+4,liney-text_offset);
}
else {
liney+=fm.getHeight();
g.drawString("Normal item",x+x_,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);
liney+=lineheight;
g.drawString("Playing item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
}
else if(iti!=null) {
g.drawImage(iti,x+x_,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Playing item",x+x_+iti.getWidth()+2,liney-text_offset);
}
else {
liney+=lineheight;
g.drawString("Playing item",x+x_,liney-text_offset);
}
g.setColor(Color.decode(selcolor));
g.fillRect(x+x_,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);
liney+=lineheight;
g.drawString("Selected item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset);
}
else if(iti!=null) {
g.drawImage(iti,x+x_,liney+iti_offset,null);
liney+=lineheight;
g.drawString("Selected item",x+x_+iti.getWidth()+2,liney-text_offset);
}
else {
liney+=lineheight;
g.drawString("Selected item",x+x_,liney-text_offset);
}
slider.draw(g);
}
public DefaultMutableTreeNode getTreeNode() {
......
......@@ -348,13 +348,8 @@ public class Text extends Item implements ActionListener{
}
else {
g2d.drawString(text,0,0+g2d.getFontMetrics().getAscent());
}
g.drawImage(bi,x+x_,y+y_,null);
}
g.drawImage(bi,x+x_,y+y_,null);
}
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Text: "+id);
......
......@@ -109,7 +109,19 @@ public class Bitmap extends Resource implements ActionListener{
public void update() {
try {
image = ImageIO.read(new File(s.skinfolder+file));
image = image.getSubimage(0,0,image.getWidth(),image.getHeight()/nbframes);
image = image.getSubimage(0,0,image.getWidth(),image.getHeight()/nbframes);
BufferedImage bi = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_ARGB);
Graphics g2d = bi.createGraphics();
int alphargb = Color.decode(alphacolor).getRGB();
for(int x=0;x<image.getWidth();x++) {
for(int y=0;y<image.getHeight();y++) {
if(image.getRGB(x,y)!=alphargb) {
g2d.setColor(new Color(image.getRGB(x,y)));
g2d.drawRect(x,y,0,0);
}
}
}
image = bi;
for(int i=0;i<SubBitmaps.size();i++) {
SubBitmaps.get(i).update(image);
}
......
......@@ -66,7 +66,7 @@ public class Font extends Resource implements ActionListener{
showOptions();
}
else {
JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it. In the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE);
try {
f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString()));
f = f.deriveFont(12);
......@@ -90,8 +90,21 @@ public class Font extends Resource implements ActionListener{
}
catch(Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file","Font file not valid",JOptionPane.INFORMATION_MESSAGE);
showOptions();
if(file.indexOf(".otf")==-1) {
JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE);
showOptions();
}
else {
JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE);
try {
f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString()));
f = f.deriveFont(12);
}
catch(Exception ex) {
ex.printStackTrace();
f=null;
}
}
}
}
public Font(Skin s_, File f_) {
......@@ -105,8 +118,21 @@ public class Font extends Resource implements ActionListener{
}
catch(Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file","Font file not valid",JOptionPane.INFORMATION_MESSAGE);
showOptions();
if(file.indexOf(".otf")==-1) {
JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE);
showOptions();
}
else {
JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE);
try {
f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString()));
f = f.deriveFont(12);
}
catch(Exception ex) {
ex.printStackTrace();
f=null;
}
}
}
}
public Font(Skin s_) {
......@@ -132,8 +158,21 @@ public class Font extends Resource implements ActionListener{
}
catch(Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file","Font file not valid",JOptionPane.INFORMATION_MESSAGE);
showOptions();
if(file.indexOf(".otf")==-1) {
JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE);
showOptions();
}
else {
JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE);
try {
f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString()));
f = f.deriveFont(12);
}
catch(Exception ex) {
ex.printStackTrace();
f=null;
}
}
}
}
......
......@@ -62,6 +62,7 @@ public class SubBitmap extends Resource implements ActionListener{
public SubBitmap(Skin s_,BufferedImage parent_) {
s=s_;
parent=parent_;
type="Bitmap";
id = "Unnamed subbitmap #"+s.getNewId();
x = 0;
y = 0;
......@@ -71,7 +72,7 @@ public class SubBitmap extends Resource implements ActionListener{
showOptions();
}
public void update() {
image = parent.getSubimage(x,y,width,height);
image = parent.getSubimage(x,y,width,height);
s.updateResources();
}
public void update(BufferedImage parent_) {
......
......@@ -25,6 +25,7 @@ package vlcskineditor;
import vlcskineditor.Resources.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import javax.swing.*;
import javax.swing.tree.*;
......@@ -379,7 +380,7 @@ public class Skin implements ActionListener{
return r;
}
/** Returns the image object of a bitmap **/
public Image getBitmapImage(String id) {
public BufferedImage getBitmapImage(String id) {
Resource r = getResource(id);
if(r==null) {
return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment