Commit 5de95d2f authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Translation system: Bitmap.java & Font.java

Bugfix: How GlobalVariables are taken into account, Slider drawing
new icons
specific post-update actions
parent 3b08552c
......@@ -37,7 +37,7 @@ OutputDir=.
[Registry]
Root: HKCR; Subkey: .vlt; ValueType: string; ValueData: VLCSkinFile; Flags: uninsdeletevalue
Root: HKCR; Subkey: VLCSkinFile; ValueType: string; ValueData: Compressed VLC Skin; Flags: uninsdeletevalue
Root: HKCR; Subkey: VLCSkinFile\DefaultIcon; ValueType: string; ValueData: """{app}\VLCSkineditor.exe"""
Root: HKCR; Subkey: VLCSkinFile\DefaultIcon; ValueType: string; ValueData: """{app}\VLCSkinEditor.exe,2"""
Root: HKCR; Subkey: VLCSkinFile\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\VLCSkinEditor.exe"" ""%1"""
Root: HKCR; Subkey: VLCSkinFile\shell\open; ValueType: string; ValueData: Edit with VLC Skin Editor
[_ISToolPreCompile]
......
No preview for this file type
......@@ -29,6 +29,7 @@ GROUP|Group
IMAGE|Image
PANEL|Panel
PLAYTREE|Playtree
RADIALSLIDER|Radial slider
SLIDER|Slider
SLIDERBG|SliderBackground
TEXT|Text
......@@ -82,8 +83,8 @@ ERROR_SAVEPNG_TITLE|Error while saving image
ERROR_SAVEPNG_MSG|Could not save image.
ERROR_NEWSKIN_TITLE|Error while creating new skin file!
ERROR_NEWSKIN_MSG|The new skin file could not be created.
ERROR_INVALID_HEADER|File appears not to be a valid VLC Theme!\n Invalid header:
ERROR_INVALID_FILE|Selected file is not a valid VLC skin file!
ERROR_HEADER_INVALID|File appears not to be a valid VLC Theme!\n Invalid header:
ERROR_SKIN_INVALID|Selected file is not a valid VLC skin file!
ERROR_VERSION_UNSUPPORTED|The version of the theme used in the selected skin is not yet supported!
ERROR_SAVE_TITLE|Error while saving the skin file!
ERROR_SAVE_MSG|Skin file could not be saved.
......@@ -101,6 +102,13 @@ ERROR_WIDTH_INVALID_TITLE|Width not valid
ERROR_WIDTH_INVALID_MSG|Please enter a valid width!
ERROR_HEIGHT_INVALID_TITLE|Height not valid
ERROR_HEIGHT_INVALID_MSG|Please enter a valid height!
ERROR_FILE_INVALID_TITLE|File not valid
ERROR_FILE_INVALID_MSG|Please choose a valid file!
ERROR_BITMAP_INVALID_MSG|The given bitmap file could not be loaded!\nPlease choose another one.
ERROR_NBFRAMES_TITLE|Invalid number of frames
ERROR_NBFRAMES_MSG|The number of frames cannot be smaller than 1
ERROR_OTF_TITLE|OTF not supported
ERROR_OTF_MSG|You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nYou will see another font in the preview.
#Other strings
THEMEINFO_NAME_DEFAULT|Unnamed Theme
......
......@@ -6,10 +6,33 @@ NOTE_STARRED|* Attributes marked with a star must be specified.
#Common strings
WIN_ITEM_GENERAL|General attributes
WIN_ITEM_ID|ID*:
WIN_ITEM_ID_TIP|Name of the %t (it may be used for actions). Must be unique.
WIN_ITEM_ID_TIP|Name and identificator of the %t. Must be unique.
WIN_ITEM_X|X:
WIN_ITEM_Y|Y:
WIN_ITEM_VISIBLE|Visibility:
FILE_INDIR|in the same folder as the XML file
#Bitmap
WIN_BITMAP_TITLE|Bitmap settings
WIN_BITMAP_FILE|File*:
WIN_BITMAP_FILE_TIP|"Indicates the path and name of the used image file.
WIN_BITMAP_OPEN|Open...
WIN_BITMAP_ALPHACOLOR|Alphacolor:
WIN_BITMAP_ALPHACOLOR_TIP|Transparency color of the bitmap in hexadecimal format. If your PNG file specifies a transparency mask, it will be taken into account too.
WIN_BITMAP_CHOOSE|Choose...
WIN_BITMAP_NBFRAMES|Number of frames:
WIN_BITMAP_NBFRAMES_TIP|This attribute is needed to define animated bitmaps; it is the number of frames (images) contained in your animation. All the different frames are just images laid vertically in the bitmap.
WIN_BITMAP_FPS|Frames per second:
WIN_BITMAP_FPS_TIP|Only used in animated bitmaps; it is the number of frames (images) per seconds of the animation.
WIN_BITMAP_ANIMATION|Animation attributes
WIN_BITMAP_CHOOSER_TITLE|Choose alphacolor
#Font
WIN_FONT_TITLE|Font settings
WIN_FONT_FILE|File*:
WIN_FONT_FILE_TIP|The file containing the used TrueType or OpenType font.
WIN_FONT_OPEN|Open...
WIN_FONT_SIZE|Size:
#Layout
WIN_LAYOUT_TITLE|Layout settings
......
......@@ -22,8 +22,6 @@
package vlcskineditor;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
......@@ -372,21 +370,27 @@ public class GlobalVariables implements ActionListener{
playlist_isLoop = Boolean.parseBoolean(loop_cb.getSelectedItem().toString());
playlist_isRepeat = Boolean.parseBoolean(repeat_cb.getSelectedItem().toString());
dvd_isActive = Boolean.parseBoolean(dvd_cb.getSelectedItem().toString());
slider_value = (float)(slider_s.getValue())/100;
slider_value = (float)(slider_s.getValue())/100;
sendUpdate();
}
/**
* Update all items according to the set variables
*/
public void sendUpdate() {
for(Window w:s.windows) {
for(Layout l:w.layouts) {
for(Layout l:w.layouts) {
for(Item i:l.items) {
i.updateToGlobalVariables();
}
}
}
}
/**
* Handles actions triggered by components listened to
* @param e ActionEvent
*/
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
update();
......
......@@ -47,12 +47,12 @@ import vlcskineditor.resources.SubBitmap;
*/
public class Main extends javax.swing.JFrame implements ActionListener, TreeSelectionListener, WindowListener, MouseListener{
private static final long serialVersionUID = 071;
private static final long serialVersionUID = 075;
private final String updateURL_s = "http://www.videolan.org/vlc/skineditor_update.php";
//The version identification of the current build.
public final String VERSION = "0.7.1.dev";
public final static String VERSION = "0.7.5.dev";
//The directory in which the VLC executable is found
String vlc_dir = "";
//The directory from which VLC loads its skins
......@@ -98,6 +98,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
public ImageIcon icon = createIcon("icons/icon.png");
public ImageIcon open_icon = createIcon("icons/open.png");
public ImageIcon save_icon = createIcon("icons/save.png");
public ImageIcon vlc_icon = createIcon("icons/vlc16x16.png");
public ImageIcon vlt_icon = createIcon("icons/vlt.png");
public ImageIcon new_icon = createIcon("icons/new.png");
public ImageIcon exit_icon = createIcon("icons/exit.png");
public ImageIcon resources_icon = createIcon("icons/resources.png");
......@@ -151,10 +153,12 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_file_save.setAccelerator(KeyStroke.getKeyStroke('S',mask));
m_file_save.addActionListener(this);
m_file_test = new JMenuItem(Language.get("MENU_FILE_TEST"));
m_file_test.setIcon(vlc_icon);
m_file_test.setMnemonic(Language.get("MENU_FILE_TEST_MN").charAt(0));
m_file_test.setAccelerator(KeyStroke.getKeyStroke('T',mask+InputEvent.SHIFT_DOWN_MASK));
m_file_test.addActionListener(this);
m_file_vlt = new JMenuItem(Language.get("MENU_FILE_VLT"));
m_file_vlt.setIcon(vlt_icon);
m_file_vlt.setMnemonic(Language.get("MENU_FILE_VLT_MN").charAt(0));
m_file_vlt.setAccelerator(KeyStroke.getKeyStroke('V',mask+InputEvent.SHIFT_DOWN_MASK));
m_file_vlt.addActionListener(this);
......@@ -359,11 +363,13 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
win_layout_up.setMaximumSize(new Dimension(24,12));
win_layout_up.setPreferredSize(new Dimension(24,12));
win_layout_up.addActionListener(this);
win_layout_up.setEnabled(false);
win_layout_down = new JButton("",down_icon);
win_layout_down.setToolTipText(Language.get("WIN_WIN_MOVE_DOWN"));
win_layout_down.setMaximumSize(new Dimension(24,12));
win_layout_down.setPreferredSize(new Dimension(24,12));
win_layout_down.addActionListener(this);
win_layout_down.setEnabled(false);
win_duplicate = new JButton("",copy_icon);
win_duplicate.setToolTipText(Language.get("WIN_WIN_COPY"));
win_duplicate.setMaximumSize(new Dimension(24,24));
......@@ -657,8 +663,9 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
FileDialog fd = new FileDialog(this);
fd.setMode(FileDialog.LOAD);
fd.setFilenameFilter(new FilenameFilter() {
@Override
public boolean accept(File f, String s) {
return f.getName().toUpperCase().matches("*.XML");
return f.getName().toUpperCase().endsWith(".XML");
}
});
fd.setVisible(true);
......@@ -791,6 +798,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
pwin.setVisible(false);
pwin.dispose();
hist = new History(this);
s.gvars.sendUpdate();
}
/**
* Shows a dialog to specify the new skin's location and creates an empty skin.
......@@ -819,6 +827,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
* Reacts to GUI actions
* @param e The performed action
*/
@Override
public void actionPerformed(ActionEvent e) {
// <editor-fold defaultstate="collapsed" desc="New File">
if(e.getSource().equals(m_file_new)) {
......@@ -947,7 +956,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
else if(e.getSource().equals(m_file_png)) {
JFileChooser png_fc = new JFileChooser();
png_fc.setAcceptAllFileFilterUsed(false);
png_fc.setFileFilter(new CustomFileFilter(png_fc, "png", "*.PNG (Portable Network Graphic)", false, ""));
png_fc.setFileFilter(new CustomFileFilter(png_fc, "png", "*.PNG (Portable Network Graphics)", false, ""));
int i = png_fc.showSaveDialog(this);
if(i==JFileChooser.APPROVE_OPTION) {
File f = png_fc.getSelectedFile();
......@@ -1483,29 +1492,34 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
/**
* Reacts to tree selections
*/
@Override
public void valueChanged(TreeSelectionEvent e) {
if(opening) return;
if(e.getSource().equals(res_tree)) {
String selection = e.getPath().getLastPathComponent().toString();
selected_resource = selection.substring(selection.indexOf(": ")+2);
selected_resource = selection.substring(selection.indexOf(": ")+2);
}
else if(e.getSource().equals(win_tree)) {
else if(e.getSource().equals(win_tree)) {
selected_in_windows = e.getPath().getLastPathComponent().toString();
Object[] path = e.getPath().getPath();
for (int i=0;i<path.length;i++) {
String type = path[i].toString().substring(0,path[i].toString().indexOf(": "));
if(type.equals("Window")) {
if(type.equals("Window")) {
selected_window = path[i].toString().substring(path[i].toString().indexOf(": ")+2);
selected_layout = null;
pvwin.clearLayout();
items_tree_model.setRoot(new DefaultMutableTreeNode("Root: Items"));
m_file_png.setEnabled(false);
items_tree_model.setRoot(new DefaultMutableTreeNode("Root: Items"));
win_layout_up.setEnabled(false);
win_layout_down.setEnabled(false);
}
else if(type.equals("Layout")) {
selected_layout = path[i].toString().substring(path[i].toString().indexOf(": ")+2);
pvwin.setLayout(s.getWindow(selected_window),s.getWindow(selected_window).getLayout(selected_layout));
m_file_png.setEnabled(true);
s.updateItems();
m_file_png.setEnabled(true);
win_layout_up.setEnabled(true);
win_layout_down.setEnabled(true);
}
}
}
......@@ -1514,11 +1528,14 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
selected_item = selection.substring(selection.indexOf(": ")+2);
pvwin.selectItem(s.getItem(selected_item));
}
}
}
@Override
public void windowClosing(WindowEvent e) {
exit();
}
@Override
public void windowClosed(WindowEvent e) {}
@Override
public void windowActivated(WindowEvent e) {
if(pvwin==null) return;
if(pvwin.fu==null) {
......@@ -1526,23 +1543,28 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
pvwin.fu.start();
}
}
@Override
public void windowDeactivated(WindowEvent e) {
if(pvwin==null || pvwin.fu==null) return;
pvwin.fu.run = false;
pvwin.fu = null;
}
@Override
public void windowDeiconified(WindowEvent e) {
if(pvwin.fu==null) {
pvwin.fu = new FrameUpdater(pvwin,5);
pvwin.fu.start();
}
}
@Override
public void windowIconified(WindowEvent e) {
if(pvwin==null || pvwin.fu==null) return;
pvwin.fu.run = false;
pvwin.fu = null;
}
public void windowOpened(WindowEvent e) {}
@Override
public void windowOpened(WindowEvent e) {}
@Override
public void mouseClicked(MouseEvent e) {
if(e.getClickCount()>1) {
if(e.getSource().equals(res_tree)) actionPerformed(new ActionEvent(res_edit,ActionEvent.ACTION_FIRST,"Doubleclick"));
......@@ -1570,9 +1592,13 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
}
}
}
@Override
public void mousePressed(MouseEvent e) {}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
/** Sets the activity state of the undo menu item to the given argument
* @param enabled Activity state
......@@ -1691,7 +1717,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
ZipInputStream zin = new ZipInputStream(new FileInputStream(tempfile));
ZipEntry entry;
while( (entry=zin.getNextEntry()) !=null ) {
if(!(System.getProperty("os.name").indexOf("Windows")==-1 && (entry.getName().endsWith("exe")||entry.getName().endsWith("dll")) )){
if(!(System.getProperty("os.name").indexOf("Windows")==-1 && (entry.getName().endsWith("exe")||entry.getName().endsWith("dll")))){
File outf = new File(entry.getName());
System.out.println(outf.getAbsoluteFile());
if(outf.exists()) outf.delete();
......@@ -1795,6 +1821,34 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
* @param args the command line arguments
*/
public static void main(String[] args) {
if(new File(".updated").exists()) {
//Post update steps for 0.7.5
System.out.println("Performing post-update steps to "+VERSION);
//Update system did not yet include exclusion for windows files on non-windows systems, so delete them
if(System.getProperty("os.name").indexOf("Windows")==-1) {
new File("VLCSkinEditor.exe").delete();
new File("ICE_JNIRegistry.dll").delete();
}
//VLT icon changed on windows
else {
try {
RegistryKey vlc_key = Registry.openSubkey(Registry.HKEY_CLASSES_ROOT,"VLCSkinFile\\DefaultIcon",RegistryKey.ACCESS_ALL);
if(vlc_key.hasDefaultValue()) {
RegistryValue icon = vlc_key.getValue("");
String s = new String(icon.getByteData())+",2";
icon.setByteData(s.getBytes());
vlc_key.setValue(icon);
}
}
catch (Exception e) {
System.err.println("Could not change VLT icon");
e.printStackTrace();
}
}
new File(".updated").delete();
}
Config.load();
Language.load(new File("lang"+File.separator+Config.get("language")+".txt"));
......
......@@ -161,7 +161,7 @@ public class Skin implements ActionListener{
if (header.indexOf("//VideoLAN//DTD VLC Skins")==-1) {
br.close();
System.err.println("Invalid header:\n"+header);
throw new Exception(Language.get("ERROR_INVALID_FILE"));
throw new Exception(Language.get("ERROR_SKIN_INVALID"));
}
//System.out.println("Valid header");
......@@ -272,7 +272,7 @@ public class Skin implements ActionListener{
Document doc = docBuilder.parse(f);
if(!doc.getDoctype().getName().equals("Theme"))
throw new Exception(Language.get("ERROR_INVALID_FILE"));
throw new Exception(Language.get("ERROR_SKIN_INVALID"));
NodeList nodes = doc.getElementsByTagName("*");
for(int i=0;i<nodes.getLength();i++) {
......
src/vlcskineditor/icons/icon16.png

1.53 KB | W: | H:

src/vlcskineditor/icons/icon16.png

3.29 KB | W: | H:

src/vlcskineditor/icons/icon16.png
src/vlcskineditor/icons/icon16.png
src/vlcskineditor/icons/icon16.png
src/vlcskineditor/icons/icon16.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -92,6 +92,7 @@ public class Button extends Item implements ActionListener{
id = Language.get("UNNAMED").replaceAll("%t",type).replaceAll("%i",String.valueOf(s.getNewId()));
showOptions();
}
@Override
public void update() {
if(!created) {
id = id_tf.getText();
......@@ -142,7 +143,9 @@ public class Button extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
}
updateToGlobalVariables();
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Button settings");
......@@ -308,6 +311,7 @@ public class Button extends Item implements ActionListener{
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
......@@ -367,6 +371,7 @@ public class Button extends Item implements ActionListener{
public void actionWasEdited(ActionEditor ae) {
if(ae==action_ae) action_tf.setText(ae.getCode());
}
@Override
public String returnCode(String indent) {
String code = indent+"<Button";
code+=" up=\""+up+"\"";
......@@ -386,9 +391,11 @@ public class Button extends Item implements ActionListener{
code+="/>";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
@Override
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
java.awt.image.BufferedImage bi;
......@@ -412,6 +419,7 @@ public class Button extends Item implements ActionListener{
java.awt.image.BufferedImage bi = up_res.image;
return (x_>=x+offsetx && x_<=x+bi.getWidth()+offsetx && y_>=y+offsety && y_<=y+bi.getHeight()+offsety);
}
@Override
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Button: "+id);
return node;
......
......@@ -123,6 +123,7 @@ public class Checkbox extends Item implements ActionListener{
id = Language.get("UNNAMED").replaceAll("%t",type).replaceAll("%i",String.valueOf(s.getNewId()));
showOptions();
}
@Override
public void update() {
if(!created) {
id = id_tf.getText();
......@@ -186,7 +187,9 @@ public class Checkbox extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
}
updateToGlobalVariables();
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Checkbox settings");
......@@ -418,6 +421,7 @@ public class Checkbox extends Item implements ActionListener{
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
......@@ -507,6 +511,7 @@ public class Checkbox extends Item implements ActionListener{
if(ae==action1_ae) action1_tf.setText(action1_ae.getCode());
else if(ae==action2_ae) action2_tf.setText(action2_ae.getCode());
}
@Override
public String returnCode(String indent) {
String code = indent+"<Checkbox";
code+=" state=\""+state+"\" up1=\""+up1+"\" up2=\""+up2+"\"";
......@@ -530,9 +535,11 @@ public class Checkbox extends Item implements ActionListener{
code+="/>";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
@Override
public void draw(Graphics2D g, int x_, int y_, int z) {
if(!created) return;
java.awt.image.BufferedImage bi = null;
......
......@@ -116,6 +116,7 @@ public class Group extends Item implements ActionListener{
showOptions();
s.updateItems();
}
@Override
public void update() {
if(!created) {
id=id_tf.getText();
......@@ -145,8 +146,9 @@ public class Group extends Item implements ActionListener{
gee.setNew();
s.m.hist.addEvent(gee);
}
}
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Group settings");
......@@ -208,6 +210,7 @@ public class Group extends Item implements ActionListener{
y_tf.setText(String.valueOf(y));
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
......@@ -238,6 +241,7 @@ public class Group extends Item implements ActionListener{
frame = null;
}
}
@Override
public String returnCode(String indent) {
String code = indent+"<Group";
if (x!=X_DEFAULT) code+=" x=\""+String.valueOf(x)+"\"";
......@@ -250,9 +254,11 @@ public class Group extends Item implements ActionListener{
code+="\n"+indent+"</Group>";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
@Override
public void draw(Graphics2D g,int x_,int y_, int z) {
for(Item i:items) {
i.draw(g,x+x,y+y_,z);
......@@ -263,6 +269,7 @@ public class Group extends Item implements ActionListener{
public boolean contains(int x_, int y_) {
return (x_>=x+offsetx && y_>=y+offsety);
}
@Override
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Group: "+id);
for(int i=0;i<items.size();i++) {
......@@ -317,4 +324,8 @@ public class Group extends Item implements ActionListener{
i.renameForCopy(p_);
}
}
@Override
public void updateToGlobalVariables() {
for(Item i:items) i.updateToGlobalVariables();
}
}
......@@ -135,7 +135,9 @@ public class Image extends Item implements ActionListener{
iee.setNew();
s.m.hist.addEvent(iee);
}
updateToGlobalVariables();
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Image settings");
......@@ -300,6 +302,7 @@ public class Image extends Item implements ActionListener{
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
......@@ -347,6 +350,7 @@ public class Image extends Item implements ActionListener{
public void actionWasEdited(ActionEditor ae) {
if(ae==action2_ae) action2_tf.setText(action2_ae.getCode());
}
@Override
public String returnCode(String indent) {
String code = indent+"<Image";
if (!id.equals(ID_DEFAULT)) code+=" id=\""+id+"\"";
......@@ -366,9 +370,11 @@ public class Image extends Item implements ActionListener{
code+="/>";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety, z);
}
@Override
public void draw(Graphics2D g,int x_, int y_, int z) {
if(!created) return;
BufferedImage bi = image_res.image;
......@@ -383,6 +389,7 @@ public class Image extends Item implements ActionListener{
BufferedImage bi = image_res.image;
return (x_>=x+offsetx && x_<=x+bi.getWidth()+offsetx && y_>=y+offsety && y_<=y+bi.getHeight()+offsety);
}
@Override
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Image: "+id);
return node;
......
......@@ -435,4 +435,8 @@ public class Panel extends Item implements ActionListener{
i.renameForCopy(p_);
}
}
@Override
public void updateToGlobalVariables() {
for(Item i:items) i.updateToGlobalVariables();
}
}
......@@ -161,6 +161,7 @@ public class Playtree extends Item implements ActionListener{
showOptions();
s.updateItems();
}
@Override
public void update() {
if(!created) {
id = id_tf.getText();
......@@ -228,7 +229,9 @@ public class Playtree extends Item implements ActionListener{
pee.setNew();
s.m.hist.addEvent(pee);
}
updateToGlobalVariables();
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Playtree settings");
......@@ -479,6 +482,7 @@ public class Playtree extends Item implements ActionListener{
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
......@@ -609,6 +613,7 @@ public class Playtree extends Item implements ActionListener{
frame = null;
}
}
@Override
public String returnCode(String indent) {
String code = indent+"<Playtree";
if (!id.equals(ID_DEFAULT)) code+=" id=\""+id+"\"";
......@@ -639,9 +644,11 @@ public class Playtree extends Item implements ActionListener{
code+="\n"+indent+"</Playtree>";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,0,0,z);
}
@Override
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);
......@@ -753,6 +760,7 @@ public class Playtree extends Item implements ActionListener{
public boolean contains (int x_, int y_) {
return (x_>=x+offsetx && x_<=x+width+offsetx && y_>=y+offsety && y_<=y+height+offsety);
}
@Override
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Playtree: "+id);
node.add(slider.getTreeNode());
......
......@@ -46,12 +46,16 @@ public class RadialSlider extends Item{
public String value = VALUE_DEFAULT;
public String tooltiptext = TOOLTIPTEXT_DEFAULT;
{
type = Language.get("RADIALSLIDER");
}
/** Creates a new instance of RadialSlider */
public RadialSlider(String xmlcode, Skin s_) {
s = s_;
sequence = XML.getValue(xmlcode,"sequence");
nbimages = XML.getIntValue(xmlcode,"nbimages");
if(xmlcode.indexOf("miangle=\"")!=-1) minangle = XML.getIntValue(xmlcode,"minangle");
if(xmlcode.indexOf("minangle=\"")!=-1) minangle = XML.getIntValue(xmlcode,"minangle");
if(xmlcode.indexOf("maxangle=\"")!=-1) maxangle = XML.getIntValue(xmlcode,"maxangle");
if(xmlcode.indexOf("value=\"")!=-1) value = XML.getValue(xmlcode,"value");
if(xmlcode.indexOf("tooltiptext=\"")!=-1) tooltiptext = XML.getValue(xmlcode,"tooltiptext");
......@@ -69,12 +73,15 @@ public class RadialSlider extends Item{
id = "Unnamed radial slider #"+s.getNewId();
showOptions();
}
@Override
public void update() {
updateToGlobalVariables();
}
@Override
public void showOptions() {
}
@Override
public String returnCode(String indent) {
String code = indent+"<RadialSlider";
if (!id.equals(ID_DEFAULT)) code+=" id=\""+id+"\"";
......@@ -94,12 +101,15 @@ public class RadialSlider extends Item{
code+="/>";
return code;
}
@Override
public void draw(Graphics2D g, int z) {
draw(g,offsetx,offsety,z);
}
@Override
public void draw(Graphics2D g, int x_, int y_, int z) {
}
@Override
public DefaultMutableTreeNode getTreeNode() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("RadialSlider: "+id);
return node;
......
......@@ -185,6 +185,7 @@ public class Slider extends Item implements ActionListener{
bezierPoints[(int)(f/10)] = b.getPoint(f/100);
}
}
@Override
public void update() {
if(!created) {
id = id_tf.getText();
......@@ -244,7 +245,9 @@ public class Slider extends Item implements ActionListener{
see.setNew();
s.m.hist.addEvent(see);
}
updateToGlobalVariables();
}
@Override
public void showOptions() {
if(frame==null) {
frame = new JFrame("Slider settings");
......@@ -448,6 +451,7 @@ public class Slider extends Item implements ActionListener{
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(ok_btn)) {
if(id_tf.getText().equals("")) {
......@@ -522,6 +526,7 @@ public class Slider extends Item implements ActionListener{
sbg_chb.setSelected(false);
sbg_btn.setEnabled(false);