fire NotifyBraille on changeing the Box and Editing values
authormmahringer <s1520454056@students.fh-hagenberg.at>
Wed, 06 Sep 2017 13:15:47 +0200
changeset 519800b2583bba9e
parent 5197 8dbfed7191ec
child 5200 80152e6a6702
fire NotifyBraille on changeing the Box and Editing values
isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala
isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala
isac-java/src/java/isac/gui/mawen/editor/Settings.scala
isac-java/src/java/isac/gui/treetable/CalcTreeCellEditor.java
     1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala	Wed Sep 06 12:52:14 2017 +0200
     1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala	Wed Sep 06 13:15:47 2017 +0200
     1.3 @@ -110,8 +110,14 @@
     1.4        }
     1.5        case None => {
     1.6          // Ident
     1.7 -        val font_var = new Font("CMMI12", Font.PLAIN,  CalcUtil.fontsizeOf(box.level))
     1.8 -        g.setFont(font_var)
     1.9 +        if (box.name.forall(c => EditingUtil.isNumber(c) || EditingUtil.isIdentifier(c)) ) {
    1.10 +          val font_var = new Font("CMMI12", Font.PLAIN,  CalcUtil.fontsizeOf(box.level))
    1.11 +          g.setFont(font_var)
    1.12 +          
    1.13 +        }else {
    1.14 +          val font_var = new Font("CMCSC8", Font.PLAIN,  CalcUtil.fontsizeOf(box.level))
    1.15 +          g.setFont(font_var)
    1.16 +        }
    1.17          
    1.18          g.drawString(box.name, box.x0, box.y0)
    1.19          drawBox(box, g)
     2.1 --- a/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala	Wed Sep 06 12:52:14 2017 +0200
     2.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala	Wed Sep 06 13:15:47 2017 +0200
     2.3 @@ -108,6 +108,7 @@
     2.4           }else if (event.getKeyCode == KeyEvent.VK_UP) {
     2.5             TransformAstUtil.BoxParent(c)
     2.6           }
     2.7 +        EditorListenerHandler.fireNotifysBraille(c, AstInfoUtil.FindBox(c.getAst()))
     2.8        } else if (AstInfoUtil.hasCursor(c.getAst())) {
     2.9          println("has Cursor")
    2.10          EditingUtil.parse(c, -event.getKeyCode)
    2.11 @@ -147,7 +148,8 @@
    2.12            || (event.getKeyChar >= 'A' && event.getKeyChar <= 'Z')
    2.13            || List('+', '-', '*', '/', '(', '=').contains(event.getKeyChar)) {
    2.14          EditingUtil.parse(c, event.getKeyChar.toInt)
    2.15 -      }else if (
    2.16 +        EditorListenerHandler.fireNotifysBraille(c, AstInfoUtil.FindBox(c.getAst()))
    2.17 +      } else if (
    2.18            event.getKeyCode == KeyEvent.VK_ENTER || 
    2.19            event.getKeyCode == KeyEvent.VK_DELETE || 
    2.20            event.getKeyCode == KeyEvent.VK_F2) {
     3.1 --- a/isac-java/src/java/isac/gui/mawen/editor/Settings.scala	Wed Sep 06 12:52:14 2017 +0200
     3.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/Settings.scala	Wed Sep 06 13:15:47 2017 +0200
     3.3 @@ -95,13 +95,23 @@
     3.4        ast_Stringbounds = ast_Stringbounds + (op -> (RectLv0, RectLv1, RectLv2))
     3.5      }
     3.6      case Variable(str) => {
     3.7 -      g.setFont(new Font("CMMI12", Font.PLAIN, CalcUtil.fontsizeOf(0)))
     3.8 -      val RectLv0 = getStringBounds(g, str, 0f,0f)
     3.9 -      g.setFont(new Font("CMMI12", Font.PLAIN, CalcUtil.fontsizeOf(1)))
    3.10 -      val RectLv1 = getStringBounds(g, str, 0f,0f)
    3.11 -      g.setFont(new Font("CMMI12", Font.PLAIN, CalcUtil.fontsizeOf(2)))
    3.12 -      val RectLv2 = getStringBounds(g, str, 0f,0f)
    3.13 -      ast_Stringbounds = ast_Stringbounds + (str -> (RectLv0, RectLv1, RectLv2))
    3.14 +      if (str.forall(c => EditingUtil.isNumber(c) || EditingUtil.isIdentifier(c)) ) {
    3.15 +        g.setFont(new Font("CMMI12", Font.PLAIN, CalcUtil.fontsizeOf(0)))
    3.16 +        val RectLv0 = getStringBounds(g, str, 0f,0f)
    3.17 +        g.setFont(new Font("CMMI12", Font.PLAIN, CalcUtil.fontsizeOf(1)))
    3.18 +        val RectLv1 = getStringBounds(g, str, 0f,0f)
    3.19 +        g.setFont(new Font("CMMI12", Font.PLAIN, CalcUtil.fontsizeOf(2)))
    3.20 +        val RectLv2 = getStringBounds(g, str, 0f,0f)
    3.21 +        ast_Stringbounds = ast_Stringbounds + (str -> (RectLv0, RectLv1, RectLv2))
    3.22 +      } else {
    3.23 +        g.setFont(new Font("CMCSC8", Font.PLAIN, CalcUtil.fontsizeOf(0)))
    3.24 +        val RectLv0 = getStringBounds(g, str, 0f,0f)
    3.25 +        g.setFont(new Font("CMCSC8", Font.PLAIN, CalcUtil.fontsizeOf(1)))
    3.26 +        val RectLv1 = getStringBounds(g, str, 0f,0f)
    3.27 +        g.setFont(new Font("CMCSC8", Font.PLAIN, CalcUtil.fontsizeOf(2)))
    3.28 +        val RectLv2 = getStringBounds(g, str, 0f,0f)
    3.29 +        ast_Stringbounds = ast_Stringbounds + (str -> (RectLv0, RectLv1, RectLv2))
    3.30 +      }
    3.31      }
    3.32      case Appl(asts) => asts.foreach(x => fillStringbounds(x, g))
    3.33    }
     4.1 --- a/isac-java/src/java/isac/gui/treetable/CalcTreeCellEditor.java	Wed Sep 06 12:52:14 2017 +0200
     4.2 +++ b/isac-java/src/java/isac/gui/treetable/CalcTreeCellEditor.java	Wed Sep 06 13:15:47 2017 +0200
     4.3 @@ -3,6 +3,7 @@
     4.4  import isac.gui.Worksheet;
     4.5  import isac.gui.mawen.editor.EditorListener;
     4.6  import isac.gui.mawen.syntax.Ast;
     4.7 +import isac.gui.mawen.syntax.XSyntax;
     4.8  import isac.interfaces.IEditor;
     4.9  import isac.util.formulae.Formula;
    4.10  
    4.11 @@ -63,7 +64,9 @@
    4.12          notifyWorksheet();
    4.13        }
    4.14  /*err*/public void notifyBraille(Ast.Ast formula) {
    4.15 -			System.out.println("output to Braille display");
    4.16 +			  System.out.println("output to Braille display:");
    4.17 +			  System.out.println(Ast.math_string_of(formula));
    4.18 +      
    4.19        }
    4.20  
    4.21      });