diff --git a/app/src/processing/app/contrib/ContributionManager.java b/app/src/processing/app/contrib/ContributionManager.java index 3cd78f3bec..ede915d607 100644 --- a/app/src/processing/app/contrib/ContributionManager.java +++ b/app/src/processing/app/contrib/ContributionManager.java @@ -27,8 +27,6 @@ import java.net.*; import java.util.*; -import javax.swing.SwingWorker; - import processing.app.Base; import processing.app.Language; import processing.app.Messages; @@ -676,14 +674,14 @@ static private void clearRestartFlags(File root) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - static ManagerFrame managerDialog; + static ManagerFrame managerFrame; static public void init(Base base) throws Exception { // long t1 = System.currentTimeMillis(); listing = ContributionListing.getInstance(); // Moved here to make sure it runs on EDT [jv 170121] // long t2 = System.currentTimeMillis(); - managerDialog = new ManagerFrame(base); + managerFrame = new ManagerFrame(base); // long t3 = System.currentTimeMillis(); cleanup(base); // long t4 = System.currentTimeMillis(); @@ -691,11 +689,18 @@ static public void init(Base base) throws Exception { } + static public void updateTheme() { + if (managerFrame != null) { + managerFrame.updateTheme(); + } + } + + /** * Show the Library installer window. */ static public void openLibraries() { - managerDialog.showFrame(ContributionType.LIBRARY); + managerFrame.showFrame(ContributionType.LIBRARY); } @@ -703,7 +708,7 @@ static public void openLibraries() { * Show the Mode installer window. */ static public void openModes() { - managerDialog.showFrame(ContributionType.MODE); + managerFrame.showFrame(ContributionType.MODE); } @@ -711,7 +716,7 @@ static public void openModes() { * Show the Tool installer window. */ static public void openTools() { - managerDialog.showFrame(ContributionType.TOOL); + managerFrame.showFrame(ContributionType.TOOL); } @@ -719,7 +724,7 @@ static public void openTools() { * Show the Examples installer window. */ static public void openExamples() { - managerDialog.showFrame(ContributionType.EXAMPLES); + managerFrame.showFrame(ContributionType.EXAMPLES); } @@ -727,28 +732,6 @@ static public void openExamples() { * Open the updates panel. */ static public void openUpdates() { - managerDialog.showFrame(null); + managerFrame.showFrame(null); } - - - // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - - /* - static int getTypeIndex(ContributionType contributionType) { - int index; - if (contributionType == ContributionType.LIBRARY) { - index = 0; - } else if (contributionType == ContributionType.MODE) { - index = 1; - } else if (contributionType == ContributionType.TOOL) { - index = 2; - } else if (contributionType == ContributionType.EXAMPLES) { - index = 3; - } else { - index = 4; - } - return index; - } - */ } diff --git a/app/src/processing/app/contrib/ManagerFrame.java b/app/src/processing/app/contrib/ManagerFrame.java index 8fbb573282..6510009a38 100644 --- a/app/src/processing/app/contrib/ManagerFrame.java +++ b/app/src/processing/app/contrib/ManagerFrame.java @@ -110,7 +110,7 @@ public void showFrame(ContributionType contributionType) { private void makeFrame() { frame = new JFrame(title); frame.setMinimumSize(Toolkit.zoom(750, 500)); - tabs = new ManagerTabs(base); + tabs = new ManagerTabs(); makeAndShowTab(false, true); @@ -137,7 +137,10 @@ private void makeFrame() { protected void updateTheme() { - frame.getContentPane().setBackground(Theme.getColor("manager.tab.background")); + Color bgColor = Theme.getColor("manager.tab.background"); + frame.getContentPane().setBackground(bgColor); + + tabs.updateTheme(); } diff --git a/app/src/processing/app/contrib/ManagerTabs.java b/app/src/processing/app/contrib/ManagerTabs.java index eefe89029a..6d63a416ed 100644 --- a/app/src/processing/app/contrib/ManagerTabs.java +++ b/app/src/processing/app/contrib/ManagerTabs.java @@ -35,11 +35,12 @@ import java.util.ArrayList; import java.util.List; -import javax.swing.*; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JComponent; +import javax.swing.JPanel; import javax.swing.border.EmptyBorder; -import processing.app.Base; -import processing.app.Mode; import processing.app.ui.Theme; import processing.app.ui.Toolkit; @@ -71,11 +72,11 @@ public class ManagerTabs extends Box { List tabList = new ArrayList<>(); - Mode mode; - Font font; int fontAscent; + Image gradient; + JPanel cardPanel; CardLayout cardLayout; Controller controller; @@ -83,13 +84,23 @@ public class ManagerTabs extends Box { Component currentPanel; - public ManagerTabs(Base base) { + public ManagerTabs() { super(BoxLayout.Y_AXIS); - // A mode shouldn't actually override these, they're coming from theme.txt. - // But use the default (Java) mode settings just in case. - mode = base.getDefaultMode(); + updateTheme(); + + setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER)); + controller = new Controller(); + add(controller); + + cardLayout = new CardLayout(); + cardPanel = new JPanel(cardLayout); + add(cardPanel); + } + + + protected void updateTheme() { textColor[SELECTED] = Theme.getColor("manager.tab.text.selected.color"); textColor[UNSELECTED] = Theme.getColor("manager.tab.text.unselected.color"); font = Theme.getFont("manager.tab.text.font"); @@ -99,14 +110,7 @@ public ManagerTabs(Base base) { gradient = Theme.makeGradient("manager.tab", Toolkit.zoom(400), HIGH); - setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER)); - - controller = new Controller(); - add(controller); - - cardLayout = new CardLayout(); - cardPanel = new JPanel(cardLayout); - add(cardPanel); + repaint(); } diff --git a/app/src/processing/app/tools/ThemeSelector.java b/app/src/processing/app/tools/ThemeSelector.java index 2c48111fb6..1f35a956d4 100644 --- a/app/src/processing/app/tools/ThemeSelector.java +++ b/app/src/processing/app/tools/ThemeSelector.java @@ -24,6 +24,7 @@ package processing.app.tools; import processing.app.*; +import processing.app.contrib.ContributionManager; import processing.app.ui.Editor; import processing.app.ui.Theme; import processing.app.ui.Toolkit; @@ -126,6 +127,7 @@ private void setCurrentIndex(int index) { Util.saveFile(themeContents[index], sketchbookFile); Theme.load(); + ContributionManager.updateTheme(); for (Editor editor : base.getEditors()) { editor.updateTheme(); //editor.repaint(); diff --git a/todo.txt b/todo.txt index dd03ae6f1d..f2a146963b 100755 --- a/todo.txt +++ b/todo.txt @@ -14,6 +14,9 @@ X https://github.com/processing/processing/issues/5309 X https://github.com/processing/processing4/issues/446 X removed weird double call of installPreviouslyFailed() X remove unused icon code from ManagerTabs +X implement updateTheme() +_ remove the extra 2-pixel line at the top +_ currently uses prepareGraphics(), do we need to remove that? _ allow update of the current Mode _ an incompatible Mode prevents the PDE from quitting after last window is closed @@ -140,7 +143,6 @@ _ console scroll bar colors _ https://github.com/processing/processing4/issues/265 _ errors table theme _ contrib manager theme -_ implement updateTheme() _ identify coloring for icons _ how much of theme to inherit _ generate manager icons