1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala Thu Sep 07 09:27:43 2017 +0200
1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala Thu Sep 07 09:41:06 2017 +0200
1.3 @@ -13,7 +13,6 @@
1.4 import java.awt.font._
1.5 import org.drools.xml.ExtensibleXmlParser.Null
1.6 import scala.collection.immutable.List
1.7 -import shapeless.Widen //WHY not java ?
1.8
1.9 /**
1.10 * The Java Swing component for a formula
2.1 --- a/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala Thu Sep 07 09:27:43 2017 +0200
2.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/BoxUtil.scala Thu Sep 07 09:41:06 2017 +0200
2.3 @@ -1,16 +1,16 @@
2.4 package isac.gui.mawen.editor
2.5
2.6 +import isac.gui.mawen.editor.Box._
2.7 +import isac.gui.mawen.syntax.Ast._
2.8 +import isac.gui.mawen.syntax.Ast
2.9 +import isac.gui.mawen.syntax.XSyntax
2.10 import java.awt.Graphics
2.11 import java.awt.Color
2.12 +import java.awt.Dimension
2.13 +import java.awt.Font
2.14 +import java.awt.Graphics2D
2.15 +import javax.swing.JButton
2.16 import javax.swing.JTextField
2.17 -import java.awt.Dimension
2.18 -import javax.swing.JButton
2.19 -import isac.gui.mawen.syntax.Ast._
2.20 -import isac.gui.mawen.syntax.Ast
2.21 -import java.awt.Font
2.22 -import isac.gui.mawen.editor.Box._
2.23 -import java.awt.Graphics2D
2.24 -import isac.gui.mawen.syntax.XSyntax
2.25
2.26 /**
2.27 * <code>paint</code>s a <code>Box</code> according to
2.28 @@ -18,10 +18,7 @@
2.29 * specific layouts defined in <code>CalcUtil</code>.
2.30 */
2.31 object BoxUtil {
2.32 -
2.33 -
2.34 -
2.35 -
2.36 +
2.37 def Draw(box : DrawBox, g: Graphics) : Unit = box.name match {
2.38 case "GAP" => drawGap(g, box)
2.39 case "CURSOR" => drawCursor(g, box)
2.40 @@ -36,12 +33,9 @@
2.41 box.children.foreach( Draw(_, g) )
2.42 }
2.43 }
2.44 -
2.45 -
2.46 def drawGap(g: Graphics, box : DrawBox) {
2.47 g.fillRoundRect(box.x, box.y- box.height, box.width, box.height, 15, 15)
2.48 drawBox(box, g)
2.49 -
2.50 }
2.51 def drawCursor(g: Graphics, box : DrawBox) = System.currentTimeMillis() match {
2.52 case n if (n / 250) % 1 == 0 => box.ast match {
2.53 @@ -49,19 +43,10 @@
2.54 g.setColor(Color.RED)
2.55 g.asInstanceOf[Graphics2D].drawLine(box.x, box.y, box.x + box.width , box.y)
2.56 g.asInstanceOf[Graphics2D].drawLine(box.x, box.y, box.x, box.y - box.height)
2.57 -
2.58 -
2.59 - // g.drawRect(box.x, box.y - box.height, box.width, box.height)
2.60 +
2.61 g.setColor(Color.BLACK)
2.62 - if (box.children.length >= 1)
2.63 - Draw(box.children.head, g)
2.64 -
2.65 -
2.66 - // Box.drawBox(box, g)
2.67 -
2.68 -
2.69 + if (box.children.length >= 1) Draw(box.children.head, g)
2.70 }
2.71 -
2.72 case Appl(List(a, Constant("CURSOR"))) => {
2.73 g.setColor(Color.RED)
2.74 g.asInstanceOf[Graphics2D].drawLine(box.x, box.y, box.x + box.width , box.y)
2.75 @@ -71,28 +56,19 @@
2.76 if (box.children.length >= 1)
2.77 Draw(box.children.head, g)
2.78 }
2.79 -
2.80 }
2.81 case _ => {
2.82 if (box.children.length >= 1)
2.83 Draw(box.children.head, g)
2.84 }
2.85 -
2.86 }
2.87 -
2.88 -
2.89 -
2.90 -
2.91 -
2.92 def drawPlus(g: Graphics, box : DrawBox) {
2.93 val font_var = new Font("CMCSC8", Font.PLAIN, CalcUtil.fontsizeOf(box.level))
2.94 g.setFont(font_var)
2.95
2.96 g.drawString("+", box.x0, box.y0)
2.97 drawBox(box, g)
2.98 -
2.99 }
2.100 -
2.101 def drawDivide(g: Graphics, box : DrawBox) {
2.102 g.drawLine(box.x, box.y, box.x + box.width, box.y)
2.103 drawBox(box, g)
2.104 @@ -106,7 +82,6 @@
2.105 g.setFont(font_var)
2.106 g.drawString(charIndex.toChar.toString(), box.x0, box.y0)
2.107 drawBox(box, g)
2.108 -
2.109 }
2.110 case None => {
2.111 // Ident
2.112 @@ -122,8 +97,6 @@
2.113 }
2.114 }
2.115
2.116 -
2.117 -
2.118 }
2.119
2.120