#BUGFIX
authorClaus Gittinger <cg@exept.de>
Thu, 08 Oct 2015 19:25:45 +0200
changeset 4856 e30db8df7505
parent 4854 23fe12653489
child 4857 bafaf0066d93
child 4858 5ec7fb478874
#BUGFIX class: NoteBookView class definition comment/format in: #redrawX:y:width:height: changed: #drawBorderEdges #initStyle #initialize support for modern flat styles
NoteBookView.st
--- a/NoteBookView.st	Wed Oct 07 01:04:27 2015 +0200
+++ b/NoteBookView.st	Thu Oct 08 19:25:45 2015 +0200
@@ -30,7 +30,7 @@
 		removeTabEnteredIcon removeTabDisabledIcon
 		showingEnteredRemoveTabButton lastUserSelection minimumTabWidth
 		addTabAction addTabIcon addTabEnteredIcon addTabDisabledIcon
-		showingEnteredAddTabButton'
+		showingEnteredAddTabButton canvasLevel'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
 		DefaultActiveForegroundColor DefaultActiveBackgroundColor
 		DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
@@ -1384,39 +1384,50 @@
 
     layout := self computeBorderLayout.
 
-    tabLevel ~~ 0 ifTrue:[
-        self drawEdgesForX:(layout left)
-                         y:(layout top)
-                     width:(layout width) 
-                    height:(layout height)
-                     level:tabLevel.
-      ^ self
+    ((tabLevel ~~ 0) or:[canvasLevel ~= 0]) ifTrue:[
+        canvasLevel ~= 0 ifTrue:[
+            self drawEdgesForX:(layout left)
+                             y:(layout top)
+                         width:(layout width) 
+                        height:(layout height)
+                         level:tabLevel.
+            ^ self
+        ].
+        "/only draw top-edge
+        self drawTopEdgeLevel:tabLevel atY:layout top
+             shadow:shadowColor light:lightColor 
+             halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle.
+        ^ self
     ].
-    list size > 1 ifFalse:[^ self].
-
-    self paint:lightColor ? lightColor.
-    trans := self transformation.
-
-    (direction == #top or:[direction == #bottom]) ifTrue:[
-        direction == #top ifTrue:[ y0 := layout top - 1 ]
-                         ifFalse:[ y0 := layout bottom ].
-        y1 := y0.
-        x0 := 0.
-        trans notNil ifTrue:[
-            x0 := trans applyInverseToX:x0.
+    
+    list size <= 0 ifTrue:[^ self].
+
+    true "canvasBorder ~~ 0" ifTrue:[
+        self paint:lightColor ? lightColor.
+        
+        trans := self transformation.
+
+        (direction == #top or:[direction == #bottom]) ifTrue:[
+            direction == #top ifTrue:[ y0 := layout top - 1 ]
+                             ifFalse:[ y0 := layout bottom ].
+            y1 := y0.
+            x0 := 0.
+            trans notNil ifTrue:[
+                x0 := trans applyInverseToX:x0.
+            ].
+            x1 := x0 + self width.
+        ] ifFalse:[
+            direction == #left ifTrue:[ x0 := layout left - 1 ]
+                              ifFalse:[ x0 := layout right    ].
+            x1 := x0.
+            y0 := 0.
+            trans notNil ifTrue:[
+                y0 := trans applyInverseToY:y0.
+            ].
+            y1 := y0 + self height.
         ].
-        x1 := x0 + self width.
-    ] ifFalse:[
-        direction == #left ifTrue:[ x0 := layout left - 1 ]
-                          ifFalse:[ x0 := layout right    ].
-        x1 := x0.
-        y0 := 0.
-        trans notNil ifTrue:[
-            y0 := trans applyInverseToY:y0.
-        ].
-        y1 := y0 + self height.
-    ].
-    self displayLineFromX:x0 y:y0 toX:x1 y:y1.
+        self displayLineFromX:x0 y:y0 toX:x1 y:y1.
+    ]
 !
 
 drawDestroyButtonForTab:aTab
@@ -2353,6 +2364,13 @@
     "setup style attributes
     "
     <resource: #style (#'noteBook.viewBackground' 
+                       #'noteBook.tabTopMargin' 
+                       #'noteBook.tabBottomMargin'
+                       #'noteBook.tabLevel'
+                       #'noteBook.tabLabelInset'
+                       #'noteBook.canvasInset'
+                       #'noteBook.canvasBorder'
+                       #'noteBook.canvasLevel'
                        )>
     |clr graphicsDevice|
 
@@ -2424,10 +2442,42 @@
 
     activeTabMarkerColor := DefaultActiveTabMarkerColor.
     activeTabMarkerFGColor := DefaultActiveTabMarkerFgColor.
+
+    canvasInset      := styleSheet at:#'noteBook.canvasInset'      default:1@1.
+
+    tabLevel         := styleSheet at:#'noteBook.tabLevel'         default:1.
+    tabLabelInset    := styleSheet at:#'noteBook.tabLabelInset'    default:6@4.
+    selectionInsetX  := (2 max:(tabLevel abs)) + 1.
+    selectionInsetY  := (2 max:(tabLevel abs)) + 1.
+
+    tabTopMargin    := styleSheet at:#'noteBook.tabTopMargin' default:4.
+    tabBottomMargin := styleSheet at:#'noteBook.tabBottomMargin' default:1.
+
+    canvasLevel := styleSheet at:#'noteBook.canvasLevel' default:tabLevel.
 !
 
 initialize
 
+    "/must init first - these values might be overwritten by initStyle
+    showDestroyTabButton := false.
+    canvasInset      := 1@1.
+    keepCanvas       := false.
+    tabLevel         := 1.
+    tabLabelInset    := 6@4.
+    selectionInsetX  := (2 max:(tabLevel abs)) + 1.
+    selectionInsetY  := (2 max:(tabLevel abs)) + 1.
+    translateLabel   := false.
+
+    tabRightMargin   := 0.
+    tabLeftMargin    := 0.
+
+    tabTopMargin     := 4.
+    tabBottomMargin  := 1.
+    canvasLevel      := tabLevel.
+
+    showingEnteredRemoveTabButton := showingEnteredAddTabButton := false.
+    tabWasActiveWhenPressed := false.
+
     super initialize.
 
     self enableMotionEvents.  "/ for flyByHelp
@@ -2438,23 +2488,6 @@
     direction        := #top.
     fitLastRow       := true.
     enabled          := true.
-    showDestroyTabButton := false.
-    canvasInset      := styleSheet at:#'noteBook.canvasInset'      default:1@1.
-    keepCanvas       := false.
-    tabLevel         := styleSheet at:#'noteBook.tabLevel'         default:1.
-    tabLabelInset    := styleSheet at:#'noteBook.tabLabelInset'    default:6@4.
-    selectionInsetX  := (2 max:(tabLevel abs)) + 1.
-    selectionInsetY  := (2 max:(tabLevel abs)) + 1.
-    translateLabel   := false.
-
-    tabRightMargin   := 0.
-    tabLeftMargin    := 0.
-
-    tabTopMargin    := styleSheet at:#'noteBook.tabTopMargin' default:4.
-    tabBottomMargin := styleSheet at:#'noteBook.tabBottomMargin' default:1.
-
-    showingEnteredRemoveTabButton := showingEnteredAddTabButton := false.
-    tabWasActiveWhenPressed := false.
 
     self lineWidth:0.