merged in jv's chenges
authorClaus Gittinger <cg@exept.de>
Wed, 05 Feb 2014 19:56:15 +0100
changeset 13805 538d93a2f75d
parent 13804 6f311465b4cf
child 13806 1846de21f150
merged in jv's chenges
Tools__Inspector2.st
--- a/Tools__Inspector2.st	Wed Feb 05 19:56:13 2014 +0100
+++ b/Tools__Inspector2.st	Wed Feb 05 19:56:15 2014 +0100
@@ -16,8 +16,9 @@
 ApplicationModel subclass:#Inspector2
 	instanceVariableNames:'tabViewAspect navigationHistoryHolder navigationStateAspect
 		browser currentObjectHolder colorProfileHolder
-		toolbarBackgroundHolder'
-	classVariableNames:'LastExtent ColorProfiles'
+		toolbarBackgroundHolder evaluationLanguageHolder
+		evaluationLanguageList'
+	classVariableNames:'LastExtent ColorProfiles EvaluationLanguageMap'
 	poolDictionaries:''
 	category:'Interface-Inspector2'
 !
@@ -71,10 +72,11 @@
         at: #green put: Color green lighter;
         at: #blue put: Color blue lighter;
         at: #yellow put: Color yellow lighter;
-        at: #gray put: Color gray;
-        yourself.
+        at: #gray put: Color gray.       
 
-    "Modified: / 17-01-2012 / 12:57:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    EvaluationLanguageMap :=  Dictionary new.
+
+    "Modified: / 26-10-2013 / 00:42:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Inspector2 class methodsFor:'help specs'!
@@ -138,6 +140,9 @@
 #colorProfile
 ''
 
+#evaluationLanguage
+'Language used for evaluating expressions in code panes'
+
 )
 ! !
 
@@ -145,10 +150,12 @@
 
 settingsIcon
 
-    ^self settingsIcon5
+    <resource: #image>
 
-    "Modified: / 17-01-2012 / 12:45:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    ^self settingsIcon6
+
     "Modified: / 19-01-2012 / 14:00:35 / cg"
+    "Modified: / 28-02-2012 / 21:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 settingsIcon1
@@ -314,9 +321,41 @@
 !
 
 settingsIcon5
+
+    <resource: #image>
+
     ^ GenericToolbarIconLibrary palette16x16Icon
 
     "Created: / 19-01-2012 / 14:00:24 / cg"
+    "Modified: / 18-02-2012 / 16:28:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+settingsIcon6
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self settingsIcon6 inspect
+     ImageEditor openOnClass:self andSelector:#settingsIcon6
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'Tools::Inspector2 class settingsIcon6'
+        ifAbsentPut:[(Depth8Image new) width: 25; height: 25; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
+(:N#(:N#(:N#(:N#(:N#(:N#(:N#(:N#(:IWY&Y&Y&Y1(!!8*J"4*J#""JCX6M3X6PJJ"YG]7]7]7]:H$O#8>O#8>(#MBP$IBP$J"(FA5]WU5]WV G3(:N#(:
+N*@+PTEAPTEA(I=X[7A/\F=/''1X1LSD1LSF_H34=OC0<OI>^T6-+Z6-+Z98QI2\''I2\''''!!,5MST5MSV^''T=''Y6]''Y6^]B2D!!HRD!!HY4TLC@0LB<0''Y1VX&I"
+X&I"''@<XFA XFA"\FRX&I"X&I)2[&9.[&9.[&9.[&9.[&9.[&9.[&9.[&9.[&V9;^7-;^8NY_(2L#H2L&I$]KB0.KB09&Y!!8#8>O#8>O&H&!!(ZF!!(ZFXIS<?
+O3<?O9"V](.K"8.K"9ZF''Y6]''Y6]%"@;N3,;N3.V%WRD!!XRD!!HRU_9&Y&Y&Y&YTWL#P2L#H2%YQ- HB@ HB@%G6U%YVU%YVTD"$)JR$)JYRSZW1<_G1<_IM9
+$YFQ$YFQ$00"H"H"H"JS$WI:^''):^''*Q X:N#(:N#)DPF!!(ZF!!(Z$YBP$IBP$IBP$IBP$IBP$IBP$IBP$IBP$IBNTU=_W5=_Z(9FTEAPTEA]# \JB 4JB!!VN
+#U-3\7M3\7NMSFU%YVU%YX4IGA0\GA0\#X)U[F1,[F1,"$%!!XVE!!XVFJA!!LSD1LSD8*IT&!!(ZF!!(ZH%GVU1YWE%Y"PPNC 8NC :I"D-#X6M#X6NHQEQTUEQT
+UH BB@ HB@ H"H]HW%9^W%9^!!4MNS$9NS$:G@@TEAPTEAX^BSU)ZV%)ZV(IER$)JR$)J  DC@0LC@0NB (JB (JB (JB (JB (JB (JB (JB (JB  @a') ; colorMapFromArray:#[88 88 211 89 89 220 91 91 215 94 94 231 96 96 219 97 97 234 99 99 224 100 100 217 101 101 239 103 103 227 105 105 229 211 88 88 170 88 211 105 106 229 106 106 243 220 89 89 176 89 220 215 91 91 174 91 215 110 110 248 211 88 170 111 111 242 219 96 96 178 96 219 231 94 94 220 89 176 185 94 231 215 91 174 114 114 252 177 100 217 217 100 100 224 99 99 182 99 224 234 97 97 189 97 234 219 96 178 227 103 103 186 103 227 231 94 185 239 101 101 217 100 177 193 101 239 229 105 105 224 99 182 188 105 229 229 106 105 188 106 229 234 97 188 234 97 189 243 106 106 197 106 243 227 103 186 198 106 243 239 101 193 229 105 188 229 106 188 242 111 111 198 111 242 248 110 110 202 110 248 243 106 197 243 106 198 252 114 114 206 114 252 242 111 198 248 110 202 252 114 206 88 170 211 91 174 215 89 176 220 100 177 217 96 178 219 88 197 88 99 182 224 94 185 231 91 201 91 103 186 227 89 205 89 97 189 234 211 170 88 105 188 229 100 204 100 96 206 96 215 174 91 101 193 239 99 209 99 220 176 89 217 177 100 219 178 96 106 197 243 94 216 94 103 213 103 106 198 243 111 198 242 97 219 97 105 216 105 224 182 99 110 202 248 231 185 94 101 223 101 227 186 103 114 206 252 229 188 105 234 189 97 106 228 106 170 211 88 111 228 111 239 193 101 110 232 110 174 215 91 177 217 100 243 197 106 243 198 106 242 198 111 176 220 89 114 236 114 178 219 96 248 202 110 182 224 99 252 206 114 186 227 103 211 211 211 185 231 94 188 229 105 189 234 97 215 215 215 217 217 217 219 219 219 193 239 101 220 220 220 223 223 223 198 242 111 197 243 106 198 243 106 224 224 224 225 225 225 226 226 226 227 227 227 228 228 228 202 248 110 229 229 229 230 230 230 231 231 231 206 252 114 233 233 233 234 234 234 235 235 235 236 236 236 237 237 237 239 239 239 240 240 240 241 241 241 242 242 242 243 243 243 244 244 244 245 245 245 246 246 246 248 248 248 249 249 249 250 250 250 251 251 251 252 252 252 253 253 253 254 254 254]; mask:((Depth1Image new) width: 25; height: 25; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???? O???8C???>@???? O???8C???>@???? O???8C???>@???? O???8C???>@???? O???8C???>@???? O???8C???>@???? O???8C???>@???? O??
+?8C???>@???? @@a') ; yourself); yourself]
 ! !
 
 !Inspector2 class methodsFor:'interface specs'!
@@ -337,41 +376,51 @@
     <resource: #canvas>
 
     ^ 
-     #(FullSpec
-        name: windowSpec
-        window: 
-       (WindowSpec
-          label: 'Inspector2'
-          name: 'Inspector2'
-          labelChannel: windowTitleAspect
-          min: (Point 0 0)
-          bounds: (Rectangle 0 0 388 421)
-          menu: mainMenu
-        )
-        component: 
-       (SpecCollection
-          collection: (
-           (MenuPanelSpec
-              name: 'ToolBar'
-              layout: (LayoutFrame 0 0 0 0 0 1 40 0)
-              backgroundChannel: toolbarBackgroundHolder
-              menu: toolbarMenu
-              textDefault: true
-            )
-           (NoteBookViewSpec
-              name: 'NoteBook'
-              layout: (LayoutFrame 0 0 40 0 0 1 0 1)
-              model: tabSelectionIndexAspect
-              menu: tabLabelsAspect
-              useIndex: true
-              fitLastRow: false
-              canvas: tabViewAspect
-              keepCanvasAlive: true
-            )
+    #(FullSpec
+       name: windowSpec
+       window: 
+      (WindowSpec
+         label: 'Inspector2'
+         name: 'Inspector2'
+         labelChannel: windowTitleAspect
+         min: (Point 0 0)
+         bounds: (Rectangle 0 0 490 654)
+         menu: mainMenu
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (MenuPanelSpec
+             name: 'ToolBar'
+             layout: (LayoutFrame 0 0 0 0 0 1 40 0)
+             backgroundChannel: toolbarBackgroundHolder
+             menu: toolbarMenu
+             textDefault: true
            )
-         
-        )
-      )
+          (NoteBookViewSpec
+             name: 'NoteBook'
+             layout: (LayoutFrame 0 0 40 0 0 1 0 1)
+             model: tabSelectionIndexAspect
+             menu: tabLabelsAspect
+             useIndex: true
+             fitLastRow: false
+             canvas: tabViewAspect
+             keepCanvasAlive: true
+           )
+          (ComboListSpec
+             name: 'EvaluationLanguageCombo'
+             layout: (LayoutFrame -200 1 7 0.0 -40 1 32 0)
+             activeHelpKey: evaluationLanguage
+             visibilityChannel: evaluationLanguageComboVisibleHolder
+             model: evaluationLanguageHolder
+             comboList: evaluationLanguageList
+             useIndex: false
+             postBuildCallback: postBuildEvaluationLanguageCombo:
+           )
+          )
+        
+       )
+     )
 ! !
 
 !Inspector2 class methodsFor:'menu specs'!
@@ -747,12 +796,14 @@
 
 currentObjectHolder
     currentObjectHolder isNil ifTrue:[
-        currentObjectHolder := ValueHolder new
+        currentObjectHolder := ValueHolder new.
+        currentObjectHolder addDependent: self.
     ].
     ^ currentObjectHolder
 
     "Created: / 27-02-2008 / 12:05:22 / janfrog"
     "Created: / 19-08-2011 / 08:58:48 / cg"
+    "Modified: / 26-10-2013 / 00:34:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 currentObjectIsFilename
@@ -771,6 +822,58 @@
     "Created: / 15-01-2012 / 10:06:28 / cg"
 !
 
+evaluationLanguageComboVisibleHolder
+    <resource: #uiAspect>
+
+    "/ Do not show language combo when language is Smalltalk.
+    "/ For those not working with multiple languages is too disturbing.
+    ^ BlockValue
+        with:[:o | o class programmingLanguage isSmalltalk not ]
+        argument:self currentObjectHolder
+
+    "Modified (comment): / 25-10-2013 / 19:39:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+evaluationLanguageHolder
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    evaluationLanguageHolder isNil ifTrue:[
+        evaluationLanguageHolder := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+       evaluationLanguageHolder addDependent:self.
+"/       evaluationLanguageHolder onChangeSend:#evaluationLanguageHolderChanged to:self.
+    ].
+    ^ evaluationLanguageHolder.
+
+    "Modified: / 26-10-2013 / 00:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+evaluationLanguageList
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    evaluationLanguageList isNil ifTrue:[
+        evaluationLanguageList := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       evaluationLanguageList addDependent:self.
+"/       evaluationLanguageList onChangeSend:#evaluationLanguageListChanged to:self.
+    ].
+    ^ evaluationLanguageList.
+!
+
 expandArraysInAllList
     ^ InspectorView expandArraysInAllLists
 
@@ -874,6 +977,54 @@
     "Modified: / 27-02-2008 / 12:05:56 / janfrog"
 ! !
 
+!Inspector2 methodsFor:'change & update'!
+
+update:something with:aParameter from:changedObject
+    "Invoked when an object that I depend upon sends a change notification."
+
+    "stub code automatically generated - please change as required"
+
+    changedObject == currentObjectHolder ifTrue:[
+         self updateEvaluationLanguageList.
+         ^ self.
+    ].
+    changedObject == evaluationLanguageHolder  ifTrue:[
+         self updateEvaluationLanguage.
+         ^ self.
+    ].  
+    super update:something with:aParameter from:changedObject
+
+    "Modified: / 26-10-2013 / 00:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateEvaluationLanguage
+    | evaluationLanguage |
+
+    evaluationLanguage :=  self evaluationLanguageHolder value.
+    "/ Remember user's selection for future...
+    EvaluationLanguageMap at: self currentObject class programmingLanguage put: evaluationLanguage.
+    "/ Update compiler class in all inspectors...
+    self setDoItActionForLanguage: evaluationLanguage.
+
+    "Created: / 26-10-2013 / 00:36:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateEvaluationLanguageList
+    | currentObject currentObjectLanguage |
+
+    currentObject := self currentObject.
+    currentObjectLanguage := currentObject class programmingLanguage.
+    currentObjectLanguage isSmalltalk ifFalse:[
+        self evaluationLanguageList value: (Array with: currentObjectLanguage with: SmalltalkLanguage instance)
+    ] ifTrue:[
+        self evaluationLanguageList value: (Array with: currentObjectLanguage).
+    ].
+
+    self evaluationLanguageHolder value:(EvaluationLanguageMap at: currentObjectLanguage ifAbsent:[currentObjectLanguage])
+
+    "Created: / 26-10-2013 / 00:40:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Inspector2 methodsFor:'configuration'!
 
 hideHashes:aBoolean
@@ -898,6 +1049,14 @@
     #todo
 ! !
 
+!Inspector2 methodsFor:'hooks'!
+
+postBuildEvaluationLanguageCombo: aComboBoxView
+"/    aComboBoxView font: (aComboBoxView font asSize: (aComboBoxView font size * 1.5) rounded)
+
+    "Modified: / 26-10-2013 / 01:00:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Inspector2 methodsFor:'menu'!
 
 backButtonMenuChannel
@@ -1082,6 +1241,35 @@
     "Created: / 15-07-2011 / 16:25:42 / cg"
 ! !
 
+!Inspector2 methodsFor:'private'!
+
+setDoItActionForLanguage: language
+
+
+    self currentState tabViews do:[:view | 
+        (view respondsTo: #workspace) ifTrue:[
+            view workspace doItAction: 
+                [:theCode |
+                    |evaluator|
+
+                    (evaluator := language evaluatorClass)
+                    notNil ifTrue:[
+                        evaluator
+                            evaluate:theCode 
+                            in:nil 
+                            receiver:self currentObject 
+                            notifying:view workspace 
+                            logged:true 
+                            ifFail:nil
+                    ] ifFalse:[
+                        'object''s class provides no evaluator'
+                    ]
+                ].
+        ].
+    ]
+
+    "Created: / 26-10-2013 / 01:13:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
 
 !Inspector2::NavigationState class methodsFor:'creating classes'!
 
@@ -1098,11 +1286,11 @@
 !Inspector2::NavigationState class methodsFor:'documentation'!
 
 version
-    ^'$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.43 2013-07-26 15:10:27 cg Exp $'
+    ^'$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.44 2014-02-05 18:56:15 cg Exp $'
 !
 
 version_SVN
-    ^'$Id: Tools__Inspector2.st,v 1.43 2013-07-26 15:10:27 cg Exp $'
+    ^'$Id: Tools__Inspector2.st,v 1.44 2014-02-05 18:56:15 cg Exp $'
 ! !
 
 !Inspector2::NavigationState methodsFor:'accessing'!
@@ -1266,7 +1454,8 @@
 initializeCommonTabs
 
     "Unfinished code"
-    self initializeClassBrowserTab
+"/    JV@2012-04-20: Don't add class tab, only takes time and nobody uses it anyway
+"/    self initializeClassBrowserTab
 
 "/    tabs add:
 "/        (Tools::Inspector2Tab new
@@ -1277,7 +1466,7 @@
 
     "Created: / 16-01-2008 / 16:56:48 / janfrog"
     "Modified: / 17-02-2008 / 10:29:54 / janfrog"
-    "Modified: / 21-08-2011 / 10:03:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 20-04-2012 / 20:23:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeExtraTabs
@@ -1328,19 +1517,19 @@
 !Inspector2 class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.43 2013-07-26 15:10:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.44 2014-02-05 18:56:15 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.43 2013-07-26 15:10:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.44 2014-02-05 18:56:15 cg Exp $'
 !
 
 version_CVS_jvrany
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.43 2013-07-26 15:10:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.44 2014-02-05 18:56:15 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__Inspector2.st,v 1.43 2013-07-26 15:10:27 cg Exp $'
+    ^ '$Id: Tools__Inspector2.st,v 1.44 2014-02-05 18:56:15 cg Exp $'
 ! !