Skip to content
Snippets Groups Projects
Commit e4479b21 authored by Lukas Ladenberger's avatar Lukas Ladenberger
Browse files

improved invisible/visible attribute

parent 4eb1d61a
No related branches found
No related tags found
No related merge requests found
de.bmotionstudio.gef.editor/icons/icon_invisible.gif

951 B

......@@ -27,6 +27,7 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
public static final String IMG_ICON_DELETE_EDIT = "icon_delete_edit";
public static final String IMG_ICON_TR_UP = "icon_tr_up";
public static final String IMG_ICON_TR_LEFT = "icon_tr_left";
public static final String IMG_ICON_CONTROL_HIDDEN = "icon_control_hidden";
public static final String IMG_ICON_JPG = "icon_jpg";
public static final String IMG_ICON_GIF = "icon_gif";
......@@ -63,11 +64,14 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_connection16.gif");
BMotionStudioImage.registerImage(IMG_ICON_CONNECTION24,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_connection24.gif");
BMotionStudioImage.registerImage(IMG_ICON_CONTROL_HIDDEN,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_invisible.gif");
BMotionStudioImage.registerImage(IMG_ICON_NEW_WIZ, "org.eclipse.ui",
"$nl$/icons/full/etool16/new_wiz.gif");
BMotionStudioImage.registerImage(IMG_ICON_DELETE_EDIT,
"org.eclipse.ui", "$nl$/icons/full/etool16/delete_edit.gif");
BMotionStudioImage.registerImage(IMG_ICON_DELETE_EDIT,
"org.eclipse.ui", "$nl$/icons/full/etool16/delete_edit.gif");
BMotionStudioImage
.registerImage(IMG_ICON_TR_UP, BMotionEditorPlugin.PLUGIN_ID,
"icons/eclipse16/updated_co.gif");
......
......@@ -8,6 +8,10 @@ package de.bmotionstudio.gef.editor.figure;
import org.eclipse.draw2d.Clickable;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
import de.bmotionstudio.gef.editor.BMotionStudioImage;
import de.bmotionstudio.gef.editor.EditorImageRegistry;
/**
* @author Lukas Ladenberger
......@@ -15,8 +19,9 @@ import org.eclipse.draw2d.Graphics;
*/
public class AbstractBMotionFigure extends Clickable {
private boolean visible;
private boolean isRunning;
protected boolean visible;
protected boolean isRunning;
public static final int HIDDEN_ALPHA_VALUE = 35;
public AbstractBMotionFigure() {
this.visible = true;
......@@ -41,8 +46,13 @@ public class AbstractBMotionFigure extends Clickable {
@Override
public void paint(Graphics g) {
if (!this.visible && !isRunning)
g.setAlpha(25);
Rectangle clientArea = getClientArea();
if (!this.visible && !isRunning()) {
g.drawImage(BMotionStudioImage
.getImage(EditorImageRegistry.IMG_ICON_CONTROL_HIDDEN),
clientArea.x, clientArea.y);
g.setAlpha(HIDDEN_ALPHA_VALUE);
}
super.paint(g);
}
......
......@@ -83,6 +83,9 @@ public class ShapeFigure extends AbstractBMotionFigure {
@Override
protected void fillShape(Graphics g) {
if (!visible && !isRunning)
g.setAlpha(AbstractBMotionFigure.HIDDEN_ALPHA_VALUE);
else
g.setAlpha(alpha);
g.setAntialias(SWT.ON);
......@@ -168,6 +171,9 @@ public class ShapeFigure extends AbstractBMotionFigure {
@Override
protected void outlineShape(Graphics g) {
if (!visible && !isRunning)
g.setAlpha(AbstractBMotionFigure.HIDDEN_ALPHA_VALUE);
else
g.setAlpha(outlineAlpha);
g.setAntialias(SWT.ON);
g.setForegroundColor(this.getForegroundColor());
......
......@@ -64,6 +64,10 @@ public class SwitchPart extends BMSAbstractEditPart {
if (aID.equals(AttributeConstants.ATTRIBUTE_SWITCH_DIRECTION))
refreshEditLayout(figure, model);
if (aID.equals(AttributeConstants.ATTRIBUTE_VISIBLE))
((SwitchFigure) figure)
.setVisible(Boolean.valueOf(value.toString()));
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment