Skip to content

Commit

Permalink
Application: Replace one-pixel dividers with full-sized ones
Browse files Browse the repository at this point in the history
Due to how hacky the implementation was, it sometimes would break
model viewer and prevent the viewport from being properly repainted
  • Loading branch information
ShadelessFox committed Jun 2, 2024
1 parent f3137ac commit bda6fa8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ModelViewerPanel() {

try {
viewport = new ModelViewport(new Camera());
viewport.setPreferredSize(new Dimension(400, 400));
viewport.setPreferredSize(new Dimension(800, 800));
viewport.setMinimumSize(new Dimension(100, 100));
viewport.addPropertyChangeListener(this);
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.shade.platform.model.persistence.PersistableComponent;
import com.shade.platform.model.persistence.Persistent;
import com.shade.platform.ui.UIColor;
import com.shade.platform.ui.controls.ThinSplitPane;
import com.shade.platform.ui.controls.ToolTabbedPane;
import com.shade.platform.ui.editors.Editor;
import com.shade.platform.ui.editors.EditorManager;
Expand Down Expand Up @@ -152,7 +151,7 @@ private JComponent createViewPanel(@NotNull JComponent root, @NotNull Anchor anc
return root;
}

final JSplitPane splitPane = new ThinSplitPane();
final JSplitPane splitPane = new JSplitPane();
final ToolTabbedPane tabbedPane = new ToolTabbedPane(anchor.toSwingConstant(), splitPane);

for (var view : views) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ public class ToolTabbedPane extends JTabbedPane {
public ToolTabbedPane(int tabPlacement, @NotNull JSplitPane parent) {
super(tabPlacement);

// FIXME: Please replace this faulty implementation with something else
getModel().addChangeListener(ev -> {
final int index = getSelectedIndex();
final Object lastDividerLocation = parent.getClientProperty(LAST_DIVIDER_LOCATION_PROPERTY);

if (index < 0 && lastDividerLocation == null) {
parent.putClientProperty(LAST_DIVIDER_LOCATION_PROPERTY, parent.getDividerLocation());
parent.setDividerLocation(TAB_HEADER_SIZE);
parent.setDividerSize(1);
} else if (index >= 0 && lastDividerLocation != null) {
parent.setDividerLocation((Integer) lastDividerLocation);
parent.putClientProperty(LAST_DIVIDER_LOCATION_PROPERTY, null);
parent.setDividerSize(UIManager.getInt("SplitPane.dividerSize"));
}
});

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.shade.platform.ui.editors.stack;

import com.shade.platform.model.messages.MessageBus;
import com.shade.platform.ui.controls.ThinSplitPane;
import com.shade.platform.ui.editors.EditorManager;
import com.shade.util.NotNull;
import com.shade.util.Nullable;
Expand Down Expand Up @@ -34,7 +33,7 @@ public SplitResult split(int orientation, double position, boolean leading) {
final var first = new EditorStackContainer(manager, getComponent(0));
final var second = new EditorStackContainer(manager, null);

final JSplitPane pane = new ThinSplitPane(orientation);
final JSplitPane pane = new JSplitPane(orientation);
pane.setLeftComponent(leading ? second : first);
pane.setRightComponent(leading ? first : second);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ TreeUI = com.shade.platform.ui.controls.tree.TreeUI
ToolTipUI = com.shade.platform.ui.controls.plaf.FlatOutlineToolTipUI
ToolTabbedPaneUI = com.shade.platform.ui.controls.plaf.FlatToolTabbedPaneUI
LabeledSeparatorUI = com.shade.platform.ui.controls.plaf.LabeledSeparatorUI
ThinSplitPaneUI = com.shade.platform.ui.controls.plaf.FlatThinSplitPaneUI
FileChooserUI = com.shade.platform.ui.controls.plaf.FlatFileChooserUI

#General
Expand All @@ -25,9 +24,9 @@ TitlePane.buttonSize = 44,28
TabbedPane.tabHeight = 24
TabbedPane.tabRotation = auto
Component.hideMnemonics = false
Tree.showsRootHandles = true
SplitPane.dividerSize = 7
SplitPaneDivider.border = com.shade.decima.ui.controls.SplitPaneDividerBorder
SplitPaneDivider.style = plain
OptionPane.showIcon = true
Button.toolbar.spacingInsets = 2,2,2,2
Button.toolbar.margin = 2,2,2,2
Expand Down

0 comments on commit bda6fa8

Please sign in to comment.