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