Skip to content

Commit 659af40

Browse files
PhilippPhilipp
Philipp
authored and
Philipp
committed
WIP 1.9.13
1 parent 2d3d023 commit 659af40

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

src/com/devkev/devscript/raw/Command.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ public boolean repeated() {
104104
return repeated;
105105
}
106106

107+
/**True, if the argument is a integer and not a float*/
108+
public boolean isInteger(String argument) {
109+
return ProcessUtils.testForWholeNumber(argument);
110+
}
111+
112+
/**True, if the argument is a float or integer*/
113+
public boolean isFloat(String argument) {
114+
return ProcessUtils.testForFloat(argument);
115+
}
116+
107117
public static String prepare(String arguments) {
108118
StringBuilder prepArgs = new StringBuilder();
109119
for(int i = 0; i < arguments.length(); i++) {

src/com/devkev/gui/Console.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void actionPerformed(ActionEvent e) {
9898
contentPane.add(rerun);
9999

100100
consolePane = new JScrollPane();
101-
consolePane.setBounds(5, 35, 474, 159);
101+
consolePane.setBounds(0, 35, 484, 165);
102102
contentPane.add(consolePane);
103103

104104
consoleText = new JTextArea();
@@ -152,7 +152,7 @@ public void windowActivated(WindowEvent arg0) {}
152152
addComponentListener(new ComponentListener() {
153153
@Override
154154
public void componentResized(ComponentEvent e) {
155-
consolePane.setSize(getRootPane().getWidth() - 10, getRootPane().getHeight()-parent.bar.getHeight() - 20);
155+
consolePane.setSize(getRootPane().getWidth(), getRootPane().getHeight()-parent.bar.getHeight() - 10);
156156
terminate.setLocation(getRootPane().getWidth() - 28, 5);
157157
rerun.setLocation(getRootPane().getWidth() - 58, 5);
158158
consolePane.updateUI();

src/com/devkev/gui/Window.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import java.awt.event.ComponentListener;
1818
import java.awt.event.KeyEvent;
1919
import java.awt.event.KeyListener;
20-
import java.awt.event.WindowEvent;
21-
import java.awt.event.WindowListener;
2220
import java.io.BufferedReader;
2321
import java.io.BufferedWriter;
2422
import java.io.File;
@@ -158,21 +156,37 @@ public void scriptExit(Process process, int exitCode, String errorMessage) {}
158156
@Override
159157
public Command[] createLib() {
160158
return new Command[] {
161-
new Command("clearConsole", "", "Clears the console") {
159+
new Command("clearConsole", "", "Deprecated since 1.9.13 and removed in future releases. Please use 'gui.clear'") {
162160
@Override
163161
public Object execute(Object[] args, Process application, Block block) throws Exception {
164162
console.consoleText.setText("");
165163
return null;
166164
}
167165
},
166+
167+
new Command("gui.clear", "", "Clears the console") {
168+
@Override
169+
public Object execute(Object[] args, Process application, Block block) throws Exception {
170+
console.consoleText.setText("");
171+
return null;
172+
}
173+
},
174+
175+
new Command("gui.size", "string string", "Sets the console window size in pixels") {
176+
@Override
177+
public Object execute(Object[] args, Process application, Block block) throws Exception {
178+
if(isInteger(args[0].toString()) && isInteger(args[1].toString())) {
179+
console.setSize(Integer.valueOf(args[0].toString()), Integer.valueOf(args[1].toString()));
180+
} else application.kill(block, "Argument 1 and 2 need to be positive integers");
181+
return null;
182+
}
183+
}
168184
};
169185
}
170186
});
171187
p.setApplicationListener(new ApplicationListener() {
172188
public void done(int exitCode) {
173189
console.consoleStatus.setText("Finished with Exit Code " + exitCode);
174-
//window.setEnabled(true);
175-
//console.setEnabled(false);
176190
}
177191
});
178192

@@ -326,7 +340,7 @@ public void actionPerformed(ActionEvent e) {
326340
console.consoleText.setText("");
327341
console.toFront();
328342
console.setVisible(true);
329-
p.execute("help", false);
343+
p.execute("gui.size 1000 400;help", false);
330344
}});
331345
m4.add(commandCC);
332346
m4.addSeparator();

0 commit comments

Comments
 (0)