Fix in ChangeSetBrowser2: orrectly update delta icon when change applied. jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 25 Apr 2015 22:36:26 +0100
branchjv
changeset 15600 067b6e4913af
parent 15599 a602fe160939
child 15601 c3e259039e36
Fix in ChangeSetBrowser2: orrectly update delta icon when change applied. Redraw list afer change is applied and selection is not changed (like when the change to apply is the last one). If selection is changed, there's no need to redraw list as this is done due to selection change. Spotted by Jan Kurs.
Tools__ChangeList.st
Tools__ChangeSetBrowser2.st
--- a/Tools__ChangeList.st	Fri Apr 24 00:29:18 2015 +0100
+++ b/Tools__ChangeList.st	Sat Apr 25 22:36:26 2015 +0100
@@ -869,24 +869,24 @@
 handlesKeyPress:key inView:aView
     <resource: #keyboard (#Accept #Ctrls)>
 
-    (super handlesKeyPress:key inView:aView)
+    ^ (super handlesKeyPress:key inView:aView)
         or:[(key == #Accept or:[ key == #Ctrls]) 
                 and:[ listView scrolledView == aView ]]
 
     "Created: / 08-02-2012 / 14:43:11 / cg"
-    "Modified: / 10-04-2014 / 11:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-04-2015 / 01:08:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 keyPress:key x:x y:y view:aView
     (key == #Accept or:[ key == #Ctrls]) ifTrue:[
         self listMenuApply.
-        ^ self
+        ^ true
     ]. 
 
-    super keyPress:key x:x y:y view:aView
+    ^ super keyPress:key x:x y:y view:aView
 
     "Created: / 08-02-2012 / 14:42:18 / cg"
-    "Modified: / 10-04-2014 / 11:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-04-2015 / 01:08:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ChangeList methodsFor:'generators'!
@@ -1226,6 +1226,38 @@
     "Created: / 05-12-2009 / 14:14:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+redrawList
+    listView notNil ifTrue:[ 
+        listView columnView invalidate.
+    ].
+
+    "Created: / 24-04-2015 / 00:50:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-04-2015 / 22:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+redrawListItem: item
+    | index |
+
+    listView notNil ifTrue:[ 
+        index := listView list identityIndexOf: item.
+        index ~~ 0 ifTrue:[ 
+            listView columnView invalidateRowAt: index.  
+         ].
+    ]
+
+    "Created: / 25-04-2015 / 22:12:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+redrawListItemAt: index
+    listView notNil ifTrue:[ 
+        index ~~ 0 ifTrue:[ 
+            listView columnView invalidateRowAt: index.  
+         ].
+    ]
+
+    "Created: / 25-04-2015 / 22:17:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 updateList
     |inGenerator changeset firstLineShown oldSel newList newSel|
 
@@ -1519,6 +1551,9 @@
 
 removed:aBoolean
     change removed: aBoolean.
+    self redraw.
+
+    "Modified: / 25-04-2015 / 22:13:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 source
@@ -1642,6 +1677,15 @@
     "Modified (format): / 27-07-2012 / 21:25:34 / cg"
 ! !
 
+!ChangeList::ListEntry methodsFor:'redrawing'!
+
+redraw
+    "Trigger redraw of reciver."
+    application redrawListItem: self
+
+    "Created: / 25-04-2015 / 22:10:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ChangeList class methodsFor:'documentation'!
 
 version
@@ -1652,6 +1696,11 @@
     ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.37 2015-02-26 01:06:39 cg Exp $'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$Id: Tools__ChangeList.st,v 1.37 2015-02-26 01:06:39 cg Exp $'
 ! !
--- a/Tools__ChangeSetBrowser2.st	Fri Apr 24 00:29:18 2015 +0100
+++ b/Tools__ChangeSetBrowser2.st	Sat Apr 25 22:36:26 2015 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
               All Rights Reserved
@@ -3241,18 +3239,27 @@
 !ChangeSetBrowser2 methodsFor:'menu actions - changes'!
 
 changeMenuApply: changeList
-    | changesToApply |
+    | changesToApply changeIdx |
 
     changesToApply := OrderedCollection new.
     self changesDo:[:chg|chg removed ifFalse:[changesToApply add: chg]].
     self changeMenuApplyChanges: changesToApply.
-    list2 notNil ifTrue:[
+    "Advance to next change"
+    changeIdx := changeList list identityIndexOf: changesToApply last change.
+    changeIdx < changeList list size ifTrue:[
+        changeList selection: { changeList list at: changeIdx + 1 }
+    ] ifFalse:[ 
+        changeList redrawListItemAt: changeIdx.
+    ].
+
+    (list2 notNil and:[changeList ~~ list2]) ifTrue:[
         "/ to get the =-icons
-        list2 updateList
+        list2 redrawList
     ].
 
     "Created: / 04-08-2011 / 17:26:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 28-12-2011 / 15:49:00 / cg"
+    "Modified: / 25-04-2015 / 22:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 changeMenuApplySelection: changeList
@@ -3266,12 +3273,14 @@
         changeIdx := changeList list identityIndexOf: change.
         changeIdx < changeList list size ifTrue:[
             changeList selection: { changeList list at: changeIdx + 1 }
+        ] ifFalse:[ 
+            changeList redrawListItemAt: changeIdx.
         ].
     ].
 
     "Created: / 04-08-2011 / 17:27:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 28-12-2011 / 15:48:53 / cg"
-    "Modified (comment): / 30-03-2012 / 13:18:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-04-2015 / 22:17:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 changeMenuApplyToEnd: changeList