BrowserView.st
changeset 665 eb23262a5ee1
parent 650 bb426452251e
child 674 fa41cdb5faa5
--- a/BrowserView.st	Tue Jul 09 22:53:50 1996 +0200
+++ b/BrowserView.st	Wed Jul 10 12:53:28 1996 +0200
@@ -3217,7 +3217,7 @@
 !
 
 classMethodMenu
-    <resource: #keyboard ( #Cmds #Cmdi ) >
+    <resource: #keyboard ( #Cmds #Cmdi #Cmdg ) >
 
     |labels selectors shorties|
 
@@ -3256,7 +3256,7 @@
                                 nil
                                 #Cmds
                                 #Cmdi
-                                nil
+                                #Cmdg
 "/                              nil
 "/                              nil
 "/                              nil
@@ -3292,7 +3292,7 @@
         selectors:selectors
         accelerators:shorties
 
-    "Modified: 29.5.1996 / 17:33:01 / cg"
+    "Modified: 10.7.1996 / 12:46:07 / cg"
 ! !
 
 !BrowserView methodsFor:'class-method stuff'!
@@ -3364,7 +3364,7 @@
     "this method is reached via delegation: are we prepared to handle
      a keyPress in some other view ?"
 
-    <resource: #keyboard (#Find #Cmdi #Cmds)>
+    <resource: #keyboard (#Find #Cmdi #Cmds #Cmdg #Cmdt #Cmda)>
 
     |untranslatedKey|
 
@@ -3374,20 +3374,24 @@
 
     ((view == methodListView)
     or:[view == classMethodListView]) ifTrue:[
-        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:nil.
+        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key.
+
         (untranslatedKey == #Cmdi) ifTrue:[^ true].
         (untranslatedKey == #Cmds) ifTrue:[^ true].
+        (untranslatedKey == #Cmdg) ifTrue:[^ true].
+        (untranslatedKey == #Cmdt) ifTrue:[^ true].
+        (untranslatedKey == #Cmda) ifTrue:[^ true].
     ].
     ^ false
 
     "Created: 2.3.1996 / 14:33:30 / cg"
-    "Modified: 12.4.1996 / 09:15:26 / cg"
+    "Modified: 10.7.1996 / 12:47:54 / cg"
 !
 
 keyPress:key x:x y:y view:view
     "this method is reached via delegation from the classCategoryListView"
 
-    <resource: #keyboard (#Find #Cmdi #Cmds)>
+    <resource: #keyboard (#Find #Cmdi #Cmds #Cmdg #Cmdt #Cmda)>
 
     |untranslatedKey|
 
@@ -3399,14 +3403,18 @@
         "/
         "/ have to untranslate (since we get #Inspect / #Search
         "/
-        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:nil.
+        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key.
+
         (untranslatedKey == #Cmdi) ifTrue:[^ self methodImplementors].
         (untranslatedKey == #Cmds) ifTrue:[^ self methodSenders].
+        (untranslatedKey == #Cmdg) ifTrue:[^ self methodGlobalReferends].
+        (untranslatedKey == #Cmdt) ifTrue:[^ self methodStringSearch].
+        (untranslatedKey == #Cmda) ifTrue:[^ self methodAproposSearch].
     ].
     view keyPress:key x:x y:y
 
     "Created: 2.3.1996 / 14:37:52 / cg"
-    "Modified: 12.4.1996 / 09:15:32 / cg"
+    "Modified: 10.7.1996 / 12:47:27 / cg"
 ! !
 
 !BrowserView methodsFor:'help'!
@@ -4774,8 +4782,11 @@
 methodAproposSearch
     "launch an enterBox for a keyword search"
 
-    self askForSelectorTitle:'keyword to search for:' 
-		    openWith:#aproposSearch:
+    self askForSearchTitle:'keyword to search for (in selector & comment):' 
+                  openWith:#aproposSearch:in:
+                isSelector:true
+
+    "Modified: 10.7.1996 / 12:48:29 / cg"
 !
 
 methodBreakPoint
@@ -4869,17 +4880,26 @@
 methodGlobalReferends
     "launch an enterBox for global symbol to search for"
 
-    self enterBoxForBrowseTitle:'global variable to browse users of:'
-			 action:[:aString | 
-				    SystemBrowser browseReferendsOf:aString asSymbol
-				]
+    self askForSearchTitle:'global variable to search users of:' 
+                  openWith:#browseReferendsOf:in:
+                isSelector:false
+
+"/    self enterBoxForBrowseTitle:'global variable to browse users of:'
+"/                         action:[:aString | 
+"/                                    SystemBrowser browseReferendsOf:aString asSymbol
+"/                                ]
+
+    "Modified: 10.7.1996 / 10:37:37 / cg"
 !
 
 methodImplementors
     "launch an enterBox for selector to search for"
 
-    self askForSelectorTitle:'selector to browse implementors of:' 
-		    openWith:#browseImplementorsOf:
+    self askForSearchTitle:'selector to browse implementors of:' 
+                  openWith:#browseImplementorsOf:in:
+                isSelector:true
+
+    "Modified: 10.7.1996 / 12:40:07 / cg"
 !
 
 methodInspect
@@ -4890,7 +4910,9 @@
 "/    (actualClass compiledMethodAt:currentSelector) inspect.
 
     "Modified: 4.6.1996 / 22:47:27 / cg"
-!
+! !
+
+!BrowserView ignoredMethodsFor:'method list menu'!
 
 methodLocalAproposSearch
     "launch an enterBox for a local keyword search"
@@ -4925,7 +4947,9 @@
     self askForSelectorTitle:'string to search for in local methods:' 
 		    openWith:#browseForString:in:
 			 and:(currentClass withAllSubclasses)
-!
+! !
+
+!BrowserView methodsFor:'method list menu'!
 
 methodLocalSuperSends
     "launch a browser showing super sends in current class & subclasses"
@@ -4972,7 +4996,7 @@
 methodMenu
     "return a popupmenu as appropriate for the methodList"
 
-    <resource: #keyboard ( #Cmds #Cmdi ) >
+    <resource: #keyboard ( #Cmds #Cmdi #Cmdg #Cmdt #Cmda) >
 
     |specialMenu m labels selectors shorties
      newLabels newSelectors
@@ -5130,31 +5154,31 @@
     searchShorties := #(
                                 Cmds
                                 Cmdi
-                                nil
-                                nil
-                                nil
+                                Cmdg
+                                Cmdt
+                                Cmda
                        ).
 
-    currentClass notNil ifTrue:[
-        localSearchLabels := #(
-                                '-'
-                                'local senders ...'
-                                'local implementors ...'
-                                'local super sends ...'
-                                'local string search ...'
-                                'local apropos ...'
-                            ).
-        localSearchSelectors := #(
-                                nil
-                                methodLocalSenders
-                                methodLocalImplementors
-                                methodLocalSuperSends
-                                methodLocalStringSearch
-                                methodLocalAproposSearch
-                              ).
-    ] ifFalse:[
-        localSearchLabels := localSearchSelectors := #()
-    ].
+"/    currentClass notNil ifTrue:[
+"/        localSearchLabels := #(
+"/                                '-'
+"/                                'local senders ...'
+"/                                'local implementors ...'
+"/                                'local super sends ...'
+"/                                'local string search ...'
+"/                                'local apropos ...'
+"/                            ).
+"/        localSearchSelectors := #(
+"/                                nil
+"/                                methodLocalSenders
+"/                                methodLocalImplementors
+"/                                methodLocalSuperSends
+"/                                methodLocalStringSearch
+"/                                methodLocalAproposSearch
+"/                              ).
+"/    ] ifFalse:[
+"/        localSearchLabels := localSearchSelectors := #()
+"/    ].
 
     currentMethodCategory notNil ifTrue:[
         sepLocalLabels := #('-'). sepLocalSelectors := #(nil).
@@ -5211,7 +5235,7 @@
     labels :=
                 fileLabels ,
                 searchLabels ,
-                localSearchLabels ,
+"/                localSearchLabels ,
                 sepLocalLabels ,
                 newLabels ,
                 mthdLabels.
@@ -5219,7 +5243,7 @@
     selectors :=
                 fileSelectors ,
                 searchSelectors ,
-                localSearchSelectors ,
+"/                localSearchSelectors ,
                 sepLocalSelectors ,
                 newSelectors ,
                 mthdSelectors .
@@ -5280,7 +5304,7 @@
 
     "Created: 23.11.1995 / 12:02:29 / cg"
     "Modified: 18.12.1995 / 16:20:07 / stefan"
-    "Modified: 17.6.1996 / 17:11:43 / cg"
+    "Modified: 10.7.1996 / 12:44:09 / cg"
 !
 
 methodMove
@@ -5423,8 +5447,11 @@
 methodSenders
     "launch an enterBox for selector to search for"
 
-    self askForSelectorTitle:'selector to browse senders of:' 
-		    openWith:#browseAllCallsOn:
+    self askForSearchTitle:'selector to browse senders of:' 
+                  openWith:#browseAllCallsOn:in:
+                isSelector:true
+
+    "Modified: 10.7.1996 / 10:33:29 / cg"
 !
 
 methodSpawn
@@ -5554,8 +5581,11 @@
 methodStringSearch
     "launch an enterBox for string to search for"
 
-    self askForSelectorTitle:'string to search for in sources:' 
-		    openWith:#browseForString:
+    self askForSearchTitle:'string to search for in sources:' 
+                  openWith:#browseForString:in:
+                isSelector:true
+
+    "Modified: 10.7.1996 / 10:33:44 / cg"
 !
 
 methodTrace
@@ -6118,11 +6148,149 @@
     "Modified: 27.3.1996 / 15:33:46 / cg"
 !
 
+askForSearchSelectorTitle:title openWith:aSelector
+    "convenient method: setup enterBox with text from codeView or selected
+     method for browsing based on a selector. Set action and launch box"
+
+    ^ self askForSearchTitle:title openWith:aSelector isSelector:true
+
+    "Modified: 10.7.1996 / 10:32:25 / cg"
+!
+
+askForSearchTitle:title openWith:aSelector isSelector:isSelector
+    "convenient method: setup enterBox with text from codeView or selected
+     method for browsing based on a selector. Set action and launch box"
+
+    |box grp panel retVal selectorHolder where whereChannel b sel classes|
+
+    isSelector ifTrue:[
+        selectorHolder := (self selectorToSearchFor) asValue.
+    ] ifFalse:[
+        selectorHolder := (self stringToSearchFor) asValue.
+    ].
+
+    box := Dialog new.
+    (box addTextLabel:title) adjust:#left.
+
+    (box addInputFieldOn:(selectorHolder) tabable:true) selectAll.
+
+    (currentClassCategory notNil or:[currentClass notNil]) ifTrue:[
+        box addHorizontalLine.
+        box addVerticalSpace.
+
+        (box addTextLabel:'search in:') adjust:#left.
+
+        panel := VerticalPanelView "HorizontalPanelView" new.
+        panel horizontalLayout:#fitSpace.
+
+        grp := RadioButtonGroup new.
+        b := CheckBox "RadioButton" label:'everywhere'.
+        panel add:b. grp add:b.
+        box makeTabable:b.
+
+        currentClassCategory notNil ifTrue:[
+            b := CheckBox "RadioButton" label:'class category'.
+            panel add:b. grp add:b.
+            box makeTabable:b.
+        ].
+
+        currentClass notNil ifTrue:[
+            b := CheckBox "RadioButton" label:'class'.
+            panel add:b.grp add:b.
+            box makeTabable:b.
+
+            b := CheckBox "RadioButton" label:'class & subclasses'.
+            panel add:b. grp add:b.
+            box makeTabable:b.
+        ].
+        grp value:1.
+        whereChannel := grp valueChannel.
+        box addComponent:panel indent:0.  "/ panel has its own idea of indenting
+
+        box addVerticalSpace.
+        box addHorizontalLine.
+    ] ifFalse:[
+        whereChannel := 1 asValue.
+    ].
+
+    box addAbortButton.
+    box addOkButtonLabelled:'browse'.
+
+    box label:'Search'.
+    box open.
+
+    box accepted ifTrue:[
+        sel := selectorHolder value.
+        where := whereChannel value.
+
+        where == 1 ifTrue:[
+            classes := Smalltalk allClasses.
+        ] ifFalse:[
+            where == 2 ifTrue:[
+                classes := Smalltalk allClassesInCategory:currentClassCategory
+            ] ifFalse:[
+                where == 3 ifTrue:[
+                    classes := Array with:currentClass
+                ] ifFalse:[
+                    classes := currentClass withAllSubclasses
+                ]
+            ]
+        ].
+        self withSearchCursorDo:[
+            SystemBrowser perform:aSelector with:sel with:classes
+        ]
+    ]
+
+    "Created: 10.7.1996 / 10:31:29 / cg"
+    "Modified: 10.7.1996 / 12:50:25 / cg"
+! !
+
+!BrowserView ignoredMethodsFor:'private'!
+
 askForSelectorTitle:title
     "convenient method: setup enterBox with text from codeView or selected
      method for browsing based on a selector. Set action and launch box"
 
-    |box retVal|
+    |box grp panel retVal selectorHolder where b|
+
+    selectorHolder := (self selectorToSearchFor) asValue.
+
+    box := Dialog new.
+    (box addTextLabel:title) adjust:#left.
+
+    box addInputFieldOn:(selectorHolder) tabable:true.
+
+    (box addTextLabel:'search in:') adjust:#left.
+
+    panel := HorizontalPanelView new.
+    panel horizontalLayout:#fitSpace.
+
+    grp := RadioButtonGroup new.
+    b := RadioButton label:'everywhere' action:[where := #everywhere].
+    panel add:b. grp add:b.
+    box makeTabable:b.
+
+    b := RadioButton label:'class category' action:[where := #classcategory.].
+    panel add:b. grp add:b.
+    box makeTabable:b.
+
+    b := RadioButton label:'class' action:[where := #class.].
+    panel add:b.grp add:b.
+    box makeTabable:b.
+
+    b := RadioButton label:'class & subclasses' action:[where := #classhierarchy.].
+    panel add:b. grp add:b.
+    box makeTabable:b.
+
+    grp value:1.
+
+    box addComponent:panel indent:0.  "/ panel has its own idea of indenting
+
+    box addAbortButton.
+    box addOkButton.
+
+    box open.
+
 
     box := self enterBoxTitle:title okText:'browse'.
     box initialText:(self selectorToSearchFor).
@@ -6130,7 +6298,7 @@
     box showAtPointer.
     ^ retVal
 
-    "Modified: 27.3.1996 / 15:32:50 / cg"
+    "Modified: 10.7.1996 / 10:13:28 / cg"
 !
 
 askForSelectorTitle:title openWith:selector
@@ -6163,7 +6331,9 @@
     ].
 
     "Created: 23.11.1995 / 14:11:38 / cg"
-!
+! !
+
+!BrowserView methodsFor:'private'!
 
 busyLabel:what with:someArgument
     "set the title for some warning"
@@ -7303,6 +7473,6 @@
 !BrowserView  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.157 1996-06-28 19:26:59 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.158 1996-07-10 10:53:28 cg Exp $'
 ! !
 BrowserView initialize!