1
0
forked from GitHub/gf-core

*** empty log message ***

This commit is contained in:
janna
2004-05-03 21:02:18 +00:00
parent 86964ca5d5
commit 3458574f95
4 changed files with 1595 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
-- use this path to read the grammar from the same directory
--# -path=.:../newresource/abstract:../prelude:../newresource/english
concrete HealthEng of Health = open PredicationEng, ResourceEng, ResourceExtEng, Prelude, SyntaxEng, ExtraEng, ParadigmsEng in {
concrete HealthEng of Health = open PredicationEng, ResourceEng, ResourceExtEng, Prelude, Predef, SyntaxEng, ExtraEng, ParadigmsEng in {
flags
startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;

View File

@@ -16,8 +16,9 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener,
private int[] sizes = {10,12,16,20,25,30,36};
private String[] envfonts;
private Font[] fontObjs;
private static int DEFAULT_FONT_SIZE = 12;
private Font font;
Font[] fontObjs;
private static int DEFAULT_FONT_SIZE = 18;
private JComboBox fontList;
private JLabel fontLabel = new JLabel(" Font: ");
private JComboBox sizeList;
@@ -150,6 +151,7 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener,
private JRadioButtonMenuItem rbMenuItemUnTyped;
private static JMenuItem fileMenuItem;
private static JCheckBoxMenuItem cbMenuItem;
private static JCheckBoxMenuItem treeCbMenuItem;
private static RadioListener myListener ;
private static ButtonGroup group = new ButtonGroup();
private static ButtonGroup languageGroup = new ButtonGroup();
@@ -178,12 +180,12 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener,
menuBar.add(viewMenu);
menuBar.add(modeMenu);
cbMenuItem = new JCheckBoxMenuItem("Tree");
cbMenuItem.setActionCommand("showTree");
treeCbMenuItem = new JCheckBoxMenuItem("Tree");
treeCbMenuItem.setActionCommand("showTree");
myListener = new RadioListener();
cbMenuItem.addActionListener(myListener);
cbMenuItem.setSelected(true);
viewMenu.add(cbMenuItem);
treeCbMenuItem.addActionListener(myListener);
treeCbMenuItem.setSelected(true);
viewMenu.add(treeCbMenuItem);
viewMenu.addSeparator();
fileMenuItem = new JMenuItem("Open...");
@@ -275,8 +277,9 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener,
output.setSelectionColor(Color.green);
// output.setSelectionColor(Color.white);
// output.setFont(new Font("Arial Unicode MS", Font.PLAIN, 17));
output.setFont(new Font(null, Font.PLAIN, 17));
field.setFont(new Font(null, Font.PLAIN, 17));
font = new Font(null, Font.PLAIN, 20);
output.setFont(font);
field.setFont(font);
field.setFocusable(true);
field.addKeyListener(this);
field.addFocusListener(this);
@@ -343,10 +346,16 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener,
}
sizeList.addActionListener(this);
upPanel.add(fontLabel);
upPanel.add(fontList);
sizeList.setFont(font);
fontList.setFont(font);
menu.setFont(font);
filter.setFont(font);
modify.setFont(font);
upPanel.add(sizeLabel);
upPanel.add(sizeList);
upPanel.add(fontLabel);
upPanel.add(fontList);
tree.setToolTipText("The abstract syntax tree representation of the current editing object");
populateTree(tree);
@@ -959,7 +968,6 @@ System.out.println("encoding "+defaultEncoding);
{
boolean abs = true;
Object obj = ae.getSource();
Font font;
if ( obj == fontList ) {
font = new Font((String)fontList.getSelectedItem(), Font.PLAIN, ((Integer)sizeList.getSelectedItem()).intValue());
@@ -973,6 +981,7 @@ System.out.println("encoding "+defaultEncoding);
tree.tree.setFont(font);
list.setFont(font);
sizeList.setFont(font);
popup2.setFont(font);
sizeLabel.setFont(font);
save.setFont(font);
fontList.setFont(font);
@@ -1140,8 +1149,8 @@ System.out.println("encoding "+defaultEncoding);
treeChanged = true;
newObject = true;
menu.removeAllItems();
menu.addItem("New");
while (1< menu.getItemCount())
menu.removeItemAt(1);
langMenu.removeAll();
AbstractButton ab = null;
@@ -1201,8 +1210,6 @@ System.out.println("encoding "+defaultEncoding);
}
submenu.removeAll();
//menu.removeAllItems();
//menu.addItem("New");
while (1< menu.getItemCount())
menu.removeItemAt(1);
System.out.println("importing: "+ file.getPath().replace('\\','/'));
@@ -1228,8 +1235,8 @@ System.out.println("encoding "+defaultEncoding);
listModel.clear();
tree.clear();
populateTree(tree);
menu.removeAllItems();
menu.addItem("New");
while (1< menu.getItemCount())
menu.removeItemAt(1);
langMenu.removeAll();
AbstractButton ab = null;
@@ -1276,8 +1283,8 @@ System.out.println("encoding "+defaultEncoding);
listModel.clear();
tree.clear();
populateTree(tree);
menu.removeAllItems();
menu.addItem("New");
while (1< menu.getItemCount())
menu.removeItemAt(1);
langMenu.removeAll();
AbstractButton ab = null;
@@ -1507,7 +1514,7 @@ System.out.println("encoding "+defaultEncoding);
if (action.equals("showTree") ) {
if (!((JCheckBoxMenuItem)e.getSource()).isSelected()){
if (debug) System.out.println("was selected");
cbMenuItem.setSelected(false);
treeCbMenuItem.setSelected(false);
if (((JRadioButtonMenuItem)viewMenu.getItem(2)).isSelected()) {
centerPanel.remove(treePanel);
centerPanel.setLeftComponent(outputPanelUp);
@@ -1519,7 +1526,7 @@ System.out.println("encoding "+defaultEncoding);
}
else {
if (debug) System.out.println("was not selected");
cbMenuItem.setSelected(true);
treeCbMenuItem.setSelected(true);
if (((JRadioButtonMenuItem)viewMenu.getItem(2)).isSelected()) {
centerPanel.remove(outputPanelUp);
treePanel.setRightComponent(outputPanelUp);
@@ -1569,10 +1576,11 @@ System.out.println("encoding "+defaultEncoding);
send("ml Abs");
}
else
{
if (!action.equals("split")&&!action.equals("combine")&&!action.equals("showTree"))
{
System.out.println("sending "+action);
send("ml " + action);
}
}
}
}
}
@@ -2077,9 +2085,15 @@ System.out.println("encoding "+defaultEncoding);
{
if (debug3) System.out.println(e.getX() + " " + e.getY());
if (selectedText.length()<5)
field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, 400, 40);
if (treeCbMenuItem.isSelected())
field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, 400, 40);
else
field.setBounds(e.getX(), e.getY()+80, 400, 40);
else
field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, selectedText.length()*20, 40);
if (treeCbMenuItem.isSelected())
field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, selectedText.length()*20, 40);
else
field.setBounds(e.getX(), e.getY()+80, selectedText.length()*20, 40);
getLayeredPane().add(field, new Integer(1), 0);
field.setText(selectedText);
field.requestFocusInWindow();
@@ -2088,6 +2102,7 @@ System.out.println("encoding "+defaultEncoding);
}
void addMenuItem(String name){
menuItem2 = new JMenuItem(name);
menuItem2.setFont(font);
menuItem2.setActionCommand("popupMenuItem");
menuItem2.addActionListener(this);
popup2.add(menuItem2);

1552
src/JavaGUI/Numerals.java Normal file

File diff suppressed because it is too large Load Diff

1
src/JavaGUI/runNumerals Normal file
View File

@@ -0,0 +1 @@
java -cp ./ Numerals "GF +java ../../grammars/numerals/old/numerals.Ita.gf ../../grammars/numerals/old/numerals.Mag.gf ../../grammars/numerals/old/numerals.Tam.gf ../../grammars/numerals/old/numerals.Suo.gf ../../grammars/numerals/old/numerals.NorB.gf ../../grammars/numerals/old/numerals.Slo.gf ../../grammars/numerals/old/numerals.Spa.gf ../../grammars/numerals/old/numerals.Swe.gf ../../grammars/numerals/old/numerals.Deu.gf ../../grammars/numerals/old/numerals.Fra.gf ../../grammars/numerals/old/numerals.Malay.gf ../../grammars/numerals/old/numerals.Ned.gf ../../grammars/numerals/old/numerals.Pol.gf ../../grammars/numerals/old/numerals.ChiU.gf ../../grammars/numerals/old/numerals.Dec.gf "