Display jump statement destination

This commit is contained in:
Anuken
2021-09-30 17:33:17 -04:00
parent 6f6590d5bb
commit c226127648
2 changed files with 26 additions and 1 deletions

View File

@@ -217,6 +217,7 @@ public class LCanvas extends Table{
e.setSize(width, e.getPrefHeight());
e.setPosition(0, height - cy, Align.topLeft);
((StatementElem)e).updateAddress(i);
cy += e.getPrefHeight() + space;
seq.add(e);
@@ -316,6 +317,8 @@ public class LCanvas extends Table{
public class StatementElem extends Table{
public LStatement st;
public int index;
Label addressLabel;
public StatementElem(LStatement st){
this.st = st;
@@ -333,9 +336,11 @@ public class LCanvas extends Table{
t.margin(6f);
t.touchable = Touchable.enabled;
t.add(st.name()).style(Styles.outlineLabel).color(color).padRight(8);
t.add(st.name()).style(Styles.outlineLabel).name("statement-name").color(color).padRight(8);
t.add().growX();
addressLabel = t.add(index + "").style(Styles.outlineLabel).color(color).padRight(8).get();
t.button(Icon.copy, Styles.logici, () -> {
}).size(24f).padRight(6).get().tapped(this::copy);
@@ -395,6 +400,11 @@ public class LCanvas extends Table{
marginBottom(7);
}
public void updateAddress(int index){
this.index = index;
addressLabel.setText(index + "");
}
public void copy(){
st.saveUI();
LStatement copy = st.copy();