Skip to content
Snippets Groups Projects
Commit 740198c2 authored by aburn's avatar aburn
Browse files

Added theme setting

parent 4dcd5ad6
Branches
No related merge requests found
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<entry key="cfgReplacePluginMessage">A plugin by the same name already exists. Would you like to overwrite it?</entry> <entry key="cfgReplacePluginMessage">A plugin by the same name already exists. Would you like to overwrite it?</entry>
<entry key="cfgSafeModeLabel">Safe mode</entry> <entry key="cfgSafeModeLabel">Safe mode</entry>
<entry key="cfgServerLabel">Reader</entry> <entry key="cfgServerLabel">Reader</entry>
<entry key="cfgThemeLabel">Theme</entry>
<entry key="cfgTimeoutLabel">Idleness timer (in seconds, default is 300, 0 means never)</entry> <entry key="cfgTimeoutLabel">Idleness timer (in seconds, default is 300, 0 means never)</entry>
<entry key="cfgTitleLabel">Title</entry> <entry key="cfgTitleLabel">Title</entry>
<entry key="cfgTypeLabel">Type</entry> <entry key="cfgTypeLabel">Type</entry>
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<entry key="cfgReplacePluginMessage">Un plugin du même nom exist déjà. Voulez-vous le remplacer?</entry> <entry key="cfgReplacePluginMessage">Un plugin du même nom exist déjà. Voulez-vous le remplacer?</entry>
<entry key="cfgSafeModeLabel">Mode sans échec</entry> <entry key="cfgSafeModeLabel">Mode sans échec</entry>
<entry key="cfgServerLabel">Feuilleteur</entry> <entry key="cfgServerLabel">Feuilleteur</entry>
<entry key="cfgThemeLabel">Thème</entry>
<entry key="cfgTimeoutLabel">Compteur d'inactivité (en secondes, 300 par défaut, 0 pour désactiver)</entry> <entry key="cfgTimeoutLabel">Compteur d'inactivité (en secondes, 300 par défaut, 0 pour désactiver)</entry>
<entry key="cfgTitleLabel">Titre</entry> <entry key="cfgTitleLabel">Titre</entry>
<entry key="cfgTypeLabel">Type</entry> <entry key="cfgTypeLabel">Type</entry>
......
...@@ -14,6 +14,7 @@ The fact that you are presently reading this means that you have had knowledge o ...@@ -14,6 +14,7 @@ The fact that you are presently reading this means that you have had knowledge o
*/ */
package org.interreg.docexplore; package org.interreg.docexplore;
import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Window; import java.awt.Window;
...@@ -126,7 +127,7 @@ public class GeneralConfigPanel extends JPanel ...@@ -126,7 +127,7 @@ public class GeneralConfigPanel extends JPanel
JTextField displayWidth, displayHeight; JTextField displayWidth, displayHeight;
JCheckBox displayHelp, displayFullscreen, displayNativeCursor; JCheckBox displayHelp, displayFullscreen, displayNativeCursor;
JComboBox displayLang; JComboBox<String> displayLang, displayThemes;
JPanel pluginsPanel; JPanel pluginsPanel;
List<PluginPanel> pluginPanels = new LinkedList<PluginPanel>(); List<PluginPanel> pluginPanels = new LinkedList<PluginPanel>();
...@@ -186,17 +187,27 @@ public class GeneralConfigPanel extends JPanel ...@@ -186,17 +187,27 @@ public class GeneralConfigPanel extends JPanel
// } // }
// } // }
JPanel display = new JPanel(new LooseGridLayout(0, 1, 5, 5, false, true, SwingConstants.LEFT, SwingConstants.TOP)); JPanel display = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, true, SwingConstants.LEFT, SwingConstants.TOP));
display.setBorder(BorderFactory.createTitledBorder(Lang.s("cfgDisplayLabel"))); display.setBorder(BorderFactory.createTitledBorder(Lang.s("cfgDisplayLabel")));
JPanel displayDims = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, true, SwingConstants.LEFT, SwingConstants.TOP)); JPanel displayDims = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, true, SwingConstants.LEFT, SwingConstants.TOP));
displayDims.add(new JLabel(Lang.s("cfgWidthLabel"))); displayDims.add(displayWidth = new JTextField(5)); displayDims.add(new JLabel(Lang.s("cfgWidthLabel"))); displayDims.add(displayWidth = new JTextField(5));
displayDims.add(new JLabel(Lang.s("cfgHeightLabel"))); displayDims.add(displayHeight = new JTextField(5)); displayDims.add(new JLabel(Lang.s("cfgHeightLabel"))); displayDims.add(displayHeight = new JTextField(5));
displayDims.add(new JLabel(Lang.s("cfgLanguageLabel"))); displayDims.add(displayLang = new JComboBox(new Object [] { displayDims.add(new JLabel(Lang.s("cfgLanguageLabel"))); displayDims.add(displayLang = new JComboBox<String>(new String [] {
Lang.s("cfgEnglishLabel"), Lang.s("cfgFrenchLabel")})); Lang.s("cfgEnglishLabel"), Lang.s("cfgFrenchLabel")}));
JPanel themesPanel = new JPanel(new BorderLayout());
JPanel themeSelectionPanel = new JPanel(new FlowLayout());
themeSelectionPanel.add(new JLabel("Theme"));
themeSelectionPanel.add(displayThemes = new JComboBox<String>(new String [] {"light", "dark"}));
themesPanel.add(themeSelectionPanel, BorderLayout.NORTH);
display.add(displayHelp = new JCheckBox(Lang.s("cfgHelpLabel"))); display.add(displayHelp = new JCheckBox(Lang.s("cfgHelpLabel")));
display.add(displayFullscreen = new JCheckBox(Lang.s("cfgFullscreenLabel"))); display.add(displayFullscreen = new JCheckBox(Lang.s("cfgFullscreenLabel")));
display.add(displayNativeCursor = new JCheckBox(Lang.s("cfgUseCursorLabel"))); display.add(displayNativeCursor = new JCheckBox(Lang.s("cfgUseCursorLabel")));
display.add(displayDims); display.add(new JLabel(""));
display.add(displayDims);
display.add(themesPanel);
JPanel topPluginsPanel = new JPanel(new LooseGridLayout(0, 1, 5, 5, true, true, SwingConstants.LEFT, SwingConstants.TOP)); JPanel topPluginsPanel = new JPanel(new LooseGridLayout(0, 1, 5, 5, true, true, SwingConstants.LEFT, SwingConstants.TOP));
topPluginsPanel.setBorder(BorderFactory.createTitledBorder(Lang.s("cfgPluginsLabel"))); topPluginsPanel.setBorder(BorderFactory.createTitledBorder(Lang.s("cfgPluginsLabel")));
...@@ -325,7 +336,8 @@ public class GeneralConfigPanel extends JPanel ...@@ -325,7 +336,8 @@ public class GeneralConfigPanel extends JPanel
if (InputPlugin.class.isAssignableFrom(clazz)) if (InputPlugin.class.isAssignableFrom(clazz))
inputPlugins.add(clazz); inputPlugins.add(clazz);
} }
jarFile.close(); jarFile.close();
loader.close();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Pair<String, String> [] classes = new Pair [metaDataPlugins.size()+analysisPlugins.size()+clientPlugins.size()+serverPlugins.size()+inputPlugins.size()]; Pair<String, String> [] classes = new Pair [metaDataPlugins.size()+analysisPlugins.size()+clientPlugins.size()+serverPlugins.size()+inputPlugins.size()];
...@@ -446,7 +458,8 @@ public class GeneralConfigPanel extends JPanel ...@@ -446,7 +458,8 @@ public class GeneralConfigPanel extends JPanel
String fs = StringUtils.getTagContent(display, "fullscreen"); String fs = StringUtils.getTagContent(display, "fullscreen");
String cursor = StringUtils.getTagContent(display, "useNativeCursor"); String cursor = StringUtils.getTagContent(display, "useNativeCursor");
String help = StringUtils.getTagContent(display, "help"); String help = StringUtils.getTagContent(display, "help");
String hasExit = StringUtils.getTagContent(display, "readerHasExit"); String hasExit = StringUtils.getTagContent(display, "readerHasExit");
String theme = StringUtils.getTagContent(display, "theme");
if (width != null) displayWidth.setText(width); if (width != null) displayWidth.setText(width);
if (height != null) displayHeight.setText(height); if (height != null) displayHeight.setText(height);
if (lang != null && lang.toLowerCase().contains("fr")) if (lang != null && lang.toLowerCase().contains("fr"))
...@@ -459,7 +472,9 @@ public class GeneralConfigPanel extends JPanel ...@@ -459,7 +472,9 @@ public class GeneralConfigPanel extends JPanel
displayHelp.setSelected(help != null && StringUtils.getBoolean(help)); displayHelp.setSelected(help != null && StringUtils.getBoolean(help));
displayFullscreen.setSelected(fs != null && StringUtils.getBoolean(fs)); displayFullscreen.setSelected(fs != null && StringUtils.getBoolean(fs));
displayNativeCursor.setSelected(cursor == null ? true : StringUtils.getBoolean(cursor)); displayNativeCursor.setSelected(cursor == null ? true : StringUtils.getBoolean(cursor));
readerConfig.hasExit.setSelected(hasExit == null ? true : StringUtils.getBoolean(hasExit)); readerConfig.hasExit.setSelected(hasExit == null ? true : StringUtils.getBoolean(hasExit));
if (theme != null)
displayThemes.setSelectedItem(theme);
} }
else else
{ {
...@@ -514,7 +529,8 @@ public class GeneralConfigPanel extends JPanel ...@@ -514,7 +529,8 @@ public class GeneralConfigPanel extends JPanel
append(displayHelp.isSelected() ? "yes" : "no").append("</help>\n\t\t<fullscreen>"). append(displayHelp.isSelected() ? "yes" : "no").append("</help>\n\t\t<fullscreen>").
append(displayFullscreen.isSelected() ? "yes" : "no").append("</fullscreen>\n\t\t<readerHasExit>"). append(displayFullscreen.isSelected() ? "yes" : "no").append("</fullscreen>\n\t\t<readerHasExit>").
append(readerConfig.hasExit.isSelected() ? "yes" : "no").append("</readerHasExit>\n\t\t<useNativeCursor>"). append(readerConfig.hasExit.isSelected() ? "yes" : "no").append("</readerHasExit>\n\t\t<useNativeCursor>").
append(displayNativeCursor.isSelected() ? "yes" : "no").append("</useNativeCursor>\n\t</display>\n"); append(displayNativeCursor.isSelected() ? "yes" : "no").append("</useNativeCursor>\n\t\t<theme>").
append(displayThemes.getSelectedItem().toString()).append("</theme>\n\t</display>\n");
for (PluginPanel panel : pluginPanels) for (PluginPanel panel : pluginPanels)
{ {
......
...@@ -38,6 +38,7 @@ import org.interreg.docexplore.datalink.mysql.DataLinkMySQLSource; ...@@ -38,6 +38,7 @@ import org.interreg.docexplore.datalink.mysql.DataLinkMySQLSource;
import org.interreg.docexplore.gui.ErrorHandler; import org.interreg.docexplore.gui.ErrorHandler;
import org.interreg.docexplore.management.plugin.analysis.AnalysisPlugin; import org.interreg.docexplore.management.plugin.analysis.AnalysisPlugin;
import org.interreg.docexplore.management.plugin.metadata.MetaDataPlugin; import org.interreg.docexplore.management.plugin.metadata.MetaDataPlugin;
import org.interreg.docexplore.manuscript.app.editors.GuiConstants;
import org.interreg.docexplore.nfd.JNativeFileDialog; import org.interreg.docexplore.nfd.JNativeFileDialog;
import org.interreg.docexplore.reader.plugin.ClientPlugin; import org.interreg.docexplore.reader.plugin.ClientPlugin;
import org.interreg.docexplore.reader.plugin.InputPlugin; import org.interreg.docexplore.reader.plugin.InputPlugin;
...@@ -58,7 +59,8 @@ public class Startup ...@@ -58,7 +59,8 @@ public class Startup
public Process [] connection = {null}; public Process [] connection = {null};
public DataLink [] autoConnectLink = {null}; public DataLink [] autoConnectLink = {null};
public int [] winSize = null; public int [] winSize = null;
public String lang = null; public String lang = null;
public String theme = "light";
public boolean showHelp = false; public boolean showHelp = false;
public boolean fullscreen = false; public boolean fullscreen = false;
public boolean nativeCursor = true; public boolean nativeCursor = true;
...@@ -190,7 +192,11 @@ public class Startup ...@@ -190,7 +192,11 @@ public class Startup
String rhe = StringUtils.getTagContent(display, "readerHasExit"); String rhe = StringUtils.getTagContent(display, "readerHasExit");
if (rhe != null) if (rhe != null)
readerHasExit = StringUtils.getBoolean(rhe); readerHasExit = StringUtils.getBoolean(rhe);
String th = StringUtils.getTagContent(display, "theme");
if (th != null)
theme = th;
} }
} }
...@@ -257,7 +263,9 @@ public class Startup ...@@ -257,7 +263,9 @@ public class Startup
DocExploreTool.setPreferredLAF(); DocExploreTool.setPreferredLAF();
// try {System.setProperty("com.apple.mrj.application.apple.menu.about.name", appName);} // try {System.setProperty("com.apple.mrj.application.apple.menu.about.name", appName);}
// catch (Exception e) {e.printStackTrace();} // catch (Exception e) {e.printStackTrace();}
GuiConstants.setTheme(theme);
if (screen != null) if (screen != null)
screen.setText("Interface startup..."); screen.setText("Interface startup...");
......
...@@ -20,29 +20,55 @@ public class GuiConstants ...@@ -20,29 +20,55 @@ public class GuiConstants
{ {
public static final Color emptyColor = new Color(0, 0, 0, 0); public static final Color emptyColor = new Color(0, 0, 0, 0);
// public static final Color editorBackground = new Color(0x20243B); public static Color editorBackground;
// public static final Color editorForeground = new Color(0x937B52); public static Color editorForeground;
// public static final Color headerBackground = new Color(0x255572); public static Color headerBackground;
// public static final Color headerDarkBackground = new Color(0x1A3D51); public static Color headerDarkBackground;
// public static final Color selectionBackgroundColor = new Color(0x344267); public static Color selectionBackgroundColor;
// public static final Color selectionColor = new Color(0xD69E42); public static Color selectionColor;
// public static final Color toolBackgroundColor = new Color(0x111422); public static Color toolBackgroundColor;
// public static final Color buttonBacgroundColor = toolBackgroundColor; public static Color buttonBacgroundColor;
// public static final Color buttonSelectedColor = editorBackground; public static Color buttonSelectedColor;
// public static final Color listEvenColor = new Color(0x3B4451); public static Color listEvenColor;
// public static final Color listOddColor = new Color(0x4E5361); public static Color listOddColor;
// public static final Color borderColor = new Color(0xcfcfcf); public static Color borderColor;
public static final Color editorBackground = new Color(0xffffff); static
public static final Color editorForeground = new Color(0x000000); {
public static final Color headerBackground = new Color(0x79959F); setTheme("light");
public static final Color headerDarkBackground = new Color(0x54686D); }
public static final Color selectionBackgroundColor = new Color(0x2E4071);
public static final Color selectionColor = new Color(0xFFD624); public static void setTheme(String theme)
public static final Color toolBackgroundColor = new Color(0xCACACA); {
public static final Color buttonBacgroundColor = toolBackgroundColor; if (theme.equals("dark"))
public static final Color buttonSelectedColor = editorBackground; {
public static final Color listEvenColor = new Color(0xB7C6DA); editorBackground = new Color(0x20243B);
public static final Color listOddColor = new Color(0x8FA7B0); editorForeground = new Color(0x937B52);
public static final Color borderColor = new Color(0xcfcfcf); headerBackground = new Color(0x255572);
headerDarkBackground = new Color(0x1A3D51);
selectionBackgroundColor = new Color(0x344267);
selectionColor = new Color(0xD69E42);
toolBackgroundColor = new Color(0x111422);
buttonBacgroundColor = toolBackgroundColor;
buttonSelectedColor = editorBackground;
listEvenColor = new Color(0x3B4451);
listOddColor = new Color(0x4E5361);
borderColor = new Color(0xcfcfcf);
}
else
{
editorBackground = new Color(0xffffff);
editorForeground = new Color(0x000000);
headerBackground = new Color(0x79959F);
headerDarkBackground = new Color(0x54686D);
selectionBackgroundColor = new Color(0x2E4071);
selectionColor = new Color(0xFFD624);
toolBackgroundColor = new Color(0xCACACA);
buttonBacgroundColor = toolBackgroundColor;
buttonSelectedColor = editorBackground;
listEvenColor = new Color(0xB7C6DA);
listOddColor = new Color(0x8FA7B0);
borderColor = new Color(0xcfcfcf);
}
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment