StandardSystemView.st
changeset 1878 76e9bc8e1b9c
parent 1865 43c2eaba229d
child 1880 2900f8770585
--- a/StandardSystemView.st	Wed Aug 20 19:13:10 1997 +0200
+++ b/StandardSystemView.st	Wed Aug 20 19:18:15 1997 +0200
@@ -14,7 +14,7 @@
 	instanceVariableNames:'label icon iconView iconLabel minExtent maxExtent sizeFixed
 		application windowEventsForApplication'
 	classVariableNames:'DefaultIcon TakeFocusWhenMapped IncludeHostNameInLabel
-		DefaultExtent'
+		DefaultExtent NewHostNameInLabelFormat'
 	poolDictionaries:''
 	category:'Views-Basic'
 !
@@ -49,18 +49,18 @@
     in the past (for example: FileBrowser, ChangesBrowser etc.).
     Although this worked, it may lead to the following
     problems and inconveniences:
-	- applications inherit a big number of methods through the
-	  SimpleView->View->TopView->StandardSystemView hierarchy.
-	  There is quite a danger that by accident, some method gets
-	  redefined which is required by one of those classes.
-	  (typical candidates are: terminate, destroy, open ...)
-	  This may lead to strange effects, which may not be obvious to
-	  non experts ...
+        - applications inherit a big number of methods through the
+          SimpleView->View->TopView->StandardSystemView hierarchy.
+          There is quite a danger that by accident, some method gets
+          redefined which is required by one of those classes.
+          (typical candidates are: terminate, destroy, open ...)
+          This may lead to strange effects, which may not be obvious to
+          non experts ...
 
-	- applications with multiple topViews are difficult to implement
-	  and manage.
+        - applications with multiple topViews are difficult to implement
+          and manage.
 
-	- use of a windowBuilder is difficult.
+        - use of a windowBuilder is difficult.
 
     For all those reasons, we HIGHLY recommend to NOT define applications
     as subclasses of StandardSystemView, but instead base them on
@@ -68,58 +68,66 @@
     if (if at all).
 
     [instance variables:]
-	label                   <String>    the label in the windows title
+        label                   <String>    the label in the windows title
 
-	icon                    <Form>      the icon
-					    [ignored if the display does not 
-					     support icons]
+        icon                    <Form>      the icon
+                                            [ignored if the display does not 
+                                             support icons]
 
-	iconView                <View>      an optional icon-view (for animated icons)
-					    [ignored if the display does not
-					     supports this]
+        iconView                <View>      an optional icon-view (for animated icons)
+                                            [ignored if the display does not
+                                             supports this]
 
-	iconLabel               <String>    the label in the icon
-					    [ignored if the display does not 
-					     support label-tabs with icons]
+        iconLabel               <String>    the label in the icon
+                                            [ignored if the display does not 
+                                             support label-tabs with icons]
 
-	minExtent               <Point>     the minimum size
-					    No limit, if nil
-					    [the window manager may have its own
-					     limit; typically some small area]
+        minExtent               <Point>     the minimum size
+                                            No limit, if nil
+                                            [the window manager may have its own
+                                             limit; typically some small area]
 
-	maxExtent               <Point>     the maximum size
-					    No limit, if nil.
-					    [the window manager may have its own
-					     limit; typically the screen size]
+        maxExtent               <Point>     the maximum size
+                                            No limit, if nil.
+                                            [the window manager may have its own
+                                             limit; typically the screen size]
 
-	sizeFixed               <Boolean>   prevents the view from resizing itself
-					    (especially to freeze a dialogs size)
+        sizeFixed               <Boolean>   prevents the view from resizing itself
+                                            (especially to freeze a dialogs size)
 
-	application             <AppModel>  if nonNil, thats the application
-					    Many requests (such as open/close etc.
-					    are forwarded to it, if present.
+        application             <AppModel>  if nonNil, thats the application
+                                            Many requests (such as open/close etc.
+                                            are forwarded to it, if present.
 
 
 
      [class variables:]
 
-	DefaultIcon             <Form>      cached default icon
+        DefaultIcon             <Form>      cached default icon
+
+        TakeFocusWhenMapped     <Boolean>   if true, views grab the keyboard
+                                            focus (convenient with some stupid
+                                            windowManagers)
 
-	TakeFocusWhenMapped     <Boolean>   if true, views grab the keyboard
-					    focus (convenient with some stupid
-					    windowManagers)
+        IncludeHostNameInLabel  <Boolean>   if true, the windows title shall
+                                            include the hostname.
+                                            (convenient if you have many remote
+                                            views open simultaneously)
 
-	IncludeHostNameInLabel  <Boolean>   if true, the windows title shall
-					    include the hostname.
-					    (convenient if you have many remote
-					    views open simultaneously)
+        NewHostNameInLabelFormat <Boolean>  if true, the hostname is appended
+                                            after a '@'-character.
+                                            If false, its prepended with a colon.
+                                            The first is better with window managers
+                                            which cut of the tail of the window
+                                            title for the icon-bar (i.e. fvwm95)
+                                        
 
     [author:]
-	Claus Gittinger
+        Claus Gittinger
 
     [see also:]
-	WindowGroup
-	ApplicationModel
+        WindowGroup
+        ApplicationModel
 "
 !
 
@@ -320,6 +328,17 @@
 	   minExtent:minExtent maxExtent:maxExtent
 ! !
 
+!StandardSystemView class methodsFor:'class initialization'!
+
+initialize
+    IncludeHostNameInLabel := false.
+    NewHostNameInLabelFormat := true.
+    TakeFocusWhenMapped := false.
+
+    "Created: 20.8.1997 / 14:16:32 / cg"
+    "Modified: 20.8.1997 / 14:16:45 / cg"
+! !
+
 !StandardSystemView class methodsFor:'defaults'!
 
 defaultExtent
@@ -722,27 +741,32 @@
      (you will appreciate this, if you are working on multiple
       machines simultaneously - as I do ...)"
 
-    |l|
+    |l hostName|
 
     aString ~= label ifTrue:[
-	label := aString.
-	drawableId notNil ifTrue: [
-	    IncludeHostNameInLabel == true ifTrue:[
-		l := OperatingSystem getHostName , ': ' , aString.
-	    ] ifFalse:[
-		l := aString
-	    ].
-	    device setWindowName:l in:drawableId.
-	    "
-	     unbuffered - to make it visible right NOW
-	    "
-	    device flush.
-	]
+        label := aString.
+        drawableId notNil ifTrue: [
+            IncludeHostNameInLabel == true ifTrue:[
+                hostName := OperatingSystem getHostName.
+                NewHostNameInLabelFormat == true ifTrue:[
+                    l := aString , '@' , hostName
+                ] ifFalse:[
+                    l := hostName , ': ' , aString.
+                ]
+            ] ifFalse:[
+                l := aString
+            ].
+            device setWindowName:l in:drawableId.
+            "
+             unbuffered - to make it visible right NOW
+            "
+            device flush.
+        ]
     ]
 
     "Created: 8.9.1995 / 19:37:06 / claus"
     "Modified: 8.9.1995 / 19:39:18 / claus"
-    "Modified: 24.4.1996 / 09:09:17 / cg"
+    "Modified: 20.8.1997 / 14:18:01 / cg"
 !
 
 label:labelString iconLabel:iconLabelString
@@ -1238,19 +1262,24 @@
 physicalCreate
     "common code for create & recreate"
 
-    |l icn icnMask org listener ret|
+    |hostName l icn icnMask org listener ret|
 
     IncludeHostNameInLabel == true ifTrue:[
-	l := OperatingSystem getHostName , ': ' , label.
+        hostName := OperatingSystem getHostName.
+        NewHostNameInLabelFormat == true ifTrue:[
+            l := label , '@' , hostName
+        ] ifFalse:[
+            l := hostName , ': ' , label.
+        ]
     ] ifFalse:[
-	l := label
+        l := label
     ].
 
     icon notNil ifTrue:[
-	icn := self convertedIcon:icon.
-	(icnMask := icon mask) notNil ifTrue:[
-	    icnMask := self convertedIconMask:icnMask
-	]
+        icn := self convertedIcon:icon.
+        (icnMask := icon mask) notNil ifTrue:[
+            icnMask := self convertedIconMask:icnMask
+        ]
     ].
 
     org := left @ top.
@@ -1267,20 +1296,20 @@
     ].
 
     drawableId := device 
-		      createWindowFor:self 
-		      type:nil
-		      origin:org
-		      extent:(width @ height)
-		      minExtent:minExtent
-		      maxExtent:maxExtent
-		      borderWidth:borderWidth
-		      subViewOf:nil 
-		      style:(self windowStyle)
-		      inputOnly:(self isInputOnly)
-		      label:l
-		      cursor:cursor
-		      icon:icn iconMask:icnMask
-		      iconView:iconView.
+                      createWindowFor:self 
+                      type:nil
+                      origin:org
+                      extent:(width @ height)
+                      minExtent:minExtent
+                      maxExtent:maxExtent
+                      borderWidth:borderWidth
+                      subViewOf:nil 
+                      style:(self windowStyle)
+                      inputOnly:(self isInputOnly)
+                      label:l
+                      cursor:cursor
+                      icon:icn iconMask:icnMask
+                      iconView:iconView.
 
     Lobby registerChange:self.
 
@@ -1295,7 +1324,7 @@
     originChanged := false.
 
     (borderColor notNil and:[borderColor ~= Black]) ifTrue:[
-	self setBorderColor
+        self setBorderColor
     ].
 
 "/  (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
@@ -1307,21 +1336,21 @@
 "/  ].
 
     borderShape notNil ifTrue:[
-	device setWindowBorderShape:(borderShape id) in:drawableId
+        device setWindowBorderShape:(borderShape id) in:drawableId
     ].
     viewShape notNil ifTrue:[
-	device setWindowShape:(viewShape id) in:drawableId
+        device setWindowShape:(viewShape id) in:drawableId
     ].
     (backed notNil and:[backed ~~ false]) ifTrue:[
-	device setBackingStore:backed in:drawableId
+        device setBackingStore:backed in:drawableId
     ].
     saveUnder ifTrue:[
-	device setSaveUnder:true in:drawableId
+        device setSaveUnder:true in:drawableId
     ].
     device setWindowClass:('Stx', self className) name:name in:drawableId.
 
     "Modified: 14.6.1996 / 17:14:25 / stefan"
-    "Modified: 7.4.1997 / 11:38:22 / cg"
+    "Modified: 20.8.1997 / 14:18:59 / cg"
 !
 
 postRealize
@@ -1372,5 +1401,6 @@
 !StandardSystemView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.82 1997-08-15 11:03:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.83 1997-08-20 17:18:15 cg Exp $'
 ! !
+StandardSystemView initialize!