class: DebugView
authorClaus Gittinger <cg@exept.de>
Fri, 06 Sep 2013 17:57:24 +0200
changeset 13519 97e23cf8edbb
parent 13518 049393762925
child 13520 b5bc5e92a5a5
class: DebugView changed: #enter #initializeCodeViewIn: support (old) accept/cancelBar
DebugView.st
--- a/DebugView.st	Fri Sep 06 17:09:05 2013 +0200
+++ b/DebugView.st	Fri Sep 06 17:57:24 2013 +0200
@@ -427,7 +427,7 @@
 
     ^ self
         enter:thisContext sender
-        withMessage:'debugger entered'
+        withMessage:'Debugger Entered'
         mayProceed:true.
 !
 
@@ -3050,26 +3050,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>"
 !
@@ -8972,15 +9014,15 @@
 !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.634 2013-09-06 15:57:24 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.634 2013-09-06 15:57:24 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: DebugView.st,v 1.633 2013-09-03 17:58:08 cg Exp $'
+    ^ '$Id: DebugView.st,v 1.634 2013-09-06 15:57:24 cg Exp $'
 ! !