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