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 ...@@ -2,7 +2,9 @@ VLC Skin Editor release 0.7.1
----------------------------------------------------------- -----------------------------------------------------------
Changelog: 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 0.7.0 - Preview can be saved as image
- Improved SubBitmap editing - Improved SubBitmap editing
- Resources/windows/layouts can be duplicated easily - Resources/windows/layouts can be duplicated easily
......
...@@ -29,6 +29,8 @@ MENU_EDIT_THEME|Theme settings ...@@ -29,6 +29,8 @@ MENU_EDIT_THEME|Theme settings
MENU_EDIT_THEME_MN|T MENU_EDIT_THEME_MN|T
MENU_EDIT_VARS|Global variables MENU_EDIT_VARS|Global variables
MENU_EDIT_VARS_MN|G MENU_EDIT_VARS_MN|G
MENU_EDIT_PREFS|Preferences
MENU_EDIT_PREFS_MN|P
MENU_EDIT_UP|Move selected item up MENU_EDIT_UP|Move selected item up
MENU_EDIT_DOWN|Move selected item down MENU_EDIT_DOWN|Move selected item down
MENU_EDIT_LEFT|Move selected item left MENU_EDIT_LEFT|Move selected item left
...@@ -77,9 +79,14 @@ WELCOME_NEW|Create a new skin ...@@ -77,9 +79,14 @@ WELCOME_NEW|Create a new skin
WELCOME_OPEN|Open an existing skin WELCOME_OPEN|Open an existing skin
WELCOME_QUIT|Quit 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 #Messages
ABOUT_TITLE|About VLC Skin Editor 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_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_MSG|The VLT file will be unpacked to a subfolder called "%f".\nDo you want to continue?
VLT_EX_YES|Yes, unpack VLT_EX_YES|Yes, unpack
......
...@@ -22,9 +22,14 @@ ...@@ -22,9 +22,14 @@
package vlcskineditor; 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.io.*;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import javax.swing.*;
/** /**
* Class to manage the configuration * Class to manage the configuration
...@@ -36,11 +41,29 @@ public class Config { ...@@ -36,11 +41,29 @@ public class Config {
private static File configFile = new File("VLCSkinEditor.cfg"); private static File configFile = new File("VLCSkinEditor.cfg");
static { static {
//Default values
strings.put("autoupdate", "true"); strings.put("autoupdate", "true");
strings.put("language", "English"); 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 { try {
FileReader fr = new FileReader(configFile); FileReader fr = new FileReader(configFile);
BufferedReader br = new BufferedReader(fr); BufferedReader br = new BufferedReader(fr);
...@@ -59,22 +82,50 @@ public class Config { ...@@ -59,22 +82,50 @@ public class Config {
fr.close(); fr.close();
} catch(FileNotFoundException ex) { } catch(FileNotFoundException ex) {
System.out.println("Configuration does not yet exist. Creating it..."); System.out.println("Configuration does not yet exist. Creating it...");
saveConfig(); save();
} catch(IOException ex) { } catch(IOException ex) {
ex.printStackTrace(); 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); String s = strings.get(key);
return (s!=null)?s: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 { try {
FileWriter fw = new FileWriter(configFile); FileWriter fw = new FileWriter(configFile);
BufferedWriter bw = new BufferedWriter(fw); BufferedWriter bw = new BufferedWriter(fw);
...@@ -93,6 +144,83 @@ public class Config { ...@@ -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 { ...@@ -67,7 +67,7 @@ public class Helper {
} }
} }
else { 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 { ...@@ -33,7 +33,11 @@ public class Language {
private static Hashtable<String, String> strings = new Hashtable<String, String>(); 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 { try {
FileReader fr = new FileReader(f); FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr); BufferedReader br = new BufferedReader(fr);
...@@ -60,7 +64,12 @@ public class Language { ...@@ -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); String s = strings.get(key);
return (s!=null)?s:key; return (s!=null)?s:key;
} }
......
...@@ -59,7 +59,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -59,7 +59,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
JMenuBar mbar; JMenuBar mbar;
JMenu m_file, m_edit, m_help; 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_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; JMenuItem m_help_doc, m_help_about;
JDesktopPane jdesk; JDesktopPane jdesk;
JInternalFrame resources,windows,items,current_window; JInternalFrame resources,windows,items,current_window;
...@@ -123,8 +123,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -123,8 +123,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
*/ */
public Main(String[] args) { public Main(String[] args) {
Config.loadConfig(); Config.load();
Language.loadLanguage(new File("lang"+File.separator+Config.getValue("language")+".txt")); Language.load(new File("lang"+File.separator+Config.get("language")+".txt"));
setTitle("VLC Skin Editor "+VERSION); setTitle("VLC Skin Editor "+VERSION);
...@@ -137,39 +137,39 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -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) //For cross-platform feel (CTRL on Win & Linux, APPLE/COMMAND on Mac OS)
int mask = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); int mask = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
m_file = new JMenu(Language.getString("MENU_FILE")); m_file = new JMenu(Language.get("MENU_FILE"));
m_file.setMnemonic(Language.getString("MENU_FILE_MN").charAt(0)); m_file.setMnemonic(Language.get("MENU_FILE_MN").charAt(0));
m_file_new = new JMenuItem(Language.getString("MENU_FILE_NEW")); m_file_new = new JMenuItem(Language.get("MENU_FILE_NEW"));
m_file_new.setIcon(new_icon); 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.setAccelerator(KeyStroke.getKeyStroke('N',mask));
m_file_new.addActionListener(this); 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.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.setAccelerator(KeyStroke.getKeyStroke('O',mask));
m_file_open.addActionListener(this); 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.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.setAccelerator(KeyStroke.getKeyStroke('S',mask));
m_file_save.addActionListener(this); m_file_save.addActionListener(this);
m_file_test = new JMenuItem(Language.getString("MENU_FILE_TEST")); m_file_test = new JMenuItem(Language.get("MENU_FILE_TEST"));
m_file_test.setMnemonic(Language.getString("MENU_FILE_TEST_MN").charAt(0)); 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.setAccelerator(KeyStroke.getKeyStroke('T',mask+InputEvent.SHIFT_DOWN_MASK));
m_file_test.addActionListener(this); m_file_test.addActionListener(this);
m_file_vlt = new JMenuItem(Language.getString("MENU_FILE_VLT")); m_file_vlt = new JMenuItem(Language.get("MENU_FILE_VLT"));
m_file_vlt.setMnemonic(Language.getString("MENU_FILE_VLT_MN").charAt(0)); 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.setAccelerator(KeyStroke.getKeyStroke('V',mask+InputEvent.SHIFT_DOWN_MASK));
m_file_vlt.addActionListener(this); m_file_vlt.addActionListener(this);
m_file_png = new JMenuItem(Language.getString("MENU_FILE_PNG")); m_file_png = new JMenuItem(Language.get("MENU_FILE_PNG"));
m_file_png.setMnemonic(Language.getString("MENU_FILE_PNG_MN").charAt(0)); m_file_png.setMnemonic(Language.get("MENU_FILE_PNG_MN").charAt(0));
m_file_png.addActionListener(this); m_file_png.addActionListener(this);
m_file_png.setEnabled(false); m_file_png.setEnabled(false);
if(System.getProperty("os.name").indexOf("Mac")==-1) { 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.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.setAccelerator(KeyStroke.getKeyStroke("alt F4"));
m_file_quit.addActionListener(this); m_file_quit.addActionListener(this);
} }
...@@ -185,37 +185,41 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -185,37 +185,41 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_file.addSeparator(); m_file.addSeparator();
m_file.add(m_file_quit); m_file.add(m_file_quit);
m_edit = new JMenu(Language.getString("MENU_EDIT")); m_edit = new JMenu(Language.get("MENU_EDIT"));
m_edit.setMnemonic(Language.getString("MENU_EDIT_MN").charAt(0)); m_edit.setMnemonic(Language.get("MENU_EDIT_MN").charAt(0));
m_edit_undo = new JMenuItem(Language.getString("MENU_EDIT_UNDO")); m_edit_undo = new JMenuItem(Language.get("MENU_EDIT_UNDO"));
m_edit_undo.setIcon(edit_undo_icon); 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.setAccelerator(KeyStroke.getKeyStroke('Z',mask));
m_edit_undo.addActionListener(this); 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.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.setAccelerator(KeyStroke.getKeyStroke('Y',mask));
m_edit_redo.addActionListener(this); 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.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.setAccelerator(KeyStroke.getKeyStroke('I',mask));
m_edit_theme.addActionListener(this); m_edit_theme.addActionListener(this);
m_edit_vars = new JMenuItem(Language.getString("MENU_EDIT_VARS")); m_edit_vars = new JMenuItem(Language.get("MENU_EDIT_VARS"));
m_edit_vars.setMnemonic(Language.getString("MENU_EDIT_VARS_MN").charAt(0)); m_edit_vars.setMnemonic(Language.get("MENU_EDIT_VARS_MN").charAt(0));
m_edit_vars.setAccelerator(KeyStroke.getKeyStroke('G',mask)); m_edit_vars.setAccelerator(KeyStroke.getKeyStroke('G',mask));
m_edit_vars.addActionListener(this); 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.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP,mask));
m_edit_up.addActionListener(this); 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.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,mask));
m_edit_down.addActionListener(this); 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.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,mask));
m_edit_left.addActionListener(this); 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.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,mask));
m_edit_right.addActionListener(this); m_edit_right.addActionListener(this);
...@@ -225,21 +229,22 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -225,21 +229,22 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_edit.add(m_edit_theme); m_edit.add(m_edit_theme);
m_edit.addSeparator(); m_edit.addSeparator();
m_edit.add(m_edit_vars); m_edit.add(m_edit_vars);
m_edit.add(m_edit_prefs);
m_edit.addSeparator(); m_edit.addSeparator();
m_edit.add(m_edit_up); m_edit.add(m_edit_up);
m_edit.add(m_edit_down); m_edit.add(m_edit_down);
m_edit.add(m_edit_left); m_edit.add(m_edit_left);
m_edit.add(m_edit_right); m_edit.add(m_edit_right);
m_help = new JMenu(Language.getString("MENU_HELP")); m_help = new JMenu(Language.get("MENU_HELP"));
m_help.setMnemonic(Language.getString("MENU_HELP_MN").charAt(0)); m_help.setMnemonic(Language.get("MENU_HELP_MN").charAt(0));
m_help_doc = new JMenuItem(Language.getString("MENU_HELP_DOC")); m_help_doc = new JMenuItem(Language.get("MENU_HELP_DOC"));
m_help_doc.setIcon(help_icon); 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.addActionListener(this);
m_help_doc.setAccelerator(KeyStroke.getKeyStroke("F1")); m_help_doc.setAccelerator(KeyStroke.getKeyStroke("F1"));
m_help_about = new JMenuItem(Language.getString("MENU_HELP_ABOUT")); m_help_about = new JMenuItem(Language.get("MENU_HELP_ABOUT"));
m_help_about.setMnemonic(Language.getString("MENU_HELP_ABOUT_MN").charAt(0)); m_help_about.setMnemonic(Language.get("MENU_HELP_ABOUT_MN").charAt(0));
m_help_about.addActionListener(this); m_help_about.addActionListener(this);
m_help.add(m_help_doc); m_help.add(m_help_doc);
...@@ -255,7 +260,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -255,7 +260,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
s = new Skin(this); 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.setFrameIcon(resources_icon);
resources.setMinimumSize(new Dimension(190,200)); resources.setMinimumSize(new Dimension(190,200));
SpringLayout res_layout = new SpringLayout(); SpringLayout res_layout = new SpringLayout();
...@@ -273,26 +278,26 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -273,26 +278,26 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
resources.add(res_tree_sp); resources.add(res_tree_sp);
res_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); res_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
res_add_bitmap = new JButton("",add_bitmap_icon); 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.setMaximumSize(new Dimension(24,24));
res_add_bitmap.setPreferredSize(new Dimension(24,24)); res_add_bitmap.setPreferredSize(new Dimension(24,24));
res_add_bitmap.addActionListener(this); res_add_bitmap.addActionListener(this);
res_add_font = new JButton("",add_font_icon); 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.setMaximumSize(new Dimension(24,24));
res_add_font.setPreferredSize(new Dimension(24,24)); res_add_font.setPreferredSize(new Dimension(24,24));
res_add_font.addActionListener(this); res_add_font.addActionListener(this);
res_duplicate = new JButton("",copy_icon); 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.setPreferredSize(new Dimension(24,24));
res_duplicate.addActionListener(this); res_duplicate.addActionListener(this);
res_edit = new JButton("",edit_icon); 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.setMaximumSize(new Dimension(24,24));
res_edit.setPreferredSize(new Dimension(24,24)); res_edit.setPreferredSize(new Dimension(24,24));
res_edit.addActionListener(this); res_edit.addActionListener(this);
res_del = new JButton("",delete_icon); 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.setMaximumSize(new Dimension(24,24));
res_del.setPreferredSize(new Dimension(24,24)); res_del.setPreferredSize(new Dimension(24,24));
res_del.addActionListener(this); res_del.addActionListener(this);
...@@ -323,10 +328,10 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -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); res_layout.putConstraint(SpringLayout.EAST, resources.getContentPane(),5,SpringLayout.EAST, res_tree_sp);
resources.pack(); resources.pack();
resources.setSize(190,200); resources.setSize(Config.getInt("win.res.width"),Config.getInt("win.res.height"));
resources.setVisible(true); 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.setFrameIcon(windows_icon);
windows.setMinimumSize(new Dimension(190,150)); windows.setMinimumSize(new Dimension(190,150));
SpringLayout win_layout = new SpringLayout(); SpringLayout win_layout = new SpringLayout();
...@@ -344,37 +349,37 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -344,37 +349,37 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
windows.add(win_tree_sp); windows.add(win_tree_sp);
win_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); win_tree_sp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
win_add_window = new JButton("",add_window_icon); 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.setMaximumSize(new Dimension(24,24));
win_add_window.setPreferredSize(new Dimension(24,24)); win_add_window.setPreferredSize(new Dimension(24,24));
win_add_window.addActionListener(this); win_add_window.addActionListener(this);
win_add_layout = new JButton("",add_layout_icon); 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.setMaximumSize(new Dimension(24,24));
win_add_layout.setPreferredSize(new Dimension(24,24)); win_add_layout.setPreferredSize(new Dimension(24,24));
win_add_layout.addActionListener(this); win_add_layout.addActionListener(this);
win_layout_up = new JButton("",up_icon); 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.setMaximumSize(new Dimension(24,12));
win_layout_up.setPreferredSize(new Dimension(24,12)); win_layout_up.setPreferredSize(new Dimension(24,12));
win_layout_up.addActionListener(this); win_layout_up.addActionListener(this);
win_layout_down = new JButton("",down_icon); 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.setMaximumSize(new Dimension(24,12));
win_layout_down.setPreferredSize(new Dimension(24,12)); win_layout_down.setPreferredSize(new Dimension(24,12));
win_layout_down.addActionListener(this); win_layout_down.addActionListener(this);
win_duplicate = new JButton("",copy_icon); 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.setMaximumSize(new Dimension(24,24));
win_duplicate.setPreferredSize(new Dimension(24,24)); win_duplicate.setPreferredSize(new Dimension(24,24));
win_duplicate.addActionListener(this); win_duplicate.addActionListener(this);
win_edit = new JButton("",edit_icon); 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.setMaximumSize(new Dimension(24,24));
win_edit.setPreferredSize(new Dimension(24,24)); win_edit.setPreferredSize(new Dimension(24,24));
win_edit.addActionListener(this); win_edit.addActionListener(this);
win_del = new JButton("",delete_icon); 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.setMaximumSize(new Dimension(24,24));
win_del.setPreferredSize(new Dimension(24,24)); win_del.setPreferredSize(new Dimension(24,24));
win_del.addActionListener(this); win_del.addActionListener(this);
...@@ -407,10 +412,10 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -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); win_layout.putConstraint(SpringLayout.EAST, windows.getContentPane(),5,SpringLayout.EAST, win_tree_sp);
windows.pack(); windows.pack();
windows.setSize(190,150); windows.setSize(Config.getInt("win.win.width"),Config.getInt("win.win.height"));
windows.setVisible(true); 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.setFrameIcon(items_icon);
items.setMinimumSize(new Dimension(190,150)); items.setMinimumSize(new Dimension(190,150));
SpringLayout items_layout = new SpringLayout(); SpringLayout items_layout = new SpringLayout();
...@@ -428,32 +433,32 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele ...@@ -428,32 +433,32 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
items.add(items_tree_sp);