Commit 20c31b6a authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

v.0.5 - see changelog in readme.txt

parent accf5ad2
......@@ -5,6 +5,9 @@ Changelog:
0.5.0a - Boolean variables are interpreted in the preview
- Global variables can be edited (boolean only atm)
- Preview window perfomance improvements
- Adding of an action editor
- Some bugfixes
- New icons
0.4.5a - Several bugfixes
- Text variables are interpreted in the preview
0.4.0a - Items can be positioned with the mouse
......@@ -48,6 +51,9 @@ Or manually run "java -jar VLCSkinEditor.jar".
-----------------------------------------------------------
Copyright:
-----------------------------------------------------------
(c)2007 Daniel "aLtgLasS" Dreibrodt
(altglass@nurfuerspam.de)
(c)2007 Daniel Dreibrodt (altglass@nurfuerspam.de)
Credits go to the Tango! Desktop Project for some icons I
used (licensed under cc-sa), to Timothy Gerard Endres
(time@gjt.org) for his Windows registry access and TAR
access packages for Java (licensed under public domain)
See LICENSE.TXT for further details
\ No newline at end of file
......@@ -22,6 +22,7 @@
package vlcskineditor;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
......@@ -32,29 +33,332 @@ import java.util.*;
*/
public class ActionEditor extends JFrame implements ActionListener{
String[] actions;
java.util.List<ActionPanel> aPanels = new ArrayList<ActionPanel>();
SpringLayout layout = new SpringLayout();
java.util.List<ActionPanel> aPanels = new ArrayList<ActionPanel>();
JScrollPane sPane = new JScrollPane();
public ImageIcon add_icon = createIcon("icons/add.png");
public ImageIcon delete_icon = createIcon("icons/delete.png");
JScrollPane sPane;
JPanel actions_p = new JPanel();
JButton add_btn = new JButton(add_icon);
JButton ok_btn = new JButton("OK");
JPopupMenu actions_pu = new JPopupMenu("Actions");
JMenu actions_dialogs = new JMenu("Show a dialog");
JMenu actions_playlist = new JMenu("Playlist");
JMenu actions_dvd = new JMenu("DVD");
JMenu actions_windows = new JMenu("Skin");
JMenuItem actions_vlc_play = new JMenuItem("Play");
JMenuItem actions_vlc_pause = new JMenuItem("Pause");
JMenuItem actions_vlc_stop = new JMenuItem("Stop");
JMenuItem actions_vlc_faster = new JMenuItem("Play faster");
JMenuItem actions_vlc_slower = new JMenuItem("Play slower");
JMenuItem actions_vlc_mute = new JMenuItem("Mute the volume");
JMenuItem actions_vlc_volumeUp = new JMenuItem("Increase the volume");
JMenuItem actions_vlc_volumeDown = new JMenuItem("Reduce the volume");
JMenuItem actions_vlc_fullscreen = new JMenuItem("Toggle fullscreen mode");
JMenuItem actions_vlc_snapshot = new JMenuItem("Take a snapshot");
JMenuItem actions_vlc_onTop = new JMenuItem("Toggle always on top");
JMenuItem actions_vlc_minimize = new JMenuItem("Minimize VLC");
JMenuItem actions_vlc_quit = new JMenuItem("Quit VLC");
JMenuItem actions_eq_enable = new JMenuItem("Enable the equalizer");
JMenuItem actions_eq_disable = new JMenuItem("Disable the equalizer");
JMenuItem actions_dialogs_changeSkin = new JMenuItem("Change skin");
JMenuItem actions_dialogs_fileSimple = new JMenuItem("Open file (simple)");
JMenuItem actions_dialogs_file = new JMenuItem("Open file (extended)");
JMenuItem actions_dialogs_directory = new JMenuItem("Open directory");
JMenuItem actions_dialogs_disc = new JMenuItem("Open disc");
JMenuItem actions_dialogs_net = new JMenuItem("Open network stream");
JMenuItem actions_dialogs_messages = new JMenuItem("Message log");
JMenuItem actions_dialogs_prefs = new JMenuItem("Preferences");
JMenuItem actions_dialogs_fileInfo = new JMenuItem("File information");
JMenuItem actions_dialogs_playlist = new JMenuItem("Unskinned playlist");
JMenuItem actions_dialogs_streamingWizard = new JMenuItem("Streaming Wizard");
JMenuItem actions_dialogs_popup = new JMenuItem("Full popup menu");
JMenuItem actions_dialogs_audioPopup = new JMenuItem("Audio settings popup menu");
JMenuItem actions_dialogs_videoPopup = new JMenuItem("Video settings popup menu");
JMenuItem actions_dialogs_miscPopup = new JMenuItem("Miscellaneous settings popup menu");
JMenuItem actions_playlist_add = new JMenuItem("Add a new item");
JMenuItem actions_playlist_del = new JMenuItem("Remove selected items");
JMenuItem actions_playlist_next = new JMenuItem("Play next item");
JMenuItem actions_playlist_previous = new JMenuItem("Play previous item");
JMenuItem actions_playlist_setRandom = new JMenuItem("Play in random/normal order");
JMenuItem actions_playlist_setLoop = new JMenuItem("Loop playlist/play it once");
JMenuItem actions_playlist_setRepeat = new JMenuItem("Repeat current item/play it once");
JMenuItem actions_playlist_sort = new JMenuItem("Sort alphabetically");
JMenuItem actions_playlist_load = new JMenuItem("Load from file");
JMenuItem actions_playlist_save = new JMenuItem("Save to file");
JMenuItem actions_dvd_nextTitle = new JMenuItem("Next title");
JMenuItem actions_dvd_previousTitle = new JMenuItem("Previous title");
JMenuItem actions_dvd_nextChapter = new JMenuItem("Next chapter");
JMenuItem actions_dvd_previousChapter = new JMenuItem("Previous Chapter");
JMenuItem actions_dvd_rootMenu = new JMenuItem("Main menu");
JMenuItem actions_windows_show = new JMenuItem("Show a window");
JMenuItem actions_windows_hide = new JMenuItem("Hide a window");
JMenuItem actions_windows_maximize = new JMenuItem("Maximize a window");
JMenuItem actions_windows_unmaximize = new JMenuItem("Unmaximize a window");
JMenuItem actions_windows_setLayout = new JMenuItem("Change the layout of a window");
Item parent;
/** Creates a new instance of ActionEditor */
public ActionEditor(String a) {
super("Edit Action");
setLayout(layout);
add(sPane);
add(ok_btn);
public ActionEditor(Item p) {
super("Edit action sequence");
setLayout(null);
setIconImage(Toolkit.getDefaultToolkit().createImage(this.getClass().getResource("icons/editor.png")));
parent = p;
actions_pu.add(actions_vlc_play);
actions_vlc_play.addActionListener(this);
actions_vlc_play.setActionCommand("vlc.play()");
actions_pu.add(actions_vlc_pause);
actions_vlc_pause.addActionListener(this);
actions_vlc_pause.setActionCommand("vlc.pause()");
actions_pu.add(actions_vlc_stop);
actions_vlc_stop.addActionListener(this);
actions_vlc_stop.setActionCommand("vlc.stop()");
actions_pu.add(actions_vlc_faster);
actions_vlc_faster.addActionListener(this);
actions_vlc_faster.setActionCommand("vlc.faster()");
actions_pu.add(actions_vlc_slower);
actions_vlc_slower.addActionListener(this);
actions_vlc_slower.setActionCommand("vlc.slower()");
actions_pu.add(actions_vlc_mute);
actions_vlc_mute.addActionListener(this);
actions_vlc_mute.setActionCommand("vlc.mute()");
actions_pu.add(actions_vlc_volumeUp);
actions_vlc_volumeUp.addActionListener(this);
actions_vlc_volumeUp.setActionCommand("vlc.volumeUp()");
actions_pu.add(actions_vlc_volumeDown);
actions_vlc_volumeDown.addActionListener(this);
actions_vlc_volumeDown.setActionCommand("vlc.volumeDown()");
actions_pu.add(actions_vlc_fullscreen);
actions_vlc_fullscreen.addActionListener(this);
actions_vlc_fullscreen.setActionCommand("vlc.fullscreen()");
actions_pu.add(actions_vlc_snapshot);
actions_vlc_snapshot.addActionListener(this);
actions_vlc_snapshot.setActionCommand("vlc.snapshot()");
actions_pu.add(actions_vlc_minimize);
actions_vlc_minimize.addActionListener(this);
actions_vlc_minimize.setActionCommand("vlc.minimize()");
actions_pu.add(actions_vlc_quit);
actions_vlc_quit.addActionListener(this);
actions_vlc_quit.setActionCommand("vlc.quit()");
actions_pu.add(actions_eq_enable);
actions_eq_enable.addActionListener(this);
actions_eq_enable.setActionCommand("equalizer.enable()");
actions_pu.add(actions_eq_disable);
actions_eq_disable.addActionListener(this);
actions_eq_disable.setActionCommand("equalizer.disable()");
actions_pu.addSeparator();
actions_dialogs.add(actions_dialogs_changeSkin);
actions_dialogs_changeSkin.addActionListener(this);
actions_dialogs_changeSkin.setActionCommand("dialogs.changeSkin()");
actions_dialogs.add(actions_dialogs_fileSimple);
actions_dialogs_fileSimple.addActionListener(this);
actions_dialogs_fileSimple.setActionCommand("dialogs.fileSimple()");
actions_dialogs.add(actions_dialogs_file);
actions_dialogs_file.addActionListener(this);
actions_dialogs_file.setActionCommand("dialogs.file()");
actions_dialogs.add(actions_dialogs_disc);
actions_dialogs_disc.addActionListener(this);
actions_dialogs_disc.setActionCommand("dialogs.disc()");
actions_dialogs.add(actions_dialogs_net);
actions_dialogs_net.addActionListener(this);
actions_dialogs_net.setActionCommand("dialogs.net()");
actions_dialogs.add(actions_dialogs_directory);
actions_dialogs_directory.addActionListener(this);
actions_dialogs_directory.setActionCommand("dialogs.directory()");
actions_dialogs.add(actions_dialogs_messages);
actions_dialogs_messages.addActionListener(this);
actions_dialogs_messages.setActionCommand("dialogs.messages()");
actions_dialogs.add(actions_dialogs_fileInfo);
actions_dialogs_fileInfo.addActionListener(this);
actions_dialogs_fileInfo.setActionCommand("dialogs.fileInfo()");
actions_dialogs.add(actions_dialogs_prefs);
actions_dialogs_prefs.addActionListener(this);
actions_dialogs_prefs.setActionCommand("dialogs.prefs()");
actions_dialogs.add(actions_dialogs_playlist);
actions_dialogs_playlist.addActionListener(this);
actions_dialogs_playlist.setActionCommand("dialogs.playlist()");
actions_dialogs.add(actions_dialogs_streamingWizard);
actions_dialogs_streamingWizard.addActionListener(this);
actions_dialogs_streamingWizard.setActionCommand("dialogs.streamingWizard()");
actions_dialogs.add(actions_dialogs_popup);
actions_dialogs_popup.addActionListener(this);
actions_dialogs_popup.setActionCommand("dialogs.popup()");
actions_dialogs.add(actions_dialogs_audioPopup);
actions_dialogs_audioPopup.addActionListener(this);
actions_dialogs_audioPopup.setActionCommand("dialogs.audioPopup()");
actions_dialogs.add(actions_dialogs_videoPopup);
actions_dialogs_videoPopup.addActionListener(this);
actions_dialogs_videoPopup.setActionCommand("dialogs.videoPopup()");
actions_dialogs.add(actions_dialogs_miscPopup);
actions_dialogs_miscPopup.addActionListener(this);
actions_dialogs_miscPopup.setActionCommand("dialogs.miscPopup()");
actions_pu.add(actions_dialogs);
actions_playlist.add(actions_playlist_add);
actions_playlist_add.addActionListener(this);
actions_playlist_add.setActionCommand("playlist.add()");
actions_playlist.add(actions_playlist_del);
actions_playlist_del.addActionListener(this);
actions_playlist_del.setActionCommand("playlist.del()");
actions_playlist.add(actions_playlist_next);
actions_playlist_next.addActionListener(this);
actions_playlist_next.setActionCommand("playlist.next()");
actions_playlist.add(actions_playlist_previous);
actions_playlist_previous.addActionListener(this);
actions_playlist_previous.setActionCommand("playlist.previous()");
actions_playlist.add(actions_playlist_setRandom);
actions_playlist_setRandom.addActionListener(this);
actions_playlist_setRandom.setActionCommand("playlist.setRandom(true)");
actions_playlist.add(actions_playlist_setLoop);
actions_playlist_setLoop.addActionListener(this);
actions_playlist_setLoop.setActionCommand("playlist.setLoop(true)");
actions_playlist.add(actions_playlist_setRepeat);
actions_playlist_setRepeat.addActionListener(this);
actions_playlist_setRepeat.setActionCommand("playlist.setRepeat(true)");
actions_playlist.add(actions_playlist_sort);
actions_playlist_sort.addActionListener(this);
actions_playlist_sort.setActionCommand("playlist.sort()");
actions_playlist.add(actions_playlist_load);
actions_playlist_load.addActionListener(this);
actions_playlist_load.setActionCommand("playlist.load()");
actions_playlist.add(actions_playlist_save);
actions_playlist_save.addActionListener(this);
actions_playlist_save.setActionCommand("playlist.save()");
actions_pu.add(actions_playlist);
actions_dvd.add(actions_dvd_nextTitle);
actions_dvd_nextTitle.addActionListener(this);
actions_dvd_nextTitle.setActionCommand("dvd.nextTitle()");
actions_dvd.add(actions_dvd_previousTitle);
actions_dvd_previousTitle.addActionListener(this);
actions_dvd_previousTitle.setActionCommand("dvd.previousTitle()");
actions_dvd.add(actions_dvd_nextChapter);
actions_dvd_nextChapter.addActionListener(this);
actions_dvd_nextChapter.setActionCommand("dvd.nextChapter()");
actions_dvd.add(actions_dvd_previousChapter);
actions_dvd_previousChapter.addActionListener(this);
actions_dvd_previousChapter.setActionCommand("dvd.previousChapter()");
actions_dvd.add(actions_dvd_rootMenu);
actions_dvd_rootMenu.addActionListener(this);
actions_dvd_rootMenu.setActionCommand("dvd.rootMenu()");
actions_pu.add(actions_dvd);
actions_windows.add(actions_windows_show);
actions_windows_show.addActionListener(this);
actions_windows_show.setActionCommand(".show()");
actions_windows.add(actions_windows_hide);
actions_windows_hide.addActionListener(this);
actions_windows_hide.setActionCommand(".hide()");
actions_windows.add(actions_windows_maximize);
actions_windows_maximize.addActionListener(this);
actions_windows_maximize.setActionCommand(".maximize()");
actions_windows.add(actions_windows_unmaximize);
actions_windows_unmaximize.addActionListener(this);
actions_windows_unmaximize.setActionCommand(".unmaximize()");
actions_windows.add(actions_windows_setLayout);
actions_windows_setLayout.addActionListener(this);
actions_windows_setLayout.setActionCommand(".setLayout()");
actions_pu.add(actions_windows);
actions_p.setLayout(new BoxLayout(actions_p,BoxLayout.Y_AXIS));
sPane = new JScrollPane(actions_p);
ok_btn.addActionListener(this);
actions = a.split(";");
for(String act:actions) act=act.trim();
add_btn.addActionListener(this);
add(sPane);
add(add_btn);
add(ok_btn);
sPane.setBounds(5,5,445,320);
add_btn.setBounds(5,330,50,25);
ok_btn.setBounds(400,330,50,25);
setSize(460,385);
setResizable(false);
}
public String getCode() {
String code = "";
for(ActionPanel act:aPanels) code+=act.getActionCode()+";";
return code;
}
public String showEditDialog() {
public void updateActions(String a) {
actions_p.removeAll();
aPanels.clear();
return actions[0];
String[] actions = a.split(";");
for(String act:actions) addAction(act);
actions_p.updateUI();
}
public void addAction(String act) {
act=act.trim();
act=act.replaceAll(";","");
aPanels.add(new ActionPanel(act,this));
actions_p.add(aPanels.get(aPanels.size()-1));
actions_p.updateUI();
}
public void editAction(String a) {
updateActions(a);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(add_btn)) actions_pu.show(add_btn,0,0);
else if (e.getSource().equals(ok_btn)) {
parent.actionWasEdited(this);
setVisible(false);
}
else if (e.getSource().getClass().equals(JMenuItem.class)) {
addAction(e.getActionCommand());
}
else {
for(ActionPanel ap:aPanels) {
if(e.getSource().equals(ap.del_btn)) {
actions_p.remove(ap);
aPanels.remove(ap);
actions_p.updateUI();
break;
}
}
}
}
public ImageIcon createIcon(String filename) {
java.awt.Image img = null;
try {
img = Toolkit.getDefaultToolkit().createImage(this.getClass().getResource(filename));
//img = ImageIO.read(file);
return new ImageIcon(img);
} catch (Exception e) {
System.out.println(e);
return null;
}
}
/**
* For testing purposes
*/
public static void main (String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e) {
}
JFrame.setDefaultLookAndFeelDecorated(true);
ActionEditor ae = new ActionEditor(null);
ae.setDefaultCloseOperation(ae.EXIT_ON_CLOSE);
/*ae.editAction("none;dialogs.changeSkin();dialogs.fileSimple();dialogs.file();dialogs.directory();dialogs.disc();dialogs.net();dialogs.messages();dialogs.prefs();dialogs.fileInfo();dialogs.playlist();dialogs.streamingWizard();dialogs.popup();dialogs.audioPopup();dialogs.videoPopup();dialogs.miscPopup();equalizer.enable();equalizer.disable();vlc.play();vlc.pause();vlc.stop();vlc.faster();vlc.slower();vlc.mute();" +
"vlc.volumeUp();vlc.volumeDown();vlc.fullscreen();vlc.snapshot();vlc.onTop();vlc.minimize();vlc.quit();playlist.add();playlist.del();playlist.next();playlist.previous();playlist.sort();playlist.setRandom(true);playlist.setLoop(true);playlist.setRepeat(true);playlist.load();playlist.save();dvd.nextTitle();dvd.previousTitle();dvd.nextChapter();dvd.previousChapter();dvd.rootMenu();WindowID.show();WindowID.hide();" +
"WindowID.maximize();WindowID.unmaximize();WindowID.setLayout(LayoutID)");
*/
ae.editAction("none");
}
}
......@@ -24,6 +24,7 @@ package vlcskineditor;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
/**
* ActionPanel
......@@ -34,50 +35,155 @@ public class ActionPanel extends JPanel {
String action;
String action_type = "static";
JTextField param1,param2;
JButton del_btn;
JTextField windowid_tf, layoutid_tf;
JComboBox bool_cb;
/** Creates a new instance of ActionPanel */
public ActionPanel(String act,ActionEditor ae_) {
action=act;
ae=ae_;
windowid_tf = new JTextField();
layoutid_tf = new JTextField();
setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
if(act.indexOf(".set")!=-1) action_type="dynamic"; // all playlist.setXXXX(boolean)
else if(act.indexOf(".show()")!=-1) action_type="dynamic";
else if(act.indexOf(".hide()")!=-1) action_type="dynamic";
else if(act.indexOf("maximize()")!=-1) action_type="dynamic"; //.unmaximize() and .maximize();
else if(act.indexOf(".setLayout")!=-1) action_type="dynamic";
if(action_type=="static") {
else if (act.indexOf(".show()")!=-1) action_type="dynamic"; // show a window
else if (act.indexOf(".hide()")!=-1) action_type="dynamic"; // hide a window
else if (act.indexOf("maximize()")!=-1) action_type="dynamic"; // un-/maximize a window
else if (act.indexOf(".setLayout")!=-1) action_type="dynamic"; //change window layout
if(action_type.equals("static")) { //static => the action has no parameters
JLabel desc = new JLabel(action);
if(action=="none") desc.setText("No action");
else if(action=="dialogs.changeSkin()") desc.setText("Show a dialog box to load a new skin.");
else if(action=="dialogs.fileSimple()") desc.setText("Show the simple \"Open File\" dialog box.");
else if(action=="dialogs.file()") desc.setText("Show the extended \"Open File\" dialog box.");
else if(action=="dialogs.directory()") desc.setText("Show the \"Open Directory\" dialog box.");
else if(action=="dialogs.disc()") desc.setText("Show the \"Open Disc\" dialog box.");
else if(action=="dialogs.net()") desc.setText("Show the \"Open Network Stream\" dialog box.");
else if(action=="dialogs.messages()") desc.setText("Show the message log dialog box.");
else if(action=="dialogs.prefs()") desc.setText("Show the preferences dialog box.");
else if(action=="dialogs.fileInfo()") desc.setText("Show the file information dialog box.");
else if(action=="dialogs.playlist()") desc.setText("Show the default (unskinned) playlist window.");
else if(action=="dialogs.streamingWizard()") desc.setText("Show the \"Streaming Wizard\" dialog box.");
else if(action=="dialogs.popup()") desc.setText("Show the full popup menu.");
else if(action=="dialogs.audioPopup()") desc.setText("Show the audio settings popup menu.");
else if(action=="dialogs.videoPopup()") desc.setText("Show the video settings popup menu.");
else if(action=="dialogs.miscPopup()") desc.setText("Show a popup menu containing playback control and general options.");
else if(action=="equalizer.enable()") desc.setText("Enable the equalizer audio filter");
else if(action=="equalizer.disable()") desc.setText("Enable the equalizer audio filter");
else if(action=="vlc.play()") desc.setText("Play the current playlist item.");
else if(action=="vlc.pause()") desc.setText("Pause the current playlist item.");
else if(action=="vlc.stop()") desc.setText("Stop playback of the current playlist item.");
else if(action=="vlc.faster()") desc.setText("Play the current playlist item faster.");
else if(action=="vlc.slower()") desc.setText("Play the current playlist item slower.");
else if(action=="vlc.mute()") desc.setText("Toggle audio muting.");
else if(action=="vlc.volumeUp()") desc.setText("Increase the volume.");
else if(action=="vlc.volumeDown()") desc.setText("Reduce the volume.");
if (action.equals("none")) desc.setText("Do nothing");
else if (action.equals("dialogs.changeSkin()")) desc.setText("Show a dialog box to load a new skin.");
else if (action.equals("dialogs.fileSimple()")) desc.setText("Show the simple \"Open File\" dialog box.");
else if (action.equals("dialogs.file()")) desc.setText("Show the extended \"Open File\" dialog box.");
else if (action.equals("dialogs.directory()")) desc.setText("Show the \"Open Directory\" dialog box.");
else if (action.equals("dialogs.disc()")) desc.setText("Show the \"Open Disc\" dialog box.");
else if (action.equals("dialogs.net()")) desc.setText("Show the \"Open Network Stream\" dialog box.");
else if (action.equals("dialogs.messages()")) desc.setText("Show the message log dialog box.");
else if (action.equals("dialogs.prefs()")) desc.setText("Show the preferences dialog box.");
else if (action.equals("dialogs.fileInfo()")) desc.setText("Show the file information dialog box.");
else if (action.equals("dialogs.playlist()")) desc.setText("Show the default (unskinned) playlist window.");
else if (action.equals("dialogs.streamingWizard()")) desc.setText("Show the \"Streaming Wizard\" dialog box.");
else if (action.equals("dialogs.popup()")) desc.setText("Show the full popup menu.");
else if (action.equals("dialogs.audioPopup()")) desc.setText("Show the audio settings popup menu.");
else if (action.equals("dialogs.videoPopup()")) desc.setText("Show the video settings popup menu.");
else if (action.equals("dialogs.miscPopup()")) desc.setText("Show a popup menu containing playback control and general options.");
else if (action.equals("equalizer.enable()")) desc.setText("Enable the equalizer audio filter.");
else if (action.equals("equalizer.disable()")) desc.setText("Disable the equalizer audio filter.");
else if (action.equals("vlc.play()")) desc.setText("Play the current playlist item.");
else if (action.equals("vlc.pause()")) desc.setText("Pause the current playlist item.");
else if (action.equals("vlc.stop()")) desc.setText("Stop playback of the current playlist item.");
else if (action.equals("vlc.faster()")) desc.setText("Play the current playlist item faster.");
else if (action.equals("vlc.slower()")) desc.setText("Play the current playlist item slower.");
else if (action.equals("vlc.mute()")) desc.setText("Toggle audio muting.");
else if (action.equals("vlc.volumeUp()")) desc.setText("Increase the volume.");
else if (action.equals("vlc.volumeDown()")) desc.setText("Reduce the volume.");
else if (action.equals("vlc.fullscreen()")) desc.setText("Toggle the fullscreen mode.");
else if (action.equals("vlc.snapshot()")) desc.setText("Take a snapshot.");
else if (action.equals("vlc.onTop()")) desc.setText("Toggle the \"always on top\" status.");
else if (action.equals("vlc.minimize()")) desc.setText("Minimize VLC.");
else if (action.equals("vlc.quit()")) desc.setText("Quit VLC.");
else if (action.equals("playlist.add()")) desc.setText("Add a new item to the playlist.");
else if (action.equals("playlist.del()")) desc.setText("Remove the selected items from the playlist.");
else if (action.equals("playlist.next()")) desc.setText("Play the next item in the playlist.");
else if (action.equals("playlist.previous()")) desc.setText("Play the previous item in the playlist.");
else if (action.equals("playlist.sort()")) desc.setText("Sort the playlist alphabetically.");
else if (action.equals("playlist.load()")) desc.setText("Load an external playlist file.");
else if (action.equals("playlist.save()")) desc.setText("Save the current playlist to a file.");
else if (action.equals("dvd.nextTitle()")) desc.setText("Go to the next title on the DVD.");
else if (action.equals("dvd.previousTitle()")) desc.setText("Go to the previous title on the DVD.");
else if (action.equals("dvd.nextChapter()")) desc.setText("Go to the next chapter of the DVD.");
else if (action.equals("dvd.previousChapter()")) desc.setText("Go to the previous chapter on the DVD.");
else if (action.equals("dvd.rootMenu()")) desc.setText("Go to the root menu of the DVD.");
add(desc);
}
else {
else { // dynamic action => it needs parameters
JLabel desc = new JLabel(action);
if (action.indexOf(".setRandom")!=-1) {
String[] bools = { "Activate", "Deactive" };
bool_cb = new JComboBox(bools);
if(action.toUpperCase().indexOf("TRUE")!=-1) bool_cb.setSelectedIndex(0);
else bool_cb.setSelectedIndex(1);
add(bool_cb);
desc.setText(" that the items in the playlist are played in random order.");
add(desc);
}
else if (action.indexOf(".setLoop")!=-1) {
String[] bools = { "Activate", "Deactive" };
bool_cb = new JComboBox(bools);
if(action.toUpperCase().indexOf("TRUE")!=-1) bool_cb.setSelectedIndex(0);
else bool_cb.setSelectedIndex(1);
add(bool_cb);
desc.setText(" that the playlist is repeated when its end is reached.");
add(desc);
}
else if (action.indexOf(".setRepeat")!=-1) {
String[] bools = { "Activate", "Deactive" };
bool_cb = new JComboBox(bools);
if(action.toUpperCase().indexOf("TRUE")!=-1) bool_cb.setSelectedIndex(0);
else bool_cb.setSelectedIndex(1);
add(bool_cb);
desc.setText(" that the current item is repeated after its end is reached");
add(desc);
}
else if (action.indexOf(".show()")!=-1) {
desc.setText("Show the window with the ID ");
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".show()")));
}
else if (action.indexOf(".hide()")!=-1) {
desc.setText("Hide the window with the ID ");
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".hide()")));
}
else if (action.indexOf(".maximize()")!=-1) {
desc.setText("Maximize the window with the ID ");
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".maximize()")));
}
else if (action.indexOf(".unmaximize()")!=-1) {
desc.setText("Unmaximize the window with the ID ");
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".unmaximize()")));
}
else if (action.indexOf(".setLayout")!=-1) {
desc.setText("Set the Layout of the window with the ID ");
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".setLayout")));
add(new JLabel(" to "));
add(layoutid_tf);
layoutid_tf.setText(action.substring(action.indexOf("(")+1,action.indexOf(")")));
}
else {
add(desc);
}
}
del_btn = new JButton(ae.delete_icon);
del_btn.addActionListener(ae);
add(Box.createHorizontalGlue()); //create a flexible space between the delete button and the other items, so that it is pushed to the left
add(Box.createRigidArea(new Dimension(5,24))); //distance between delete button and other items
add(del_btn);
setBackground(Color.decode("#fce94f"));
setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
setMaximumSize(new Dimension(445,30));
}
public String getActionCode() {
if(action_type=="static") return action;
else return "";
if(action_type.equals("static")) return action;
else if (action.indexOf(".setRandom")!=-1) return "playlist.setRandom("+( (bool_cb.getSelectedIndex()==0) ? "true" : "false" )+")";
else if (action.indexOf(".setLoop")!=-1) return "playlist.setLoop("+( (bool_cb.getSelectedIndex()==0) ? "true" : "false" )+")";
else if (action.indexOf(".setRepeat")!=-1) return "playlist.setRepeat("+( (bool_cb.getSelectedIndex()==0) ? "true" : "false" )+")";
else if (action.indexOf(".show()")!=-1) return windowid_tf.getText()+".show()";
else if (action.indexOf(".hide()")!=-1) return windowid_tf.getText()+".hide()";
else if (action.indexOf(".maximize()")!=-1) return windowid_tf.getText()+".maximize()";
else if (action.indexOf(".unmaximize()")!=-1) return windowid_tf.getText()+".unmaximize()";
else if (action.indexOf(".setLayout")!=-1) return windowid_tf.getText()+".setLayout("+layoutid_tf.getText()+")";
else return "none";
}
}
......@@ -112,5 +112,9 @@ public abstract class Item {
offsetx=x_;
offsety=y_;
}
/** Tells the item that an action attribute has been changed by the ActionEditor <code>ae</code>**/
public void actionWasEdited(ActionEditor ae) {
}
}
......@@ -28,6 +28,7 @@ import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.border.*;
/**
* Anchor item
......@@ -75,6 +76,7 @@ public class Anchor extends Item implements ActionListener{
range=r_;
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
}
public void showOptions() {
if(frame==null) {
......@@ -123,7 +125,7 @@ public class Anchor extends Item implements ActionListener{
general.add(lefttop_cb);
lefttop_l.setBounds(5,75,75,24);
lefttop_cb.setBounds(85,75,150,24);
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY), "General Attributes"));
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "General Attributes"));
general.setMinimumSize(new Dimension(240,110));
general.setPreferredSize(new Dimension(240,110));
general.setMaximumSize(new Dimension(240,110));
......
......@@ -27,6 +27,7 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.border.*;
/**
* Button item
......@@ -49,6 +50,7 @@ public class Button extends Item implements ActionListener{
JComboBox lefttop_cb, rightbottom_cb, xkeepratio_cb, ykeepratio_cb;
JButton visible_btn, action_btn, ok_btn, help_btn;
ActionEditor action_ae;
/** Creates a new instance of Button */
public Button(String xmlcode, Skin s_) {
......@@ -93,6 +95,7 @@ public class Button extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
}
public void showOptions() {
if(frame==null) {
......@@ -138,7 +141,7 @@ public class Button extends Item implements ActionListener{
down_tf = new JTextField();
JLabel action_l = new JLabel("Action:");
action_tf = new JTextField();
action_btn = new JButton("",s.m.help_icon);
action_btn = new JButton("",s.m.editor_icon);
action_btn.addActionListener(this);
JLabel tooltiptext_l = new JLabel("Tooltiptext:");
tooltiptext_tf = new JTextField();
......@@ -160,7 +163,7 @@ public class Button extends Item implements ActionListener{
general.add(y_l);
general.add(y_tf);
y_l.setBounds(5,75,75,24);
y_tf.setBounds(85,75,75,24);
y_tf.setBounds(85,75,150,24);
general.add(lefttop_l);
general.add(lefttop_cb);
lefttop_l.setBounds(5,105,75,24);
......@@ -187,7 +190,7 @@ public class Button extends Item implements ActionListener{
general.add(help_tf);
help_l.setBounds(5,255,75,24);
help_tf.setBounds(85,255,150,24);
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY), "General Attributes"));
general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "General Attributes"));
general.setMinimumSize(new Dimension(240,285));
general.setPreferredSize(new Dimension(240,285));
general.setMaximumSize(new Dimension(240,285));
......@@ -216,7 +219,7 @@ public class Button extends Item implements ActionListener{
button.add(tooltiptext_tf);
tooltiptext_l.setBounds(5,135,75,24);
tooltiptext_tf.setBounds(85,135,150,24);
button.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY), "Button Attributes"));
button.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Button Attributes"));
button.setMinimumSize(new Dimension(240,165));
button.setPreferredSize(new Dimension(240,165));
button.setMaximumSize(new Dimension(240,165));
......@@ -309,21 +312,13 @@ public class Button extends Item implements ActionListener{
}
}
else if(e.getSource().equals(action_btn)) {
Desktop desktop;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
try {