import java.awt.Dimension;
import java.awt.Toolkit;
import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import com.mpcmaid.gui.BaseFrame;
import com.mpcmaid.gui.MainFrame;
import com.mpcmaid.gui.Preferences;

/**
 * Dummy main class with short name
 * 
 * @author cyrille martraire
 */
public final class MPCMaid {

	// splash screen
	private static JWindow screen = null;

	public static void showSplash() {
		screen = new JWindow();
		final URL resource = MainFrame.class.getResource("mpcmaidlogo400_400.png");
		screen.getContentPane().add(new JLabel(new ImageIcon(resource)));
		screen.setLocationRelativeTo(null);
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension labelSize = screen.getPreferredSize();
		screen.setLocation((int) -40, -20);
		screen
				.setLocation(screenSize.width / 2 - (labelSize.width / 2), screenSize.height / 2
						- (labelSize.height / 2));

		screen.pack();
		screen.setVisible(true);
	}

	public static void hideSplash() {
		if (screen == null) {
			return;
		}
		screen.setVisible(false);
		screen = null;
	}

	public static void main(String[] args) {
		makeAsNativeAsPossible();
		showSplash();

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {

				final BaseFrame baseFrame = new MainFrame();

				// wait to show the splash
				if (screen != null) {
					try {
						Thread.sleep(1500);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
				//baseFrame.setVisible(true);
				baseFrame.show();

				hideSplash();
			}
		});
	}

	public static final boolean isMacOsX() {
		return System.getProperty("mrj.version") != null;
	}

	public static final void makeAsNativeAsPossible() {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
		}
		try {
			if (isMacOsX()) {
				System.setProperty("apple.laf.useScreenMenuBar", "true");
				System.setProperty("com.apple.mrj.application.apple.menu.about.name", "MPC Maid");
			}
		} catch (Exception e) {
		}
		try {
			Preferences.getInstance().load();
		} catch (Exception ignore) {
		}
	}

	public String toString() {
		return "MPCMaid";
	}

}

@@ -45,16 +45,37 @@
 oolkit;%0A
+import java.io.File;%0A
 import j
@@ -1254,16 +1254,435 @@
 args) %7B%0A
+%09%09// process the command line arguments%0A%09%09boolean showSplash = true;%0A%09%09String fileName = null;%0A%09%09for (String arg : args) %7B%0A%09%09%09if (arg.equals(%22-n%22)) %7B%0A%09%09%09%09showSplash = false;%0A%09%09%09%7D else if (arg.startsWith(%22-%22)) %7B%0A%09%09%09%09showHelp();%0A%09%09%09%09return;%0A%09%09%09%7D else %7B%0A%09%09%09%09fileName = arg;%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09final File programFile;%0A%09%09if (fileName != null) %7B%0A%09%09%09programFile = new File(fileName);%0A%09%09%7D else %7B%0A%09%09%09programFile = null;%0A%09%09%7D%0A%0A
 %09%09makeAs
@@ -1701,16 +1701,35 @@
 ible();%0A
+%09%09if (showSplash)%0A%09
 %09%09showSp
@@ -1806,17 +1806,16 @@
 run() %7B%0A
-%0A
 %09%09%09%09fina
@@ -1826,16 +1826,145 @@
 seFrame 
+baseFrame;%0A%09%09%09%09if (programFile != null && programFile.exists()) %7B%0A%09%09%09%09%09baseFrame = new MainFrame(programFile);%0A%09%09%09%09%7D else %7B%0A%09%09%09%09%09
 baseFram
@@ -1980,24 +1980,29 @@
 ainFrame();%0A
+%09%09%09%09%7D
 %0A%09%09%09%09// wait
@@ -2808,24 +2808,259 @@
 ) %7B%0A%09%09%7D%0A%09%7D%0A%0A
+%09public static final void showHelp() %7B%0A%09%09System.err.println(%22Usage: mpcmaid %5B-h%5D %5B-n%5D %5B%3Cprogram.pgm%3E%5D%22);%0A%09%09System.err.println();%0A%09%09System.err.println(%22 -n     Do not show splash screen%22);%0A%09%09System.err.println(%22 -h     This text%22);%0A%09%7D%0A%0A
 %09public Stri

Implement basic command line interface