1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2009 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
54 |
CC.initJSampler(); |
CC.initJSampler(); |
55 |
initGUI(); |
initGUI(); |
56 |
} |
} |
57 |
|
|
58 |
|
/** |
59 |
|
* Schedule the specified script to be run when connection is established. |
60 |
|
* @param fileName The path of the script to run. |
61 |
|
*/ |
62 |
|
public static void |
63 |
|
open(String fileName) { |
64 |
|
CC.getLogger().warning(fileName); |
65 |
|
if(fileName == null) return; |
66 |
|
if(CC.getClient().isConnected()) { |
67 |
|
CC.getMainFrame().runScript(fileName); |
68 |
|
return; |
69 |
|
} |
70 |
|
|
71 |
|
if(scripts == null) { |
72 |
|
scripts = new String[1]; |
73 |
|
scripts[0] = fileName; |
74 |
|
CC.addConnectionEstablishedListener(new ConnectionEstablishedListener()); |
75 |
|
} else { |
76 |
|
String[] files = new String[scripts.length + 1]; |
77 |
|
for(int i = 0; i < scripts.length; i++) { |
78 |
|
files[i] = scripts[i]; |
79 |
|
} |
80 |
|
files[files.length - 1] = fileName; |
81 |
|
scripts = files; |
82 |
|
} |
83 |
|
} |
84 |
|
|
85 |
private static void |
private static void |
86 |
initGUI() { |
initGUI() { |
95 |
|
|
96 |
private static void |
private static void |
97 |
initGUI0() { |
initGUI0() { |
98 |
CC.addConnectionEstablishedListener(new ConnectionEstablishedListener()); |
if(scripts != null) { |
99 |
|
CC.addConnectionEstablishedListener(new ConnectionEstablishedListener()); |
100 |
|
} |
101 |
|
|
102 |
CC.checkJSamplerHome(); |
CC.checkJSamplerHome(); |
103 |
CC.loadOrchestras(); |
CC.loadOrchestras(); |
111 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
112 |
if(scripts == null) return; |
if(scripts == null) return; |
113 |
for(String s : scripts) CC.getMainFrame().runScript(s); |
for(String s : scripts) CC.getMainFrame().runScript(s); |
114 |
|
scripts = null; |
115 |
SwingUtilities.invokeLater(this); |
SwingUtilities.invokeLater(this); |
116 |
} |
} |
117 |
|
|