Commit 1169d4ec authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Multi-language support.

Full integration of Main.java into language system.
parent cb4fd9ba
#English language file for VLC Skin Editor
#Author/s: Daniel Dreibrodt
#The Menu bar and its entries
#The access key for a menu entry is defined by the MN value
MENU_FILE|File
MENU_FILE_MN|F
MENU_FILE_NEW|New
MENU_FILE_NEW_MN|N
MENU_FILE_OPEN|Open
MENU_FILE_OPEN_MN|O
MENU_FILE_SAVE|Save
MENU_FILE_SAVE_MN|S
MENU_FILE_TEST|Test skin in VLC...
MENU_FILE_TEST_MN|T
MENU_FILE_VLT|Export as VLT...
MENU_FILE_VLT_MN|V
MENU_FILE_PNG|Save current preview as image
MENU_FILE_PNG_MN|p
MENU_FILE_EXIT|Exit
MENU_FILE_EXIT_MN|x
MENU_EDIT|Edit
MENU_EDIT_MN|E
MENU_EDIT_UNDO|Undo
MENU_EDIT_UNDO_MN|U
MENU_EDIT_REDO|Redo
MENU_EDIT_REDO_MN|R
MENU_EDIT_THEME|Theme settings
MENU_EDIT_THEME_MN|T
MENU_EDIT_VARS|Global variables
MENU_EDIT_VARS_MN|G
MENU_EDIT_UP|Move selected item up
MENU_EDIT_DOWN|Move selected item down
MENU_EDIT_LEFT|Move selected item left
MENU_EDIT_RIGHT|Move selected item right
MENU_HELP|Help
MENU_HELP_MN|H
MENU_HELP_DOC|Online help
MENU_HELP_DOC_MN|O
MENU_HELP_ABOUT|About
MENU_HELP_ABOUT_MN|A
#Resource Window
WIN_RES_TITLE|Resources
WIN_RES_ADD_BMP|Add a new Bitmap or SubBitmap
WIN_RES_ADD_FONT|Add a new Font
WIN_RES_COPY|Create a copy of the selected resource
WIN_RES_EDIT|Edit the selected resource
WIN_RES_DELETE|Delete the selected resource
WIN_RES_PU_ADD_BMP|Add Bitmap/s
WIN_RES_PU_ADD_SBMP|Add SubBitmap
#Windows window
WIN_WIN_TITLE|Windows
WIN_WIN_ADD|Add a new window
WIN_WIN_ADD_LAY|Add a new layout to the selected window
WIN_WIN_MOVE_UP|Move selected layout up in hierarchy (last layout is the default layout for the window)
WIN_WIN_MOVE_DOWN|Move selected layout down in hierarchy (last layout is the default layout for the window)
WIN_WIN_COPY|Create a copy of the selected window or layout
WIN_WIN_EDIT|Edit the selecte window or layout
WIN_WIN_DELETE|Delete the selected window or layout
#Items window
WIN_ITEMS_TITLE|Items
WIN_ITEMS_ADD|Add a new item
WIN_ITEMS_MOVE_UP|Move selected item up in hierarchy
WIN_ITEMS_MOVE_DOWN|Move selected item down in hierarchy
WIN_ITEMS_COPY|Create a copy of the selected item
WIN_ITEMS_EDIT|Edit the selected item
WIN_ITEMS_DELETE|Delete the selecte item
WIN_ITEMS_PU_PANEL_ADD|Add to selected Panel
#Welcome dialog
WELCOME_TITLE|Welcome to the VLC Skin Editor
WELCOME_MSG|What would you like to do?
WELCOME_NEW|Create a new skin
WELCOME_OPEN|Open an existing skin
WELCOME_QUIT|Quit
#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+)
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
VLT_EX_NO|No, cancel
VLT_EX_PROGRESS|Unpacking VLT file...
XML_PARSING_PROGRESS|Parsing XML...
ADD_BMP_FILE_FILTER_DESC|*.png (Portable Network Graphic) inside the XML file's directory
ADD_FONT_FILE_FILTER_DESC|*.otf/*.ttf (Open and true type fonts) inside the XML file's directory
DUPLICATE_MSG|Please enter the rename pattern for the duplicated objects.\n%oldid% will be replaced by the old ID of the object.
DEL_CONFIRM_TITLE|Deletion confirmation
DEL_CONFIRM_MSG|Do you really want to delete "%n"?
EXIT_CONFIRM_TITLE|Your modifications were not saved
EXIT_CONFIRM_MSG|Would you like to save your skin before exiting?
UPDATE_TITLE|Update found
UPDATE_MSG|There is an update available for the Skin Editor.\nYour version: %v\nLatest version: %c\nDo you want to update the Skin Editor now?
DOWNLOAD_PROGRESS|Downloading...
CONNECT_PROGRESS|Connecting...
UPDATE_SUCCESS_TITLE|Finished updating
UPDATE_SUCCESS_MSG|Update was sucessfully downloaded and installed.\nVLC Skin Editor will restart now
#General strings
CHOICE_YES|Yes
CHOICE_NO|No
CHOICE_CANCEL|Cancel
BUTTON_OK|OK
BUTTON_CANCEL|Cancel
BUTTON_HELP|Help
#Error messages
ERROR_FILENEXIST_TITLE|Error while opening file
ERROR_FILENEXIST_MSG|The file "%f" does not exist and thus could not be opened!
ERROR_VLT_UNPACK_TITLE|Could not unpack VLT file
ERROR_VLT_UNPACK_MSG|VLT file could not be unpacked!
ERROR_VLT_NOTHEME_TITLE|Could not find theme.xml
ERROR_VLT_NOTHEME_MSG|Could not find "theme.xml" inside the unpacked contents of the VLT file.\nTry opening it manually.
ERROR_VLC_LAUNCH_TITLE|Error
ERROR_VLC_LAUNCH_MSG|VLC media player could not be launched
ERROR_BROWSE_TITLE|Could not launch Browser
ERROR_BROWSE_MSG|Go to the following URL manually:\n%u
ERROR_ADD_SBMP_TITLE|Could not add SubBitmap
ERROR_ADD_SBMP_NOBMP|No parent Bitmap has been selected!
ERROR_ADD_SBMP_NOTBMP|The selected resource is not a Bitmap!
ERROR_RES_DEL_TITLE|Could not delete resource
ERROR_RES_DEL_INUSE|Resource is still used in the skin, thus it cannot be deleted.
ERROR_ADD_LAYOUT_TITLE|Could not add layout
ERROR_ADD_LAYOUT_MSG|No parent window selected!
ERROR_UPDATE_TITLE|Error while updating!
\ No newline at end of file
......@@ -395,19 +395,7 @@ public class GlobalVariables implements ActionListener{
frame = null;
}
else if(e.getSource().equals(help_btn)) {
Desktop desktop;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
try {
desktop.browse(new java.net.URI("http://www.videolan.org/vlc/skinedhlp/boolexpr.html"));
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null,ex.toString(),ex.getMessage(),JOptionPane.ERROR_MESSAGE);
}
}
else {
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skinedhlp/boolexpr.html",JOptionPane.WARNING_MESSAGE);
}
Helper.browse("http://www.videolan.org/vlc/skinedhlp/boolexpr.html");
}
}
/**
......
......@@ -23,12 +23,21 @@
package vlcskineditor;
import java.awt.Component;
import java.awt.Desktop;
import javax.swing.JOptionPane;
/**
* Provides helper method
* @author Daniel Dreibrodt
*/
public class Helper {
private static Desktop desktop;
static {
if(Desktop.isDesktopSupported())
desktop = Desktop.getDesktop();
}
/**
* Gets the greatest width of the given components
......@@ -43,4 +52,22 @@ public class Helper {
}
return w;
}
/**
* Opens the given webpage in the systems default browser
* @param url The URL to the webpage
*/
public static void browse(String url) {
if(desktop!=null) {
try {
desktop.browse(new java.net.URI(url));
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null,ex.toString(),ex.getMessage(),JOptionPane.ERROR_MESSAGE);
}
}
else {
JOptionPane.showMessageDialog(null,Language.getString("ERROR_BROWSE_MSG").replaceAll("%u", url),Language.getString("ERROR_BROWSE_TITLE"),JOptionPane.WARNING_MESSAGE);
}
}
}
......@@ -400,19 +400,7 @@ public class Layout implements ActionListener{
update();
}
else if(e.getSource().equals(help_btn)) {
Desktop desktop;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
try {
desktop.browse(new java.net.URI("http://www.videolan.org/vlc/skinedhlp/layout.html"));
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null,ex.toString(),ex.getMessage(),JOptionPane.ERROR_MESSAGE);
}
}
else {
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skinedhlp/layout.html",JOptionPane.WARNING_MESSAGE);
}
Helper.browse("http://www.videolan.org/vlc/skinedhlp/layout.html");
}
else if(e.getSource().equals(cancel_btn)) {
frame.setVisible(false);
......
......@@ -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_global, 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_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;
......@@ -121,8 +121,13 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
* @param args Command line arguments passed by the console.
* If there exist one or more arguments, the first argument is intepreted as a file locator for a skin to be loaded.
*/
public Main(String[] args) {
setTitle("New skin - VLC Skin Editor "+VERSION);
public Main(String[] args) {
//TODO: Load configuration
Language.loadLanguage(new File("lang/English.txt"));
setTitle("VLC Skin Editor "+VERSION);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(this);
setSize(800,700);
......@@ -132,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("File");
m_file.setMnemonic("F".charAt(0));
m_file_new = new JMenuItem("New");
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.setIcon(new_icon);
m_file_new.setMnemonic("N".charAt(0));
m_file_new.setMnemonic(Language.getString("MENU_FILE_NEW_MN").charAt(0));
m_file_new.setAccelerator(KeyStroke.getKeyStroke('N',mask));
m_file_new.addActionListener(this);
m_file_open = new JMenuItem("Open");
m_file_open = new JMenuItem(Language.getString("MENU_FILE_OPEN"));
m_file_open.setIcon(open_icon);
m_file_open.setMnemonic('O');
m_file_open.setMnemonic(Language.getString("MENU_FILE_OPEN_MN").charAt(0));
m_file_open.setAccelerator(KeyStroke.getKeyStroke('O',mask));
m_file_open.addActionListener(this);
m_file_save = new JMenuItem("Save");
m_file_save = new JMenuItem(Language.getString("MENU_FILE_SAVE"));
m_file_save.setIcon(save_icon);
m_file_save.setMnemonic('S');
m_file_save.setMnemonic(Language.getString("MENU_FILE_SAVE_MN").charAt(0));
m_file_save.setAccelerator(KeyStroke.getKeyStroke('S',mask));
m_file_save.addActionListener(this);
m_file_test = new JMenuItem("Test skin in VLC...");
m_file_test.setMnemonic('T');
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.setAccelerator(KeyStroke.getKeyStroke('T',mask+InputEvent.SHIFT_DOWN_MASK));
m_file_test.addActionListener(this);
m_file_vlt = new JMenuItem("Export as VLT...");
m_file_vlt.setMnemonic('V');
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.setAccelerator(KeyStroke.getKeyStroke('V',mask+InputEvent.SHIFT_DOWN_MASK));
m_file_vlt.addActionListener(this);
m_file_png = new JMenuItem("Save current preview as image");
m_file_png.setMnemonic('p');
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.addActionListener(this);
m_file_png.setEnabled(false);
if(System.getProperty("os.name").indexOf("Mac")==-1) {
m_file_quit = new JMenuItem("Exit");
m_file_quit = new JMenuItem(Language.getString("MENU_FILE_EXIT"));
m_file_quit.setIcon(exit_icon);
m_file_quit.setMnemonic('x');
m_file_quit.setMnemonic(Language.getString("MENU_FILE_EXIT_MN").charAt(0));
m_file_quit.setAccelerator(KeyStroke.getKeyStroke("alt F4"));
m_file_quit.addActionListener(this);
}
......@@ -180,37 +185,37 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_file.addSeparator();
m_file.add(m_file_quit);
m_edit = new JMenu("Edit");
m_edit.setMnemonic("E".charAt(0));
m_edit_undo = new JMenuItem("Undo");
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_undo.setIcon(edit_undo_icon);
m_edit_undo.setMnemonic('U');
m_edit_undo.setMnemonic(Language.getString("MENU_EDIT_UNDO_MN").charAt(0));
m_edit_undo.setAccelerator(KeyStroke.getKeyStroke('Z',mask));
m_edit_undo.addActionListener(this);
m_edit_redo = new JMenuItem("Redo");
m_edit_redo = new JMenuItem(Language.getString("MENU_EDIT_REDO"));
m_edit_redo.setIcon(edit_redo_icon);
m_edit_redo.setMnemonic('R');
m_edit_redo.setMnemonic(Language.getString("MENU_EDIT_REDO_MN").charAt(0));
m_edit_redo.setAccelerator(KeyStroke.getKeyStroke('Y',mask));
m_edit_redo.addActionListener(this);
m_edit_theme = new JMenuItem("Theme settings");
m_edit_theme = new JMenuItem(Language.getString("MENU_EDIT_THEME"));
m_edit_theme.setIcon(edit_icon);
m_edit_theme.setMnemonic('I');
m_edit_theme.setMnemonic(Language.getString("MENU_EDIT_THEME_MN").charAt(0));
m_edit_theme.setAccelerator(KeyStroke.getKeyStroke('I',mask));
m_edit_theme.addActionListener(this);
m_edit_global = new JMenuItem("Global variables");
m_edit_global.setMnemonic('G');
m_edit_global.setAccelerator(KeyStroke.getKeyStroke('G',mask));
m_edit_global.addActionListener(this);
m_edit_up = new JMenuItem("Move selected item up");
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.setAccelerator(KeyStroke.getKeyStroke('G',mask));
m_edit_vars.addActionListener(this);
m_edit_up = new JMenuItem(Language.getString("MENU_EDIT_UP"));
m_edit_up.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP,mask));
m_edit_up.addActionListener(this);
m_edit_down = new JMenuItem("Move selected item down");
m_edit_down = new JMenuItem(Language.getString("MENU_EDIT_DOWN"));
m_edit_down.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,mask));
m_edit_down.addActionListener(this);
m_edit_left = new JMenuItem("Move selected item left");
m_edit_left = new JMenuItem(Language.getString("MENU_EDIT_LEFT"));
m_edit_left.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,mask));
m_edit_left.addActionListener(this);
m_edit_right = new JMenuItem("Move selected item right");
m_edit_right = new JMenuItem(Language.getString("MENU_EDIT_RIGHT"));
m_edit_right.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,mask));
m_edit_right.addActionListener(this);
......@@ -219,22 +224,22 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
m_edit.addSeparator();
m_edit.add(m_edit_theme);
m_edit.addSeparator();
m_edit.add(m_edit_global);
m_edit.add(m_edit_vars);
m_edit.addSeparator();
m_edit.add(m_edit_up);
m_edit.add(m_edit_down);
m_edit.add(m_edit_left);
m_edit.add(m_edit_right);
m_help = new JMenu("Help");
m_help.setMnemonic('H');
m_help_doc = new JMenuItem("Online Help");
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_doc.setIcon(help_icon);
m_help_doc.setMnemonic('D');
m_help_doc.setMnemonic(Language.getString("MENU_HELP_DOC_MN").charAt(0));
m_help_doc.addActionListener(this);
m_help_doc.setAccelerator(KeyStroke.getKeyStroke("F1"));
m_help_about = new JMenuItem("About");
m_help_about.setMnemonic('A');
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.addActionListener(this);
m_help.add(m_help_doc);
......@@ -250,7 +255,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
s = new Skin(this);
resources = new JInternalFrame("Resources",true,false);
resources = new JInternalFrame(Language.getString("WIN_RES_TITLE"),true,false);
resources.setFrameIcon(resources_icon);
resources.setMinimumSize(new Dimension(190,200));
SpringLayout res_layout = new SpringLayout();
......@@ -268,26 +273,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("Add a new Bitmap or SubBitmap");
res_add_bitmap.setToolTipText(Language.getString("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("Add a new font");
res_add_font.setToolTipText(Language.getString("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("Create a copy of the selected resource");
res_duplicate.setToolTipText(Language.getString("WIN_RES_COPY"));
res_duplicate.setPreferredSize(new Dimension(24,24));
res_duplicate.addActionListener(this);
res_edit = new JButton("",edit_icon);
res_edit.setToolTipText("Edit the selected item");
res_edit.setToolTipText(Language.getString("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("Delete the selected item");
res_del.setToolTipText(Language.getString("WIN_RES_DELETE"));
res_del.setMaximumSize(new Dimension(24,24));
res_del.setPreferredSize(new Dimension(24,24));
res_del.addActionListener(this);
......@@ -321,7 +326,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
resources.setSize(190,200);
resources.setVisible(true);
windows = new JInternalFrame("Windows",true,false);
windows = new JInternalFrame(Language.getString("WIN_WIN_TITLE"),true,false);
windows.setFrameIcon(windows_icon);
windows.setMinimumSize(new Dimension(190,150));
SpringLayout win_layout = new SpringLayout();
......@@ -339,37 +344,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("Add a new window");
win_add_window.setToolTipText(Language.getString("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("Add a new layout to the selected window");
win_add_layout.setToolTipText(Language.getString("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("Move selected layout up in hierarchy (last layout is the default layout for the window)");
win_layout_up.setToolTipText(Language.getString("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("Move selected layout down in hierarchy (last layout is the default layout for the window)");
win_layout_down.setToolTipText(Language.getString("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("Create a copy of the selected window or layout");
win_duplicate.setToolTipText(Language.getString("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("Edit the selected resource");
win_edit.setToolTipText(Language.getString("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("Delete the selected resource");
win_del.setToolTipText(Language.getString("WIN_WIN_DELETE"));
win_del.setMaximumSize(new Dimension(24,24));
win_del.setPreferredSize(new Dimension(24,24));
win_del.addActionListener(this);
......@@ -405,7 +410,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
windows.setSize(190,150);
windows.setVisible(true);
items = new JInternalFrame("Items",true,false);
items = new JInternalFrame(Language.getString("WIN_EDIT_TITLE"),true,false);
items.setFrameIcon(items_icon);
items.setMinimumSize(new Dimension(190,150));
SpringLayout items_layout = new SpringLayout();
......@@ -423,32 +428,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("Add a new item");
items_add.setToolTipText(Language.getString("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("Move selected item up in hierarchy");
items_up.setToolTipText(Language.getString("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("Move selected item down in hierarchy");
items_down.setToolTipText(Language.getString("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("Create a copy of the selected resource");
items_duplicate.setToolTipText(Language.getString("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("Edit the selected item");
items_edit.setToolTipText(Language.getString("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("Delete the selected item");
items_del.setToolTipText(Language.getString("WIN_ITEMS_DELETE"));
items_del.setMaximumSize(new Dimension(24,24));
items_del.setPreferredSize(new Dimension(24,24));
items_del.addActionListener(this);
......@@ -494,16 +499,16 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
pvwin.frame.setLocation(250,0);
res_add_bitmap_pu = new JPopupMenu();
res_add_bitmap_pu_b = new JMenuItem("Add Bitmap/s");
res_add_bitmap_pu_b = new JMenuItem(Language.getString("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("Add SubBitmap");
res_add_bitmap_pu_s = new JMenuItem(Language.getString("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("Add to selected Panel");
items_add_pu_tp = new JMenu(Language.getString("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);
......@@ -574,10 +579,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
if(args.length>0) {
File f = new File(args[0]);
if (f.exists()) openFile(f);
else {
}
openFile(f);
}
else showWelcomeDialog();
}
......@@ -611,8 +613,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= {"Create a new skin", "Open an exisiting skin","Quit"};
int n = JOptionPane.showOptionDialog(this,"What would you like to do?","Welcome to the VLC Skin Editor",
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"),
JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1]);
if(n==0) {
createNew();
......@@ -669,7 +671,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
*/
private void openFile(File f) {
if(!f.exists()) {
JOptionPane.showMessageDialog(this,"The file \""+f.getPath()+"\" does not exist and thus could not be opened!","Error while opening file",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_FILENEXIST_MSG").replaceAll("%f", f.getName()),Language.getString("ERROR_FILENEXIST_TITLE"),JOptionPane.ERROR_MESSAGE);
if(!opened) showWelcomeDialog();
return;
}
......@@ -680,8 +682,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= {"Yes, unpack", "No, cancel"};
int n = JOptionPane.showOptionDialog(this,"The VLT file will be unpacked to a subfolder called \""+vltname+"_unpacked\".\nDo you want to continue?","Importing a VLT file",
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"),
JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1]);
if(n!=0) {
showWelcomeDialog();
......@@ -689,7 +691,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("Unpacking VLT file...");
pwin.setText(Language.getString("VLT_EX_PROGRESS"));
pwin.setVisible(true);
// <editor-fold defaultstate="collapsed" desc="zip">
try {
......@@ -715,8 +717,8 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
}
unpacked=true;
}
catch (IOException ex2) {
ex2.printStackTrace();
catch (IOException ex) {
System.out.println("VLT file is not a valid ZIP file. Trying tar.gz now...");
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="tar.gz">
......@@ -753,20 +755,19 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
//</editor-fold>
if(!unpacked) {
pwin.setVisible(false);
JOptionPane.showMessageDialog(this,"VLT file could not be unpacked!","Could not unpack VLT file",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_VLT_UNPACK_MSG"),Language.getString("ERROR_VLT_UNPACK_TITLE"),JOptionPane.ERROR_MESSAGE);
opening=false;
return;
}
if(f==base_fc.getSelectedFile()) {
pwin.setVisible(false);
JOptionPane.showMessageDialog(this,"Could not find \"theme.xml\" inside the unpacked contents of the VLT file\n" +
"try opening it manually.","Could not find theme.xml",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_VLT_NOTHEME_MSG"),Language.getString("ERROR_VLT_NOTHEME_TITLE"),JOptionPane.ERROR_MESSAGE);
opening=false;
return;
}
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
pwin.setText("Parsing XML...");
pwin.setText(Language.getString("XML_PARSING_PROGRESS"));
pwin.setVisible(true);
setTitle(f.toString()+" - VLC Skin Editor "+VERSION);
m_file_png.setEnabled(false);
......@@ -834,7 +835,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
Runtime.getRuntime().exec(command);
}
catch (IOException ex) {
JOptionPane.showMessageDialog(this,"VLC Media Player could not be launched","Error",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_VLC_LAUNCH_MSG"),Language.getString("ERROR_VLC_LAUNCH_ERROR"),JOptionPane.ERROR_MESSAGE);
}
}
// </editor-fold>
......@@ -974,35 +975,16 @@ 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_global)) s.gvars.showOptions();
else if(e.getSource().equals(m_edit_vars)) s.gvars.showOptions();
// <editor-fold defaultstate="collapsed" desc="Open Help">
else if(e.getSource().equals(m_help_doc)) {
Desktop desktop;
if(Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
try {
desktop.browse(new java.net.URI("http://www.videolan.org/vlc/skinedhlp/"));
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null,ex.toString(),ex.getMessage(),JOptionPane.ERROR_MESSAGE);
}
}
else {
JOptionPane.showMessageDialog(null,"Could not launch Browser","Go to the following URL manually:\nhttp://www.videolan.org/vlc/skinedhlp/",JOptionPane.WARNING_MESSAGE);
}
Helper.browse("http://www.videolan.org/vlc/skinedhlp/");
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="About">
else if(e.getSource().equals(m_help_about)) {
JOptionPane.showMessageDialog(this,"Copyright 2007-2008 The VideoLAN Team\n" +
"Lead programmer: Daniel Dreibrodt (daniel.dreibrodt@googlemail.com)\n" +
"http://www.videolan.org/vlc/skineditor.php\n" +
"Released under terms of the GPL 2+\n\n" +
"Credits:\n" +
"Timothy Gerard Endres for registry access and TAR support (Public Domain)\n" +
"The Tango! Desktop Project (http://tango.freedesktop.org/) for some icons (Creative Commons BY-SA 2.5)\n" +
"Cyril Deguet (asmax@via.ecp.fr) and Olivier Teuliere (ipkiss@via.ecp.fr) for the Boolean Expression Evaluator and Bezier code (GPL 2+)",
"About VLC Skin Editor", JOptionPane.INFORMATION_MESSAGE,icon);
JOptionPane.showMessageDialog(this,Language.getString("ABOUT_MSG").replaceAll("%w", "http://www.videolan.org/vlc/skineditor.html").replaceAll("%y", String.valueOf(Calendar.getInstance().get(Calendar.YEAR))),
Language.getString("ABOUT_TITLE"), JOptionPane.INFORMATION_MESSAGE,icon);
}
// </editor-fold>
else if(e.getSource().equals(res_add_bitmap)) res_add_bitmap_pu.show(res_add_bitmap,0,0);
......@@ -1010,7 +992,7 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
else if(e.getSource().equals(res_add_bitmap_pu_b)) {
if(bitmap_adder==null) {
bitmap_adder = new JFileChooser();
bitmap_adder.setFileFilter(new CustomFileFilter(bitmap_adder,"png","*.png (Portable Network Graphic) inside the XML file's directory",true,s.skinfolder));
bitmap_adder.setFileFilter(new CustomFileFilter(bitmap_adder,"png",Language.getString("ADD_BMP_FILE_FILTER_DESC"),true,s.skinfolder));
bitmap_adder.setCurrentDirectory(new File(s.skinfolder));
bitmap_adder.setAcceptAllFileFilterUsed(false);
bitmap_adder.setMultiSelectionEnabled(true);
......@@ -1040,15 +1022,15 @@ public class Main extends javax.swing.JFrame implements ActionListener, TreeSele
b.SubBitmaps.add(new vlcskineditor.resources.SubBitmap(s,b));
}
else {
JOptionPane.showMessageDialog(this,"The selected resource is no bitmap!","Could not add subbitmap",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(this,Language.getString("ERROR_ADD_SBMP_NOTBMP"),Language.getString("ERROR_ADD_SBMP_TITLE"),JOptionPane.INFORMATION_MESSAGE);
}
}
else {
JOptionPane.showMessageDialog(this,"No parent bitmap selected!","Could not add subbitmap",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(this,Language