Commit 6591f2a8 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Cancel buttons for items, items can be moved with ctrl+DIRECTION

parent 4cfee9a9
VLC Skin Editor release 0.5.0a
VLC Skin Editor release 0.6.0a
-----------------------------------------------------------
Changelog:
-----------------------------------------------------------
0.6.0a - Resources/windows/layouts/items can be edited by
doubleclicking on them in the hiearchy trees
- Sliders are rendered completely as in VLC
- Cancel buttons for editing dialogs
- Items can be moved in the preview window with the
arrow keys when the preview window is focused and
the CONTROL button is pressed.
0.5.0a - Boolean variables are interpreted in the preview
- Global variables can be edited (boolean only atm)
- Preview window perfomance improvements
......
......@@ -65,6 +65,7 @@ public abstract class Item {
public int offsetx = 0;
public int offsety = 0;
/** Determines whether the process of creating the object has finished **/
public boolean created = false;
/** Creates a new instance of Item */
......
......@@ -227,12 +227,9 @@ public class Anchor extends Item implements ActionListener{
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l==null) frame.setVisible(false);
else l.remove(this);
}
else {
frame.setVisible(false);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public String returnCode() {
......@@ -249,6 +246,7 @@ public class Anchor extends Item implements ActionListener{
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g,int x_,int y_) {
if(!created) return;
if(selected) {
g.setColor(Color.RED);
for(float f=0f;f<=1f;f=f+0.1f) {
......
......@@ -48,7 +48,7 @@ public class Button extends Item implements ActionListener{
JFrame frame = null;
JTextField id_tf, x_tf, y_tf, help_tf, visible_tf, up_tf, down_tf, over_tf, action_tf, tooltiptext_tf;
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb;
JButton visible_btn, action_btn, ok_btn, help_btn;
JButton visible_btn, action_btn, ok_btn, cancel_btn, help_btn;
ActionEditor action_ae;
......@@ -69,6 +69,7 @@ public class Button extends Item implements ActionListener{
if(xmlcode.indexOf("ykeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"ykeepratio");
if(xmlcode.indexOf("tooltiptext=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"tooltiptext");
if(xmlcode.indexOf(" visible=\"")!=-1) visible = XML.getValue(xmlcode,"visible");
created = true;
}
public Button(Skin s_) {
s=s_;
......@@ -96,13 +97,14 @@ public class Button extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Button settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
......@@ -148,6 +150,8 @@ public class Button extends Item implements ActionListener{
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -227,6 +231,7 @@ public class Button extends Item implements ActionListener{
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -315,6 +320,13 @@ public class Button extends Item implements ActionListener{
if (action_ae==null) action_ae = new ActionEditor(this);
action_ae.editAction(action_tf.getText());
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public void actionWasEdited(ActionEditor ae) {
if(ae==action_ae) action_tf.setText(ae.getCode());
......@@ -342,6 +354,7 @@ public class Button extends Item implements ActionListener{
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g, int x_, int y_) {
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);
......
......@@ -59,7 +59,7 @@ public class Checkbox extends Item implements ActionListener{
JTextField id_tf, x_tf, y_tf, help_tf, visible_tf, up1_tf, down1_tf, over1_tf, action1_tf, tooltiptext1_tf;
JTextField up2_tf, down2_tf, over2_tf, action2_tf, tooltiptext2_tf, state_tf;
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb;
JButton visible_btn, action1_btn, action2_btn, state_btn, ok_btn, help_btn;
JButton visible_btn, action1_btn, action2_btn, state_btn, ok_btn, cancel_btn, help_btn;
ActionEditor action1_ae, action2_ae;
......@@ -88,6 +88,7 @@ public class Checkbox extends Item implements ActionListener{
if(xmlcode.indexOf(" xkeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"xkeepratio");
if(xmlcode.indexOf(" ykeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"ykeepratio");
if(xmlcode.indexOf(" visible=\"")!=-1) visible = XML.getValue(xmlcode,"visible");
created = true;
}
public Checkbox(Skin s_) {
s = s_;
......@@ -123,6 +124,7 @@ public class Checkbox extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
......@@ -193,6 +195,8 @@ public class Checkbox extends Item implements ActionListener{
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -314,6 +318,7 @@ public class Checkbox extends Item implements ActionListener{
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -443,6 +448,13 @@ public class Checkbox extends Item implements ActionListener{
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skins2-create.html",JOptionPane.WARNING_MESSAGE);
}
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public void actionWasEdited(ActionEditor ae) {
if(ae==action1_ae) action1_tf.setText(action1_ae.getCode());
......@@ -475,6 +487,7 @@ public class Checkbox extends Item implements ActionListener{
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g, int x_, int y_) {
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
java.awt.image.BufferedImage bi = s.getBitmapImage(up2);
if(s.gvars.parseBoolean(state)) {
......
......@@ -40,7 +40,7 @@ public class Group extends Item implements ActionListener{
public java.util.List<Item> items = new ArrayList<Item>();
JFrame frame = null;
JTextField id_tf, x_tf, y_tf;
JButton ok_btn, help_btn;
JButton ok_btn, cancel_btn, help_btn;
/** Creates a new instance of Group */
public Group(String xmlcode, Skin s_) {
......@@ -103,6 +103,7 @@ public class Group extends Item implements ActionListener{
for(Item i:items) {
i.setOffset(x,y);
}
created = true;
}
public Group(Skin s_) {
type="Group";
......@@ -121,13 +122,14 @@ public class Group extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Group settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
......@@ -138,6 +140,8 @@ public class Group extends Item implements ActionListener{
y_tf.setDocument(new NumbersOnlyDocument());
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -161,6 +165,7 @@ public class Group extends Item implements ActionListener{
frame.add(general);
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -205,6 +210,13 @@ public class Group extends Item implements ActionListener{
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skins2-create.html",JOptionPane.WARNING_MESSAGE);
}
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public String returnCode() {
String code = "<Group";
......@@ -221,7 +233,7 @@ public class Group extends Item implements ActionListener{
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g,int x_,int y_) {
public void draw(Graphics2D g,int x_,int y_) {
for(Item i:items) {
i.draw(g,x+x,y+y_);
i.setOffset(x+offsetx,y+offsety);
......
......@@ -46,7 +46,7 @@ public class Image extends Item implements ActionListener{
JFrame frame = null;
JTextField id_tf, x_tf, y_tf, help_tf, visible_tf, image_tf, action2_tf;
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb, resize_cb, action_cb;
JButton visible_btn, action2_btn, ok_btn, help_btn;
JButton visible_btn, action2_btn, ok_btn, cancel_btn, help_btn;
ActionEditor action2_ae;
......@@ -68,6 +68,7 @@ public class Image extends Item implements ActionListener{
if(xmlcode.indexOf("xkeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"xkeepratio");
if(xmlcode.indexOf("ykeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"ykeepratio");
if(xmlcode.indexOf(" visible=\"")!=-1) visible = XML.getValue(xmlcode,"visible");
created = true;
}
public Image(Skin s_) {
s = s_;
......@@ -94,13 +95,14 @@ public class Image extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Image settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
......@@ -150,6 +152,8 @@ public class Image extends Item implements ActionListener{
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -225,6 +229,7 @@ public class Image extends Item implements ActionListener{
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -301,6 +306,13 @@ public class Image extends Item implements ActionListener{
}
}
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public void actionWasEdited(ActionEditor ae) {
if(ae==action2_ae) action2_tf.setText(action2_ae.getCode());
......@@ -326,6 +338,7 @@ public class Image extends Item implements ActionListener{
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g,int x_, int y_) {
if(!created) return;
java.awt.image.BufferedImage bi = s.getBitmapImage(image);
g.drawImage(bi,x+x_,y+y_,null);
if(selected) {
......
......@@ -44,7 +44,7 @@ public class Panel extends Item implements ActionListener{
JFrame frame = null;
JTextField id_tf, x_tf, y_tf, width_tf, height_tf, help_tf, visible_tf;
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb;
JButton ok_btn, help_btn;
JButton ok_btn, cancel_btn, help_btn;
/** Creates a new instance of Panel */
public Panel(String xmlcode, Skin s_) {
......@@ -114,6 +114,7 @@ public class Panel extends Item implements ActionListener{
for(Item i:items) {
i.setOffset(x,y);
}
created = true;
}
public Panel(Skin s_) {
type = "Panel";
......@@ -144,13 +145,14 @@ public class Panel extends Item implements ActionListener{
i.setOffset(x,y);
}
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Panel settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
......@@ -185,6 +187,8 @@ public class Panel extends Item implements ActionListener{
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -247,6 +251,7 @@ public class Panel extends Item implements ActionListener{
frame.add(dim);
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -301,6 +306,13 @@ public class Panel extends Item implements ActionListener{
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skins2-create.html",JOptionPane.WARNING_MESSAGE);
}
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public String returnCode() {
String code = "<Panel";
......@@ -322,7 +334,7 @@ public class Panel extends Item implements ActionListener{
public void draw(Graphics2D g) {
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g,int x_,int y_) {
public void draw(Graphics2D g,int x_,int y_) {
for(Item i:items) {
i.draw(g,x+x,y+y_);
i.setOffset(x+offsetx,y+offsety);
......
......@@ -548,12 +548,9 @@ public class Playtree extends Item implements ActionListener{
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l==null) frame.setVisible(false);
else l.remove(this);
}
else {
frame.setVisible(false);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public String returnCode() {
......@@ -590,6 +587,7 @@ public class Playtree extends Item implements ActionListener{
draw(g,0,0);
}
public void draw(Graphics2D g, int x_, int y_) {
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
Font f = s.getFont(font);
g.setFont(f);
......
......@@ -434,7 +434,7 @@ public class Slider extends Item implements ActionListener{
}
else if(e.getSource().equals(sbg_chb)) {
if(sbg_chb.isSelected()) {
sbg = new SliderBackground(s);
sbg = new SliderBackground(s,this);
sbg_btn.setEnabled(true);
}
else {
......@@ -463,14 +463,17 @@ public class Slider extends Item implements ActionListener{
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l==null) frame.setVisible(false);
else l.remove(this);
}
else {
frame.setVisible(false);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public void removeBG() {
if(sbg==null) return;
sbg = null;
sbg_chb.setSelected(false);
sbg_btn.setEnabled(false);
}
public String returnCode() {
String code = "<Slider";
if (id!=ID_DEFAULT) code+=" id=\""+id+"\"";
......@@ -502,6 +505,7 @@ public class Slider extends Item implements ActionListener{
draw(g,0,0);
}
public void draw(Graphics2D g, int x_, int y_) {
if(!created) return;
offsetx=x_;
offsety=y_;
if(s.gvars.parseBoolean(visible)==false) return;
......
......@@ -49,9 +49,10 @@ public class SliderBackground extends Item implements ActionListener{
JFrame frame;
JTextField id_tf, image_tf, nbhoriz_tf, nbvert_tf, padhoriz_tf, padvert_tf;
JButton gen_btn, ok_btn, help_btn;
JButton gen_btn, ok_btn, cancel_btn, help_btn;
BufferedImage bi = null;
String bitmap_str = "";
Slider sl;
/** Creates a new instance of SliderBackground */
......@@ -64,9 +65,11 @@ public class SliderBackground extends Item implements ActionListener{
if(xmlcode.indexOf("padvert=\"")!=-1) padvert = XML.getIntValue(xmlcode,"padvert");
if(xmlcode.indexOf("id=\"")!=-1) id = XML.getValue(xmlcode,"id");
else id = "Unnamed slider background #"+s.getNewId();
created = true;
}
public SliderBackground(Skin s_) {
public SliderBackground(Skin s_, Slider sl_) {
s = s_;
sl = sl_;
image = "none";
id = "Unnamed slider background #"+s.getNewId();
showOptions();
......@@ -79,13 +82,14 @@ public class SliderBackground extends Item implements ActionListener{
padhoriz = Integer.parseInt(padhoriz_tf.getText());
padvert = Integer.parseInt(padvert_tf.getText());
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Slider background settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
gen_btn = new JButton("Open slider background wizard...");
......@@ -106,6 +110,8 @@ public class SliderBackground extends Item implements ActionListener{
padvert_tf.setDocument(new NumbersOnlyDocument());
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -151,6 +157,7 @@ public class SliderBackground extends Item implements ActionListener{
frame.add(specific);
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -204,7 +211,11 @@ public class SliderBackground extends Item implements ActionListener{
}
}
else if(e.getSource().equals(gen_btn)) {
//TODO
}
else if(e.getSource().equals(cancel_btn)) {
frame.setVisible(false);
if(!created) sl.removeBG();
}
}
public String returnCode() {
......
......@@ -52,7 +52,7 @@ public class Text extends Item implements ActionListener{
JFrame frame = null;
JTextField id_tf, x_tf, y_tf, help_tf, visible_tf, text_tf, font_tf, color_tf, width_tf;
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb, alignment_cb, scrolling_cb;
JButton visible_btn, color_btn, ok_btn, help_btn;
JButton visible_btn, color_btn, ok_btn, cancel_btn, help_btn;
/** Creates a new instance of Text */
public Text(String xmlcode, Skin s_) {
......@@ -72,6 +72,7 @@ public class Text extends Item implements ActionListener{
if(xmlcode.indexOf(" xkeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"xkeepratio");
if(xmlcode.indexOf(" ykeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"ykeepratio");
if(xmlcode.indexOf(" visible=\"")!=-1) visible = XML.getValue(xmlcode,"visible");
created = true;
}
public Text(Skin s_) {
s = s_;
......@@ -100,13 +101,14 @@ public class Text extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Text settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
......@@ -157,6 +159,8 @@ public class Text extends Item implements ActionListener{
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -239,6 +243,7 @@ public class Text extends Item implements ActionListener{
frame.add(txt);
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -329,6 +334,13 @@ public class Text extends Item implements ActionListener{
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skins2-create.html",JOptionPane.WARNING_MESSAGE);
}
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public String returnCode() {
String code = "<Text";
......@@ -353,6 +365,7 @@ public class Text extends Item implements ActionListener{
draw(g,0,0);
}
public void draw(Graphics2D g, int x_, int y_) {
if(!created || font==null) return;
if(s.gvars.parseBoolean(visible)==false) return;
Font f = s.getFont(font);
if(f==null) {
......
......@@ -46,7 +46,7 @@ public class Video extends Item implements ActionListener{
JFrame frame = null;
JTextField id_tf, x_tf, y_tf, help_tf, visible_tf, width_tf, height_tf;
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb, autoresize_cb;
JButton visible_btn, ok_btn, help_btn;
JButton visible_btn, ok_btn, cancel_btn, help_btn;
/** Creates a new instance of Video */
public Video(String xmlcode, Skin s_) {
......@@ -63,6 +63,7 @@ public class Video extends Item implements ActionListener{
if(xmlcode.indexOf(" xkeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"xkeepratio");
if(xmlcode.indexOf(" ykeepratio=\"")!=-1) xkeepratio = XML.getBoolValue(xmlcode,"ykeepratio");
if(xmlcode.indexOf(" visible=\"")!=-1) visible = XML.getValue(xmlcode,"visible");
created = true;
}
public Video(Skin s_) {
s = s_;
......@@ -86,13 +87,14 @@ public class Video extends Item implements ActionListener{
s.updateItems();
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
created = true;
}
public void showOptions() {
if(frame==null) {
frame = new JFrame("Video settings");
frame.setResizable(false);
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
if(!created) frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
JLabel id_l = new JLabel("ID*:");
id_tf = new JTextField();
JLabel x_l = new JLabel("X:");
......@@ -135,6 +137,8 @@ public class Video extends Item implements ActionListener{
ok_btn = new JButton("OK");
ok_btn.addActionListener(this);
cancel_btn = new JButton("Cancel");
cancel_btn.addActionListener(this);
help_btn = new JButton("Help");
help_btn.addActionListener(this);
......@@ -203,6 +207,7 @@ public class Video extends Item implements ActionListener{
frame.add(video);
frame.add(ok_btn);
frame.add(cancel_btn);
frame.add(help_btn);
frame.add(new JLabel("* required attribute"));
......@@ -273,6 +278,13 @@ public class Video extends Item implements ActionListener{
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skins2-create.html",JOptionPane.WARNING_MESSAGE);
}
}
else if(e.getSource().equals(cancel_btn)) {
if(!created) {
java.util.List<Item> l = s.getParentListOf(id);
if(l!=null) l.remove(this);
}
frame.setVisible(false);
}
}
public String returnCode() {
String code = "<Video";
......@@ -295,6 +307,7 @@ public class Video extends Item implements ActionListener{
draw(g,offsetx,offsety);
}
public void draw(Graphics2D g, int x_, int y_) {
if(!created) return;
if(s.gvars.parseBoolean(visible)==false) return;
g.setColor(Color.BLACK);
g.fillRect(x+x_,y+y_,width,height);
......
......@@ -51,7 +51,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
JMenuBar mbar;
JMenu m_file, m_edit, m_help;
JMenuItem m_file_new, m_file_open, m_file_save, m_file_test, m_file_vlt, m_file_quit;
JMenuItem m_edit_theme, m_edit_global;
JMenuItem m_edit_theme, m_edit_global, m_edit_up, m_edit_down, m_edit_right, m_edit_left;
JMenuItem m_help_doc, m_help_about;
JDesktopPane jdesk;
JInternalFrame resources,windows,items,current_window;
......@@ -158,10 +158,27 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_edit_global.setMnemonic("G".charAt(0));
m_edit_global.setAccelerator(KeyStroke.getKeyStroke("ctrl G"));
m_edit_global.addActionListener(this);
m_edit_up = new JMenuItem("Move selected item up");
m_edit_up.setAccelerator(KeyStroke.getKeyStroke("ctrl UP"));
m_edit_up.addActionListener(this);
m_edit_down = new JMenuItem("Move selected item down");
m_edit_down.setAccelerator(KeyStroke.getKeyStroke("ctrl DOWN"));
m_edit_down.addActionListener(this);
m_edit_left = new JMenuItem("Move selected item left");
m_edit_left.setAccelerator(KeyStroke.getKeyStroke("ctrl LEFT"));
m_edit_left.addActionListener(this);
m_edit_right = new JMenuItem("Move selected item right");
m_edit_right.setAccelerator(KeyStroke.getKeyStroke("ctrl RIGHT"));
m_edit_right.addActionListener(this);
m_edit.add(m_edit_theme);
m_edit.addSeparator();
m_edit.add(m_edit_global);
m_edit.addSeparator();
m_edit.add(m_edit_up);
m_edit.add(m_edit_down);
m_edit.add(m_edit_left);
m_edit.add(m_edit_right);
m_help = new JMenu("Help");
m_help.setMnemonic("H".charAt(0));
......@@ -511,7 +528,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
fc = new JFileChooser();
fc.setCurrentDirectory(new File(vlc_skins_dir));
setVisible(true);
setVisible(true);
setSize(800,600);
Object[] options= {"Create a new skin", "Open an exisiting skin","Quit"};
......@@ -532,7 +549,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
String[] exts = { "xml","vlt" };
fc.setFileFilter(new CustomFileFilter(fc,exts,"*.xml (VLC XML-Skin Files), *.vlt (Packed XML-Skins)",false,vlc_dir));
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {