Thread: [Mathlib-commitlog] SF.net SVN: mathlib:[504] JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2008-11-30 15:39:27
|
Revision: 504
http://mathlib.svn.sourceforge.net/mathlib/?rev=504&view=rev
Author: st_mueller
Date: 2008-11-30 15:39:23 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
added message for update information
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2008-11-30 15:38:51 UTC (rev 503)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2008-11-30 15:39:23 UTC (rev 504)
@@ -226,16 +226,31 @@
interpreter = new Interpreter(runningStandalone);
interpreter.setOutputPanel(answer);
+
+ this.setTitle(TITLE + " - [4/4] running startup script");
+ interpreter.executeExpression("startup;");
+ //interpreter.executeExpression("messageoftheday");
+ answer.displayPrompt();
+
// silent check for updates
interpreter.executeExpression("checkForUpdates('-silent')");
+ this.setTitle(TITLE + " - Console Window");
+
+ // in case an update is available inform the user
+ if (interpreter.prefs.getLocalProperty("update.newversionavailable").equals("yes"))
+ {
+ this.setTitle(TITLE + " - (NEW version available: type update at prompt)");
+ String s = interpreter.prefs.getLocalProperty("update.newversionavailable.message01");
+ if (s==null)
+ answer.displayText("A NEW version of JMathLib is available\n type update or visit www.jmathlib.de");
+ else
+ answer.displayText(s);
+
+ answer.displayPrompt();
+ }
- this.setTitle(TITLE + " - [4/4] running startup script");
- interpreter.executeExpression("startup;");
- answer.displayPrompt();
-
- this.setTitle(TITLE + " - Console Window");
-
+
}
/**The main console initializer.*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2008-11-30 16:21:07
|
Revision: 507
http://mathlib.svn.sourceforge.net/mathlib/?rev=507&view=rev
Author: st_mueller
Date: 2008-11-30 16:21:05 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
better handling for update information
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2008-11-30 16:18:59 UTC (rev 506)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2008-11-30 16:21:05 UTC (rev 507)
@@ -238,7 +238,8 @@
this.setTitle(TITLE + " - Console Window");
// in case an update is available inform the user
- if (interpreter.prefs.getLocalProperty("update.newversionavailable").equals("yes"))
+ String u = interpreter.prefs.getLocalProperty("update.newversionavailable");
+ if ((u!=null) && u.equals("yes"))
{
this.setTitle(TITLE + " - (NEW version available: type update at prompt)");
String s = interpreter.prefs.getLocalProperty("update.newversionavailable.message01");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 20:23:44
|
Revision: 732
http://mathlib.svn.sourceforge.net/mathlib/?rev=732&view=rev
Author: st_mueller
Date: 2009-01-23 20:23:41 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
check upper and lower case of function names: e.g. sin is unequal to SIN
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-01-23 20:11:12 UTC (rev 731)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-01-23 20:23:41 UTC (rev 732)
@@ -80,7 +80,7 @@
}
else if (o == checkForUpdatesMenuItem)
{
- String answerString = interpreter.executeExpression("checkForUpdates()");
+ String answerString = interpreter.executeExpression("checkforupdates()");
answer.displayText(answerString);
answer.displayPrompt();
}
@@ -233,7 +233,7 @@
answer.displayPrompt();
// silent check for updates
- interpreter.executeExpression("checkForUpdates('-silent')");
+ interpreter.executeExpression("checkforupdates('-silent')");
this.setTitle(TITLE + " - Console Window");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-30 19:04:08
|
Revision: 797
http://mathlib.svn.sourceforge.net/mathlib/?rev=797&view=rev
Author: st_mueller
Date: 2009-01-30 19:03:54 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
changed handling of preferences/properties
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-01-30 19:02:16 UTC (rev 796)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-01-30 19:03:54 UTC (rev 797)
@@ -238,11 +238,11 @@
this.setTitle(TITLE + " - Console Window");
// in case an update is available inform the user
- String u = interpreter.prefs.getLocalProperty("update.newversionavailable");
+ String u = interpreter.globals.getProperty("update.newversionavailable");
if ((u!=null) && u.equals("yes"))
{
this.setTitle(TITLE + " - (NEW version available: type update at prompt)");
- String s = interpreter.prefs.getLocalProperty("update.newversionavailable.message01");
+ String s = interpreter.globals.getProperty("update.newversionavailable.message01");
if (s==null)
answer.displayText("A NEW version of JMathLib is available\n type update or visit www.jmathlib.de");
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-01 21:03:20
|
Revision: 826
http://mathlib.svn.sourceforge.net/mathlib/?rev=826&view=rev
Author: st_mueller
Date: 2009-02-01 21:03:14 +0000 (Sun, 01 Feb 2009)
Log Message:
-----------
addeds support for "cut","copy","paste"
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-02-01 21:02:30 UTC (rev 825)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-02-01 21:03:14 UTC (rev 826)
@@ -1,17 +1,18 @@
package jmathlib.ui.awt;
import jmathlib.core.interfaces.RemoteAccesible;
+import jmathlib.core.interpreter.ErrorLogger;
import jmathlib.core.interpreter.Interpreter;
-//import jmathlib.ui.common.console;
import java.awt.*;
import java.awt.event.*;
+import java.awt.datatransfer.*;
/**
- * Simple GUI for the MathLib package.
+ * Simple GUI for the JMathLib package.
* Some options may be given in the command line, by example:
- * <kbd>localhost# java MathLib.GUI.GUI -width=320 -height=200</kbd>.
+ * <kbd>localhost# java jmathlib.ui.awt.GUI -width=320 -height=200</kbd>.
* <p>
* <b>Command line options</b>
* <ul>
@@ -20,7 +21,7 @@
* </ul>
* </p>
*/
-public class GUI extends Frame implements WindowListener, ActionListener, RemoteAccesible
+public class GUI extends Frame implements WindowListener, ActionListener, RemoteAccesible, ClipboardOwner
{
/*The menubar container.*/
private MenuBar mainMenuBar;
@@ -46,9 +47,6 @@
/**Constant with the application title.*/
private final String TITLE="JMathLib GUI";
- /**Flag storing whether the program is running as an application or an applet*/
- private boolean runningStandalone;
-
/**The area used for user input and where the answers are displayed*/
private Console answer;
@@ -62,6 +60,7 @@
if (o == newFileMenuItem)
{
+
}
else if (o == openFileMenuItem)
{
@@ -86,16 +85,48 @@
}
else if (o == exitFileMenuItem)
{
- close();
+ close();
}
else if (o == cutEditMenuItem)
{
+ // get text from textarea
+ String s = answer.getSelectedText();
+
+ // replace selected text with empty string
+ answer.replaceRange("", answer.getSelectionStart(), answer.getSelectionEnd());
+
+ // copy selected string to system clipboard
+ StringSelection sel = new StringSelection(s);
+ Clipboard clip = getToolkit().getSystemClipboard();
+ clip.setContents(sel, this);
}
- else if (o == copyEditMenuItem)
+ else if (o == copyEditMenuItem)
{
+ // get text from textarea
+ String s = answer.getSelectedText();
+
+ // copy selected string to system clipboard
+ StringSelection sel = new StringSelection(s);
+ Clipboard clip = getToolkit().getSystemClipboard();
+ clip.setContents(sel, this);
}
else if (o == pasteEditMenuItem)
{
+ // paste from system clipboard to textarea
+ Clipboard clip = getToolkit().getSystemClipboard();
+ Transferable cont = clip.getContents(this);
+ if (cont!=null)
+ {
+ try
+ {
+ String s = (String)cont.getTransferData(DataFlavor.stringFlavor);
+ answer.insert(s, answer.getCaretPosition());
+ }
+ catch (Exception ex)
+ {
+ ErrorLogger.debugLine("clipboard not STRING");
+ }
+ }
}
else if (o == aboutHelpMenuItem)
{
@@ -113,10 +144,17 @@
plotWindowMenuItem.setEnabled(false);
consoleWindowMenuItem.setEnabled(true);
}
+ } // end actionPerformed
+
+ /**
+ * @param
+ * @param
+ */
+ public void lostOwnership(Clipboard clip, Transferable cont)
+ {
+ ErrorLogger.debugLine("clipboard has been changed");
}
-
-
/**
* Command-line parameter handler
* Takes control of the size of the main window
@@ -165,6 +203,7 @@
else
System.out.println(args[i] + ": Invalid option.");
}
+
// Let's resize the window...
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
if (width == -1)
@@ -184,75 +223,71 @@
this.dispose();
System.exit(0);
}
-
/**Create the main graphical interface (menu, buttons, delays...).*/
public GUI(String[] args)
{
- //this is an application, so set to true
- runningStandalone = true;
- this.argumentHandler(args);
+ this.argumentHandler(args);
- this.setVisible(false);
- this.setLayout(new BorderLayout());
- this.setBackground(new Color(214,211,206));
- //Get the size of the screen
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- //position the frame in the centre of the screen
- this.setLocation((d.width-getSize().width) / 2,
- (d.height-getSize().height) / 2);
- this.addWindowListener(this);
- this.setResizable(true);
- this.setVisible(true);
-
- // add image to window
- Toolkit tk = Toolkit.getDefaultToolkit();
- Image icon = tk.getImage(GUI.class.getResource("smalllogo.gif"));
- MediaTracker mt = new MediaTracker(this);
- mt.addImage(icon,0);
- try {
- mt.waitForAll();
- }
- catch (InterruptedException e){ ;}
- this.setIconImage(icon);
-
- this.setTitle(TITLE + " [1/4] Initializing menus");
- InitMenuBar(this);
+ this.setVisible(false);
+ this.setLayout(new BorderLayout());
+ this.setBackground(new Color(214,211,206));
+ //Get the size of the screen
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ //position the frame in the centre of the screen
+ this.setLocation((d.width-getSize().width) / 2,
+ (d.height-getSize().height) / 2);
+ this.addWindowListener(this);
+ this.setResizable(true);
+ this.setVisible(true);
+
+ // add image to window
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ Image icon = tk.getImage(GUI.class.getResource("smalllogo.gif"));
+ MediaTracker mt = new MediaTracker(this);
+ mt.addImage(icon,0);
+ try {
+ mt.waitForAll();
+ }
+ catch (InterruptedException e){ ;}
+ this.setIconImage(icon);
+
+ this.setTitle(TITLE + " [1/4] Initializing menus");
+ InitMenuBar(this);
- this.setTitle(TITLE + " [2/4] Initializing console window");
- InitConsole();
+ this.setTitle(TITLE + " [2/4] Initializing console window");
+ InitConsole();
- this.setTitle(TITLE + " [3/4] Initializing interpreter");
- interpreter = new Interpreter(runningStandalone);
- interpreter.setOutputPanel(answer);
-
-
- this.setTitle(TITLE + " - [4/4] running startup script");
- interpreter.executeExpression("startup;");
- //interpreter.executeExpression("messageoftheday");
- answer.displayPrompt();
+ this.setTitle(TITLE + " [3/4] Initializing interpreter");
+ interpreter = new Interpreter(true);
+ interpreter.setOutputPanel(answer);
+
+
+ this.setTitle(TITLE + " - [4/4] running startup script");
+ interpreter.executeExpression("startup;");
+ //interpreter.executeExpression("messageoftheday");
+ answer.displayPrompt();
- // silent check for updates
- interpreter.executeExpression("checkforupdates('-silent')");
+ // silent check for updates
+ interpreter.executeExpression("checkforupdates('-silent')");
- this.setTitle(TITLE + " - Console Window");
+ this.setTitle(TITLE + " - Console Window");
- // in case an update is available inform the user
- String u = interpreter.globals.getProperty("update.newversionavailable");
- if ((u!=null) && u.equals("yes"))
- {
- this.setTitle(TITLE + " - (NEW version available: type update at prompt)");
- String s = interpreter.globals.getProperty("update.newversionavailable.message01");
- if (s==null)
- answer.displayText("A NEW version of JMathLib is available\n type update or visit www.jmathlib.de");
- else
- answer.displayText(s);
-
- answer.displayPrompt();
- }
+ // in case an update is available inform the user
+ String u = interpreter.globals.getProperty("update.newversionavailable");
+ if ((u!=null) && u.equals("yes"))
+ {
+ this.setTitle(TITLE + " - (NEW version available: type update at prompt)");
+ String s = interpreter.globals.getProperty("update.newversionavailable.message01");
+ if (s==null)
+ answer.displayText("A NEW version of JMathLib is available\n type update or visit www.jmathlib.de");
+ else
+ answer.displayText(s);
+ answer.displayPrompt();
+ }
- }
+ } // end GUI
/**The main console initializer.*/
private void InitConsole()
@@ -280,35 +315,51 @@
separator1 = new MenuItem("-");
separator2 = new MenuItem("-");
+
newFileMenuItem = new MenuItem("New");
newFileMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_N));
newFileMenuItem.addActionListener(listener);
+
openFileMenuItem = new MenuItem("Open");
openFileMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_O));
openFileMenuItem.addActionListener(listener);
+
saveFileMenuItem = new MenuItem("Save");
saveFileMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_S));
saveFileMenuItem.addActionListener(listener);
+
saveAsFileMenuItem = new MenuItem("Save as...");
saveAsFileMenuItem.addActionListener(listener);
+
checkForUpdatesMenuItem = new MenuItem("Check for updates");
checkForUpdatesMenuItem.addActionListener(listener);
+
exitFileMenuItem = new MenuItem("Exit");
exitFileMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_E));
exitFileMenuItem.addActionListener(listener);
+
cutEditMenuItem = new MenuItem("Cut");
+ cutEditMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_X));
cutEditMenuItem.addActionListener(listener);
+
copyEditMenuItem = new MenuItem("Copy");
+ copyEditMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_C));
copyEditMenuItem.addActionListener(listener);
+
pasteEditMenuItem = new MenuItem("Paste");
+ pasteEditMenuItem.setShortcut(new MenuShortcut(KeyEvent.VK_V));
pasteEditMenuItem.addActionListener(listener);
+
consoleWindowMenuItem = new MenuItem("Console Window");
consoleWindowMenuItem.setEnabled(false);
consoleWindowMenuItem.addActionListener(listener);
+
plotWindowMenuItem = new MenuItem("Plot Window");
plotWindowMenuItem.addActionListener(listener);
+
aboutHelpMenuItem = new MenuItem("About...");
aboutHelpMenuItem.addActionListener(listener);
+
fileMenu.add(newFileMenuItem);
fileMenu.add(openFileMenuItem);
fileMenu.add(separator1);
@@ -328,7 +379,10 @@
this.setMenuBar(mainMenuBar);
}
- /**Interpret the last command line entered*/
+ /**
+ * Interpret the last command line entered
+ * @param
+ */
public void interpretLine(String line)
{
String answerString = interpreter.executeExpression(line);
@@ -336,36 +390,61 @@
answer.displayPrompt();
}
+ /**
+ *
+ * @param args
+ */
public static void main (String[] args)
{
- GUI myGui = new GUI(args);
+ GUI gui = new GUI(args);
}
+ /**
+ *
+ */
public void windowActivated(WindowEvent e)
{
}
+ /**
+ *
+ */
public void windowClosed(WindowEvent e)
{
}
+ /**
+ *
+ */
public void windowClosing(WindowEvent e)
{
close();
}
+ /**
+ *
+ */
public void windowDeactivated(WindowEvent e)
{
}
+ /**
+ *
+ */
public void windowDeiconified(WindowEvent e)
{
}
+ /**
+ *
+ */
public void windowIconified(WindowEvent e)
{
}
+ /**
+ *
+ */
public void windowOpened(WindowEvent e)
{
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-03-01 13:25:54
|
Revision: 897
http://mathlib.svn.sourceforge.net/mathlib/?rev=897&view=rev
Author: st_mueller
Date: 2009-03-01 13:25:51 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
use Console.java from jmathlib.ui.common
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-03-01 13:23:39 UTC (rev 896)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-03-01 13:25:51 UTC (rev 897)
@@ -4,6 +4,7 @@
import jmathlib.core.interpreter.Interpreter;
import jmathlib.core.interfaces.JMathLibOutput;
import jmathlib.core.interfaces.RemoteAccessible;
+import jmathlib.ui.common.Console;
import java.awt.*;
import java.awt.event.*;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|