Tools__ChangeList.st
changeset 13835 7dfb57f5f5e7
parent 13513 97b651d76972
child 13927 78883c6c8297
equal deleted inserted replaced
13834:25c7fe104a94 13835:7dfb57f5f5e7
    26 "{ Package: 'stx:libtool' }"
    26 "{ Package: 'stx:libtool' }"
    27 
    27 
    28 "{ NameSpace: Tools }"
    28 "{ NameSpace: Tools }"
    29 
    29 
    30 BrowserListWithFilter subclass:#ChangeList
    30 BrowserListWithFilter subclass:#ChangeList
    31 	instanceVariableNames:'listHolder showRemovedHolder showSameHolder
    31 	instanceVariableNames:'listHolder showRemovedHolder showSameHolder showTimestampHolder
    32 		showConflictsOnlyHolder allowRemoveHolder allowAcceptHolder
    32 		allowRemoveHolder allowAcceptHolder scrollToBottom applyAction
    33 		applyAction'
    33 		showConflictsOnlyHolder'
    34 	classVariableNames:'LastSelectionConditionString'
    34 	classVariableNames:'LastSelectionConditionString'
    35 	poolDictionaries:''
    35 	poolDictionaries:''
    36 	category:'Interface-Browsers-ChangeSet'
    36 	category:'Interface-Browsers-ChangeSet'
    37 !
    37 !
    38 
    38 
   130      Tools::ChangeList open
   130      Tools::ChangeList open
   131     "
   131     "
   132 
   132 
   133     <resource: #canvas>
   133     <resource: #canvas>
   134 
   134 
   135     ^ 
   135     ^
   136      #(FullSpec
   136      #(FullSpec
   137         name: windowSpec
   137 	name: windowSpec
   138         window: 
   138 	window:
   139        (WindowSpec
   139        (WindowSpec
   140           label: 'Change List'
   140 	  label: 'Change List'
   141           name: 'Change List'
   141 	  name: 'Change List'
   142           min: (Point 10 10)
   142 	  min: (Point 10 10)
   143           bounds: (Rectangle 0 0 300 300)
   143 	  bounds: (Rectangle 0 0 300 300)
   144         )
   144 	)
   145         component: 
   145 	component:
   146        (SpecCollection
   146        (SpecCollection
   147           collection: (
   147 	  collection: (
   148            (SelectionInListModelViewSpec
   148 	   (InputFieldSpec
   149               name: 'List'
   149 	      name: 'Filter'
   150               layout: (LayoutFrame 0 0 0 0 0 1 0 1)
   150 	      layout: (LayoutFrame 0 0 0 0 0 1 25 0)
   151               model: selectionHolder
   151 	      initiallyInvisible: true
   152               menu: menuHolderWithShowFilter
   152 	      model: filterPatternHolder
   153               hasHorizontalScrollBar: true
   153 	      immediateAccept: true
   154               hasVerticalScrollBar: true
   154 	      acceptOnLeave: false
   155               listModel: listHolder
   155 	      acceptOnReturn: false
   156               multipleSelectOk: true
   156 	      acceptOnTab: false
   157               useIndex: false
   157 	      acceptOnPointerLeave: false
   158               highlightMode: line
   158 	      emptyFieldReplacementText: 'Search Filter...'
   159               doubleClickSelector: selectionDoubleclicked
   159 	      postBuildCallback: postBuildFilterView:
   160               postBuildCallback: postBuildListView:
   160 	    )
   161             )
   161 	   (DataSetSpec
   162            (InputFieldSpec
   162 	      name: 'List'
   163               name: 'Filter'
   163 	      layout: (LayoutFrame 0 0 0 0 0 1 0 1)
   164               layout: (LayoutFrame 0 0 0 0 0 1 26 0)
   164 	      model: selectionHolder
   165               initiallyInvisible: true
   165 	      menu: menuHolderWithShowFilter
   166               model: filterPatternHolder
   166 	      hasHorizontalScrollBar: true
   167               immediateAccept: true
   167 	      hasVerticalScrollBar: true
   168               acceptOnLeave: false
   168 	      dataList: listHolder
   169               acceptOnReturn: false
   169 	      useIndex: false
   170               acceptOnTab: false
   170 	      doubleClickSelector: selectionDoubleclicked
   171               acceptOnPointerLeave: false
   171 	      columnHolder: listColumns
   172               emptyFieldReplacementText: 'Search Filter...'
   172 	      showLabels: false
   173               usePreferredHeight: true
   173 	      multipleSelectOk: true
   174               useDynamicPreferredHeight: true
   174 	      postBuildCallback: postBuildListView:
   175               postBuildCallback: postBuildFilterView:
   175 	      properties:
   176             )
   176 	     (PropertyListDictionary
   177            )
   177 		startDragSelector: nil
   178          
   178 		dropObjectSelector: dragObjects:
   179         )
   179 		canDropSelector: canDrop:
       
   180 		dropSelector: dropObjects:
       
   181 	      )
       
   182 	    )
       
   183 	   )
       
   184 
       
   185 	)
   180       )
   186       )
   181 
   187 ! !
   182     "Modified: / 29-11-2011 / 15:52:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   188 
       
   189 !ChangeList class methodsFor:'list specs'!
       
   190 
       
   191 listColumnSpec
       
   192     "This resource specification was automatically generated
       
   193      by the DataSetBuilder of ST/X."
       
   194 
       
   195     "Do not manually edit this!! If it is corrupted,
       
   196      the DataSetBuilder may not be able to read the specification."
       
   197 
       
   198     "
       
   199      DataSetBuilder new openOnClass:Tools::ChangeList andSelector:#listColumnSpec
       
   200     "
       
   201 
       
   202     <resource: #tableColumns>
       
   203 
       
   204     ^#(
       
   205       (DataSetColumnSpec
       
   206 	 label: 'Removed'
       
   207 	 id: 'removed'
       
   208 	 labelButtonType: Button
       
   209 	 width: 20
       
   210 	 minWidth: 20
       
   211 	 editorType: CheckToggle
       
   212 	 rendererType: CheckToggle
       
   213 	 model: notRemoved
       
   214 	 menuFromApplication: false
       
   215 	 printSelector: notRemoved
       
   216 	 isResizeable: false
       
   217 	 showRowSeparator: false
       
   218 	 showSelectionHighLighted: false
       
   219 	 showColSeparator: false
       
   220        )
       
   221       (DataSetColumnSpec
       
   222 	 label: 'Delta'
       
   223 	 id: 'delta'
       
   224 	 labelButtonType: Button
       
   225 	 width: 20
       
   226 	 minWidth: 20
       
   227 	 menuFromApplication: false
       
   228 	 printSelector: iconDelta
       
   229 	 canSelect: false
       
   230 	 isResizeable: false
       
   231 	 showRowSeparator: false
       
   232 	 showSelectionHighLighted: false
       
   233 	 showColSeparator: false
       
   234        )
       
   235       (DataSetColumnSpec
       
   236 	 label: 'Change'
       
   237 	 id: change
       
   238 	 labelAlignment: left
       
   239 	 labelButtonType: Button
       
   240 	 menuFromApplication: false
       
   241 	 printSelector: label
       
   242 	 canSelect: false
       
   243 	 showRowSeparator: false
       
   244 	 showColSeparator: false
       
   245        )
       
   246       (DataSetColumnSpec
       
   247 	 label: 'Class'
       
   248 	 id: 'className'
       
   249 	 labelAlignment: left
       
   250 	 activeHelpKey: ''
       
   251 	 activeHelpKeyForLabel: ''
       
   252 	 labelButtonType: Button
       
   253 	 usePreferredWidth: true
       
   254 	 model: className
       
   255 	 menuFromApplication: false
       
   256 	 canSelect: false
       
   257 	 showRowSeparator: false
       
   258 	 showColSeparator: false
       
   259        )
       
   260       (DataSetColumnSpec
       
   261 	 label: 'Selector'
       
   262 	 id: 'selector'
       
   263 	 labelAlignment: left
       
   264 	 activeHelpKey: ''
       
   265 	 activeHelpKeyForLabel: ''
       
   266 	 labelButtonType: Button
       
   267 	 usePreferredWidth: true
       
   268 	 model: selector
       
   269 	 menuFromApplication: false
       
   270 	 canSelect: false
       
   271 	 showRowSeparator: false
       
   272 	 showColSeparator: false
       
   273        )
       
   274       (DataSetColumnSpec
       
   275 	 label: 'Category'
       
   276 	 id: category
       
   277 	 labelAlignment: left
       
   278 	 labelButtonType: Button
       
   279 	 usePreferredWidth: true
       
   280 	 model: category
       
   281 	 menuFromApplication: false
       
   282 	 canSelect: false
       
   283 	 showRowSeparator: false
       
   284 	 showColSeparator: false
       
   285        )
       
   286       (DataSetColumnSpec
       
   287 	 label: 'Time Stamp'
       
   288 	 id: timeStamp
       
   289 	 labelAlignment: left
       
   290 	 labelButtonType: Button
       
   291 	 usePreferredWidth: true
       
   292 	 model: timeStamp
       
   293 	 menuFromApplication: false
       
   294 	 canSelect: false
       
   295 	 showRowSeparator: false
       
   296 	 showColSeparator: false
       
   297        )
       
   298       )
       
   299 
   183 ! !
   300 ! !
   184 
   301 
   185 !ChangeList class methodsFor:'menu specs'!
   302 !ChangeList class methodsFor:'menu specs'!
   186 
   303 
   187 listMenu
   304 listMenu
   323      (if this app is embedded in a subCanvas)."
   440      (if this app is embedded in a subCanvas)."
   324 
   441 
   325     ^ #(
   442     ^ #(
   326         #allowAcceptHolder
   443         #allowAcceptHolder
   327         #allowRemoveHolder
   444         #allowRemoveHolder
   328 
       
   329         #inGeneratorHolder
   445         #inGeneratorHolder
   330         #menuHolder
   446         #menuHolder
   331         #outGeneratorHolder
   447         #outGeneratorHolder
   332         #selectionHolder
   448         #selectionHolder
       
   449         #showFilterHolder
   333         #showRemovedHolder
   450         #showRemovedHolder
   334         #showSameHolder
   451         #showSameHolder
       
   452         #showTimestampHolder
   335         #showConflictsOnlyHolder
   453         #showConflictsOnlyHolder
   336       ).
   454       ).
   337 
   455 
   338     "Modified: / 24-01-2012 / 19:54:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   339 ! !
   456 ! !
   340 
   457 
   341 !ChangeList methodsFor:'accessing'!
   458 !ChangeList methodsFor:'accessing'!
   342 
   459 
   343 acceptEnabled
   460 acceptEnabled
   375 
   492 
   376     "Created: / 05-12-2009 / 14:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   493     "Created: / 05-12-2009 / 14:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   377     "Created: / 27-12-2011 / 14:18:25 / cg"
   494     "Created: / 27-12-2011 / 14:18:25 / cg"
   378 !
   495 !
   379 
   496 
       
   497 scrollToBottom:aBoolean
       
   498     "If set to true, list will automaticallu scroll to bottom
       
   499      ehen the list is updated and clears this flag.
       
   500 
       
   501      This is required as the list is updated asynchronously"
       
   502 
       
   503     scrollToBottom := aBoolean.
       
   504 
       
   505     "Modified (comment): / 30-03-2012 / 17:05:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   506 !
       
   507 
   380 selection
   508 selection
   381 
   509 
   382     ^self selectionHolder value
   510     ^(self selectionHolder value ? #()) reject:[:e|e isNil].
   383 
   511 
   384     "Created: / 05-12-2009 / 14:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   512     "Created: / 05-12-2009 / 14:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   513 !
       
   514 
       
   515 selection: selection
       
   516 
       
   517     self selectionHolder value: selection
       
   518 
       
   519     "Created: / 30-03-2012 / 12:29:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   385 !
   520 !
   386 
   521 
   387 selectionIndices
   522 selectionIndices
   388     |sel|
   523     |sel|
   389 
   524 
   467             with:newValue
   602             with:newValue
   468             from:allowRemoveHolder.
   603             from:allowRemoveHolder.
   469     ].
   604     ].
   470 !
   605 !
   471 
   606 
       
   607 listColumns
       
   608 
       
   609     |holder|
       
   610     (holder := builder bindingAt:#listColumns) isNil ifTrue:[
       
   611 	builder aspectAt:#listColumns put:(holder := List new).
       
   612 	self listColumnShow: #delta.
       
   613 	self listColumnShow: #change.
       
   614     ].
       
   615     ^ holder
       
   616 
       
   617     "Created: / 26-07-2012 / 18:03:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   618 !
       
   619 
   472 listHolder
   620 listHolder
   473     listHolder isNil ifTrue:[
   621     listHolder isNil ifTrue:[
   474         listHolder := ValueHolder new.
   622         listHolder := ValueHolder new.
   475     ].
   623     ].
   476     ^ listHolder
   624     ^ listHolder
   561     ].
   709     ].
   562     newValue := showSameHolder value.
   710     newValue := showSameHolder value.
   563     oldValue ~~ newValue ifTrue:[
   711     oldValue ~~ newValue ifTrue:[
   564         self update:#value with:newValue from:showSameHolder.
   712         self update:#value with:newValue from:showSameHolder.
   565     ].
   713     ].
       
   714 !
       
   715 
       
   716 showTimestampHolder
       
   717     "return/create the 'showTimestampHolder' value holder (automatically generated)"
       
   718 
       
   719     showTimestampHolder isNil ifTrue:[
       
   720 	showTimestampHolder := ValueHolder new.
       
   721 	showTimestampHolder addDependent:self.
       
   722     ].
       
   723     ^ showTimestampHolder
       
   724 !
       
   725 
       
   726 showTimestampHolder:something
       
   727     "set the 'showTimestampHolder' value holder (automatically generated)"
       
   728 
       
   729     |oldValue newValue|
       
   730 
       
   731     showTimestampHolder notNil ifTrue:[
       
   732 	oldValue := showTimestampHolder value.
       
   733 	showTimestampHolder removeDependent:self.
       
   734     ].
       
   735     showTimestampHolder := something.
       
   736     showTimestampHolder notNil ifTrue:[
       
   737 	showTimestampHolder addDependent:self.
       
   738     ].
       
   739     newValue := showTimestampHolder value.
       
   740     oldValue ~~ newValue ifTrue:[
       
   741 	self update:#value with:newValue from:showTimestampHolder.
       
   742     ].
   566 ! !
   743 ! !
   567 
   744 
   568 !ChangeList methodsFor:'change & update'!
   745 !ChangeList methodsFor:'change & update'!
   569 
   746 
   570 selectionChanged
   747 selectionChanged
   571    super selectionChanged
   748    super selectionChanged
   572 !
   749 !
   573 
   750 
   574 update: aspect with: param from: sender
   751 update: aspect with: param from: sender
       
   752 
       
   753     sender == allowRemoveHolder ifTrue:[
       
   754         self listColumn: #removed visible: allowRemoveHolder value.
       
   755         ^self.
       
   756     ].
       
   757 
       
   758     sender == showTimestampHolder ifTrue:[
       
   759         self listColumn: #timeStamp visible: showTimestampHolder value.
       
   760         ^self.
       
   761     ].
       
   762 
   575 
   763 
   576     sender == selectionHolder ifTrue:[
   764     sender == selectionHolder ifTrue:[
   577         self selectionChanged.
   765         self selectionChanged.
   578         ^ self
   766         ^ self
   579     ].
   767     ].
   580     sender == showSameHolder ifTrue:[
   768     sender == showSameHolder ifTrue:[
   581         self updateList
   769         self updateList.
       
   770         ^self.
   582     ].
   771     ].
   583     sender == showRemovedHolder ifTrue:[
   772     sender == showRemovedHolder ifTrue:[
   584         self updateList
   773         self updateList
   585     ].
   774     ].
   586     sender == showConflictsOnlyHolder ifTrue:[
   775     sender == showConflictsOnlyHolder ifTrue:[
   589 
   778 
   590     ^super update: aspect with: param from: sender
   779     ^super update: aspect with: param from: sender
   591 
   780 
   592     "Created: / 24-10-2009 / 19:47:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   781     "Created: / 24-10-2009 / 19:47:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   593     "Modified (format): / 27-12-2011 / 14:20:30 / cg"
   782     "Modified (format): / 27-12-2011 / 14:20:30 / cg"
       
   783     "Modified: / 26-07-2012 / 18:44:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   784 ! !
       
   785 
       
   786 !ChangeList methodsFor:'drag & drop'!
       
   787 
       
   788 canDrop: aDropContext
       
   789 
       
   790     ^(self inGeneratorHolder value isKindOf: Iterator) not
       
   791 	and:[aDropContext dropObjects allSatisfy:[:obj|(obj theObject isKindOf: Change)]].
       
   792 
       
   793     "Created: / 01-08-2012 / 17:53:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   794 !
       
   795 
       
   796 dragObjects: aDropSource
       
   797 
       
   798     ^self selection collect:[:item|(DropObject new: item change) displayObject: (item labelAndIcon)]
       
   799 
       
   800     "Created: / 01-08-2012 / 17:50:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   801 !
       
   802 
       
   803 dropObjects:aDropContext
       
   804     "drop manager wants to drop.
       
   805      This is ony sent, if #canDrop: returned true.
       
   806      Must be redefined in order for drop to work."
       
   807 
       
   808     | changes |
       
   809 
       
   810     changes := self inGeneratorHolder value.
       
   811     aDropContext dropObjects do:[:obj|changes add: obj theObject].
       
   812     self inGeneratorHolder changed: #value
       
   813 
       
   814     "Modified: / 01-08-2012 / 18:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   594 ! !
   815 ! !
   595 
   816 
   596 !ChangeList methodsFor:'event processing'!
   817 !ChangeList methodsFor:'event processing'!
   597 
   818 
   598 buttonPress:button x:x y:y view:aView
   819 buttonPress:button x:x y:y view:aView
   632 
   853 
   633     "Created: / 08-02-2012 / 14:43:11 / cg"
   854     "Created: / 08-02-2012 / 14:43:11 / cg"
   634 !
   855 !
   635 
   856 
   636 keyPress:key x:x y:y view:aView
   857 keyPress:key x:x y:y view:aView
   637     <resource: #keyboard (#Ctrls #Accept)>
       
   638 
       
   639     (key == #Accept or:[ key == #Ctrls]) ifTrue:[
   858     (key == #Accept or:[ key == #Ctrls]) ifTrue:[
   640         self listMenuApply.
   859 	self listMenuApply.
   641         ^ self
   860 	^ self
   642     ].
   861     ].
   643 
   862 
   644     "Created: / 08-02-2012 / 14:42:18 / cg"
   863     "Created: / 08-02-2012 / 14:42:18 / cg"
   645 ! !
   864 ! !
   646 
   865 
   673 ! !
   892 ! !
   674 
   893 
   675 !ChangeList methodsFor:'initialization'!
   894 !ChangeList methodsFor:'initialization'!
   676 
   895 
   677 initialize
   896 initialize
       
   897 
   678     super initialize.
   898     super initialize.
   679 
       
   680     menuHolder := [self menuFor: #listMenu].
   899     menuHolder := [self menuFor: #listMenu].
       
   900     scrollToBottom := false.
   681     applyAction isNil ifTrue:[
   901     applyAction isNil ifTrue:[
   682         applyAction := [:change | change apply ].
   902 	applyAction := [:change | change apply ].
   683     ].
   903     ].
   684 
   904 
   685     "Created: / 29-10-2010 / 12:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   905     "Created: / 29-10-2010 / 12:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   686     "Modified: / 10-09-2012 / 13:57:20 / cg"
       
   687 ! !
   906 ! !
   688 
   907 
   689 !ChangeList methodsFor:'menu actions'!
   908 !ChangeList methodsFor:'menu actions'!
   690 
   909 
   691 listMenuApply
   910 listMenuApply
   895     sym = #= ifTrue:[^#iconEqual].
  1114     sym = #= ifTrue:[^#iconEqual].
   896     "/ different.
  1115     "/ different.
   897     ^ nil.
  1116     ^ nil.
   898 !
  1117 !
   899 
  1118 
       
  1119 listColumn: columnId visible: visible
       
  1120     visible ifTrue:[
       
  1121         self listColumnShow: columnId
       
  1122     ] ifFalse:[
       
  1123         self listColumnHide: columnId
       
  1124     ]
       
  1125 
       
  1126     "Created: / 26-07-2012 / 18:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1127 !
       
  1128 
       
  1129 listColumnHide: columnId
       
  1130     self listColumns do:[:spec|
       
  1131 	spec id = columnId ifTrue:[
       
  1132 	    self listColumns remove: spec.
       
  1133 	    listView notNil ifTrue:[
       
  1134 		listView invalidate.
       
  1135 	    ].
       
  1136 	    ^self
       
  1137 	].
       
  1138     ]
       
  1139 
       
  1140     "Created: / 26-07-2012 / 18:19:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1141 !
       
  1142 
       
  1143 listColumnShow: columnId
       
  1144 
       
  1145     | columns |
       
  1146     columns := self listColumns.
       
  1147 
       
  1148     columns do:[:spec|
       
  1149 	spec id = columnId ifTrue:[
       
  1150 	    ^self.
       
  1151 	]
       
  1152     ].
       
  1153 
       
  1154     self class listColumnSpec do:[:specArray|
       
  1155 	| spec |
       
  1156 
       
  1157 	spec := specArray decodeAsLiteralArray.
       
  1158 	spec id = columnId ifTrue:[
       
  1159 	    columnId == #removed ifTrue:[
       
  1160 		columns addFirst: spec.
       
  1161 	    ] ifFalse:[
       
  1162 		columns add: spec.
       
  1163 	    ].
       
  1164 	    listView notNil ifTrue:[
       
  1165 		listView invalidate.
       
  1166 	    ].
       
  1167 	    ^self.
       
  1168 	]
       
  1169 
       
  1170     ].
       
  1171 
       
  1172     "Created: / 26-07-2012 / 17:56:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1173 !
       
  1174 
   900 listEntryFor:chg 
  1175 listEntryFor:chg 
   901     ^ListEntry change:chg application: self
  1176     ^ListEntry change:chg application: self
   902 
  1177 
   903     "Modified: / 05-12-2009 / 14:39:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1178     "Modified: / 05-12-2009 / 14:39:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   904 !
  1179 !
   919 
  1194 
   920     "Created: / 05-12-2009 / 14:14:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1195     "Created: / 05-12-2009 / 14:14:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   921 !
  1196 !
   922 
  1197 
   923 updateList
  1198 updateList
   924     |inGenerator changeset newList|
  1199     |inGenerator changeset firstLineShown oldSel newList newSel |
   925 
       
   926     self withWaitCursorDo:[
  1200     self withWaitCursorDo:[
   927         inGenerator := self inGeneratorHolder value.
  1201         inGenerator := self inGeneratorHolder value.
   928         changeset := inGenerator ifNil:[ #() ] ifNotNil:[ inGenerator ].
  1202         listView notNil ifTrue:[
   929         self showConflictsOnlyHolder value ifTrue:[
  1203             ((listView isKindOf: ScrollableView) not or:[listView scrolledView notNil]) ifTrue:[
   930             newList := changeset select: [:chg | 
  1204                 firstLineShown := listView firstLineShown
   931                            chg isConflict
  1205             ].
   932                        ].
       
   933         ] ifFalse:[
       
   934             | showRemoved showSame |
       
   935 
       
   936             showRemoved := self showRemovedHolder value.
       
   937             showSame := self showSameHolder value.
       
   938 
       
   939             newList := changeset select: [:chg | 
       
   940                            (showRemoved or:[ chg removed not ])
       
   941                                and:[showSame or:[chg delta ~~ #=]]
       
   942                        ].
       
   943         ].
  1206         ].
       
  1207         oldSel := self selection.
       
  1208 
       
  1209         changeset := inGenerator isNil ifTrue:[ #() ] ifFalse:[ inGenerator ].
       
  1210         newList := changeset
       
  1211                     select:
       
  1212                         [:chg |
       
  1213                         (self showRemovedHolder value or:[ chg removed not ])
       
  1214                             and:[self showSameHolder value or:[chg delta ~~ #=]]
       
  1215                         ].
   944         newList := self filterList: newList.
  1216         newList := self filterList: newList.
   945         newList := newList collect:[:chg | self listEntryFor:chg ].
  1217         newList := newList collect:[:chg | self listEntryFor:chg ].
   946         self listHolder value ~= newList ifTrue:[
  1218         self listHolder value ~= newList ifTrue:[
   947             self listHolder value: newList.
  1219             self listHolder value: newList.
       
  1220             ((newList size ~~ 0) and:[scrollToBottom]) ifTrue:[
       
  1221                 self selection: { newList last }
       
  1222             ] ifFalse:[
       
  1223                 oldSel notEmptyOrNil ifTrue:[
       
  1224                     newSel := OrderedCollection new: oldSel size.
       
  1225                     oldSel := oldSel reject:[:e|e isNil].
       
  1226                     oldSel := oldSel collect:[:e|e change].
       
  1227                     newList do:[:e|(oldSel includes:e change) ifTrue:[newSel add:e]].
       
  1228                     self selection: newSel.
       
  1229                 ].
       
  1230                 (listView notNil and:[firstLineShown notNil]) ifTrue:[
       
  1231                     listView scrollToLine: (newList size min: firstLineShown).
       
  1232                 ].
       
  1233             ].
       
  1234             scrollToBottom := false.
       
  1235 
   948         ]
  1236         ]
   949     ]
  1237     ]
   950 
       
   951     "Modified: / 29-11-2011 / 15:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   952     "Modified: / 28-12-2011 / 15:46:15 / cg"
  1238     "Modified: / 28-12-2011 / 15:46:15 / cg"
       
  1239     "Modified: / 01-08-2012 / 18:10:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   953 ! !
  1240 ! !
   954 
  1241 
   955 !ChangeList methodsFor:'queries'!
  1242 !ChangeList methodsFor:'queries'!
   956 
  1243 
   957 hasChangeSelected
  1244 hasChangeSelected
   979         chg isClassChange ifTrue:[
  1266         chg isClassChange ifTrue:[
   980             (chg isMethodChange not or:[chg isMethodCodeChange]) ifFalse:[^ false]
  1267             (chg isMethodChange not or:[chg isMethodCodeChange]) ifFalse:[^ false]
   981         ].
  1268         ].
   982     ].
  1269     ].
   983     ^ true
  1270     ^ true
       
  1271 !
       
  1272 
       
  1273 showColumn: columnSymbol
       
  1274 
       
  1275     ^self showColumnSpecHolder value includes: columnSymbol.
       
  1276 
       
  1277     "Created: / 03-04-2012 / 11:28:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   984 ! !
  1278 ! !
   985 
  1279 
   986 !ChangeList::ListEntry class methodsFor:'instance creation'!
  1280 !ChangeList::ListEntry class methodsFor:'instance creation'!
   987 
  1281 
   988 change: aChange
  1282 change: aChange
  1038 !
  1332 !
  1039 
  1333 
  1040 changeSource
  1334 changeSource
  1041     "the changes source"
  1335     "the changes source"
  1042 
  1336 
  1043     ^change changeSource
  1337     "/ Hack to make sure code is displayed in similar way
       
  1338     "/ (i.e., with no namespace pragma)
       
  1339     ^ (change isClassDefinitionChange and:[change isPrivateClassDefinitionChange]) ifTrue:[
       
  1340         change definitionStringInNamespace: nil.
       
  1341     ] ifFalse:[
       
  1342         change changeSource.
       
  1343     ].
  1044 
  1344 
  1045     "Created: / 19-07-2011 / 12:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1345     "Created: / 19-07-2011 / 12:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1046     "Modified (comment): / 25-07-2012 / 17:39:39 / cg"
  1346     "Modified (comment): / 25-07-2012 / 17:39:39 / cg"
       
  1347     "Modified: / 14-11-2013 / 14:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1047 !
  1348 !
  1048 
  1349 
  1049 children
  1350 children
  1050 
  1351 
  1051     children isNil ifTrue:[
  1352     children isNil ifTrue:[
  1110 
  1411 
  1111 label
  1412 label
  1112     | label |
  1413     | label |
  1113 
  1414 
  1114     label := change displayString.
  1415     label := change displayString.
       
  1416 
       
  1417     "Hack: if the printString contains multiple lines, then
       
  1418      if there are just 2 lines, then merge them, otherwise add
       
  1419      ... to the first line"
       
  1420     (label includes: Character cr) ifTrue:[
       
  1421         | firstCR secondCR |
       
  1422         firstCR := label indexOf: Character cr.
       
  1423         firstCR ~~ label size ifTrue:[
       
  1424             secondCR := label indexOf: Character cr startingAt: firstCR + 1.
       
  1425         ].
       
  1426         secondCR isNil ifTrue:[
       
  1427             "/2 lines only
       
  1428             label := label copy at: firstCR put: Character space.
       
  1429         ] ifFalse:[
       
  1430             label := (label copyTo: firstCR - 1) , '...'
       
  1431         ].
       
  1432     ].
  1115     self removed ifTrue:[label := label asText colorizeAllWith: Color gray].
  1433     self removed ifTrue:[label := label asText colorizeAllWith: Color gray].
  1116     ^label
  1434     ^label
  1117 
  1435 
  1118     "Created: / 05-11-2008 / 08:20:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1436     "Created: / 05-11-2008 / 08:20:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1119     "Modified: / 25-07-2009 / 23:43:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1437     "Modified: / 25-07-2009 / 23:43:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1120     "Modified: / 05-12-2009 / 14:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1438     "Modified: / 05-12-2009 / 14:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1121     "Modified (format): / 27-07-2012 / 21:26:34 / cg"
  1439     "Modified (format): / 27-07-2012 / 21:26:34 / cg"
  1122 !
  1440 !
  1123 
  1441 
       
  1442 labelAndIcon
       
  1443     ^(LabelAndIcon label: self label icon: self iconDelta)
       
  1444 
       
  1445     "Created: / 01-08-2012 / 18:14:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1446 !
       
  1447 
       
  1448 notRemoved
       
  1449     ^ self removed not
       
  1450 
       
  1451     "Created: / 26-07-2012 / 18:31:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1452 !
       
  1453 
       
  1454 notRemoved: aBoolean
       
  1455     ^ self removed: aBoolean not
       
  1456 
       
  1457     "Created: / 26-07-2012 / 18:31:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1458 !
       
  1459 
  1124 removed
  1460 removed
  1125     ^ change removed
  1461     ^ change removed == true
       
  1462 
       
  1463     "Modified: / 26-07-2012 / 18:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1126 !
  1464 !
  1127 
  1465 
  1128 removed:aBoolean
  1466 removed:aBoolean
  1129     change removed: aBoolean.
  1467     change removed: aBoolean.
  1130 !
  1468 !
  1132 source
  1470 source
  1133 
  1471 
  1134     ^change source
  1472     ^change source
  1135 !
  1473 !
  1136 
  1474 
       
  1475 timeStamp
       
  1476     ^change timeOfChangeIfKnown
       
  1477 
       
  1478     "Created: / 26-07-2012 / 18:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1479 !
       
  1480 
  1137 x
  1481 x
  1138     ^ x
  1482     ^ x
  1139 ! !
  1483 ! !
  1140 
  1484 
  1141 !ChangeList::ListEntry methodsFor:'displaying'!
  1485 !ChangeList::ListEntry methodsFor:'displaying'!
  1142 
  1486 
  1143 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h 
  1487 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h
  1144     | cx icon |
  1488 
  1145 
  1489     | list cx icon colW colS |
       
  1490     list := self application.
  1146     cx := x := newX.
  1491     cx := x := newX.
  1147     self application allowRemoveHolder value ifTrue:[
  1492     (list allowRemoveHolder value and:[list showRemovedHolder value]) ifTrue: [
  1148         (icon := self iconRemoved) notNil ifTrue:[
  1493 	(icon := self iconRemoved) notNil ifTrue:[
  1149             icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2) 
  1494 	    icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2)
  1150         ].
  1495 	].
  1151         cx := cx + 22."experimental value - this looks good"
  1496 	cx := cx + 22."experimental value - this looks good"
  1152     ].
  1497     ].
  1153     (icon := self iconDelta) notNil ifTrue:[
  1498     (icon := self iconDelta) notNil ifTrue:[
  1154         icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2) 
  1499 	icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2)
  1155     ].
  1500     ].
  1156     cx := cx + 16."12 + 2px gap"                
  1501     cx := cx + 16."12 + 2px gap"
  1157 
  1502 
  1158     super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h
  1503     super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h.
  1159 
  1504 
  1160     "Modified: / 24-01-2012 / 21:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1505 "/    "Now, display additional columns..."
  1161     "Modified: / 27-07-2012 / 21:26:23 / cg"
  1506 "/    (list showColumn: #timestamp) ifTrue:[
       
  1507 "/        cx := cx + (aLabel widthOn: aGC) + 5."px - padding"
       
  1508 "/        colS := change timeOfChangeIfKnown notNil
       
  1509 "/                    ifTrue:[change timeOfChangeIfKnown printString]
       
  1510 "/                    ifFalse:['???'].
       
  1511 "/        [ (colW := colS widthOn: aGC) > (aGC width - cx - 5) ] whileTrue:[
       
  1512 "/            colS = '...' ifTrue:[ ^ self ].
       
  1513 "/            colS := '...' , (colS copyFrom: 6).
       
  1514 "/        ].
       
  1515 "/        super displayLabel:colS h:lH on:aGC x: (aGC width - 5 - colW) y:y h:h.
       
  1516 "/    ].
       
  1517 
       
  1518     "Modified: / 27-07-2012 / 17:13:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1162 !
  1519 !
  1163 
  1520 
  1164 iconDelta
  1521 iconDelta
  1165     | iconSelector |
  1522     | iconSelector |
  1166 
  1523 
  1198 ! !
  1555 ! !
  1199 
  1556 
  1200 !ChangeList class methodsFor:'documentation'!
  1557 !ChangeList class methodsFor:'documentation'!
  1201 
  1558 
  1202 version
  1559 version
  1203     ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.26 2013-09-05 23:18:30 cg Exp $'
  1560     ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.27 2014-02-05 18:58:09 cg Exp $'
  1204 !
  1561 !
  1205 
  1562 
  1206 version_CVS
  1563 version_CVS
  1207     ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.26 2013-09-05 23:18:30 cg Exp $'
  1564     ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.27 2014-02-05 18:58:09 cg Exp $'
  1208 !
  1565 !
  1209 
  1566 
  1210 version_SVN
  1567 version_SVN
  1211     ^ '$Id: Tools__ChangeList.st,v 1.26 2013-09-05 23:18:30 cg Exp $'
  1568     ^ '$Id: Tools__ChangeList.st,v 1.27 2014-02-05 18:58:09 cg Exp $'
  1212 ! !
  1569 ! !
  1213 
  1570