fix problem with setting a cursor
authormmahringer <s1520454056@students.fh-hagenberg.at>
Tue, 12 Sep 2017 10:13:45 +0200
changeset 5206766b810ae181
parent 5205 db502ee98055
child 5209 515070991639
child 5210 7ef211d6ba4c
fix problem with setting a cursor
isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala
isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala
isac-java/src/java/isac/gui/mawen/editor/EditingUtil.scala
isac-java/src/java/isac/gui/mawen/editor/EditorPanel.java
isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala
     1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala	Tue Sep 12 09:30:34 2017 +0200
     1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala	Tue Sep 12 10:13:45 2017 +0200
     1.3 @@ -37,7 +37,7 @@
     1.4    new Thread(new Runnable() {
     1.5      def run() {
     1.6        while (true) {
     1.7 -        Thread.sleep(250);
     1.8 +        //Thread.sleep(250);
     1.9          repaint()
    1.10        }
    1.11      }
    1.12 @@ -107,14 +107,13 @@
    1.13  		repaint()
    1.14  	}
    1.15  	def mouseClicked(e: MouseEvent ) {
    1.16 -		if (e.isControlDown()) {
    1.17 -		  val boxAst : Ast = AstInfoUtil.FindBox(ast)
    1.18 +	  if (e.isControlDown()) {
    1.19 +	    val boxAst : Ast = AstInfoUtil.FindBox(ast)
    1.20    	  if (boxAst != null) {
    1.21      	  ast =TransformAstUtil.Update(ast, boxAst, TransformAstUtil.UnBox)    
    1.22    	  }
    1.23  		  EventUtil.foreachBoxFunction = EventUtil.doInBox(e.getPoint,
    1.24  		      (g, box) => {
    1.25 -		        
    1.26    	        ast = TransformAstUtil.Update(ast, box.ast, TransformAstUtil.AstToCursor)
    1.27    	        
    1.28    	        repaint()
     2.1 --- a/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala	Tue Sep 12 09:30:34 2017 +0200
     2.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala	Tue Sep 12 10:13:45 2017 +0200
     2.3 @@ -88,7 +88,7 @@
     2.4          drawBox(box, g)
     2.5        }
     2.6        case None => {
     2.7 -        println(box.name)
     2.8 +        
     2.9          // Ident
    2.10          if (box.name.forall(c => EditingUtil.isNumber(c)) ) {
    2.11            val font_var = new Font("AR PL KaitiM Big5", Font.PLAIN,  CalcUtil.fontsizeOf(box.level))
     3.1 --- a/isac-java/src/java/isac/gui/mawen/editor/EditingUtil.scala	Tue Sep 12 09:30:34 2017 +0200
     3.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/EditingUtil.scala	Tue Sep 12 10:13:45 2017 +0200
     3.3 @@ -35,9 +35,7 @@
     3.4    }
     3.5    
     3.6    def startState(c: AstContainer, inputCode: Int, cursorAst: Ast) : Option[Ast] = {
     3.7 -    println("startstate")
     3.8      if (isActionCode(inputCode)) {
     3.9 -      println("action")
    3.10        return ActionState(c, -inputCode, cursorAst)
    3.11      } else if (isDelim(inputCode) ) {
    3.12        return delimerState(c, inputCode.toChar , cursorAst)
    3.13 @@ -57,7 +55,6 @@
    3.14      case Variable(str) if inputCode == -KeyEvent.VK_BACK_SPACE && str.length() == 1 => Some(Appl(List(Constant("CURSOR"), Constant("GAP"))))
    3.15      case Variable(str) if inputCode == -KeyEvent.VK_BACK_SPACE                      => Some(Appl(List(Variable(str.slice(0, str.length - 1)), Constant("CURSOR"))))
    3.16      case _ => {
    3.17 -      println("none")
    3.18        None
    3.19      }
    3.20    }
    3.21 @@ -77,7 +74,6 @@
    3.22        if (b == null) {
    3.23          return None
    3.24        }
    3.25 -      println(b)
    3.26        c.setAst(TransformAstUtil.Update(c.getAst(), b, (a) => a match {
    3.27          case Appl(List(Constant(str), ast)) if str.startsWith("BOX") => Appl(List(Constant("CURSOR"), ast))
    3.28        }))
     4.1 --- a/isac-java/src/java/isac/gui/mawen/editor/EditorPanel.java	Tue Sep 12 09:30:34 2017 +0200
     4.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/EditorPanel.java	Tue Sep 12 10:13:45 2017 +0200
     4.3 @@ -32,7 +32,7 @@
     4.4    }
     4.5    @Override
     4.6    public void setFormula(String formula) {
     4.7 -    System.out.println(formula);
     4.8 +   
     4.9    }
    4.10    @Override
    4.11  /*err*/public void setFormula(Ast.Ast formula) {
    4.12 @@ -72,7 +72,6 @@
    4.13    }
    4.14    @Override
    4.15    public String getMathText() {
    4.16 -/*err*/System.out.println(isac.gui.mawen.syntax.Ast$.MODULE$.math_string_of(getFormula()));
    4.17  /*err*/return Ast.math_string_of(getFormula() );
    4.18    }
    4.19  }
     5.1 --- a/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala	Tue Sep 12 09:30:34 2017 +0200
     5.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala	Tue Sep 12 10:13:45 2017 +0200
     5.3 @@ -38,10 +38,8 @@
     5.4        (Graphics, DrawBox) => Unit = {
     5.5  	  (g: Graphics, box: DrawBox) => {
     5.6  	    val xfrom = box.x * Settings.zoom + Settings.translateX
     5.7 -  	  val xto   = box.x * Settings.zoom + Settings.translateX 
     5.8 -  	    + box.width  * Settings.zoom
     5.9 -  	  val yfrom = box.y * Settings.zoom + Settings.translateY 
    5.10 -        - box.height * Settings.zoom
    5.11 +  	  val xto   = box.x * Settings.zoom + Settings.translateX + box.width  * Settings.zoom
    5.12 +  	  val yfrom = box.y * Settings.zoom + Settings.translateY  - box.height * Settings.zoom
    5.13    	  val yto   = box.y * Settings.zoom + Settings.translateY
    5.14    	  if (xfrom < mousePos.x && xto > mousePos.x && 
    5.15    	      yfrom < mousePos.y && yto > mousePos.y)
    5.16 @@ -76,7 +74,7 @@
    5.17      }
    5.18      def keyReleased(event: KeyEvent): Unit = {
    5.19        if (AstInfoUtil.hasBox(c.getAst())) {
    5.20 -        println("has Box")
    5.21 +        
    5.22           if (event.getKeyCode == KeyEvent.VK_DOWN) {
    5.23             TransformAstUtil.BoxChild(c)
    5.24           }else if (event.getKeyCode == KeyEvent.VK_RIGHT) {
    5.25 @@ -88,7 +86,6 @@
    5.26           }
    5.27          EditorListenerHandler.fireNotifysBraille(c, AstInfoUtil.FindBox(c.getAst()))
    5.28        } else if (AstInfoUtil.hasCursor(c.getAst())) {
    5.29 -        println("has Cursor")
    5.30          EditingUtil.parse(c, -event.getKeyCode)
    5.31        }
    5.32        if (event.getKeyCode == KeyEvent.VK_DOWN) {