improved display of control points and status message

This commit is contained in:
bancika
2011-01-16 23:18:15 +00:00
parent 796276b1c1
commit 584d84ff77
2 changed files with 18 additions and 10 deletions
@@ -239,7 +239,7 @@ public class StatusBar extends JPanel implements IPlugIn {
if (componentSlot == null) { if (componentSlot == null) {
if (componentsUnderCursor != null && !componentsUnderCursor.isEmpty()) { if (componentsUnderCursor != null && !componentsUnderCursor.isEmpty()) {
String formattedNames = Utils.toCommaString(componentsUnderCursor); String formattedNames = Utils.toCommaString(componentsUnderCursor);
getStatusLabel().setText("Drag control points of " + formattedNames); getStatusLabel().setText("Drag control point(s) of " + formattedNames);
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) { } else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(Utils.toCommaString(selectedComponentNames)); builder.append(Utils.toCommaString(selectedComponentNames));
@@ -133,20 +133,28 @@ public class ProjectPainter {
} }
} }
g2dWrapper.setColor(Constants.CONTROL_POINT_COLOR);
// Draw control points. // Draw control points.
for (IDIYComponent<?> component : project.getComponents()) { if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) { // Draw unselected points first to make sure they are below.
for (IDIYComponent<?> component : project.getComponents()) {
if (drawControlPoints.contains(component)
&& !selectedComponents.contains(component)) {
g2dWrapper.setColor(Constants.CONTROL_POINT_COLOR);
for (int i = 0; i < component.getControlPointCount(); i++) {
Point controlPoint = component.getControlPoint(i);
int pointSize = CONTROL_POINT_SIZE - 2;
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
- pointSize / 2, pointSize, pointSize);
}
}
}
// Then draw the selected ones.
for (IDIYComponent<?> component : selectedComponents) {
if (drawControlPoints.contains(component)) { if (drawControlPoints.contains(component)) {
boolean isSelected = selectedComponents.contains(component); g2dWrapper.setColor(Constants.SELECTED_CONTROL_POINT_COLOR);
g2dWrapper.setColor(isSelected ? Constants.SELECTED_CONTROL_POINT_COLOR
: Constants.CONTROL_POINT_COLOR);
for (int i = 0; i < component.getControlPointCount(); i++) { for (int i = 0; i < component.getControlPointCount(); i++) {
Point controlPoint = component.getControlPoint(i); Point controlPoint = component.getControlPoint(i);
int pointSize = CONTROL_POINT_SIZE; int pointSize = CONTROL_POINT_SIZE;
if (!isSelected) {
pointSize -= 2;
}
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
- pointSize / 2, pointSize, pointSize); - pointSize / 2, pointSize, pointSize);
} }