#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Fri, 13 Jul 2018 14:51:52 +0200
changeset 6378 3cf0a2838cb8
parent 6377 085f33bdceca
child 6379 6a0103018ab9
#UI_ENHANCEMENT by cg class: TextView changed: #openSearchBoxAndSearchWithReplaceChecked: class: TextView class changed: #searchDialogSpec
TextView.st
--- a/TextView.st	Fri Jul 13 11:10:21 2018 +0200
+++ b/TextView.st	Fri Jul 13 14:51:52 2018 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -410,10 +408,12 @@
     ^ 
     #(FullSpec
        name: searchDialogSpec
+       uuid: '391489e6-869a-11e8-80e0-b8f6b1108e05'
        window: 
       (WindowSpec
          label: 'String search'
          name: 'String search'
+         uuid: 'c93c164e-8698-11e8-80e0-b8f6b1108e05'
          min: (Point 10 10)
          max: (Point 1280 1024)
          bounds: (Rectangle 0 0 475 376)
@@ -425,6 +425,7 @@
              label: 'SearchPattern:'
              name: 'label'
              layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
+             uuid: 'c93c1a7c-8698-11e8-80e0-b8f6b1108e05'
              level: 0
              translateLabel: true
              adjust: left
@@ -433,6 +434,7 @@
              name: 'patternComboBox'
              layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
              activeHelpKey: searchPattern
+             uuid: 'c93c1d38-8698-11e8-80e0-b8f6b1108e05'
              tabable: true
              model: searchPattern
              immediateAccept: false
@@ -447,6 +449,7 @@
           (VerticalPanelViewSpec
              name: 'VerticalPanel1'
              layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
+             uuid: 'c93c21e8-8698-11e8-80e0-b8f6b1108e05'
              horizontalLayout: fit
              verticalLayout: top
              component: 
@@ -456,6 +459,7 @@
                    label: 'Case Sensitive'
                    name: 'ignoreCaseCheckBox'
                    activeHelpKey: searchCaseSensitive
+                   uuid: 'c93c242c-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    tabable: true
                    model: caseSensitive
@@ -464,6 +468,7 @@
                  )
                 (ViewSpec
                    name: 'MatchBox'
+                   uuid: 'c93c2620-8698-11e8-80e0-b8f6b1108e05'
                    component: 
                   (SpecCollection
                      collection: (
@@ -472,6 +477,7 @@
                          name: 'matchCheckBox'
                          layout: (LayoutFrame 0 0 0 0 260 0 0 1)
                          activeHelpKey: matchSearch
+                         uuid: 'c93c272e-8698-11e8-80e0-b8f6b1108e05'
                          level: 0
                          tabable: true
                          model: match
@@ -482,6 +488,7 @@
                          name: 'CheckBox6'
                          layout: (LayoutFrame -170 1 0 0 0 1 22 0)
                          activeHelpKey: matchWithRegex
+                         uuid: 'c93c285a-8698-11e8-80e0-b8f6b1108e05'
                          enableChannel: matchWithRegexVisible
                          model: matchWithRegex
                          translateLabel: true
@@ -495,6 +502,7 @@
                    label: 'Search Full Words'
                    name: 'CheckBox2'
                    activeHelpKey: searchFullWord
+                   uuid: 'c93c29ae-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    enableChannel: searchFullWordEnabled
                    tabable: true
@@ -506,6 +514,7 @@
                    label: 'At Begin of Line Only'
                    name: 'CheckBox5'
                    activeHelpKey: searchAtBeginOfLineOnly
+                   uuid: 'c93c2ac6-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    tabable: true
                    model: searchAtBeginOfLineOnly
@@ -516,6 +525,7 @@
                    label: 'Variable Only'
                    name: 'CheckBox1'
                    activeHelpKey: searchVariable
+                   uuid: 'c93c2bde-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    visibilityChannel: searchVariableVisible
                    enableChannel: searchVariableEnabled
@@ -529,6 +539,7 @@
                    label: 'Select Lines'
                    name: 'CheckBox3'
                    activeHelpKey: selectLines
+                   uuid: 'c93c2d0a-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    initiallyInvisible: true
                    tabable: true
@@ -540,6 +551,7 @@
                    label: 'Wrap at End of Text (forward only)'
                    name: 'CheckBox7'
                    activeHelpKey: searchWithWrap
+                   uuid: 'c93c2e2c-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    tabable: true
                    model: wrapAtEndOfTextHolder
@@ -548,10 +560,12 @@
                  )
                 (ViewSpec
                    name: 'Box1'
+                   uuid: 'c93c2f44-8698-11e8-80e0-b8f6b1108e05'
                    extent: (Point 475 10)
                  )
                 (HorizontalPanelViewSpec
                    name: 'HorizontalPanel1'
+                   uuid: 'c93c3016-8698-11e8-80e0-b8f6b1108e05'
                    horizontalLayout: leftFit
                    verticalLayout: fit
                    ignoreInvisibleComponents: false
@@ -563,6 +577,7 @@
                          label: 'Replace By:'
                          name: 'CheckBox4'
                          activeHelpKey: replaceText
+                         uuid: 'c93c3192-8698-11e8-80e0-b8f6b1108e05'
                          level: 0
                          enableChannel: replaceEnabled
                          tabable: true
@@ -574,13 +589,14 @@
                       (InputFieldSpec
                          name: 'ReplaceEntryField'
                          activeHelpKey: replaceText
+                         uuid: 'c93c32f0-8698-11e8-80e0-b8f6b1108e05'
                          visibilityChannel: replaceBoolean
                          enableChannel: replaceBoolean
                          model: replaceTextHolder
                          acceptOnReturn: true
                          acceptOnTab: true
                          acceptOnPointerLeave: true
-                         extent: (Point 318 24)
+                         extent: (Point 344 24)
                        )
                       )
                     
@@ -591,6 +607,7 @@
                    label: '  Replace All (to End of Text)'
                    name: 'CheckBox8'
                    activeHelpKey: replaceAll
+                   uuid: 'c93c353e-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    enableChannel: replaceBoolean
                    tabable: true
@@ -602,6 +619,7 @@
                    label: '  Preserve Case'
                    name: 'CheckBox9'
                    activeHelpKey: replacePreserveCase
+                   uuid: 'c93c366a-8698-11e8-80e0-b8f6b1108e05'
                    level: 0
                    enableChannel: replaceBoolean
                    tabable: true
@@ -615,9 +633,10 @@
            )
           (HorizontalPanelViewSpec
              name: 'horizontalPanelView'
-             layout: (LayoutFrame 0 0.0 -36 1.0 -16 1.0 0 1.0)
+             layout: (LayoutFrame 20 0.0 -36 1.0 -30 1.0 0 1.0)
+             uuid: 'c93c3908-8698-11e8-80e0-b8f6b1108e05'
              level: 0
-             horizontalLayout: fitSpace
+             horizontalLayout: leftSpace
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
@@ -629,31 +648,67 @@
                 (ActionButtonSpec
                    label: 'Cancel'
                    name: 'cancelButton'
+                   uuid: 'c93c3b74-8698-11e8-80e0-b8f6b1108e05'
                    level: 2
                    translateLabel: true
                    tabable: true
                    model: cancel
                    useDefaultExtent: true
                  )
-                (ActionButtonSpec
-                   label: 'Prev'
-                   name: 'prevButton'
-                   level: 2
-                   translateLabel: true
-                   tabable: true
-                   model: prevAction
-                   useDefaultExtent: true
+                (ViewSpec
+                   name: 'Box2'
+                   uuid: 'db91ecb4-8699-11e8-80e0-b8f6b1108e05'
+                   extent: (Point 80 30)
                  )
-                (ActionButtonSpec
-                   label: 'Next'
-                   name: 'nextButton'
-                   level: 2
-                   borderWidth: 1
-                   translateLabel: true
-                   tabable: true
-                   model: nextAction
-                   isDefault: true
-                   useDefaultExtent: true
+                (HorizontalPanelViewSpec
+                   name: 'HorizontalPanel2'
+                   uuid: 'c93c3908-8698-11e8-80e0-b8f6b1108e05'
+                   level: 0
+                   horizontalLayout: fitSpace
+                   verticalLayout: center
+                   horizontalSpace: 3
+                   verticalSpace: 3
+                   ignoreInvisibleComponents: true
+                   component: 
+                  (SpecCollection
+                     collection: (
+                      (ActionButtonSpec
+                         label: 'Prev'
+                         name: 'prevButton'
+                         uuid: 'c93c3e6c-8698-11e8-80e0-b8f6b1108e05'
+                         level: 2
+                         translateLabel: true
+                         tabable: true
+                         model: prevAction
+                         useDefaultExtent: true
+                       )
+                      (ActionButtonSpec
+                         label: 'Next'
+                         name: 'nextButton'
+                         uuid: 'c93c3ffc-8698-11e8-80e0-b8f6b1108e05'
+                         level: 2
+                         borderWidth: 1
+                         translateLabel: true
+                         tabable: true
+                         model: nextAction
+                         isDefault: true
+                         useDefaultExtent: true
+                       )
+                      (ActionButtonSpec
+                         label: 'Last'
+                         name: 'lastButton'
+                         uuid: 'db91f074-8699-11e8-80e0-b8f6b1108e05'
+                         level: 2
+                         borderWidth: 1
+                         translateLabel: true
+                         tabable: true
+                         model: lastAction
+                         useDefaultExtent: true
+                       )
+                      )
+                    
+                   )
+                   extent: (Point 250 36)
                  )
                 )
               
@@ -2451,7 +2506,7 @@
      cg: yes - turns out to be useful and less confusing than keeping last per view
     "
     |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
-     fwd ign match initialString
+     fwd last ign match initialString
      bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder selectLinesHolder
      replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
      replaceAllBooleanHolder replacePreserveCaseBooleanHolder
@@ -2518,10 +2573,18 @@
     ].
 
     fwd := true.
-
-    doSearch := [:fwd |
-        |isVariableSearch pattern searchAction|
-
+    last := false.
+
+    doSearch := [:fwdOrLast |
+        |isVariableSearch pattern searchAction fwd last|
+
+        fwdOrLast == #last ifTrue:[
+            fwd := last := true.
+        ] ifFalse:[
+            fwd := fwdOrLast.
+            last := false
+        ].
+        
         self resetVariablesBeforeNewSearch.
 
         isVariableSearch := self searchVariableVisible
@@ -2606,7 +2669,17 @@
                 ]
             ]
         ] ifFalse:[
+            |selStart|
+            
+            selStart := self characterPositionOfSelection.
             searchAction value.
+            last ifTrue:[
+                [
+                    self characterPositionOfSelection ~= selStart] whileTrue:[
+                        selStart := self characterPositionOfSelection.
+                        searchAction value.
+                    ].    
+            ].    
         ].
     ].
 
@@ -2614,6 +2687,16 @@
     bindings at:#searchPattern put:patternHolder.
     modal ifTrue:[
         bindings
+            at:#lastAction
+            put:[
+                replaceAllBooleanHolder value ifTrue:[
+                    fwd := #last. searchBox doAccept.
+                    searchBox doAccept.
+                ] ifFalse:[
+                    doSearch value:#last
+                ]
+            ].
+        bindings
             at:#nextAction
             put:[
                 replaceAllBooleanHolder value ifTrue:[
@@ -2724,6 +2807,7 @@
     ].
     
     (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
+    (bldr componentAt:#lastButton) cursor:(Cursor thumbsUp).
     (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
     (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
 
@@ -2751,7 +2835,7 @@
     ]
 
     "Created: / 22-05-2018 / 15:47:29 / Claus Gittinger"
-    "Modified: / 22-05-2018 / 18:24:22 / Claus Gittinger"
+    "Modified: / 13-07-2018 / 14:46:29 / Claus Gittinger"
 !
 
 openWebBrowserOnIt