RCSConflictEditTextView.st
changeset 1749 044c5af08830
child 1750 1e7547bc0724
equal deleted inserted replaced
1748:09dcf4b6b702 1749:044c5af08830
       
     1 EditTextView subclass:#RCSConflictEditTextView
       
     2 	instanceVariableNames:''
       
     3 	classVariableNames:''
       
     4 	poolDictionaries:''
       
     5 	category:'Views-Text'
       
     6 !
       
     7 
       
     8 !RCSConflictEditTextView class methodsFor:'documentation'!
       
     9 
       
    10 history
       
    11 
       
    12     "Created: / 27.7.1998 / 12:19:24 / cg"
       
    13     "Created: #initialize / 27.7.1998 / 12:19:45 / cg"
       
    14     "Modified: #initialize / 27.7.1998 / 12:22:31 / cg"
       
    15     "Created: #moveToPreviousChanged / 27.7.1998 / 12:25:34 / cg"
       
    16     "Created: #moveToNextChanged / 27.7.1998 / 12:26:24 / cg"
       
    17     "Modified: #moveToNextChanged / 27.7.1998 / 12:26:43 / cg"
       
    18     "Modified: #moveToPreviousChanged / 27.7.1998 / 12:26:48 / cg"
       
    19     "Modified: #moveToPreviousChanged / 27.7.1998 / 12:27:17 / cg"
       
    20     "Modified: #moveToNextChanged / 27.7.1998 / 12:27:21 / cg"
       
    21     "Modified: #moveToNextChanged / 27.7.1998 / 12:29:24 / cg"
       
    22     "Modified: #moveToPreviousChanged / 27.7.1998 / 12:29:31 / cg"
       
    23     "Modified: #moveToPreviousChanged / 27.7.1998 / 12:30:54 / cg"
       
    24     "Modified: #moveToPreviousChanged / 27.7.1998 / 12:31:26 / cg"
       
    25 ! !
       
    26 
       
    27 !RCSConflictEditTextView methodsFor:'actions'!
       
    28 
       
    29 moveToNextChanged
       
    30     "somewhat of a kludge - simply search for the next text-item"
       
    31 
       
    32     |start end lnNr max list|
       
    33 
       
    34     start := self lastLineShown + 1.
       
    35 
       
    36     list := self list.
       
    37     max  := list size.
       
    38     lnNr := start.
       
    39 
       
    40     [(lnNr > max or:[(list at:lnNr) isText])
       
    41     ] whileFalse:[
       
    42         lnNr := lnNr + 1
       
    43     ].
       
    44 
       
    45     (lnNr <= max) ifTrue:[
       
    46         (end isNil or:[lnNr < end]) ifTrue:[
       
    47             end := lnNr.
       
    48         ]
       
    49     ].
       
    50 
       
    51     end notNil ifTrue:[
       
    52         self scrollToLine:end
       
    53     ] ifFalse:[
       
    54         self beep
       
    55     ].
       
    56 
       
    57     "Modified: / 27.7.1998 / 12:29:24 / cg"
       
    58 !
       
    59 
       
    60 moveToPreviousChanged
       
    61     "somewhat of a kludge - simply search for the previous text-item"
       
    62 
       
    63     |start end found lnNr list|
       
    64 
       
    65     start := firstLineShown - 1.
       
    66     end   := 1.
       
    67     found := false.
       
    68 
       
    69     start > 1 ifTrue:[
       
    70         list := self list.
       
    71         lnNr := list size.
       
    72 
       
    73         lnNr >= start ifTrue:[
       
    74             lnNr := start
       
    75         ].
       
    76 
       
    77         [(lnNr == end or:[(list at:lnNr) isText])
       
    78         ] whileFalse:[
       
    79             lnNr := lnNr - 1
       
    80         ].
       
    81         (list at:lnNr) isText ifTrue:[
       
    82             end   := lnNr.
       
    83             found := true.
       
    84             "/ skip multiple text-lines
       
    85             [end > 1 and:[(list at:(end-1)) isText]] whileTrue:[
       
    86                 end := end - 1
       
    87             ].
       
    88         ]
       
    89     ].
       
    90     found ifTrue:[
       
    91         self scrollToLine:end
       
    92     ] ifFalse:[
       
    93         self beep
       
    94     ]
       
    95 
       
    96     "Created: / 27.7.1998 / 12:25:34 / cg"
       
    97     "Modified: / 27.7.1998 / 12:31:26 / cg"
       
    98 ! !
       
    99 
       
   100 !RCSConflictEditTextView methodsFor:'initialization'!
       
   101 
       
   102 initialize
       
   103     |panel buttonPrev buttonNext|
       
   104 
       
   105     super initialize.
       
   106 
       
   107 "set up-down buttons"
       
   108 
       
   109     panel := VerticalPanelView in:self.
       
   110 
       
   111     buttonPrev := Button label:'-' in:panel.
       
   112     buttonNext := Button label:'+' in:panel.
       
   113     buttonPrev extent:15@22.
       
   114     buttonNext extent:15@22.
       
   115     panel origin:0.0 @ 1.0 corner:(15 + SimpleView viewSpacing) @ 1.0.
       
   116     panel topInset:(2 * (buttonPrev preferredExtent y)) negated.
       
   117 
       
   118 "set actions"
       
   119 
       
   120     buttonPrev pressAction:[
       
   121         buttonPrev turnOff.
       
   122         self moveToPreviousChanged
       
   123     ].
       
   124 
       
   125     buttonNext pressAction:[
       
   126         buttonNext turnOff.
       
   127         self moveToNextChanged
       
   128     ].
       
   129     self moveToNextChanged.
       
   130 
       
   131     "Modified: / 27.7.1998 / 12:22:31 / cg"
       
   132 ! !
       
   133 
       
   134 !RCSConflictEditTextView class methodsFor:'documentation'!
       
   135 
       
   136 version
       
   137     ^ '$Header: /cvs/stx/stx/libtool/RCSConflictEditTextView.st,v 1.1 1998-07-27 10:36:03 cg Exp $'
       
   138 ! !