Skip to content

Commit

Permalink
Improves the display of icons on Windows
Browse files Browse the repository at this point in the history
Also tries to get rid of an annoying error regarding the version of
antlr runtime on Windows.
  • Loading branch information
AlexisDrogoul committed Sep 12, 2021
1 parent 8b5061d commit 5df7f48
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
15 changes: 7 additions & 8 deletions ummisco.gama.feature.dependencies/feature.xml
Expand Up @@ -439,7 +439,6 @@
version="0.0.0"
unpack="false"/>


<plugin
id="org.eclipse.ui.workbench.texteditor"
download-size="0"
Expand Down Expand Up @@ -594,13 +593,6 @@
version="0.0.0"
unpack="false"/>

<plugin
id="org.antlr.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.equinox.common"
download-size="0"
Expand Down Expand Up @@ -1437,4 +1429,11 @@
fragment="true"
unpack="false"/>

<plugin
id="org.antlr.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
2 changes: 1 addition & 1 deletion ummisco.gama.ui.modeling/META-INF/MANIFEST.MF
Expand Up @@ -11,7 +11,7 @@ Require-Bundle: msi.gama.lang.gaml;visibility:=reexport,
org.eclipse.xtext.builder,
org.eclipse.xtext.ui.codetemplates.ui,
msi.gama.core,
org.antlr.runtime,
org.antlr.runtime;bundle-version="3.2.0",
org.eclipse.ui.ide,
org.eclipse.compare,
org.eclipse.ui.editors,
Expand Down
Expand Up @@ -131,6 +131,7 @@
import ummisco.gama.ui.resources.GamaIcons;
import ummisco.gama.ui.resources.IGamaColors;
import ummisco.gama.ui.resources.IGamaIcons;
import ummisco.gama.ui.utils.PlatformHelper;
import ummisco.gama.ui.utils.WorkbenchHelper;
import ummisco.gama.ui.views.IGamlEditor;
import ummisco.gama.ui.views.toolbar.GamaToolbar2;
Expand Down Expand Up @@ -529,7 +530,7 @@ private void enableExperimentButton(final int index, final String text, final Se
b.addSelectionListener(listener);
t.setData("index", index);
b.setData("exp", text);
// toolbar.sep(4, SWT.LEFT);

}

/**
Expand All @@ -545,7 +546,10 @@ private void updateToolbar(final GamlEditorState newState, final boolean forceSt
WorkbenchHelper.runInUI("Editor refresh", 50, m -> {
if (toolbar == null || toolbar.isDisposed()) return;
toolbar.wipe(SWT.LEFT, true);
// if (PlatformHelper.isWindows()) { toolbar.sep(4, SWT.LEFT); }
// without the following line, the display of the
// text "msg" is not updated
// correctly (at least for Windows OS)
if (PlatformHelper.isWindows()) { toolbar.sep(2, maxImageHeight, SWT.LEFT); }

final var c = state.getColor();
var msg = state.getStatus();
Expand All @@ -569,10 +573,6 @@ private void updateToolbar(final GamlEditorState newState, final boolean forceSt
if (msg != null) {
final var t = toolbar.button(c, msg, GamaIcons.create(imageName).image(), listener, SWT.LEFT);

// without the following line, the display of the
// text "msg" is not updated
// correctly (at least for Windows OS)
// if (PlatformHelper.isWindows()) { toolbar.sep(4, SWT.LEFT); }
} else {
var i = 0;
if (newState.showExperiments) {
Expand Down
Expand Up @@ -135,14 +135,33 @@ protected void checkSubclass() {}
/**
* Sep.
*
* @param n
* @param width
* the n
* @param side
* the side
* @return the tool item
*/
public ToolItem sep(final int width, final int side /* SWT.LEFT or SWT.RIGHT */) {
final var icon = GamaIcons.createSizer(getBackground(), width, height);
final var item = create(icon.getCode(), null, null, null, SWT.NONE, false, null, side);
item.setDisabledImage(icon.image());
if (!PlatformHelper.isLinux()) { item.setEnabled(false); }
return item;
}

/**
* Sep.
*
* @param width
* the n
* @param side
* the side
* @param height
* the height
* @return the tool item
*/
public ToolItem sep(final int n, final int side /* SWT.LEFT or SWT.RIGHT */) {
final var icon = GamaIcons.createSizer(getBackground(), n, height);
public ToolItem sep(final int width, final int height, final int side /* SWT.LEFT or SWT.RIGHT */) {
final var icon = GamaIcons.createSizer(getBackground(), width, height);
final var item = create(icon.getCode(), null, null, null, SWT.NONE, false, null, side);
item.setDisabledImage(icon.image());
if (!PlatformHelper.isLinux()) { item.setEnabled(false); }
Expand Down

0 comments on commit 5df7f48

Please sign in to comment.