Commit 3ad6a28a authored by Chad Barb's avatar Chad Barb
Browse files

 A couple of UI fixups:

 - Added "you're over the trashcan" visual clue when dragging thingees into the can.
 - Clicking a node to drag it from the panel now visually selects it
   (this is subtle, but more correct.)
parent 13fad6ea
......@@ -113,6 +113,7 @@ public class Netbuild extends java.applet.Applet
// this hack makes it so
// the widget creating goes on at app startup,
// not when the user places the first node (that is very annoying)
doittoit( true, nodePropertiesArea, false );
doittoit( true, linkPropertiesArea, false );
doittoit( true, lanPropertiesArea, false );
......@@ -249,6 +250,9 @@ public class Netbuild extends java.applet.Applet
if (clickedOnSomething) {
if (allowMove) {
if (dragStarted) {
if (palette.hitTrash( lastDragX + downX, lastDragY + downY )) {
palette.funktasticizeTrash( g );
}
Enumeration en = Thingee.selectedElements();
while(en.hasMoreElements()) {
......@@ -266,9 +270,13 @@ public class Netbuild extends java.applet.Applet
}
dragStarted = true;
lastDragX = e.getX() - downX;
lastDragY = e.getY() - downY;
if (palette.hitTrash( e.getX(), e.getY() )) {
palette.funktasticizeTrash( g );
}
Enumeration en = Thingee.selectedElements();
......@@ -471,7 +479,12 @@ public class Netbuild extends java.applet.Applet
private void paintThingee( Thingee t ) {
Rectangle r = t.getRectangle();
repaint( r.x + workAreaX, r.y, r.width, r.height );
// HACK!
if (palette.has( t )) {
repaint( r.x, r.y, r.width, r.height );
} else {
repaint( r.x + workAreaX, r.y, r.width, r.height );
}
}
private Dictionary wasSelected;
......@@ -513,6 +526,10 @@ public class Netbuild extends java.applet.Applet
if (dragStarted) {
Graphics g = getGraphics();
g.setXORMode( Color.white );
if (palette.hitTrash( lastDragX + downX, lastDragY + downY )) {
palette.funktasticizeTrash( g );
}
{
Enumeration en = Thingee.selectedElements();
......
......@@ -39,6 +39,10 @@ public class Palette {
copier.propertyEditable = false;
}
public boolean has( Thingee t ) {
return (newNode == t || newLAN == t || trash == t);
}
public void paint( Graphics g ) {
newNode.draw( g );
newLAN.draw( g );
......@@ -50,6 +54,10 @@ public class Palette {
return trash.clicked(x, y);
}
public void funktasticizeTrash( Graphics g ) {
trash.drawRect( g );
}
public boolean hitCopier( int x, int y ) {
return false;
//return copier.clicked(x, y);
......
......@@ -205,7 +205,7 @@ abstract synchronized class PropertiesArea extends Panel implements TextListener
public abstract String getName();
private synchronized void download() {
System.out.println( "PropertiesArea.download(): Beginning");
// System.out.println( "PropertiesArea.download(): Beginning");
Enumeration et = Thingee.selectedElements();
//currentThingees = new Vector();
......@@ -269,18 +269,18 @@ abstract synchronized class PropertiesArea extends Panel implements TextListener
}
currentThingees = cThingees;
System.out.println( "PropertiesArea.download(): Ending");
// System.out.println( "PropertiesArea.download(): Ending");
}
private synchronized void upload() {
System.out.println("Upload begins..");
// System.out.println("Upload begins..");
if (currentThingees == null) { return; }
Enumeration et = currentThingees.elements();
boolean needRedraw = false;
while (et.hasMoreElements()) {
System.out.println( "PropertiesArea.upload(): Regarding a thingee.");
// System.out.println( "PropertiesArea.upload(): Regarding a thingee.");
Thingee t = (Thingee)et.nextElement();
//if (iCare(t)) {
......@@ -295,10 +295,11 @@ abstract synchronized class PropertiesArea extends Panel implements TextListener
t.getName().compareTo( s ) != 0) {
needRedraw = true;
}
System.out.println(
"PA.upload(): Setting prop \"" +
p.name +
"\" to \"" + s + "\"." );
// System.out.println(
// "PA.upload(): Setting prop \"" +
// p.name +
// "\" to \"" + s + "\"." );
t.setProperty(p.name, s);
}
}
......@@ -308,7 +309,7 @@ abstract synchronized class PropertiesArea extends Panel implements TextListener
if (needRedraw) {
Netbuild.redrawAll();
}
System.out.println("Upload ends..");
// System.out.println("Upload ends..");
}
public void refresh() {
......
......@@ -119,8 +119,8 @@ class Thingee {
}
public void setName( String newName ) {
System.out.println("Thingee.setName(): Renamed from \"" + name +
"\" to \"" + newName + "\"" );
// System.out.println("Thingee.setName(): Renamed from \"" + name +
// "\" to \"" + newName + "\"" );
names.remove( name );
name = new String( newName );
names.put( name, new Integer(1) );
......@@ -165,6 +165,10 @@ class Thingee {
wid * 2 + 6, 57 + 6 );
}
public void drawRect( Graphics g ) {
g.fillRect( x-16, y-16, 32, 32 );
}
public void drawIcon( Graphics g ) {
g.setColor( Color.lightGray );
g.fillRect( -12, -12, 32, 32 );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment