Commit 3a985b40 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Configuration editing dialog

Windows' last position and size is remembered
parent f2d2971d
......@@ -2,7 +2,9 @@ VLC Skin Editor release 0.7.1
-----------------------------------------------------------
Changelog:
-----------------------------------------------------------
0.7.1 - Slight performance improvements
0.7.5 - Slight performance improvements
- Multi-language support
- Remembering of windows' last positions&sizes
0.7.0 - Preview can be saved as image
- Improved SubBitmap editing
- Resources/windows/layouts can be duplicated easily
......
......@@ -29,6 +29,8 @@ MENU_EDIT_THEME|Theme settings
MENU_EDIT_THEME_MN|T
MENU_EDIT_VARS|Global variables
MENU_EDIT_VARS_MN|G
MENU_EDIT_PREFS|Preferences
MENU_EDIT_PREFS_MN|P
MENU_EDIT_UP|Move selected item up
MENU_EDIT_DOWN|Move selected item down
MENU_EDIT_LEFT|Move selected item left
......@@ -77,9 +79,14 @@ WELCOME_NEW|Create a new skin
WELCOME_OPEN|Open an existing skin
WELCOME_QUIT|Quit
#Preferences window
WIN_PREFS_TITLE|Preferences
WIN_PREFS_UPDATE_L|Enable auto-update:
WIN_PREFS_LANG_L|Language (takes effect on next start):
#Messages
ABOUT_TITLE|About VLC Skin Editor
ABOUT_MSG|Copyright 2007-%y The VideoLAN Team\nLead programmer: Daniel Dreibrodt (daniel.dreibrodt@googlemail.com)\nWebsite: %w\nReleased under terms of the GPL 2+\n\nCredits:\nTimothy Gerard Endres for registry access and TAR support (Public Domain)\nThe Tango! Desktop Project (http://tango.freedesktop.org/) for some icons (Creative Commons BY-SA 2.5)\nCyril Deguet (asmax@via.ecp.fr) and Olivier Teulire (ipkiss@via.ecp.fr) for the Boolean Expression Evaluator and Bezier code (GPL 2+)
ABOUT_MSG|<html><h3>Copyright 2007-%y The VideoLAN Team</h3>Released under terms of the GPL 2+<br><br><b>Lead programmer:</b> Daniel Dreibrodt (daniel.dreibrodt@googlemail.com)<br><b>Website:</b> %w<br><br><b>Credits:</b><br>Timothy Gerard Endres for registry access and TAR support (Public Domain)<br>The Tango! Desktop Project (http://tango.freedesktop.org) for some icons (Creative Commons BY-SA 2.5)<br>Cyril Deguet (asmax@via.ecp.fr) and Olivier Teuli&egrave;re (ipkiss@via.ecp.fr) for the Boolean Expression Evaluator and Bezier code (GPL 2+)</html>
VLT_EX_TITLE|Importing a VLT file
VLT_EX_MSG|The VLT file will be unpacked to a subfolder called "%f".\nDo you want to continue?
VLT_EX_YES|Yes, unpack
......
......@@ -22,9 +22,14 @@
package vlcskineditor;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.swing.*;
/**
* Class to manage the configuration
......@@ -36,11 +41,29 @@ public class Config {
private static File configFile = new File("VLCSkinEditor.cfg");
static {
//Default values
strings.put("autoupdate", "true");
strings.put("language", "English");
strings.put("win.main.width","800");
strings.put("win.main.height","600");
strings.put("win.res.x","0");
strings.put("win.res.y","0");
strings.put("win.res.width","190");
strings.put("win.res.height","200");
strings.put("win.win.x","0");
strings.put("win.win.y","200");
strings.put("win.win.width","190");
strings.put("win.win.height","150");
strings.put("win.items.x","0");
strings.put("win.items.y","350");
strings.put("win.items.width","190");
strings.put("win.items.height","200");
}
public static void loadConfig() {
/**
* Loads the configuration
*/
public static void load() {
try {
FileReader fr = new FileReader(configFile);
BufferedReader br = new BufferedReader(fr);
......@@ -59,22 +82,50 @@ public class Config {
fr.close();
} catch(FileNotFoundException ex) {
System.out.println("Configuration does not yet exist. Creating it...");
saveConfig();
save();
} catch(IOException ex) {
ex.printStackTrace();
}
}
public static String getValue(String key) {
/**
* Gets the configured value of a certain key
* @param key The key to look for
* @return The key's value
*/
public static String get(String key) {
String s = strings.get(key);
return (s!=null)?s:key;
}
/**
* Gets the configured value of a certain key as an integer
* @param key The key to look for
* @return The key's value
*/
public static int getInt(String key) {
String s = strings.get(key);
int i = 0;
try {
i = Integer.parseInt(s);
} catch(Exception ex) {
}
return i;
}
public static void setValue(String key, String value) {
strings.put(key, value);
/**
* Configures a certain key
* @param key The key to set
* @param value The key's new value
*/
public static void set(String key, Object value) {
strings.put(key, String.valueOf(value));
}
public static void saveConfig() {
/**
* Saves the configuration
*/
public static void save() {
try {
FileWriter fw = new FileWriter(configFile);
BufferedWriter bw = new BufferedWriter(fw);
......@@ -93,6 +144,83 @@ public class Config {
}
}
/**
* Shows a dialog to edit the configuration
*/
public static void showOptions() {
final JFrame frame = new JFrame(Language.get("WIN_PREFS_TITLE"));
JLabel update_l = new JLabel(Language.get("WIN_PREFS_UPDATE_L"));
final JCheckBox update_cb = new JCheckBox();
update_cb.setSelected(Boolean.parseBoolean(Config.get("autoupdate")));
JLabel lang_l = new JLabel(Language.get("WIN_PREFS_LANG_L"));
File[] lang_files = new File("lang").listFiles();
String[] lang_choices = new String[lang_files.length];
int sel = 0;
for(int i=0;i<lang_files.length;i++) {
lang_choices[i] = lang_files[i].getName().replaceAll("\\.txt", "");
if(lang_choices[i].equals(Config.get("language"))) sel = i;
}
final JComboBox lang_cb = new JComboBox(lang_choices);
lang_cb.setSelectedIndex(sel);
JButton ok_btn = new JButton(Language.get("BUTTON_OK"));
ok_btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
strings.put("autoupdate", String.valueOf(update_cb.isSelected()));
strings.put("language", (String)lang_cb.getSelectedItem());
frame.setVisible(false);
frame.dispose();
}
});
JButton cancel_btn = new JButton(Language.get("BUTTON_CANCEL"));
cancel_btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
frame.dispose();
}
});
frame.add(lang_l);
frame.add(lang_cb);
frame.add(update_l);
frame.add(update_cb);
frame.add(ok_btn);
frame.add(cancel_btn);
Component[] labels = { lang_l, update_l};
int tf_dx = Helper.maxWidth(labels)+10;
lang_cb.setPreferredSize(new Dimension(200,lang_cb.getPreferredSize().height));
SpringLayout layout = new SpringLayout();
layout.putConstraint(SpringLayout.NORTH, lang_l, 5, SpringLayout.NORTH, frame.getContentPane());
layout.putConstraint(SpringLayout.WEST, lang_l, 5, SpringLayout.WEST, frame.getContentPane());
layout.putConstraint(SpringLayout.VERTICAL_CENTER, lang_cb, 0, SpringLayout.VERTICAL_CENTER, lang_l);
layout.putConstraint(SpringLayout.WEST, lang_cb, tf_dx, SpringLayout.WEST, frame.getContentPane());
//layout.putConstraint(SpringLayout.EAST, lang_cb, 5, SpringLayout.EAST, frame.getContentPane());
layout.putConstraint(SpringLayout.NORTH, update_l, 10, SpringLayout.SOUTH, lang_l);
layout.putConstraint(SpringLayout.WEST, update_l, 5, SpringLayout.WEST, frame.getContentPane());
layout.putConstraint(SpringLayout.VERTICAL_CENTER, update_cb, 0, SpringLayout.VERTICAL_CENTER, update_l);
layout.putConstraint(SpringLayout.WEST, update_cb, tf_dx, SpringLayout.WEST, frame.getContentPane());
layout.putConstraint(SpringLayout.EAST, update_cb, 0, SpringLayout.EAST, lang_cb);
layout.putConstraint(SpringLayout.NORTH, ok_btn, 10, SpringLayout.SOUTH, update_l);
layout.putConstraint(SpringLayout.WEST, ok_btn, 5, SpringLayout.WEST, frame.getContentPane());
layout.putConstraint(SpringLayout.WEST, cancel_btn, 5, SpringLayout.EAST, ok_btn);
layout.putConstraint(SpringLayout.NORTH, cancel_btn, 0, SpringLayout.NORTH, ok_btn);
layout.putConstraint(SpringLayout.SOUTH, frame.getContentPane(), 10, SpringLayout.SOUTH, ok_btn);
layout.putConstraint(SpringLayout.EAST, frame.getContentPane(), 5, SpringLayout.EAST, lang_cb);
frame.setLayout(layout);
frame.pack();
//frame.setResizable(false);
frame.setVisible(true);
}
}
\ No newline at end of file
......@@ -67,7 +67,7 @@ public class Helper {
}
}
else {
JOptionPane.showMessageDialog(null,Language.getString("ERROR_BROWSE_MSG").replaceAll("%u", url),Language.getString("ERROR_BROWSE_TITLE"),JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(null,Language.get("ERROR_BROWSE_MSG").replaceAll("%u", url),Language.get("ERROR_BROWSE_TITLE"),JOptionPane.WARNING_MESSAGE);
}
}
}
......@@ -33,7 +33,11 @@ public class Language {
private static Hashtable<String, String> strings = new Hashtable<String, String>();
public static void loadLanguage(File f) {
/**
* Loads the current language from a file
* @param f The language file, e.g. lang/English.txt
*/
public static void load(File f) {
try {
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
......@@ -60,7 +64,12 @@ public class Language {
}
}
public static String getString(String key) {
/**
* Gets the string in the current language for the given key
* @param key the string key
* @return the translated string
*/
public static String get(String key) {
String s = strings.get(key);
return (s!=null)?s:key;
}
......
......@@ -59,7 +59,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_png, m_file_quit;
JMenuItem m_edit_undo, m_edit_redo, m_edit_theme, m_edit_vars, m_edit_up, m_edit_down, m_edit_right, m_edit_left;
JMenuItem m_edit_undo, m_edit_redo, m_edit_theme, m_edit_vars, m_edit_prefs, 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;
......@@ -123,8 +123,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
*/
public Main(String[] args) {
Config.loadConfig();
Language.loadLanguage(new File("lang"+File.separator+Config.getValue("language")+".txt"));
Config.load();
Language.load(new File("lang"+File.separator+Config.get("language")+".txt"));
setTitle("VLC Skin Editor "+VERSION);
......@@ -137,39 +137,39 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
//For cross-platform feel (CTRL on Win & Linux, APPLE/COMMAND on Mac OS)
int mask = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
m_file = new JMenu(Language.getString("MENU_FILE"));
m_file.setMnemonic(Language.getString("MENU_FILE_MN").charAt(0));
m_file_new = new JMenuItem(Language.getString("MENU_FILE_NEW"));
m_file = new JMenu(Language.get("MENU_FILE"));
m_file.setMnemonic(Language.get("MENU_FILE_MN").charAt(0));
m_file_new = new JMenuItem(Language.get("MENU_FILE_NEW"));
m_file_new.setIcon(new_icon);
m_file_new.setMnemonic(Language.getString("MENU_FILE_NEW_MN").charAt(0));
m_file_new.setMnemonic(Language.get("MENU_FILE_NEW_MN").charAt(0));
m_file_new.setAccelerator(KeyStroke.getKeyStroke('N',mask));
m_file_new.addActionListener(this);
m_file_open = new JMenuItem(Language.getString("MENU_FILE_OPEN"));
m_file_open = new JMenuItem(Language.get("MENU_FILE_OPEN"));
m_file_open.setIcon(open_icon);
m_file_open.setMnemonic(Language.getString("MENU_FILE_OPEN_MN").charAt(0));
m_file_open.setMnemonic(Language.get("MENU_FILE_OPEN_MN").charAt(0));
m_file_open.setAccelerator(KeyStroke.getKeyStroke('O',mask));
m_file_open.addActionListener(this);
m_file_save = new JMenuItem(Language.getString("MENU_FILE_SAVE"));
m_file_save = new JMenuItem(Language.get("MENU_FILE_SAVE"));
m_file_save.setIcon(save_icon);
m_file_save.setMnemonic(Language.getString("MENU_FILE_SAVE_MN").charAt(0));
m_file_save.setMnemonic(Language.get("MENU_FILE_SAVE_MN").charAt(0));
m_file_save.setAccelerator(KeyStroke.getKeyStroke('S',mask));
m_file_save.addActionListener(this);
m_file_test = new JMenuItem(Language.getString("MENU_FILE_TEST"));
m_file_test.setMnemonic(Language.getString("MENU_FILE_TEST_MN").charAt(0));
m_file_test = new JMenuItem(Language.get("MENU_FILE_TEST"));
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.getString("MENU_FILE_VLT"));
m_file_vlt.setMnemonic(Language.getString("MENU_FILE_VLT_MN").charAt(0));
m_file_vlt = new JMenuItem(Language.get("MENU_FILE_VLT"));
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);
m_file_png = new JMenuItem(Language.getString("MENU_FILE_PNG"));
m_file_png.setMnemonic(Language.getString("MENU_FILE_PNG_MN").charAt(0));
m_file_png = new JMenuItem(Language.get("MENU_FILE_PNG"));
m_file_png.setMnemonic(Language.get("MENU_FILE_PNG_MN").charAt(0));
m_file_png.addActionListener(this);
m_file_png.setEnabled(false);
if(System.getProperty("os.name").indexOf("Mac")==-1) {
m_file_quit = new JMenuItem(Language.getString("MENU_FILE_EXIT"));
m_file_quit = new JMenuItem(Language.get("MENU_FILE_EXIT"));
m_file_quit.setIcon(exit_icon);
m_file_quit.setMnemonic(Language.getString("MENU_FILE_EXIT_MN").charAt(0));
m_file_quit.setMnemonic(Language.get("MENU_FILE_EXIT_MN").charAt(0));
m_file_quit.setAccelerator(KeyStroke.getKeyStroke("alt F4"));
m_file_quit.addActionListener(this);
}
......@@ -185,37 +185,41 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_file.addSeparator();
m_file.add(m_file_quit);
m_edit = new JMenu(Language.getString("MENU_EDIT"));
m_edit.setMnemonic(Language.getString("MENU_EDIT_MN").charAt(0));
m_edit_undo = new JMenuItem(Language.getString("MENU_EDIT_UNDO"));
m_edit = new JMenu(Language.get("MENU_EDIT"));
m_edit.setMnemonic(Language.get("MENU_EDIT_MN").charAt(0));
m_edit_undo = new JMenuItem(Language.get("MENU_EDIT_UNDO"));
m_edit_undo.setIcon(edit_undo_icon);
m_edit_undo.setMnemonic(Language.getString("MENU_EDIT_UNDO_MN").charAt(0));
m_edit_undo.setMnemonic(Language.get("MENU_EDIT_UNDO_MN").charAt(0));
m_edit_undo.setAccelerator(KeyStroke.getKeyStroke('Z',mask));
m_edit_undo.addActionListener(this);
m_edit_redo = new JMenuItem(Language.getString("MENU_EDIT_REDO"));
m_edit_redo = new JMenuItem(Language.get("MENU_EDIT_REDO"));
m_edit_redo.setIcon(edit_redo_icon);
m_edit_redo.setMnemonic(Language.getString("MENU_EDIT_REDO_MN").charAt(0));
m_edit_redo.setMnemonic(Language.get("MENU_EDIT_REDO_MN").charAt(0));
m_edit_redo.setAccelerator(KeyStroke.getKeyStroke('Y',mask));
m_edit_redo.addActionListener(this);
m_edit_theme = new JMenuItem(Language.getString("MENU_EDIT_THEME"));
m_edit_theme = new JMenuItem(Language.get("MENU_EDIT_THEME"));
m_edit_theme.setIcon(edit_icon);
m_edit_theme.setMnemonic(Language.getString("MENU_EDIT_THEME_MN").charAt(0));
m_edit_theme.setMnemonic(Language.get("MENU_EDIT_THEME_MN").charAt(0));
m_edit_theme.setAccelerator(KeyStroke.getKeyStroke('I',mask));
m_edit_theme.addActionListener(this);
m_edit_vars = new JMenuItem(Language.getString("MENU_EDIT_VARS"));
m_edit_vars.setMnemonic(Language.getString("MENU_EDIT_VARS_MN").charAt(0));
m_edit_vars = new JMenuItem(Language.get("MENU_EDIT_VARS"));
m_edit_vars.setMnemonic(Language.get("MENU_EDIT_VARS_MN").charAt(0));
m_edit_vars.setAccelerator(KeyStroke.getKeyStroke('G',mask));
m_edit_vars.addActionListener(this);
m_edit_up = new JMenuItem(Language.getString("MENU_EDIT_UP"));
m_edit_prefs = new JMenuItem(Language.get("MENU_EDIT_PREFS"));
m_edit_prefs.setIcon(editor_icon);
m_edit_prefs.setMnemonic(Language.get("MENU_EDIT_PREFS_MN").charAt(0));
m_edit_prefs.addActionListener(this);
m_edit_up = new JMenuItem(Language.get("MENU_EDIT_UP"));
m_edit_up.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP,mask));
m_edit_up.addActionListener(this);
m_edit_down = new JMenuItem(Language.getString("MENU_EDIT_DOWN"));
m_edit_down = new JMenuItem(Language.get("MENU_EDIT_DOWN"));
m_edit_down.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,mask));
m_edit_down.addActionListener(this);
m_edit_left = new JMenuItem(Language.getString("MENU_EDIT_LEFT"));
m_edit_left = new JMenuItem(Language.get("MENU_EDIT_LEFT"));
m_edit_left.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,mask));
m_edit_left.addActionListener(this);
m_edit_right = new JMenuItem(Language.getString("MENU_EDIT_RIGHT"));
m_edit_right = new JMenuItem(Language.get("MENU_EDIT_RIGHT"));
m_edit_right.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,mask));
m_edit_right.addActionListener(this);
......@@ -225,21 +229,22 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_edit.add(m_edit_theme);
m_edit.addSeparator();
m_edit.add(m_edit_vars);
m_edit.add(m_edit_prefs);
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(Language.getString("MENU_HELP"));
m_help.setMnemonic(Language.getString("MENU_HELP_MN").charAt(0));
m_help_doc = new JMenuItem(Language.getString("MENU_HELP_DOC"));
m_help = new JMenu(Language.get("MENU_HELP"));
m_help.setMnemonic(Language.get("MENU_HELP_MN").charAt(0));
m_help_doc = new JMenuItem(Language.get("MENU_HELP_DOC"));
m_help_doc.setIcon(help_icon);
m_help_doc.setMnemonic(Language.getString("MENU_HELP_DOC_MN").charAt(0));
m_help_doc.setMnemonic(Language.get("MENU_HELP_DOC_MN").charAt(0));
m_help_doc.addActionListener(this);
m_help_doc.setAccelerator(KeyStroke.getKeyStroke("F1"));
m_help_about = new JMenuItem(Language.getString("MENU_HELP_ABOUT"));
m_help_about.setMnemonic(Language.getString("MENU_HELP_ABOUT_MN").charAt(0));
m_help_about = new JMenuItem(Language.get("MENU_HELP_ABOUT"));
m_help_about.setMnemonic(Language.get("MENU_HELP_ABOUT_MN").charAt(0));
m_help_about.addActionListener(this);
m_help.add(m_help_doc);
......@@ -255,7 +260,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
s = new Skin(this);
resources = new JInternalFrame(Language.getString("WIN_RES_TITLE"),true,false);
resources = new JInternalFrame(Language.get("WIN_RES_TITLE"),true,false);
resources.setFrameIcon(resources_icon);
resources.setMinimumSize(new Dimension(190,200));
SpringLayout res_layout = new SpringLayout();
......@@ -273,26 +278,26 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
resources.add(res_tree_sp);
res_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
res_add_bitmap = new JButton("",add_bitmap_icon);
res_add_bitmap.setToolTipText(Language.getString("WIN_RES_ADD_BMP"));
res_add_bitmap.setToolTipText(Language.get("WIN_RES_ADD_BMP"));
res_add_bitmap.setMaximumSize(new Dimension(24,24));
res_add_bitmap.setPreferredSize(new Dimension(24,24));
res_add_bitmap.addActionListener(this);
res_add_font = new JButton("",add_font_icon);
res_add_font.setToolTipText(Language.getString("WIN_RES_ADD_FONT"));
res_add_font.setToolTipText(Language.get("WIN_RES_ADD_FONT"));
res_add_font.setMaximumSize(new Dimension(24,24));
res_add_font.setPreferredSize(new Dimension(24,24));
res_add_font.addActionListener(this);
res_duplicate = new JButton("",copy_icon);
res_duplicate.setToolTipText(Language.getString("WIN_RES_COPY"));
res_duplicate.setToolTipText(Language.get("WIN_RES_COPY"));
res_duplicate.setPreferredSize(new Dimension(24,24));
res_duplicate.addActionListener(this);
res_edit = new JButton("",edit_icon);
res_edit.setToolTipText(Language.getString("WIN_RES_EDIT"));
res_edit.setToolTipText(Language.get("WIN_RES_EDIT"));
res_edit.setMaximumSize(new Dimension(24,24));
res_edit.setPreferredSize(new Dimension(24,24));
res_edit.addActionListener(this);
res_del = new JButton("",delete_icon);
res_del.setToolTipText(Language.getString("WIN_RES_DELETE"));
res_del.setToolTipText(Language.get("WIN_RES_DELETE"));
res_del.setMaximumSize(new Dimension(24,24));
res_del.setPreferredSize(new Dimension(24,24));
res_del.addActionListener(this);
......@@ -323,10 +328,10 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
res_layout.putConstraint(SpringLayout.EAST, resources.getContentPane(),5,SpringLayout.EAST, res_tree_sp);
resources.pack();
resources.setSize(190,200);
resources.setSize(Config.getInt("win.res.width"),Config.getInt("win.res.height"));
resources.setVisible(true);
windows = new JInternalFrame(Language.getString("WIN_WIN_TITLE"),true,false);
windows = new JInternalFrame(Language.get("WIN_WIN_TITLE"),true,false);
windows.setFrameIcon(windows_icon);
windows.setMinimumSize(new Dimension(190,150));
SpringLayout win_layout = new SpringLayout();
......@@ -344,37 +349,37 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
windows.add(win_tree_sp);
win_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
win_add_window = new JButton("",add_window_icon);
win_add_window.setToolTipText(Language.getString("WIN_WIN_ADD"));
win_add_window.setToolTipText(Language.get("WIN_WIN_ADD"));
win_add_window.setMaximumSize(new Dimension(24,24));
win_add_window.setPreferredSize(new Dimension(24,24));
win_add_window.addActionListener(this);
win_add_layout = new JButton("",add_layout_icon);
win_add_layout.setToolTipText(Language.getString("WIN_WIN_ADD_LAY"));
win_add_layout.setToolTipText(Language.get("WIN_WIN_ADD_LAY"));
win_add_layout.setMaximumSize(new Dimension(24,24));
win_add_layout.setPreferredSize(new Dimension(24,24));
win_add_layout.addActionListener(this);
win_layout_up = new JButton("",up_icon);
win_layout_up.setToolTipText(Language.getString("WIN_WIN_MOVE_UP"));
win_layout_up.setToolTipText(Language.get("WIN_WIN_MOVE_UP"));
win_layout_up.setMaximumSize(new Dimension(24,12));
win_layout_up.setPreferredSize(new Dimension(24,12));
win_layout_up.addActionListener(this);
win_layout_down = new JButton("",down_icon);
win_layout_down.setToolTipText(Language.getString("WIN_WIN_MOVE_DOWN"));
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_duplicate = new JButton("",copy_icon);
win_duplicate.setToolTipText(Language.getString("WIN_WIN_COPY"));
win_duplicate.setToolTipText(Language.get("WIN_WIN_COPY"));
win_duplicate.setMaximumSize(new Dimension(24,24));
win_duplicate.setPreferredSize(new Dimension(24,24));
win_duplicate.addActionListener(this);
win_edit = new JButton("",edit_icon);
win_edit.setToolTipText(Language.getString("WIN_WIN_EDIT"));
win_edit.setToolTipText(Language.get("WIN_WIN_EDIT"));
win_edit.setMaximumSize(new Dimension(24,24));
win_edit.setPreferredSize(new Dimension(24,24));
win_edit.addActionListener(this);
win_del = new JButton("",delete_icon);
win_del.setToolTipText(Language.getString("WIN_WIN_DELETE"));
win_del.setToolTipText(Language.get("WIN_WIN_DELETE"));
win_del.setMaximumSize(new Dimension(24,24));
win_del.setPreferredSize(new Dimension(24,24));
win_del.addActionListener(this);
......@@ -407,10 +412,10 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
win_layout.putConstraint(SpringLayout.EAST, windows.getContentPane(),5,SpringLayout.EAST, win_tree_sp);
windows.pack();
windows.setSize(190,150);
windows.setSize(Config.getInt("win.win.width"),Config.getInt("win.win.height"));
windows.setVisible(true);
items = new JInternalFrame(Language.getString("WIN_ITEMS_TITLE"),true,false);
items = new JInternalFrame(Language.get("WIN_ITEMS_TITLE"),true,false);
items.setFrameIcon(items_icon);
items.setMinimumSize(new Dimension(190,150));
SpringLayout items_layout = new SpringLayout();
......@@ -428,32 +433,32 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
items.add(items_tree_sp);
items_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
items_add = new JButton("",add_icon);
items_add.setToolTipText(Language.getString("WIN_ITEMS_ADD"));
items_add.setToolTipText(Language.get("WIN_ITEMS_ADD"));
items_add.setMaximumSize(new Dimension(24,24));
items_add.setPreferredSize(new Dimension(24,24));
items_add.addActionListener(this);
items_up = new JButton("",up_icon);
items_up.setToolTipText(Language.getString("WIN_ITEMS_MOVE_UP"));
items_up.setToolTipText(Language.get("WIN_ITEMS_MOVE_UP"));
items_up.setMaximumSize(new Dimension(24,12));
items_up.setPreferredSize(new Dimension(24,12));
items_up.addActionListener(this);
items_down = new JButton("",down_icon);
items_down.setToolTipText(Language.getString("WIN_ITEMS_MOVE_DOWN"));
items_down.setToolTipText(Language.get("WIN_ITEMS_MOVE_DOWN"));
items_down.setMaximumSize(new Dimension(24,12));
items_down.setPreferredSize(new Dimension(24,12));
items_down.addActionListener(this);
items_duplicate = new JButton("",copy_icon);
items_duplicate.setToolTipText(Language.getString("WIN_ITEMS_COPY"));
items_duplicate.setToolTipText(Language.get("WIN_ITEMS_COPY"));
items_duplicate.setMaximumSize(new Dimension(24,24));
items_duplicate.setPreferredSize(new Dimension(24,24));
items_duplicate.addActionListener(this);
items_edit = new JButton("",edit_icon);
items_edit.setToolTipText(Language.getString("WIN_ITEMS_EDIT"));
items_edit.setToolTipText(Language.get("WIN_ITEMS_EDIT"));
items_edit.setMaximumSize(new Dimension(24,24));
items_edit.setPreferredSize(new Dimension(24,24));
items_edit.addActionListener(this);
items_del = new JButton("",delete_icon);
items_del.setToolTipText(Language.getString("WIN_ITEMS_DELETE"));
items_del.setToolTipText(Language.get("WIN_ITEMS_DELETE"));
items_del.setMaximumSize(new Dimension(24,24));
items_del.setPreferredSize(new Dimension(24,24));
items_del.addActionListener(this);
......@@ -483,7 +488,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
items_layout.putConstraint(SpringLayout.EAST, items.getContentPane(),5,SpringLayout.EAST, items_tree_sp);
items.pack();
items.setSize(190,200);
items.setSize(Config.getInt("win.items.width"),Config.getInt("win.items.height"));
items.setVisible(true);
pvwin = new PreviewWindow(this);
......@@ -493,22 +498,22 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
jdesk.add(items);
jdesk.add(pvwin.frame);
resources.setLocation(0,0);
windows.setLocation(0,200);
items.setLocation(0,350);
resources.setLocation(Config.getInt("win.res.x"),Config.getInt("win.res.y"));
windows.setLocation(Config.getInt("win.win.x"),Config.getInt("win.win.y"));
items.setLocation(Config.getInt("win.items.x"),Config.getInt("win.items.y"));
pvwin.frame.setLocation(250,0);
res_add_bitmap_pu = new JPopupMenu();
res_add_bitmap_pu_b = new JMenuItem(Language.getString("WIN_RES_PU_ADD_BMP"));
res_add_bitmap_pu_b = new JMenuItem(Language.get("WIN_RES_PU_ADD_BMP"));
res_add_bitmap_pu_b.addActionListener(this);
res_add_bitmap_pu.add(res_add_bitmap_pu_b);
res_add_bitmap_pu_s = new JMenuItem(Language.getString("WIN_RES_PU_ADD_SBMP"));
res_add_bitmap_pu_s = new JMenuItem(Language.get("WIN_RES_PU_ADD_SBMP"));
res_add_bitmap_pu_s.addActionListener(this);
res_add_bitmap_pu.add(res_add_bitmap_pu_s);
jdesk.add(res_add_bitmap_pu);
items_add_pu = new JPopupMenu();
items_add_pu_tp = new JMenu(Language.getString("WIN_ITEMS_PU_PANEL_ADD"));
items_add_pu_tp = new JMenu(Language.get("WIN_ITEMS_PU_PANEL_ADD"));
items_add_pu_tp_anchor = new JMenuItem("Anchor");
items_add_pu_tp_anchor.addActionListener(this);
items_add_pu_tp.add(items_add_pu_tp_anchor);
......@@ -571,7 +576,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
add(jdesk);
setVisible(true);
setSize(800,600);
setSize(Config.getInt("win.main.width"),Config.getInt("win.main.height"));
update();
......@@ -613,8 +618,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
* Shows a dialog from which the user can choose to either create a new skin, open an existing skin or quit the skin editor.
*/
public void showWelcomeDialog() {
Object[] options= {Language.getString("WELCOME_NEW"), Language.getString("WELCOME_OPEN"),Language.getString("WELCOME_QUIT")};
int n = JOptionPane.showOptionDialog(this,Language.getString("WELCOME_MSG"),Language.getString("WELCOME_TITLE"),
Object[] options= {Language.get("WELCOME_NEW"), Language.get("WELCOME_OPEN"),Language.get("WELCOME_QUIT")};
int n = JOptionPane.showOptionDialog(this,Language.get("WELCOME_MSG"),Language.get("WELCOME_TITLE"),
JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1]);
if(n==0) {
createNew();
......@@ -671,7 +676,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
*/
private void openFile(File f) {
if(!f.exists()) {
JOptionPane.showMessageDialog(this,Language.getString("ERROR_FILENEXIST_MSG").replaceAll("%f", f.getName()),Language.getString("ERROR_FILENEXIST_TITLE"),JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.get("ERROR_FILENEXIST_MSG").replaceAll("%f", f.getName()),Language.get("ERROR_FILENEXIST_TITLE"),JOptionPane.ERROR_MESSAGE);
if(!opened) showWelcomeDialog();
return;
}
......@@ -682,8 +687,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
ProgressWindow pwin = new ProgressWindow(this,"");
if(f.toString().toLowerCase().endsWith(".vlt")) {
String vltname = f.getName().replaceAll(".vlt","");
Object[] options= {Language.getString("VLT_EX_YES"), Language.getString("VLT_EX_NO")};
int n = JOptionPane.showOptionDialog(this,Language.getString("VLT_EX_MSG").replaceAll("%f", vltname+"_unpacked"),Language.getString("VLT_EX_TITLE"),
Object[] options= {Language.get("VLT_EX_YES"), Language.get("VLT_EX_NO")};
int n = JOptionPane.showOptionDialog(this,Language.get("VLT_EX_MSG").replaceAll("%f", vltname+"_unpacked"),Language.get("VLT_EX_TITLE"),
JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1]);
if(n!=0) {
showWelcomeDialog();
......@@ -691,7 +696,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
File unpackfolder = new File(f.getParent(),vltname+"_unpacked");
unpackfolder.mkdirs();
boolean unpacked=false;
pwin.setText(Language.getString("VLT_EX_PROGRESS"));
pwin.setText(Language.get("VLT_EX_PROGRESS"));
pwin.setVisible(true);
// <editor-fold defaultstate="collapsed" desc="zip">
try {
......@@ -755,19 +760,19 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
//</editor-fold>
if(!unpacked) {
pwin.setVisible(false);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_VLT_UNPACK_MSG"),Language.getString("ERROR_VLT_UNPACK_TITLE"),JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.get("ERROR_VLT_UNPACK_MSG"),Language.get("ERROR_VLT_UNPACK_TITLE"),JOptionPane.ERROR_MESSAGE);
opening=false;
return;
}
if(f==base_fc.getSelectedFile()) {
pwin.setVisible(false);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_VLT_NOTHEME_MSG"),Language.getString("ERROR_VLT_NOTHEME_TITLE"),JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.get("ERROR_VLT_NOTHEME_MSG"),Language.get("ERROR_VLT_NOTHEME_TITLE"),JOptionPane.ERROR_MESSAGE);
opening=false;
return;
}
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
pwin.setText(Language.getString("XML_PARSING_PROGRESS"));
pwin.setText(Language.get("XML_PARSING_PROGRESS"));
pwin.setVisible(true);
setTitle(f.toString()+" - VLC Skin Editor "+VERSION);
m_file_png.setEnabled(false);
......@@ -836,7 +841,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
Runtime.getRuntime().exec(command);
}
catch (IOException ex) {
JOptionPane.showMessageDialog(this,Language.getString("ERROR_VLC_LAUNCH_MSG"),Language.getString("ERROR_VLC_LAUNCH_ERROR"),JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.get("ERROR_VLC_LAUNCH_MSG"),Language.get("ERROR_VLC_LAUNCH_ERROR"),JOptionPane.ERROR_MESSAGE);
}
}
// </editor-fold>
......@@ -955,6 +960,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
// </editor-fold>
else if(e.getSource().equals(m_edit_theme)) s.showThemeOptions();
else if(e.getSource().equals(m_edit_vars)) s.gvars.showOptions();