Skip to content

Commit

Permalink
Improves the TextDisplayer for parameters. Adds a new splash screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed May 8, 2022
1 parent 02602bd commit 1c8d6d0
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 49 deletions.
20 changes: 2 additions & 18 deletions msi.gama.application/plugin.xml
Expand Up @@ -21,18 +21,10 @@
name="aboutImage"
value="branding_icons/icon128.png">
</property>
<property
name="startupForegroundColor"
value="165E93">
</property>
<property
name="startupProgressRect"
value="71,515,500,12">
</property>
<property
name="startupMessageRect"
value="230,490,500,16">
</property>
<property
name="appName"
value="Gama">
Expand Down Expand Up @@ -118,21 +110,13 @@
value="branding_icons/icon128.png">
</property>
<property
name="startupForegroundColor"
value="165E93">
name="appName"
value="Gama (runtime)">
</property>
<property
name="startupProgressRect"
value="71,515,500,12">
</property>
<property
name="startupMessageRect"
value="230,490,500,16">
</property>
<property
name="appName"
value="Gama (runtime)">
</property>
<property
name="preferenceCustomization"
value="plugin_customization.ini">
Expand Down
Binary file modified msi.gama.application/splash.bmp
Binary file not shown.
16 changes: 14 additions & 2 deletions msi.gama.core/src/msi/gama/kernel/experiment/TextStatement.java
Expand Up @@ -53,11 +53,16 @@
type = IType.COLOR,
optional = true,
doc = @doc ("The color with wich the text will be displayed")),
@facet (
name = IKeyword.BACKGROUND,
type = IType.COLOR,
optional = true,
doc = @doc ("The color of the background of the text")),
@facet (
name = FONT,
type = { IType.FONT, IType.STRING },
optional = true,
doc = @doc ("the font used to draw the text, if any. Applying this facet to geometries or images has no effect. You can construct here your font with the operator \"font\". ex : font:font(\"Helvetica\", 20 , #plain)")),
doc = @doc ("the font used to draw the text, which can be built with the operator \"font\". ex : font:font(\"Helvetica\", 20 , #bold)")),
@facet (
name = IKeyword.CATEGORY,
type = IType.LABEL,
Expand All @@ -79,13 +84,14 @@ public TextStatement(final IDescription desc) {
color = getFacet(IKeyword.COLOR);
category = getFacet(IKeyword.CATEGORY);
font = getFacet(IKeyword.FONT);
background = getFacet(IKeyword.BACKGROUND);
}

/** The message. */
final IExpression message;

/** The color. */
final IExpression color, category, font;
final IExpression color, category, font, background;

@Override
public Object privateExecuteIn(final IScope scope) throws GamaRuntimeException {
Expand All @@ -107,6 +113,12 @@ public Color getColor(final IScope scope) {
return rgb;
}

public Color getBackground(final IScope scope) {
GamaColor rgb = null;
if (background != null) { rgb = Cast.asColor(scope, background.value(scope)); }
return rgb;
}

@Override
public String getTitle() { return ""; }

Expand Down
Expand Up @@ -54,8 +54,8 @@ experiment "Show Parameters" type: gui {
// Texts can be inserted in the parameters pane to explain, for instance, how the model works
// Category: Explanation
//////////////////////////////////////////////
text "This is a simple text using default values" category: "Explanation";
text "This is a more elaborate text in a different color" color: #darkgreen category: "Explanation";
text "This is a simple text using default values. It adapts automatically to the light/dark themes" category: "Explanation";
text "This is a more elaborate text in a different color and a background" color: #white background: #violet category: "Explanation";
text "This is a text in a different font, in italic and a size of 12" category: "Explanation" color: #orange font: font("Helvetica",12,#italic);
text "This bold red text \rspans over \r3 lines." category: "Explanation" color: #red font: font("Helvetica",12,#bold);

Expand Down
6 changes: 2 additions & 4 deletions ummisco.gama.product/gama.product
Expand Up @@ -66,9 +66,7 @@

<splash
location="msi.gama.application"
startupProgressRect="71,515,500,12"
startupMessageRect="230,490,500,16"
startupForegroundColor="165E93" />
startupProgressRect="71,515,500,12" />
<launcher name="Gama">
<linux icon="launcher_icons/icon.icns"/>
<macosx icon="launcher_icons/icon.icns"/>
Expand Down Expand Up @@ -283,9 +281,9 @@
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.p2.reconciler.dropins" autoStart="true" startLevel="5" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<property name="eclipse.buildId" value="${build.id}" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="version" value="1.8.2" />
<property name="eclipse.buildId" value="${build.id}" />
</configurations>

<repositories>
Expand Down
24 changes: 11 additions & 13 deletions ummisco.gama.product/gama.runtime.product
Expand Up @@ -6,11 +6,11 @@
<aboutInfo>
<image path="branding_icons/icon128.png"/>
<text>
GAMA Platform - V1.8.2 - http://gama-platform.org

(c) 2007-2008 IRD-UR GEODES (France) &amp; IFI-MSI (Vietnam)
(c) 2009-2011 UMI 209 UMMISCO IRD/UPMC - MSI (Vietnam)
(c) 2012-2017 UMI 209 UMMISCO IRD/UPMC &amp; Partners
GAMA Platform - V1.8.2 - http://gama-platform.org

(c) 2007-2008 IRD-UR GEODES (France) &amp; IFI-MSI (Vietnam)
(c) 2009-2011 UMI 209 UMMISCO IRD/UPMC - MSI (Vietnam)
(c) 2012-2017 UMI 209 UMMISCO IRD/UPMC &amp; Partners
(c) 2018-2021 UMI 209 UMMISCO IRD/SU &amp; Partners
</text>
</aboutInfo>
Expand All @@ -19,9 +19,9 @@
</configIni>

<launcherArgs>
<programArgs>-showsplash
-data @noDefault
--launcher.defaultAction
<programArgs>-showsplash
-data @noDefault
--launcher.defaultAction
openFile
</programArgs>
<programArgsLin>--launcher.GTK_version 3
Expand Down Expand Up @@ -56,7 +56,7 @@
--add-exports=java.desktop/sun.java2d=ALL-UNNAMED
-Dsun.java2d.uiScale.enabled=false
</vmArgs>
<vmArgsMac>-XstartOnFirstThread
<vmArgsMac>-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>
Expand All @@ -65,9 +65,7 @@

<splash
location="msi.gama.application"
startupProgressRect="71,515,500,12"
startupMessageRect="230,490,500,16"
startupForegroundColor="165E93" />
startupProgressRect="71,515,500,12" />
<launcher name="Gama">
<linux icon="launcher_icons/icon.icns"/>
<macosx icon="launcher_icons/icon.icns"/>
Expand Down Expand Up @@ -290,8 +288,8 @@
<plugin id="org.eclipse.equinox.p2.reconciler.dropins" autoStart="true" startLevel="5" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<property name="version" value="1.8.2" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="eclipse.buildId" value="${build.id}" />
<property name="org.eclipse.update.reconcile" value="false" />
</configurations>

<repositories>
Expand Down
Expand Up @@ -25,11 +25,10 @@
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaFont;
import ummisco.gama.ui.resources.GamaColors;
import ummisco.gama.ui.resources.IGamaColors;
import ummisco.gama.ui.utils.WorkbenchHelper;

/**
* The Class CommandEditor.
* The Class TextDisplayer.
*/
public class TextDisplayer extends AbstractStatementEditor<TextStatement> {

Expand Down Expand Up @@ -83,16 +82,19 @@ Composite createValueComposite() {
protected Control createCustomParameterControl(final Composite composite) throws GamaRuntimeException {

java.awt.Color c = getStatement().getColor(getScope());
Color color;
if (c == null) {
color = IGamaColors.NEUTRAL.color();
} else {
color = GamaColors.toSwtColor(getStatement().getColor(getScope()));
}
text = new StyledText(composite, SWT.BORDER | SWT.WRAP);
java.awt.Color b = getStatement().getBackground(getScope());
Color color = c == null ? null : GamaColors.toSwtColor(c);
Color back = b == null ? null : GamaColors.toSwtColor(b);
text = new StyledText(composite, SWT.BORDER | SWT.WRAP | SWT.READ_ONLY);
text.setJustify(true);
text.setMargins(4, 4, 4, 4);
GamaColors.setBackAndForeground(text, IGamaColors.WHITE.color(), color);
if (back != null) {
if (color != null) {
GamaColors.setBackAndForeground(text, back, color);
} else {
GamaColors.setBackground(text, back);
}
} else if (color != null) { GamaColors.setForeground(text, color); }
text.setText(getStatement().getText(getScope()));
GamaFont font = getStatement().getFont(getScope());
if (font != null) {
Expand Down

0 comments on commit 1c8d6d0

Please sign in to comment.