Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@ Alice.Block.knurlForeground = #D9D9D9

# contrasting text/backgrounds
Alice.Block.contrastForeground = #3E3E41
Alice.Block.contrastBackground = #D9D9D9
Alice.Block.contrastBackground = #D9D9D9

Alice.ControlFlow.knurlActive = #000000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't love this, but I need more time to think about how I'd do it differently.

I would expect this to be under Alice.Block tho

Alice.ControlFlow.knurlInactive = #333333
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.lgna.project.ast.StatementListProperty;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.*;

/**
Expand All @@ -75,6 +76,10 @@ public void setMaxYForIfBlock(int maxYForIfBlock) {
this.maxYForIfBlock = maxYForIfBlock;
}

protected Color getKnurlColor() {
return isActive() ? UIManager.getColor("Alice.ControlFlow.knurlActive") : UIManager.getColor("Alice.ControlFlow.knurlInactive");
}

@Override
protected void paintEpilogue(Graphics2D g2, int x, int y, int width, int height) {
super.paintEpilogue(g2, x, y, width, height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public ControlFlowPanel(ControlFlowComposite composite) {
this.internalAddComponent(BoxUtilities.createHorizontalSliver(8));
}
}
this.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
this.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 0));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.lgna.project.ast.Statement;

import javax.swing.UIManager;
import java.awt.Color;
import java.awt.Point;
import java.awt.event.MouseEvent;

Expand Down Expand Up @@ -146,4 +147,16 @@ protected void handleUndisplayable() {
// this.removeAllComponents();
super.handleUndisplayable();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to do this without the insets? i found unraveling the inset code really unintuitive. also, why 6?

@Override
protected int getInsetRight() {
return 6;
}

protected Color getKnurlColor() {
if (getModel() instanceof ExpressionStatementTemplateDragModel) {
return super.getKnurlColor();
}
return this.isActive() ? UIManager.getColor("Alice.ControlFlow.knurlActive") : UIManager.getColor("Alice.ControlFlow.knurlInactive");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,15 @@ protected void paintEpilogue(Graphics2D g2, int x, int y, int width, int height)
Shape shape = this.createShape(x, y, width, height);
this.paintOutline(g2, shape);
if (isKnurlDesired()) {
Color c = this.isActive() ? getOutlineColor() : UIManager.getColor("Alice.Block.knurlForeground");
g2.setColor(c);
g2.setColor(getKnurlColor());
KnurlUtilities.paintKnurl5(g2, x + this.getDockInsetLeft(), y + 2, KNURL_WIDTH, height - 5);
}
}

protected Color getKnurlColor() {
return this.isActive() ? getOutlineColor() : UIManager.getColor("Alice.Block.knurlForeground");
}

public void addComponent(AwtComponentView<?> component) {
this.internalAddComponent(component);
}
Expand Down