Skip to content

Commit ad1e3fd

Browse files
committed
moved log view to bottom.
1 parent a062081 commit ad1e3fd

18 files changed

+392
-116
lines changed

resources/ui/css/base.bss

-134 Bytes
Binary file not shown.

resources/ui/css/base.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,6 @@
544544
}
545545

546546
.tab-pane > .tab-header-area > .tab-header-background {
547-
/* TODO should not be using text-box-border I think? */
548547
-fx-background-color: -fx-background-background;
549548
}
550549

@@ -553,7 +552,7 @@
553552
}
554553

555554
.tab-pane:bottom > .tab-header-area > .tab-header-background {
556-
-fx-background-insets: 0, 1 0 0 0, 1;
555+
-fx-background-insets: 0; /* 0, 0 1 0 0, 1 */
557556
}
558557

559558
.tab-pane:left > .tab-header-area > .tab-header-background {
@@ -570,7 +569,7 @@
570569
}
571570

572571
.tab-pane:bottom > .tab-header-area {
573-
-fx-padding: 0 0.166667em 0.416667em 0.416667em; /* 0 2 5 5 */
572+
-fx-padding: 0; /* 5 0 2 5 */
574573
}
575574

576575
.tab-pane:left > .tab-header-area {

resources/ui/css/custom_ids.bss

-105 Bytes
Binary file not shown.

resources/ui/css/custom_ids.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@
5555
-fx-background-color: transparent;
5656
}
5757

58-
#GlobalToolComponent {
58+
#GlobalLeftToolComponent {
5959
-fx-min-width: 26;
6060
-fx-tab-max-height: 18;
6161
}
6262

63+
#GlobalBottomToolComponent {
64+
-fx-min-height: 26;
65+
-fx-tab-max-height: 18;
66+
}
67+
6368
#AssetComponent {
6469
-fx-background-color: -fx-background-background;
6570
-fx-alignment: top-center;

src/com/ss/editor/config/EditorConfig.java

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ public final class EditorConfig implements AssetEventListener {
6464

6565
private static final String PREF_ADDITIONAL_CLASSPATH = ASSET_OTHER + "." + "additionalClasspath";
6666
private static final String PREF_ADDITIONAL_ENVS = ASSET_OTHER + "." + "additionalEnvs";
67-
private static final String PREF_GLOBAL_TOOL_WIDTH = ASSET_OTHER + "." + "globalToolWidth";
68-
private static final String PREF_GLOBAL_TOOL_COLLAPSED = ASSET_OTHER + "." + "globalToolCollapsed";
67+
private static final String PREF_GLOBAL_LEFT_TOOL_WIDTH = ASSET_OTHER + "." + "globalLeftToolWidth";
68+
private static final String PREF_GLOBAL_LEFT_TOOL_COLLAPSED = ASSET_OTHER + "." + "globalLeftToolCollapsed";
69+
private static final String PREF_GLOBAL_BOTTOM_TOOL_WIDTH = ASSET_OTHER + "." + "globalBottomToolWidth";
70+
private static final String PREF_GLOBAL_BOTTOM_TOOL_COLLAPSED = ASSET_OTHER + "." + "globalBottomToolCollapsed";
6971
private static final String PREF_ANALYTICS = ASSET_OTHER + "." + "analytics";
7072
private static final String PREF_AUTO_TANGENT_GENERATING = ASSET_EDITING + "." + "autoTangentGenerating";
7173
private static final String PREF_DEFAULT_USE_FLIPPED_TEXTURE = ASSET_EDITING + "." + "defaultUseFlippedTexture";
@@ -145,14 +147,24 @@ public static EditorConfig getInstance() {
145147
private volatile int screenHeight;
146148

147149
/**
148-
* The global tool width.
150+
* The global left tool width.
149151
*/
150-
private volatile int globalToolWidth;
152+
private volatile int globalLeftToolWidth;
151153

152154
/**
153-
* Flag is for collapsing the global tool.
155+
* The global bottom tool width.
154156
*/
155-
private volatile boolean globalToolCollapsed;
157+
private volatile int globalBottomToolWidth;
158+
159+
/**
160+
* Flag is for collapsing the global left tool.
161+
*/
162+
private volatile boolean globalLeftToolCollapsed;
163+
164+
/**
165+
* Flag is for collapsing the global bottom tool.
166+
*/
167+
private volatile boolean globalBottomToolCollapsed;
156168

157169
/**
158170
* Flag is for enabling the FXAA.
@@ -444,35 +456,67 @@ public void setDecorated(final boolean decorated) {
444456
}
445457

446458
/**
447-
* @return the global tool width.
459+
* @return the global left tool width.
460+
*/
461+
@FromAnyThread
462+
public int getGlobalLeftToolWidth() {
463+
return globalLeftToolWidth;
464+
}
465+
466+
/**
467+
* @return the global bottom tool width.
468+
*/
469+
@FromAnyThread
470+
public int getGlobalBottomToolWidth() {
471+
return globalBottomToolWidth;
472+
}
473+
474+
/**
475+
* @param globalLeftToolWidth the global left tool width.
476+
*/
477+
@FromAnyThread
478+
public void setGlobalLeftToolWidth(final int globalLeftToolWidth) {
479+
this.globalLeftToolWidth = globalLeftToolWidth;
480+
}
481+
482+
/**
483+
* @param globalBottomToolWidth the global bottom tool width.
484+
*/
485+
@FromAnyThread
486+
public void setGlobalBottomToolWidth(final int globalBottomToolWidth) {
487+
this.globalBottomToolWidth = globalBottomToolWidth;
488+
}
489+
490+
/**
491+
* @param globalLeftToolCollapsed flag is for collapsing the global left tool.
448492
*/
449493
@FromAnyThread
450-
public int getGlobalToolWidth() {
451-
return globalToolWidth;
494+
public void setGlobalLeftToolCollapsed(final boolean globalLeftToolCollapsed) {
495+
this.globalLeftToolCollapsed = globalLeftToolCollapsed;
452496
}
453497

454498
/**
455-
* @param globalToolWidth the global tool width.
499+
* @param globalBottomToolCollapsed flag is for collapsing the global bottom tool.
456500
*/
457501
@FromAnyThread
458-
public void setGlobalToolWidth(final int globalToolWidth) {
459-
this.globalToolWidth = globalToolWidth;
502+
public void setGlobalBottomToolCollapsed(final boolean globalBottomToolCollapsed) {
503+
this.globalBottomToolCollapsed = globalBottomToolCollapsed;
460504
}
461505

462506
/**
463-
* @param globalToolCollapsed flag is for collapsing the global tool.
507+
* @return true if the global left tool is collapsed.
464508
*/
465509
@FromAnyThread
466-
public void setGlobalToolCollapsed(final boolean globalToolCollapsed) {
467-
this.globalToolCollapsed = globalToolCollapsed;
510+
public boolean isGlobalLeftToolCollapsed() {
511+
return globalLeftToolCollapsed;
468512
}
469513

470514
/**
471-
* @return true if the global tool is collapsed.
515+
* @return true if the global bottom tool is collapsed.
472516
*/
473517
@FromAnyThread
474-
public boolean isGlobalToolCollapsed() {
475-
return globalToolCollapsed;
518+
public boolean isGlobalBottomToolCollapsed() {
519+
return globalBottomToolCollapsed;
476520
}
477521

478522
/**
@@ -631,8 +675,10 @@ private void init() {
631675
this.maximized = prefs.getBoolean(PREF_SCREEN_MAXIMIZED, false);
632676
this.screenHeight = prefs.getInt(PREF_SCREEN_HEIGHT, 800);
633677
this.screenWidth = prefs.getInt(PREF_SCREEN_WIDTH, 1200);
634-
this.globalToolWidth = prefs.getInt(PREF_GLOBAL_TOOL_WIDTH, 300);
635-
this.globalToolCollapsed = prefs.getBoolean(PREF_GLOBAL_TOOL_COLLAPSED, false);
678+
this.globalLeftToolWidth = prefs.getInt(PREF_GLOBAL_LEFT_TOOL_WIDTH, 300);
679+
this.globalLeftToolCollapsed = prefs.getBoolean(PREF_GLOBAL_LEFT_TOOL_COLLAPSED, false);
680+
this.globalBottomToolWidth = prefs.getInt(PREF_GLOBAL_BOTTOM_TOOL_WIDTH, 300);
681+
this.globalBottomToolCollapsed = prefs.getBoolean(PREF_GLOBAL_BOTTOM_TOOL_COLLAPSED, true);
636682
this.decorated = prefs.getBoolean(PREF_SCREEN_DECORATED, true);
637683
this.analytics = prefs.getBoolean(PREF_ANALYTICS, true);
638684
this.frameRate = prefs.getInt(PREF_GRAPHIC_FRAME_RATE, 40);
@@ -702,8 +748,10 @@ public synchronized void save() {
702748
prefs.putInt(PREF_SCREEN_HEIGHT, getScreenHeight());
703749
prefs.putInt(PREF_SCREEN_WIDTH, getScreenWidth());
704750
prefs.putBoolean(PREF_SCREEN_MAXIMIZED, isMaximized());
705-
prefs.putInt(PREF_GLOBAL_TOOL_WIDTH, getGlobalToolWidth());
706-
prefs.putBoolean(PREF_GLOBAL_TOOL_COLLAPSED, isGlobalToolCollapsed());
751+
prefs.putInt(PREF_GLOBAL_LEFT_TOOL_WIDTH, getGlobalLeftToolWidth());
752+
prefs.putBoolean(PREF_GLOBAL_LEFT_TOOL_COLLAPSED, isGlobalLeftToolCollapsed());
753+
prefs.putInt(PREF_GLOBAL_BOTTOM_TOOL_WIDTH, getGlobalBottomToolWidth());
754+
prefs.putBoolean(PREF_GLOBAL_BOTTOM_TOOL_COLLAPSED, isGlobalBottomToolCollapsed());
707755
prefs.putBoolean(PREF_SCREEN_DECORATED, isDecorated());
708756
prefs.putBoolean(PREF_ANALYTICS, isAnalytics());
709757
prefs.putInt(PREF_GRAPHIC_FRAME_RATE, getFrameRate());

src/com/ss/editor/ui/builder/EditorFXSceneBuilder.java

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22

33
import static javafx.geometry.Pos.TOP_CENTER;
44
import static javafx.scene.paint.Color.TRANSPARENT;
5-
65
import com.ss.editor.Messages;
76
import com.ss.editor.annotation.FXThread;
87
import com.ss.editor.ui.component.asset.AssetComponent;
98
import com.ss.editor.ui.component.bar.EditorBarComponent;
109
import com.ss.editor.ui.component.editor.area.EditorAreaComponent;
1110
import com.ss.editor.ui.component.log.LogView;
12-
import com.ss.editor.ui.component.split.pane.GlobalToolSplitPane;
13-
import com.ss.editor.ui.component.tab.GlobalToolComponent;
11+
import com.ss.editor.ui.component.split.pane.GlobalBottomToolSplitPane;
12+
import com.ss.editor.ui.component.split.pane.GlobalLeftToolSplitPane;
13+
import com.ss.editor.ui.component.tab.GlobalBottomToolComponent;
14+
import com.ss.editor.ui.component.tab.GlobalLeftToolComponent;
1415
import com.ss.editor.ui.css.CSSIds;
1516
import com.ss.editor.ui.event.EventRedirector;
1617
import com.ss.editor.ui.scene.EditorFXScene;
17-
18-
import org.jetbrains.annotations.NotNull;
19-
18+
import javafx.application.Platform;
2019
import javafx.collections.ObservableList;
2120
import javafx.geometry.Insets;
2221
import javafx.scene.Group;
2322
import javafx.scene.canvas.Canvas;
2423
import javafx.scene.layout.StackPane;
2524
import javafx.stage.Stage;
25+
import org.jetbrains.annotations.NotNull;
2626
import rlib.ui.util.FXUtils;
2727

2828
/**
@@ -32,8 +32,6 @@
3232
*/
3333
public class EditorFXSceneBuilder {
3434

35-
public static final Insets BAR_OFFSET = new Insets(34, 0, 0, 0);
36-
3735
/**
3836
* The path to the base CSS styles.
3937
*/
@@ -92,25 +90,40 @@ private static void build(@NotNull final EditorFXScene scene, @NotNull final Sta
9290

9391
new EventRedirector(editorAreaComponent, canvas, stage);
9492

95-
final GlobalToolSplitPane splitContainer = new GlobalToolSplitPane(scene);
96-
splitContainer.setId(CSSIds.MAIN_SPLIT_PANEL);
93+
final GlobalLeftToolSplitPane leftSplitContainer = new GlobalLeftToolSplitPane(scene);
94+
leftSplitContainer.setId(CSSIds.MAIN_SPLIT_PANEL);
9795

98-
final GlobalToolComponent globalToolComponent = new GlobalToolComponent(splitContainer);
99-
globalToolComponent.addComponent(new AssetComponent(), Messages.EDITOR_TOOL_ASSET);
100-
globalToolComponent.addComponent(LogView.getInstance(), Messages.LOG_VIEW_TITLE);
96+
final GlobalBottomToolSplitPane bottomSplitContainer = new GlobalBottomToolSplitPane(scene);
97+
bottomSplitContainer.setId(CSSIds.MAIN_SPLIT_PANEL);
10198

102-
splitContainer.initFor(globalToolComponent, editorAreaComponent);
99+
final GlobalLeftToolComponent globalLeftToolComponent = new GlobalLeftToolComponent(leftSplitContainer);
100+
globalLeftToolComponent.addComponent(new AssetComponent(), Messages.EDITOR_TOOL_ASSET);
103101

104-
FXUtils.addToPane(splitContainer, container);
102+
final GlobalBottomToolComponent globalBottomToolComponent = new GlobalBottomToolComponent(bottomSplitContainer);
103+
globalBottomToolComponent.addComponent(LogView.getInstance(), Messages.LOG_VIEW_TITLE);
104+
105+
leftSplitContainer.initFor(globalLeftToolComponent, bottomSplitContainer);
106+
bottomSplitContainer.initFor(globalBottomToolComponent, editorAreaComponent);
107+
108+
FXUtils.addToPane(leftSplitContainer, container);
105109
FXUtils.addToPane(barComponent, container);
106110

107111
barComponent.createDrawer(container, stage);
108112
barComponent.toFront();
109113

110-
FXUtils.bindFixedHeight(splitContainer, container.heightProperty().subtract(BAR_OFFSET.getTop()).add(2));
111-
FXUtils.bindFixedWidth(splitContainer, container.widthProperty());
114+
FXUtils.bindFixedWidth(leftSplitContainer, container.widthProperty());
112115
FXUtils.bindFixedWidth(barComponent, container.widthProperty());
113116

114-
StackPane.setMargin(splitContainer, BAR_OFFSET);
117+
barComponent.heightProperty().addListener((observable, oldValue, newValue) ->
118+
updateLayout(container, leftSplitContainer, newValue));
119+
}
120+
121+
private static void updateLayout(@NotNull final StackPane container,
122+
@NotNull final GlobalLeftToolSplitPane leftSplitContainer,
123+
@NotNull final Number newValue) {
124+
125+
StackPane.setMargin(leftSplitContainer, new Insets(newValue.doubleValue(), 0, 0, 0));
126+
FXUtils.bindFixedHeight(leftSplitContainer, container.heightProperty().subtract(newValue.doubleValue()).add(2));
127+
Platform.runLater(container::requestLayout);
115128
}
116129
}

src/com/ss/editor/ui/component/bar/EditorBarComponent.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
package com.ss.editor.ui.component.bar;
22

33
import static javafx.util.Duration.millis;
4-
54
import com.ss.editor.JFXApplication;
65
import com.ss.editor.config.Config;
76
import com.ss.editor.ui.Icons;
8-
import com.ss.editor.ui.builder.EditorFXSceneBuilder;
97
import com.ss.editor.ui.component.ScreenComponent;
108
import com.ss.editor.ui.component.bar.action.CloseEditorAction;
119
import com.ss.editor.ui.component.bar.action.OpenAssetAction;
1210
import com.ss.editor.ui.component.bar.action.OpenSettingsAction;
1311
import com.ss.editor.ui.css.CSSClasses;
1412
import com.ss.editor.ui.css.CSSIds;
15-
1613
import javafx.animation.FadeTransition;
1714
import javafx.animation.TranslateTransition;
1815
import javafx.event.ActionEvent;
@@ -173,7 +170,8 @@ public void createDrawer(final StackPane container, final Stage stage) {
173170

174171
updateFullscreenButton(stage.isMaximized());
175172

176-
StackPane.setMargin(drawerContainer, EditorFXSceneBuilder.BAR_OFFSET);
173+
heightProperty().addListener((observable, oldValue, newValue) ->
174+
StackPane.setMargin(drawerContainer, new Insets(newValue.doubleValue(), 0, 0, 0)));
177175
}
178176

179177
/**

src/com/ss/editor/ui/component/split/pane/EditorToolSplitPane.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.ss.editor.ui.component.split.pane;
22

33
import com.ss.editor.ui.component.editor.state.EditorToolConfig;
4-
import com.ss.editor.ui.component.tab.GlobalToolComponent;
4+
import com.ss.editor.ui.component.tab.GlobalLeftToolComponent;
55
import com.ss.editor.ui.component.tab.TabToolComponent;
6-
7-
import org.jetbrains.annotations.NotNull;
8-
6+
import javafx.application.Platform;
97
import javafx.scene.Node;
108
import javafx.scene.Scene;
119
import javafx.scene.control.SplitPane;
1210
import javafx.scene.layout.Region;
11+
import org.jetbrains.annotations.NotNull;
1312

1413
/**
15-
* The implementation of the {@link SplitPane} for the {@link GlobalToolComponent}.
14+
* The implementation of the {@link SplitPane} for the {@link GlobalLeftToolComponent}.
1615
*
1716
* @author JavaSaBr
1817
*/
@@ -21,6 +20,7 @@ public class EditorToolSplitPane extends TabToolSplitPane<EditorToolConfig> {
2120
/**
2221
* The root of the editor.
2322
*/
23+
@NotNull
2424
private final Region root;
2525

2626
public EditorToolSplitPane(@NotNull final Scene scene, @NotNull final Region root) {
@@ -34,6 +34,12 @@ public void initFor(@NotNull final TabToolComponent toolComponent, @NotNull fina
3434
root.widthProperty().addListener((observableValue, oldValue, newValue) -> handleSceneChanged(getSceneWidth()));
3535
}
3636

37+
@Override
38+
protected void handleSceneChanged(@NotNull final Number newWidth) {
39+
super.handleSceneChanged(newWidth);
40+
Platform.runLater(this::requestLayout);
41+
}
42+
3743
@Override
3844
protected void bindToScene() {
3945
}
@@ -45,22 +51,22 @@ protected void addElements(final @NotNull TabToolComponent toolComponent, final
4551

4652
@Override
4753
protected boolean loadCollapsed() {
48-
return config.isToolCollapsed();
54+
return getConfig().isToolCollapsed();
4955
}
5056

5157
@Override
5258
protected int loadWidth() {
53-
return config.getToolWidth();
59+
return getConfig().getToolWidth();
5460
}
5561

5662
@Override
5763
protected void saveCollapsed(final boolean collapsed) {
58-
config.setToolCollapsed(collapsed);
64+
getConfig().setToolCollapsed(collapsed);
5965
}
6066

6167
@Override
6268
protected void saveWidth(final int width) {
63-
config.setToolWidth(width);
69+
getConfig().setToolWidth(width);
6470
}
6571

6672
@Override

0 commit comments

Comments
 (0)