DebugView.st
branchjv
changeset 13609 8b400fde34ef
parent 13491 b3afe831ff0a
parent 13553 728eae2b6327
child 13613 066908b0c801
--- a/DebugView.st	Tue Sep 17 11:25:54 2013 +0100
+++ b/DebugView.st	Thu Sep 19 10:20:29 2013 +0100
@@ -427,7 +427,7 @@
 
     ^ self
         enter:thisContext sender
-        withMessage:'debugger entered'
+        withMessage:'Debugger Entered'
         mayProceed:true.
 !
 
@@ -1865,10 +1865,10 @@
             windowGroup notNil ifTrue:[
                 windowGroup setProcess:nil.
             ].
-            NumberOfDebuggers := NumberOfDebuggers - 1.
+            NumberOfDebuggers := (NumberOfDebuggers ? 1) - 1.
             self destroy
         ].
-        NumberOfDebuggers := NumberOfDebuggers - 1.
+        NumberOfDebuggers := (NumberOfDebuggers ? 1) - 1.
     ].
     "/ here after my own control loop is finished.
 
@@ -3062,26 +3062,68 @@
 !
 
 initializeCodeViewIn:panel
-    |v|
+    |scrollableCodeView|
 
     (UserPreferences current useCodeView2In: #Debugger) ifTrue:[
-        v := codeView := Tools::CodeView2 in: panel.
+        scrollableCodeView := codeView := Tools::CodeView2 new.
         codeView model: ValueHolder new.
         codeView methodHolder: ValueHolder new.
         codeView classHolder: ValueHolder new.
     ] ifFalse:[
-        v := HVScrollableView
+        scrollableCodeView := HVScrollableView
                     for:CodeView
                     miniScrollerH:true
                     miniScrollerV:false
                     in:panel.
 
-    "/    v autoHideScrollBars:true.
-        codeView := v scrolledView.
+        codeView := scrollableCodeView scrolledView.
         codeView enableMotionEvents. "/ for active help
     ].
 
-    ^ v
+    UserPreferences current showAcceptCancelBarInBrowser ifTrue:[
+        ViewWithAcceptAndCancelBar notNil ifTrue:[
+            |v|
+
+            v := ViewWithAcceptAndCancelBar new.
+            v slaveView:scrollableCodeView.
+            v reallyModifiedHolder:(codeView isCodeView2 
+                                        ifTrue:[ codeView reallyModifiedChannel ]
+                                        ifFalse:[ 
+                                            BlockValue
+                                                with:[:m |
+                                                    |same|
+
+                                                    same := (codeView contentsAsString string = currentMethod source string).
+                                                    codeView modifiedChannel setValue:false.  "/ so it triggers again
+                                                    same not.
+                                                ]
+                                                argument:codeView modifiedChannel 
+                                        ]).
+            v cancelAction:
+                [
+                    "/ codeView setClipboardText:(codeView contents).   "/ for undo
+                    codeView device rememberInCopyBufferHistory:(codeView contents).  "/ for undo
+                    codeView contents:(currentMethod source).
+                    codeView modifiedChannel setValue:false; changed.   "/ trigger
+                    codeView requestFocus.
+                ].
+            v compareAction:
+                [
+                    v := DiffCodeView
+                            openOn:codeView contentsAsString
+                            label:(resources string:'Changed definition (to be accepted ?)')
+                            and:currentMethod source
+                            label:(resources string:'Method''s Original Code').
+                    v label:(resources string:'Changed Code in Debugger').
+                    v waitUntilVisible.
+                    "/ codeView requestFocus
+                ].
+            scrollableCodeView := v.
+        ]
+    ].
+
+    panel add:scrollableCodeView.
+    ^ scrollableCodeView
 
     "Modified: / 27-07-2011 / 13:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -4623,40 +4665,39 @@
         receiversClass := classToDefineIn.
     ] ifFalse:[
         selector := actualContext selector.
-
-        implClass := actualContext receiver class whichClassIncludesSelector:selector.
-        implClass notNil ifTrue:[
-            "/ must be a subclassResponsibility
-
-            idx := contextArray identityIndexOf:actualContext.
-            idx > 1 ifTrue:[
-                callee := contextArray at:idx-1.
-
-                callee selector == #subclassResponsibility ifTrue:[
-                    restart := false.
-                ]
-            ].
-        ].
-
-        "generate nice argument names"
-        bagOfClassNames := (actualContext args collect:[:eachArg | eachArg class name]) asBag.
-        bagOfUsedClassNames := Bag new.
-        argNames := actualContext args
-                        collect:
-                            [:eachArg |
-                                |nm|
-
-                                nm := eachArg class nameWithoutPrefix.
-                                (bagOfClassNames occurrencesOf:nm) == 1 ifTrue:[
-                                    nm article , nm
-                                ] ifFalse:[
-                                    bagOfUsedClassNames add:nm.
-                                    nm asLowercaseFirst , (bagOfUsedClassNames occurrencesOf:nm) printString
-                                ].
+        receiversClass := actualContext receiver class.
+    ].
+
+    implClass := actualContext receiver class whichClassIncludesSelector:selector.
+    implClass notNil ifTrue:[
+        "/ must be a subclassResponsibility
+
+        idx := contextArray identityIndexOf:actualContext.
+        idx > 1 ifTrue:[
+            callee := contextArray at:idx-1.
+
+            callee selector == #subclassResponsibility ifTrue:[
+                restart := false.
+            ]
+        ].
+    ].
+
+    "generate nice argument names"
+    bagOfClassNames := (actualContext args collect:[:eachArg | eachArg class name]) asBag.
+    bagOfUsedClassNames := Bag new.
+    argNames := actualContext args
+                    collect:
+                        [:eachArg |
+                            |nm|
+
+                            nm := eachArg class nameWithoutPrefix.
+                            (bagOfClassNames occurrencesOf:nm) == 1 ifTrue:[
+                                nm article , nm
+                            ] ifFalse:[
+                                bagOfUsedClassNames add:nm.
+                                nm asLowercaseFirst , (bagOfUsedClassNames occurrencesOf:nm) printString
                             ].
-
-        receiversClass := actualContext receiver class.
-    ].
+                        ].
 
     proto := Method methodDefinitionTemplateForSelector:selector andArgumentNames:argNames.
 
@@ -5431,17 +5472,22 @@
      AND it has an applicaiton, return it.
      Otherwise, return nil"
 
-    |p wg app|
+    |p wgs app|
 
     p := inspectedProcess ? Processor activeProcess.
     (p notNil and:[p isGUIProcess]) ifTrue:[
-        wg := WindowGroup scheduledWindowGroups detect:[:wg | wg process == p] ifNone:nil.
-        [wg notNil] whileTrue:[
-            (app := wg application) notNil ifTrue:[^ app].
-            wg isModal ifTrue:[
-                wg := wg previousGroup
-            ] ifFalse:[
-                wg := nil.
+        wgs := WindowGroup scheduledWindowGroups select:[:wg | wg process == p].
+        wgs do:[:wg |
+            |wgi|
+
+            wgi := wg.
+            [wgi notNil] whileTrue:[
+                (app := wgi application) notNil ifTrue:[^ app].
+                wgi isModal ifTrue:[
+                    wgi := wgi previousGroup
+                ] ifFalse:[
+                    wgi := nil.
+                ]
             ]
         ]
     ].
@@ -7744,7 +7790,7 @@
                 ^ true.
             ].
 
-            "/ thats a big hack, but I am tired of navigating to find the missing menu message...
+            "/ that's a big hack, but I am tired of navigating to find the missing menu message...
             "/ you will thank me!!
             mthd selector == #error:mayProceed: ifTrue:[
                 (callee receiver isKindOf:MenuPanel) ifTrue:[
@@ -8984,11 +9030,11 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.633 2013-09-03 17:58:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.637 2013-09-15 12:43:20 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.633 2013-09-03 17:58:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.637 2013-09-15 12:43:20 cg Exp $'
 !
 
 version_HG
@@ -8997,7 +9043,7 @@
 !
 
 version_SVN
-    ^ '$Id: DebugView.st,v 1.633 2013-09-03 17:58:08 cg Exp $'
+    ^ '$Id: DebugView.st,v 1.637 2013-09-15 12:43:20 cg Exp $'
 ! !