mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
a bit of cleaning and implement updateTheme() in contrib manager
This commit is contained in:
@@ -27,8 +27,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
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 @@ public class ContributionManager {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
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 @@ public class ContributionManager {
|
||||
}
|
||||
|
||||
|
||||
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 @@ public class ContributionManager {
|
||||
* Show the Mode installer window.
|
||||
*/
|
||||
static public void openModes() {
|
||||
managerDialog.showFrame(ContributionType.MODE);
|
||||
managerFrame.showFrame(ContributionType.MODE);
|
||||
}
|
||||
|
||||
|
||||
@@ -711,7 +716,7 @@ public class ContributionManager {
|
||||
* Show the Tool installer window.
|
||||
*/
|
||||
static public void openTools() {
|
||||
managerDialog.showFrame(ContributionType.TOOL);
|
||||
managerFrame.showFrame(ContributionType.TOOL);
|
||||
}
|
||||
|
||||
|
||||
@@ -719,7 +724,7 @@ public class ContributionManager {
|
||||
* Show the Examples installer window.
|
||||
*/
|
||||
static public void openExamples() {
|
||||
managerDialog.showFrame(ContributionType.EXAMPLES);
|
||||
managerFrame.showFrame(ContributionType.EXAMPLES);
|
||||
}
|
||||
|
||||
|
||||
@@ -727,28 +732,6 @@ public class ContributionManager {
|
||||
* 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;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ManagerFrame {
|
||||
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 @@ public class ManagerFrame {
|
||||
|
||||
|
||||
protected void updateTheme() {
|
||||
frame.getContentPane().setBackground(Theme.getColor("manager.tab.background"));
|
||||
Color bgColor = Theme.getColor("manager.tab.background");
|
||||
frame.getContentPane().setBackground(bgColor);
|
||||
|
||||
tabs.updateTheme();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,11 +35,12 @@ import java.awt.event.MouseEvent;
|
||||
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<Tab> tabList = new ArrayList<>();
|
||||
|
||||
Mode mode;
|
||||
|
||||
Font font;
|
||||
int fontAscent;
|
||||
|
||||
Image gradient;
|
||||
|
||||
JPanel cardPanel;
|
||||
CardLayout cardLayout;
|
||||
Controller controller;
|
||||
@@ -83,21 +84,10 @@ 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();
|
||||
|
||||
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");
|
||||
|
||||
tabColor[SELECTED] = Theme.getColor("manager.tab.selected.color");
|
||||
tabColor[UNSELECTED] = Theme.getColor("manager.tab.unselected.color");
|
||||
|
||||
gradient = Theme.makeGradient("manager.tab", Toolkit.zoom(400), HIGH);
|
||||
updateTheme();
|
||||
|
||||
setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER));
|
||||
|
||||
@@ -110,6 +100,20 @@ public class ManagerTabs extends Box {
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
||||
tabColor[SELECTED] = Theme.getColor("manager.tab.selected.color");
|
||||
tabColor[UNSELECTED] = Theme.getColor("manager.tab.unselected.color");
|
||||
|
||||
gradient = Theme.makeGradient("manager.tab", Toolkit.zoom(400), HIGH);
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a panel with a name.
|
||||
* @param comp Component that will be shown when this tab is selected
|
||||
|
||||
@@ -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 @@ public class ThemeSelector extends JFrame implements Tool {
|
||||
Util.saveFile(themeContents[index], sketchbookFile);
|
||||
Theme.load();
|
||||
|
||||
ContributionManager.updateTheme();
|
||||
for (Editor editor : base.getEditors()) {
|
||||
editor.updateTheme();
|
||||
//editor.repaint();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user