mirror of
https://github.com/rememberber/MooTool.git
synced 2026-09-01 15:34:30 +08:00
opt:统一svg图标风格
This commit is contained in:
@@ -46,7 +46,7 @@ ICON_MAP = {
|
||||
"java.svg": "coffee",
|
||||
"json.svg": "braces",
|
||||
"left_arrow.svg": "arrow-left",
|
||||
"list.svg": "list",
|
||||
"list.svg": "align-justify",
|
||||
"list_ordered.svg": "list-ordered",
|
||||
"list_unordered.svg": "list",
|
||||
"method.svg": "box",
|
||||
|
||||
@@ -59,6 +59,15 @@ public class MainWindow {
|
||||
|
||||
private static final String[] ICON_PATH = {"icon/smile.svg", "icon/edit.svg", "icon/time.svg", "icon/json.svg", "icon/translate.svg", "icon/check.svg", "icon/global.svg", "icon/exchange.svg", "icon/QRcode.svg", "icon/method.svg", "icon/calculate.svg", "icon/network.svg", "icon/color.svg", "icon/image.svg", "icon/schedule.svg", "icon/reg.svg", "icon/java.svg", "icon/format_painter.svg", "icon/pdf.svg", "icon/fx.svg", "icon/suffix-yml.svg", "icon/diff.svg", "icon/protobuf.svg"};
|
||||
|
||||
private static final int TAB_ICON_ONLY_SIZE = 20;
|
||||
|
||||
private static FlatSVGIcon tabIcon(String path, boolean iconOnly) {
|
||||
if (iconOnly) {
|
||||
return new FlatSVGIcon(path, TAB_ICON_ONLY_SIZE, TAB_ICON_ONLY_SIZE);
|
||||
}
|
||||
return new FlatSVGIcon(path);
|
||||
}
|
||||
|
||||
private MainWindow() {
|
||||
}
|
||||
|
||||
@@ -111,9 +120,10 @@ public class MainWindow {
|
||||
}
|
||||
|
||||
public void initTabPlacement() {
|
||||
boolean iconOnly = App.config.isTabHideTitle();
|
||||
// 设置所有tab的图标
|
||||
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
||||
tabbedPane.setIconAt(i, new FlatSVGIcon(ICON_PATH[i]));
|
||||
tabbedPane.setIconAt(i, tabIcon(ICON_PATH[i], iconOnly));
|
||||
}
|
||||
|
||||
// 设置所有tab的tips和标题一致
|
||||
@@ -156,18 +166,16 @@ public class MainWindow {
|
||||
}
|
||||
|
||||
// 隐藏所有 tab 的标题
|
||||
if (App.config.isTabHideTitle()) {
|
||||
if (iconOnly) {
|
||||
tabbedPane.putClientProperty(FlatClientProperties.TABBED_PANE_TAB_WIDTH_MODE,
|
||||
FlatClientProperties.TABBED_PANE_TAB_WIDTH_MODE_ICON_ONLY);
|
||||
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
||||
// 设置所有tab的icon
|
||||
tabbedPane.setIconAt(i, new FlatSVGIcon(ICON_PATH[i]));
|
||||
tabbedPane.setIconAt(i, tabIcon(ICON_PATH[i], true));
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
||||
tabbedPane.setTitleAt(i, tabbedPane.getToolTipTextAt(i));
|
||||
// 设置所有tab的icon
|
||||
tabbedPane.setIconAt(i, new FlatSVGIcon(ICON_PATH[i]));
|
||||
tabbedPane.setIconAt(i, tabIcon(ICON_PATH[i], false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,16 +203,14 @@ public class MainWindow {
|
||||
if (App.config.isTabHideTitle()) {
|
||||
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
||||
tabbedPane.setTitleAt(i, tabbedPane.getToolTipTextAt(i));
|
||||
// 设置所有tab的icon
|
||||
tabbedPane.setIconAt(i, new FlatSVGIcon(ICON_PATH[i]));
|
||||
tabbedPane.setIconAt(i, tabIcon(ICON_PATH[i], false));
|
||||
}
|
||||
App.config.setTabHideTitle(false);
|
||||
App.config.save();
|
||||
} else {
|
||||
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
||||
tabbedPane.setTitleAt(i, "");
|
||||
// 设置所有tab的icon放大
|
||||
tabbedPane.setIconAt(i, new FlatSVGIcon(ICON_PATH[i]));
|
||||
tabbedPane.setIconAt(i, tabIcon(ICON_PATH[i], true));
|
||||
}
|
||||
App.config.setTabHideTitle(true);
|
||||
App.config.save();
|
||||
|
||||
@@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg class="icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#cdcdcd" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/></svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Icons derived from Lucide (ISC) https://lucide.dev --><svg class="icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#cdcdcd" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M3 12h18"/><path d="M3 18h18"/></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 352 B |
Reference in New Issue
Block a user