class: Form
authorStefan Vogel <sv@exept.de>
Tue, 04 Feb 2014 14:27:19 +0100
changeset 6227 72c2836e3151
parent 6226 cdb753921735
child 6228 0d2c822acecd
class: Form changed:5 methods view creation and view properties done via graphics context
Form.st
--- a/Form.st	Tue Feb 04 14:26:34 2014 +0100
+++ b/Form.st	Tue Feb 04 14:27:19 2014 +0100
@@ -497,6 +497,7 @@
 !Form class methodsFor:'file search'!
 
 findBitmapFile:fileName
+    <resource: #obsolete>
     "find the bitmap file in one of the standard places;
      return the pathName or nil"
 
@@ -1237,7 +1238,6 @@
 ! !
 
 
-
 !Form methodsFor:'converting'!
 
 asForm
@@ -1882,7 +1882,7 @@
     (self readFromFile:filename) isNil ifTrue:[^ nil].
 
     "if the device is within +- 50% of dpi, no magnify is needed"
-    dev := device.
+    dev := self device.
     dev isNil ifTrue:[
         "should not happen ..."
         dev := Screen current
@@ -1895,7 +1895,9 @@
     ].
     ^ self magnifiedBy:(mag @ mag)
 
-    "Form fromFile:'SBrowser.icn' resolution:50"
+    "
+        Form fromFile:'SBrowser.icn' resolution:50
+    "
 
     "Modified: 7.2.1996 / 16:03:45 / cg"
 !
@@ -1911,37 +1913,27 @@
 width:w height:h
     "actual create of a monochrome form"
 
-    ((w == 0) or:[h == 0]) ifTrue:[
-        self error:'invalid form extent'.
-        ^ nil
-    ].
-    width := w.
-    height := h.
-    depth := 1.
-    offset := 0@0.
-    BlackAndWhiteColorMap isNil ifTrue:[
-        BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
-    ].
-    localColorMap := BlackAndWhiteColorMap.
-
-    device notNil ifTrue:[
-        drawableId := device createBitmapWidth:w height:h.
-"/        drawableId isNil ifTrue:[^ nil].
-        realized := true.
-        Lobby registerChange:self.
-    ].
+    ^ self width:w height:h depth:1.
 !
 
 width:w height:h depth:d
     "actual create of an arbitrary deep form (but, must be supported by device)"
 
+    ((w == 0) or:[h == 0]) ifTrue:[
+        self error:'invalid form extent'.
+    ].
     width := w.
     height := h.
     offset := 0@0.
     depth := d.
+    depth == 1 ifTrue:[
+        BlackAndWhiteColorMap isNil ifTrue:[
+            BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
+        ].
+        localColorMap := BlackAndWhiteColorMap.
+    ].
     device notNil ifTrue:[
-        drawableId := device createPixmapWidth:w height:h depth:d.
-"/        drawableId isNil ifTrue:[^ nil].
+        self createPixmapWidth:w height:h depth:d.
         realized := true.
         Lobby registerChange:self.
     ].
@@ -1960,7 +1952,6 @@
      srcStart  "{ Class: SmallInteger }"
      srcIndex  "{ Class: SmallInteger }"
      dstIndex  "{ Class: SmallInteger }"
-     hi        "{ Class: SmallInteger }" 
      w         "{ Class: SmallInteger }" 
      h         "{ Class: SmallInteger }"
      sz        "{ Class: SmallInteger }" |
@@ -2029,22 +2020,8 @@
             ]
         ]
     ].
-    width := w.
-    height := h.
-    depth := 1.
-    offset := 0@0.
+    self width:w height:h depth:1.
     data := bytes.
-    BlackAndWhiteColorMap isNil ifTrue:[
-        BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
-    ].
-    localColorMap := BlackAndWhiteColorMap.
-
-    device notNil ifTrue:[
-        drawableId := device createBitmapFromArray:bytes width:w height:h.
-"/        drawableId isNil ifTrue:[^ nil].
-        realized := true.
-        Lobby registerChange:self.
-    ].
 !
 
 width:w height:h offset:offs fromArray:anArray
@@ -2216,7 +2193,7 @@
 !Form class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Form.st,v 1.146 2013-10-09 10:13:32 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Form.st,v 1.147 2014-02-04 13:27:19 stefan Exp $'
 ! !