neilcsmith-net commented on code in PR #4335:
URL: https://github.com/apache/netbeans/pull/4335#discussion_r914698039
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties:
##########
@@ -22,6 +22,10 @@ nb.preferred.color.profile=FlatLaf Dark
nb.errorForeground=#DB5860
nb.warningForeground=@foreground
+# Keep the tree background at @background rather than the very slightly lighter
+# @componentBackground, to make the Projects/Files/Services and Navigator
backgrounds connect
+# seamlessly with the background of their tab on top.
+Tree.background = @background
Review Comment:
I steered away from this. Have you investigated all the implications of
changing this? eg. use of `Tree.background` across the codebase. Even in
FlatLaf, what effect does this have on unified background support?
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties:
##########
@@ -52,6 +58,8 @@ ViewTab.activeBackground=$EditorTab.activeBackground
ViewTab.activeForeground=$EditorTab.activeForeground
ViewTab.selectedBackground=$EditorTab.selectedBackground
ViewTab.selectedForeground=$EditorTab.selectedForeground
+ViewTab.hoverBackground=$ViewTab.selectedBackground
+ViewTab.unselectedHoverBackground=lighten($ViewTab.activeBackground,7%)
Review Comment:
Ditto.
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties:
##########
@@ -39,11 +44,12 @@
TabbedContainer.view.contentBorderColor=$Component.borderColor
#---- EditorTab ----
-EditorTab.tabInsets=5,6,7,8
+EditorTab.tabInsets=5,6,7,6
EditorTab.underlineHeight=3
EditorTab.underlineAtTop=true
EditorTab.tabSeparatorColor=$Component.borderColor
EditorTab.showTabSeparators=true
+EditorTab.showSelectedTabBorder=true
Review Comment:
Remove? See comment in tab rendering code.
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/ui/FlatViewTabDisplayerUI.java:
##########
@@ -207,40 +220,51 @@ protected void paintTabBackground(Graphics g, int index,
int x, int y, int width
}
private void paintTabBackgroundAtScale1x(Graphics2D g, int index, int
width, int height, double scale) {
- // do not round tab separator width to get nice small lines at 125%,
150% and 175%
- int tabSeparatorWidth = (showTabSeparators && index >= 0) ? (int) (1 *
scale) : 0;
+ boolean selected = isSelected(index);
- // paint background
Color bg = colorForState(index, background, activeBackground,
selectedBackground,
- hoverBackground, attentionBackground);
+ hoverBackground, unselectedHoverBackground,
attentionBackground);
+
+ boolean showSeparator = showTabSeparators &&
+ // Show separators _between_ tabs (not after the last one),
like for editor tabs.
+ index >= 0 && index < getDataModel().size() - 1 &&
+ /* Don't show separators around the selected tab, if there's
already a border or
+ color contrast at its sides. */
+ (!showSelectedTabBorder &&
selectedBackground.equals(activeBackground) ||
+ (!selected && !isSelected(index + 1)));
+
+ int contentBorderWidth = unscaledBorders ? 1 :
HiDPIUtils.deviceBorderWidth(scale, 1);
+ int tabSeparatorWidth = showSeparator ? contentBorderWidth : 0;
+
+ // paint background
g.setColor(bg);
g.fillRect(0, 0, width - (bg != background ? tabSeparatorWidth : 0),
height);
- if (isSelected(index) && underlineHeight > 0) {
- // paint underline if tab is selected
- int underlineHeight = (int) Math.round(this.underlineHeight *
scale);
- g.setColor(isActive() ? underlineColor : inactiveUnderlineColor);
- if (underlineAtTop) {
+ if (selected) {
+ if (showSelectedTabBorder) {
g.setColor(contentBorderColor);
- int borderWidth = (int) (1 * scale);
- g.fillRect(0, 0, borderWidth, height);
- g.fillRect(width - tabSeparatorWidth - borderWidth, 0,
borderWidth, height);
- g.setColor(isActive() ? underlineColor :
inactiveUnderlineColor);
- g.fillRect(0, 0, width - tabSeparatorWidth, underlineHeight);
- } else {
+ g.fillRect(0, 0, width - tabSeparatorWidth,
contentBorderWidth); // Top
Review Comment:
Any implications to now always drawing the top border even if drawing over
it later?
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/ui/FlatEditorTabCellRenderer.java:
##########
@@ -66,14 +67,27 @@ public class FlatEditorTabCellRenderer extends
AbstractTabCellRenderer {
private static final boolean underlineAtTop =
UIManager.getBoolean("EditorTab.underlineAtTop"); // NOI18N
private static boolean showTabSeparators =
UIManager.getBoolean("EditorTab.showTabSeparators"); // NOI18N
- private static final FlatTabPainter painter = new FlatTabPainter();
+ /**
+ * Margin on the right of the close button. Note that {@code
tabInsets.right} denotes the space
+ * between the caption text and the "close" icon. Here, we set the right
margin to the same
+ * value as the left margin (before the tab's caption).
+ */
+ private static final int CLOSE_ICON_RIGHT_PAD = tabInsets.left;
+
+ private static final boolean showSelectedTabBorder =
Utils.getUIBoolean("EditorTab.showSelectedTabBorder", false); // NOI18N
Review Comment:
I think this should default to the value of `underlineAtTop` rather than
false. I added the code that way deliberately - it's the sensible default in my
opinion, even if adding the ability to override.
```java
showSelectedTabBorder =
Utils.getUIBoolean("EditorTab.showSelectedTabBorder", underlineAtTop);
```
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties:
##########
@@ -36,7 +40,9 @@
EditorTab.activeBackground=shade($TabbedPane.underlineColor,75%)
EditorTab.activeForeground=darken(@foreground,10%)
EditorTab.selectedBackground=@background
EditorTab.selectedForeground=@foreground
-EditorTab.hoverBackground=lighten(@componentBackground,5%)
+# Add the hover effect only for unselected tabs.
+EditorTab.hoverBackground=$EditorTab.selectedBackground
+EditorTab.unselectedHoverBackground=lighten($EditorTab.activeBackground,7%)
Review Comment:
That might make more sense being `EditorTab.selectedHoverBackground`? Why
special case the more commonly used value?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists