# HG changeset patch # User mmahringer # Date 1505204025 -7200 # Node ID 766b810ae18168af87ba792e64e0818274e9cda9 # Parent db502ee9805531792395b6a408678774c21207a5 fix problem with setting a cursor diff -r db502ee98055 -r 766b810ae181 isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala --- a/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala Tue Sep 12 09:30:34 2017 +0200 +++ b/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala Tue Sep 12 10:13:45 2017 +0200 @@ -37,7 +37,7 @@ new Thread(new Runnable() { def run() { while (true) { - Thread.sleep(250); + //Thread.sleep(250); repaint() } } @@ -107,14 +107,13 @@ repaint() } def mouseClicked(e: MouseEvent ) { - if (e.isControlDown()) { - val boxAst : Ast = AstInfoUtil.FindBox(ast) + if (e.isControlDown()) { + val boxAst : Ast = AstInfoUtil.FindBox(ast) if (boxAst != null) { ast =TransformAstUtil.Update(ast, boxAst, TransformAstUtil.UnBox) } EventUtil.foreachBoxFunction = EventUtil.doInBox(e.getPoint, (g, box) => { - ast = TransformAstUtil.Update(ast, box.ast, TransformAstUtil.AstToCursor) repaint() diff -r db502ee98055 -r 766b810ae181 isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala --- a/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala Tue Sep 12 09:30:34 2017 +0200 +++ b/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala Tue Sep 12 10:13:45 2017 +0200 @@ -88,7 +88,7 @@ drawBox(box, g) } case None => { - println(box.name) + // Ident if (box.name.forall(c => EditingUtil.isNumber(c)) ) { val font_var = new Font("AR PL KaitiM Big5", Font.PLAIN, CalcUtil.fontsizeOf(box.level)) diff -r db502ee98055 -r 766b810ae181 isac-java/src/java/isac/gui/mawen/editor/EditingUtil.scala --- a/isac-java/src/java/isac/gui/mawen/editor/EditingUtil.scala Tue Sep 12 09:30:34 2017 +0200 +++ b/isac-java/src/java/isac/gui/mawen/editor/EditingUtil.scala Tue Sep 12 10:13:45 2017 +0200 @@ -35,9 +35,7 @@ } def startState(c: AstContainer, inputCode: Int, cursorAst: Ast) : Option[Ast] = { - println("startstate") if (isActionCode(inputCode)) { - println("action") return ActionState(c, -inputCode, cursorAst) } else if (isDelim(inputCode) ) { return delimerState(c, inputCode.toChar , cursorAst) @@ -57,7 +55,6 @@ case Variable(str) if inputCode == -KeyEvent.VK_BACK_SPACE && str.length() == 1 => Some(Appl(List(Constant("CURSOR"), Constant("GAP")))) case Variable(str) if inputCode == -KeyEvent.VK_BACK_SPACE => Some(Appl(List(Variable(str.slice(0, str.length - 1)), Constant("CURSOR")))) case _ => { - println("none") None } } @@ -77,7 +74,6 @@ if (b == null) { return None } - println(b) c.setAst(TransformAstUtil.Update(c.getAst(), b, (a) => a match { case Appl(List(Constant(str), ast)) if str.startsWith("BOX") => Appl(List(Constant("CURSOR"), ast)) })) diff -r db502ee98055 -r 766b810ae181 isac-java/src/java/isac/gui/mawen/editor/EditorPanel.java --- a/isac-java/src/java/isac/gui/mawen/editor/EditorPanel.java Tue Sep 12 09:30:34 2017 +0200 +++ b/isac-java/src/java/isac/gui/mawen/editor/EditorPanel.java Tue Sep 12 10:13:45 2017 +0200 @@ -32,7 +32,7 @@ } @Override public void setFormula(String formula) { - System.out.println(formula); + } @Override /*err*/public void setFormula(Ast.Ast formula) { @@ -72,7 +72,6 @@ } @Override public String getMathText() { -/*err*/System.out.println(isac.gui.mawen.syntax.Ast$.MODULE$.math_string_of(getFormula())); /*err*/return Ast.math_string_of(getFormula() ); } } diff -r db502ee98055 -r 766b810ae181 isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala --- a/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala Tue Sep 12 09:30:34 2017 +0200 +++ b/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala Tue Sep 12 10:13:45 2017 +0200 @@ -38,10 +38,8 @@ (Graphics, DrawBox) => Unit = { (g: Graphics, box: DrawBox) => { val xfrom = box.x * Settings.zoom + Settings.translateX - val xto = box.x * Settings.zoom + Settings.translateX - + box.width * Settings.zoom - val yfrom = box.y * Settings.zoom + Settings.translateY - - box.height * Settings.zoom + val xto = box.x * Settings.zoom + Settings.translateX + box.width * Settings.zoom + val yfrom = box.y * Settings.zoom + Settings.translateY - box.height * Settings.zoom val yto = box.y * Settings.zoom + Settings.translateY if (xfrom < mousePos.x && xto > mousePos.x && yfrom < mousePos.y && yto > mousePos.y) @@ -76,7 +74,7 @@ } def keyReleased(event: KeyEvent): Unit = { if (AstInfoUtil.hasBox(c.getAst())) { - println("has Box") + if (event.getKeyCode == KeyEvent.VK_DOWN) { TransformAstUtil.BoxChild(c) }else if (event.getKeyCode == KeyEvent.VK_RIGHT) { @@ -88,7 +86,6 @@ } EditorListenerHandler.fireNotifysBraille(c, AstInfoUtil.FindBox(c.getAst())) } else if (AstInfoUtil.hasCursor(c.getAst())) { - println("has Cursor") EditingUtil.parse(c, -event.getKeyCode) } if (event.getKeyCode == KeyEvent.VK_DOWN) {