Launcher.st
changeset 1610 ba0e5de6aba0
parent 1607 dd4ea615d9d2
child 1614 7aa9afa0a41d
--- a/Launcher.st	Sat Apr 25 19:22:21 1998 +0200
+++ b/Launcher.st	Sat Apr 25 19:56:56 1998 +0200
@@ -5090,9 +5090,12 @@
 viewStyleSettingsFor:requestor 
     "open a dialog on viewStyle related settings"
 
-    |listOfStyles resourceDir dir box 
+    | resourceDir dir box 
      list listView scrView infoLabel infoForwarder newStyle
-     someRsrcFile b didApply resources|
+     someRsrcFile b didApply resources listUpdater showStandardStylesOnly standardStyles|
+
+    showStandardStylesOnly := true asValue.
+    standardStyles := #('iris' 'motif' 'mswindows95' 'next' 'openwin' 'os2' 'st80' 'normal').
 
     resources := requestor class classResources.
 
@@ -5112,41 +5115,42 @@
     ].
     dir := resourceDir asFilename directoryContents.
 
-    listOfStyles := dir select:[:aFileName | aFileName asFilename hasSuffix:'style'].
-    listOfStyles := listOfStyles collect:[:aFileName | aFileName asFilename withoutSuffix name].
-    Filename isCaseSensitive ifFalse:[
-        listOfStyles := listOfStyles collect:[:aStyleName | aStyleName asLowercase].
+    list := SelectionInList new.
+
+    listUpdater := [
+        |listOfStyles lastSelection|
+
+        lastSelection := list selection.
+        listOfStyles := dir select:[:aFileName | aFileName asFilename hasSuffix:'style'].
+        listOfStyles := listOfStyles collect:[:aFileName | aFileName asFilename withoutSuffix name].
+        Filename isCaseSensitive ifFalse:[
+            listOfStyles := listOfStyles collect:[:aStyleName | aStyleName asLowercase].
+        ].
+        listOfStyles remove:'generic'; remove:'mswindows3'.
+        showStandardStylesOnly value ifTrue:[
+            listOfStyles := listOfStyles select:[:aStyleName | standardStyles includes:aStyleName].
+        ].
+
+        listOfStyles sort.
+        list list:listOfStyles.
+        list selection:lastSelection.
     ].
-    listOfStyles sort.
-
-"/ old code: used a standard ListSelectionBox
-"/ changed to intercept selection and add info-output.
-
-"/    box := ListSelectionBox title:(resources string:'STYLE_MSG' default:'select a style') withCRs.
-"/    box label:(resources string:'Style selection').
-"/    box list:listOfStyles.
-"/    box initialText:View defaultStyle.
-"/    box selectAction:[:newStyle |
-"/    ].    
-"/    box action:[:newStyle |
-"/        transcript topView withCursor:Cursor wait do:[
-"/            transcript showCR:'change style to ' , newStyle , ' ...'.
-"/            View defaultStyle:newStyle asSymbol.
-"/        ]
-"/    ].    
-"/    box showAtPointer
-
-"/ new code: build box 'by 'hand'
-"/
+    listUpdater value.
+
+    showStandardStylesOnly onChangeSend:#value to:listUpdater.
+
     infoForwarder := [
                         |nm sheet comment|
+
+                        comment := ''.
                         nm := list selection.
-                        sheet := ViewStyle fromFile:(nm , '.style').
-                        comment := sheet at:#comment ifAbsent:''.
+                        nm notNil ifTrue:[
+                            sheet := ViewStyle fromFile:(nm , '.style').
+                            comment := sheet at:#comment ifAbsent:''.
+                        ].
                         infoLabel label:comment withCRs asStringCollection
                        ].
 
-    list := SelectionInList with:listOfStyles.
     list onChangeSend:#value to:infoForwarder.
 
     box := Dialog new.
@@ -5155,16 +5159,19 @@
     (box addTextLabel:(resources at:'STYLE_MSG' default:'select a style') withCRs) adjust:#left.
     listView := SelectionInListView on:list.
     listView doubleClickAction:[:sel | box accept value:true. box hide].
+    box addCheckBox:(resources string:'standard styles only') on:showStandardStylesOnly.
     scrView := box addComponent:(ScrollableView forView:listView) tabable:true.
 
     box addVerticalSpace.
 
     (infoLabel := box addTextLabel:'\\' withCRs) adjust:#centerLeft.
 
-
     box addAbortButton.
-    b := box addButton:(Button label:(resources string:'apply')).
-    b action:[didApply := true. requestor changeViewStyleTo:(list selection)].
+
+"/ mhmh - the newLauncher does not yet handle apply (without close) correctly
+"/    b := box addButton:(Button label:(resources string:'apply')).
+"/    b action:[didApply := true. requestor changeViewStyleTo:(list selection)].
+
     box addOkButton.
     list selection:(View defaultStyle).
 
@@ -5409,5 +5416,5 @@
 !Launcher class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.331 1998-04-25 16:56:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.332 1998-04-25 17:56:56 cg Exp $'
 ! !