]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Use Eclipse icons.
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 23 Apr 2020 10:40:01 +0000 (12:40 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 23 Apr 2020 10:40:01 +0000 (12:40 +0200)
rcp/dep/org.argeo.dep.cms.e4.rcp/pom.xml
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/MiniBrowser.java
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/MiniDesktopImages.java [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/MiniDesktopManager.java
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/cheatsheet_obj@2x.png [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/console_view@2x.png [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/delete@2x.png [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/external_browser@2x.png [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/file_obj@2x.png [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/fldr_obj@2x.png [new file with mode: 0644]
rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/nav_home@2x.png [new file with mode: 0644]

index 39f46714f1e0985bed3ebade586c8b51d6ea822e..6197125b5247ef1dd15645c550a906b2f748b418 100644 (file)
                        <scope>test</scope>
                </dependency>
 
-               <!-- SWT for ARM -->
-               <dependency>
-                       <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.swt.gtk.linux.arm</artifactId>
-                       <version>3.108.0.v20180905-1254</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
-                       <version>3.109.0.202003311246</version>
-               </dependency>
-
-               <!-- Additional text components (not in RCP distribution) -->
-               <dependency>
-                       <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.text</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.jface.text</artifactId>
-               </dependency>
-
-               <!-- SWT and JFace -->
-               <dependency>
-                       <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.swt</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.jface</artifactId>
-               </dependency>
+               <!-- SWT native -->
                <dependency>
                        <groupId>org.argeo.tp.rcp.e4</groupId>
                        <artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
                <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
                <!-- <artifactId>org.eclipse.swt.gtk.linux.ppc64le</artifactId> -->
                <!-- </dependency> -->
-
-
-               <!-- Eclipse launcher -->
+               <!-- SWT for ARM -->
                <dependency>
                        <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.equinox.launcher</artifactId>
+                       <artifactId>org.eclipse.swt.gtk.linux.arm</artifactId>
+                       <version>3.108.0.v20180905-1254</version>
                </dependency>
                <dependency>
                        <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.equinox.launcher.gtk.linux.x86_64</artifactId>
+                       <artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
+                       <version>3.109.0.202003311246</version>
                </dependency>
+
+
+               <!-- Eclipse launcher -->
+               <!-- <dependency> -->
+               <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
+               <!-- <artifactId>org.eclipse.equinox.launcher</artifactId> -->
+               <!-- </dependency> -->
+               <!-- <dependency> -->
+               <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
+               <!-- <artifactId>org.eclipse.equinox.launcher.gtk.linux.x86_64</artifactId> -->
+               <!-- </dependency> -->
                <!-- <dependency> -->
                <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
                <!-- <artifactId>org.eclipse.equinox.launcher.gtk.linux.x86</artifactId> -->
                <!-- </dependency> -->
+               <!-- <dependency> -->
+               <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
+               <!-- <artifactId>org.eclipse.equinox.launcher.cocoa.macosx.x86_64</artifactId> -->
+               <!-- </dependency> -->
+               <!-- <dependency> -->
+               <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
+               <!-- <artifactId>org.eclipse.equinox.launcher.win32.win32.x86_64</artifactId> -->
+               <!-- </dependency> -->
+               <!-- <dependency> -->
+               <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
+               <!-- <artifactId>org.eclipse.equinox.launcher.win32.win32.x86</artifactId> -->
+               <!-- </dependency> -->
+
+               <!-- SWT JFace -->
                <dependency>
                        <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.equinox.launcher.cocoa.macosx.x86_64</artifactId>
+                       <artifactId>org.eclipse.swt</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.argeo.tp.rcp.e4</groupId>
-                       <artifactId>org.eclipse.equinox.launcher.win32.win32.x86_64</artifactId>
+                       <artifactId>org.eclipse.jface</artifactId>
                </dependency>
-               <!-- <dependency> -->
-               <!-- <groupId>org.argeo.tp.rcp.e4</groupId> -->
-               <!-- <artifactId>org.eclipse.equinox.launcher.win32.win32.x86</artifactId> -->
-               <!-- </dependency> -->
+
+               <!-- Additional text components (not in RCP distribution) -->
+               <dependency>
+                       <groupId>org.argeo.tp.rcp.e4</groupId>
+                       <artifactId>org.eclipse.text</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.rcp.e4</groupId>
+                       <artifactId>org.eclipse.jface.text</artifactId>
+               </dependency>
+
 
                <!-- RCP -->
                <dependency>
index 16c405d4af26a52c453f5865a729245ad2bf04a7..406382bce3c681a74f38e7f1ca467e678b2965ac 100644 (file)
@@ -150,7 +150,7 @@ public class MiniBrowser {
                }
                boolean fullscreen = options.contains("--fullscreen");
                boolean appMode = options.contains("--app");
-               String url = "https://duckduckgo.com/";
+               String url = "https://start.duckduckgo.com/";
                if (options.size() > 0) {
                        String last = options.get(options.size() - 1);
                        if (!last.startsWith("--"))
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/MiniDesktopImages.java b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/MiniDesktopImages.java
new file mode 100644 (file)
index 0000000..db5e6f2
--- /dev/null
@@ -0,0 +1,53 @@
+package org.argeo.minidesktop;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/** Icons. */
+public class MiniDesktopImages {
+
+       public final Image homeIcon;
+       public final Image exitIcon;
+       
+       public final Image terminalIcon;
+       public final Image browserIcon;
+       public final Image explorerIcon;
+       public final Image textEditorIcon;
+
+       public final Image folderIcon;
+       public final Image fileIcon;
+
+       public MiniDesktopImages(Display display) {
+               homeIcon = loadImage(display, "nav_home@2x.png");
+               exitIcon = loadImage(display, "delete@2x.png");
+
+               terminalIcon = loadImage(display, "console_view@2x.png");
+               browserIcon = loadImage(display, "external_browser@2x.png");
+               explorerIcon = loadImage(display, "fldr_obj@2x.png");
+               textEditorIcon = loadImage(display, "cheatsheet_obj@2x.png");
+
+               folderIcon = loadImage(display, "fldr_obj@2x.png");
+               fileIcon = loadImage(display, "file_obj@2x.png");
+       }
+
+       static Image loadImage(Display display, String path) {
+               InputStream stream = MiniDesktopImages.class.getResourceAsStream(path);
+               if (stream == null)
+                       throw new IllegalArgumentException("Image " + path + " not found");
+               Image image = null;
+               try {
+                       image = new Image(display, stream);
+               } catch (SWTException ex) {
+               } finally {
+                       try {
+                               stream.close();
+                       } catch (IOException ex) {
+                       }
+               }
+               return image;
+       }
+}
index a1f6d333e2e33c0de3b6820fdf044b147a3dbb45..fa66a8e76db0058c0e7dafb8cddf2fe8e717d15a 100644 (file)
@@ -11,6 +11,7 @@ import org.eclipse.swt.custom.CTabFolder;
 import org.eclipse.swt.custom.CTabItem;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.Point;
@@ -37,17 +38,22 @@ public class MiniDesktopManager {
        private final boolean fullscreen;
        private final boolean stacking;
 
+       private MiniDesktopImages images;
+
        public MiniDesktopManager(boolean fullscreen, boolean stacking) {
                this.fullscreen = fullscreen;
                this.stacking = stacking;
        }
 
        public void init() {
+               Display.setAppName("Mini SWT Desktop");
                display = Display.getCurrent();
                if (display != null)
                        throw new IllegalStateException("Already a display " + display);
                display = new Display();
 
+               images = new MiniDesktopImages(display);
+
                int toolBarSize = 48;
 
                if (isFullscreen()) {
@@ -56,9 +62,11 @@ public class MiniDesktopManager {
                        Rectangle bounds = display.getBounds();
                        rootShell.setSize(bounds.width, bounds.height);
                } else {
-                       rootShell = new Shell(display, SWT.SHELL_TRIM);
+                       rootShell = new Shell(display, SWT.CLOSE | SWT.RESIZE);
                        Rectangle shellArea = rootShell.computeTrim(200, 200, 800, 480);
                        rootShell.setSize(shellArea.width, shellArea.height);
+                       rootShell.setText(Display.getAppName());
+                       rootShell.setImage(images.terminalIcon);
                }
 
                rootShell.setLayout(noSpaceGridLayout(new GridLayout(2, false)));
@@ -75,19 +83,33 @@ public class MiniDesktopManager {
                } else {
                        toolBar = new ToolBar(toolBarArea, SWT.VERTICAL | SWT.FLAT | SWT.BORDER);
                        createDock(toolBar);
-                       toolBarArea.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
+                       toolBarArea.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
                }
 
                if (isStacking()) {
-                       tabFolder = new CTabFolder(rootShell, SWT.MULTI);
+                       tabFolder = new CTabFolder(rootShell, SWT.MULTI | SWT.BORDER | SWT.BOTTOM);
+                       tabFolder.setLayout(noSpaceGridLayout(new GridLayout()));
                        tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+                       Color selectionBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION);
+                       tabFolder.setSelectionBackground(selectionBackground);
+//                     tabFolder.setSelectionForeground(selectionBackground);
+//                     tabFolder.setSelectionBackground(
+//                                     new Color[] { display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_BLUE) },
+//                                     new int[] { 100 }, true);
+
                        // background
                        Control background = createBackground(tabFolder);
-                       CTabItem noCloseItem = new CTabItem(tabFolder, SWT.NONE);
-                       noCloseItem.setText("Home");
-                       noCloseItem.setControl(background);
+                       CTabItem homeTabItem = new CTabItem(tabFolder, SWT.NONE);
+                       homeTabItem.setText("Home");
+                       homeTabItem.setImage(images.homeIcon);
+                       homeTabItem.setControl(background);
+                       tabFolder.setFocus();
                } else {
-                       createBackground(rootShell);
+                       if (isFullscreen())
+                               createBackground(rootShell);
+                       else
+                               rootShell.pack();
                }
 
                rootShell.open();
@@ -101,9 +123,9 @@ public class MiniDesktopManager {
 
        protected void createDock(ToolBar toolBar) {
                // Terminal
-               addToolItem(toolBar, display.getSystemImage(SWT.ICON_INFORMATION), "Terminal", () -> {
+               addToolItem(toolBar, images.terminalIcon, "Terminal", () -> {
                        String url = System.getProperty("user.home");
-                       AppContext appContext = createAppParent();
+                       AppContext appContext = createAppParent(images.terminalIcon);
                        new MiniTerminal(appContext.getAppParent(), url) {
 
                                @Override
@@ -130,9 +152,9 @@ public class MiniDesktopManager {
                });
 
                // Web browser
-               addToolItem(toolBar, display.getSystemImage(SWT.ICON_QUESTION), "Browser", () -> {
-                       String url = "https://duckduckgo.com/";
-                       AppContext appContext = createAppParent();
+               addToolItem(toolBar, images.browserIcon, "Browser", () -> {
+                       String url = "https://start.duckduckgo.com/";
+                       AppContext appContext = createAppParent(images.browserIcon);
                        new MiniBrowser(appContext.getAppParent(), url, false, false) {
                                @Override
                                protected void titleChanged(String title) {
@@ -148,9 +170,9 @@ public class MiniDesktopManager {
                });
 
                // File explorer
-               addToolItem(toolBar, display.getSystemImage(SWT.ICON_WARNING), "Explorer", () -> {
+               addToolItem(toolBar, images.explorerIcon, "Explorer", () -> {
                        String url = System.getProperty("user.home");
-                       AppContext appContext = createAppParent();
+                       AppContext appContext = createAppParent(images.explorerIcon);
                        new MiniExplorer(appContext.getAppParent(), url) {
 
                                @Override
@@ -166,8 +188,11 @@ public class MiniDesktopManager {
                        openApp(appContext);
                });
 
+               // Separator
+               new ToolItem(toolBar, SWT.SEPARATOR);
+
                // Exit
-               addToolItem(toolBar, display.getSystemImage(SWT.ICON_ERROR), "Exit", () -> rootShell.dispose());
+               addToolItem(toolBar, images.exitIcon, "Exit", () -> rootShell.dispose());
 
                toolBar.pack();
        }
@@ -190,15 +215,17 @@ public class MiniDesktopManager {
                });
        }
 
-       protected AppContext createAppParent() {
+       protected AppContext createAppParent(Image icon) {
                if (isStacking()) {
-                       Composite appParent = new Composite(tabFolder, SWT.NONE);
+                       Composite appParent = new Composite(tabFolder, SWT.CLOSE);
                        appParent.setLayout(noSpaceGridLayout(new GridLayout()));
                        CTabItem item = new CTabItem(tabFolder, SWT.CLOSE);
+                       item.setImage(icon);
                        item.setControl(appParent);
                        return new AppContext(item);
                } else {
-                       Shell shell = new Shell(rootShell, SWT.SHELL_TRIM);
+                       Shell shell = new Shell(rootShell.getDisplay(), SWT.SHELL_TRIM);
+                       shell.setImage(icon);
                        return new AppContext(shell);
                }
        }
@@ -210,6 +237,7 @@ public class MiniDesktopManager {
                        shell.setSize(new Point(800, 480));
                }
                if (appContext.tabItem != null) {
+                       tabFolder.setFocus();
                        tabFolder.setSelection(appContext.tabItem);
                }
        }
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/cheatsheet_obj@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/cheatsheet_obj@2x.png
new file mode 100644 (file)
index 0000000..55c614d
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/cheatsheet_obj@2x.png differ
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/console_view@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/console_view@2x.png
new file mode 100644 (file)
index 0000000..54ecae2
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/console_view@2x.png differ
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/delete@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/delete@2x.png
new file mode 100644 (file)
index 0000000..eb2fc72
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/delete@2x.png differ
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/external_browser@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/external_browser@2x.png
new file mode 100644 (file)
index 0000000..06d337a
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/external_browser@2x.png differ
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/file_obj@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/file_obj@2x.png
new file mode 100644 (file)
index 0000000..31e671c
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/file_obj@2x.png differ
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/fldr_obj@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/fldr_obj@2x.png
new file mode 100644 (file)
index 0000000..adb7c2c
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/fldr_obj@2x.png differ
diff --git a/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/nav_home@2x.png b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/nav_home@2x.png
new file mode 100644 (file)
index 0000000..4c9a16c
Binary files /dev/null and b/rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/nav_home@2x.png differ