equal
deleted
inserted
replaced
13 |
13 |
14 "{ NameSpace: Tools }" |
14 "{ NameSpace: Tools }" |
15 |
15 |
16 ApplicationModel subclass:#StringSearchTool |
16 ApplicationModel subclass:#StringSearchTool |
17 instanceVariableNames:'searchTextHolder searchTextView searchBarImageInfoLabelHolder |
17 instanceVariableNames:'searchTextHolder searchTextView searchBarImageInfoLabelHolder |
18 searchBarInfoLabelHolder searchTextModifiedHolder |
18 searchBarInfoLabelHolder searchTextModifiedHolder matchCaseHolder |
19 ignoreCaseHolder closeBlock searchNextBlock searchPreviousBlock |
19 closeBlock searchNextBlock searchPreviousBlock restartHolder' |
20 restartHolder' |
20 classVariableNames:'LastMatchCase LastRestart' |
21 classVariableNames:'LastIgnoreCase LastRestart' |
|
22 poolDictionaries:'' |
21 poolDictionaries:'' |
23 category:'Interface-Tools' |
22 category:'Interface-Tools' |
24 ! |
23 ! |
25 |
24 |
26 !StringSearchTool class methodsFor:'documentation'! |
25 !StringSearchTool class methodsFor:'documentation'! |
71 " |
70 " |
72 ! ! |
71 ! ! |
73 |
72 |
74 !StringSearchTool class methodsFor:'accessing'! |
73 !StringSearchTool class methodsFor:'accessing'! |
75 |
74 |
76 lastIgnoreCase |
75 lastMatchCase |
77 |
76 |
78 ^ LastIgnoreCase ? true |
77 ^ LastMatchCase ? false |
79 ! |
78 ! |
80 |
79 |
81 lastIgnoreCase: aBoolean |
80 lastMatchCase: aBoolean |
82 |
81 |
83 LastIgnoreCase := aBoolean |
82 LastMatchCase := aBoolean |
84 ! |
83 ! |
85 |
84 |
86 lastRestart |
85 lastRestart |
87 |
86 |
88 ^ LastRestart ? false |
87 ^ LastRestart ? false |
363 ) |
362 ) |
364 (CheckBoxSpec |
363 (CheckBoxSpec |
365 label: 'Case' |
364 label: 'Case' |
366 name: 'DoNotIgnoreCaseCheckBox' |
365 name: 'DoNotIgnoreCaseCheckBox' |
367 layout: (LayoutFrame 360 0 1 0 553 0 23 0) |
366 layout: (LayoutFrame 360 0 1 0 553 0 23 0) |
368 model: doNotIgnoreCaseHolder |
367 model: matchCaseHolder |
369 translateLabel: true |
368 translateLabel: true |
370 ) |
369 ) |
371 (LabelSpec |
370 (LabelSpec |
372 label: 'SearchBarImageInfoLabel' |
371 label: 'SearchBarImageInfoLabel' |
373 name: 'SearchBarImageInfoLabel' |
372 name: 'SearchBarImageInfoLabel' |
402 |
401 |
403 closeBlock:something |
402 closeBlock:something |
404 closeBlock := something. |
403 closeBlock := something. |
405 ! |
404 ! |
406 |
405 |
|
406 ignoreCase |
|
407 |
|
408 ^ self matchCaseHolder value not |
|
409 ! |
|
410 |
407 initialSearchString: aString |
411 initialSearchString: aString |
408 |
412 |
409 self searchTextHolder value: aString. |
413 self searchTextHolder value: aString. |
410 ! |
414 ! |
411 |
415 |
434 searchPreviousBlock := something. |
438 searchPreviousBlock := something. |
435 ! ! |
439 ! ! |
436 |
440 |
437 !StringSearchTool methodsFor:'aspects'! |
441 !StringSearchTool methodsFor:'aspects'! |
438 |
442 |
439 doNotIgnoreCaseHolder |
443 matchCaseHolder |
440 ^ BlockValue forLogicalNot:self ignoreCaseHolder |
444 |
441 ! |
445 matchCaseHolder isNil ifTrue:[ |
442 |
446 matchCaseHolder := self class lastMatchCase asValue. |
443 ignoreCaseHolder |
|
444 |
|
445 ignoreCaseHolder isNil ifTrue:[ |
|
446 ignoreCaseHolder := self class lastIgnoreCase asValue. |
|
447 "/ if your app needs to be notified of changes, uncomment one of the lines below: |
447 "/ if your app needs to be notified of changes, uncomment one of the lines below: |
448 "/ ignoreCaseHolder addDependent:self. |
448 "/ matchCaseHolder addDependent:self. |
449 ignoreCaseHolder onChangeSend:#ignoreCaseHolderChanged to:self. |
449 matchCaseHolder onChangeSend:#matchCaseHolderChanged to:self. |
450 |
450 |
451 ]. |
451 ]. |
452 ^ ignoreCaseHolder. |
452 ^ matchCaseHolder. |
453 |
|
454 "Created: / 16-06-2007 / 06:45:04 / Administrador" |
|
455 "Modified: / 16-06-2007 / 19:32:15 / Administrador" |
|
456 ! |
453 ! |
457 |
454 |
458 restartHolder |
455 restartHolder |
459 |
456 |
460 restartHolder isNil ifTrue:[ |
457 restartHolder isNil ifTrue:[ |
506 "Created: / 15-06-2007 / 18:07:19 / Administrador" |
503 "Created: / 15-06-2007 / 18:07:19 / Administrador" |
507 ! ! |
504 ! ! |
508 |
505 |
509 !StringSearchTool methodsFor:'change & update'! |
506 !StringSearchTool methodsFor:'change & update'! |
510 |
507 |
511 ignoreCaseHolderChanged |
508 matchCaseHolderChanged |
512 |
509 |
513 self searchNextTextIncludingCurrentSelection: true. |
510 self searchNextTextIncludingCurrentSelection: true. |
514 self setFocusToSearchTextView. |
511 self setFocusToSearchTextView. |
515 self class lastIgnoreCase: self ignoreCaseHolder value. |
512 self class lastMatchCase: self matchCaseHolder value. |
516 ! |
513 ! |
517 |
514 |
518 processEvent:anEvent |
515 processEvent:anEvent |
519 searchTextView hasFocus ifFalse:[^ false]. |
516 searchTextView hasFocus ifFalse:[^ false]. |
520 |
517 |
637 self selectAllInSearchTextView. |
634 self selectAllInSearchTextView. |
638 ! |
635 ! |
639 |
636 |
640 searchNextTextReachEnd |
637 searchNextTextReachEnd |
641 |message| |
638 |message| |
642 message := 'End of list reached'. |
639 message := 'End of text reached'. |
643 self searchTextRestarted: message. |
640 self searchTextRestarted: message. |
644 Smalltalk beep. |
641 Smalltalk beep. |
645 |
642 |
646 self restartSearch ifTrue:[ |
643 self restartSearch ifTrue:[ |
647 message := message, ', starting from the beginning'. |
644 message := message, ', starting from the beginning'. |
651 ! |
648 ! |
652 |
649 |
653 searchPreviousTextReachBeginning |
650 searchPreviousTextReachBeginning |
654 |message| |
651 |message| |
655 |
652 |
656 message := 'Beginning of list reached'. |
653 message := 'Beginning of text reached'. |
657 self searchTextRestarted: message. |
654 self searchTextRestarted: message. |
658 Smalltalk beep. |
655 Smalltalk beep. |
659 |
656 |
660 self restartSearch ifTrue:[ |
657 self restartSearch ifTrue:[ |
661 message := message, ', starting from the end'. |
658 message := message, ', starting from the end'. |
722 searchNextTextFromBeginning |
719 searchNextTextFromBeginning |
723 |searchText ignoreCase| |
720 |searchText ignoreCase| |
724 |
721 |
725 searchText := searchTextView contents. |
722 searchText := searchTextView contents. |
726 searchText isEmptyOrNil ifTrue:[^self]. |
723 searchText isEmptyOrNil ifTrue:[^self]. |
727 ignoreCase := self ignoreCaseHolder value. |
724 ignoreCase := self ignoreCase. |
728 searchNextBlock isNil ifTrue:[^ self]. |
725 searchNextBlock isNil ifTrue:[^ self]. |
729 searchNextBlock value: self value: searchText value: ignoreCase value: #beginning |
726 searchNextBlock value: self value: searchText value: ignoreCase value: #beginning |
730 |
727 |
731 "/ self parent |
728 "/ self parent |
732 "/ searchNextTextFromBeginning: searchText |
729 "/ searchNextTextFromBeginning: searchText |
737 |searchText ignoreCase startPlace| |
734 |searchText ignoreCase startPlace| |
738 |
735 |
739 self searchTextStarted. |
736 self searchTextStarted. |
740 searchText := searchTextView contents. |
737 searchText := searchTextView contents. |
741 searchText isEmptyOrNil ifTrue:[^self]. |
738 searchText isEmptyOrNil ifTrue:[^self]. |
742 ignoreCase := self ignoreCaseHolder value. |
739 ignoreCase := self ignoreCase. |
743 searchNextBlock isNil ifTrue:[^ self]. |
740 searchNextBlock isNil ifTrue:[^ self]. |
744 startPlace := includeCurrentSelection ifTrue:[#current] ifFalse:[#includingCurrent]. |
741 startPlace := includeCurrentSelection ifTrue:[#current] ifFalse:[#includingCurrent]. |
745 searchNextBlock value: self value: searchText value: ignoreCase value: startPlace |
742 searchNextBlock value: self value: searchText value: ignoreCase value: startPlace |
746 |
743 |
747 "/ self parent |
744 "/ self parent |
756 |
753 |
757 self searchTextStarted. |
754 self searchTextStarted. |
758 searchText := searchTextView contents. |
755 searchText := searchTextView contents. |
759 "/ self setFocusToSearchTextView. |
756 "/ self setFocusToSearchTextView. |
760 searchText isEmptyOrNil ifTrue:[^self]. |
757 searchText isEmptyOrNil ifTrue:[^self]. |
761 ignoreCase := self ignoreCaseHolder value. |
758 ignoreCase := self ignoreCase. |
762 searchPreviousBlock isNil ifTrue:[^ self]. |
759 searchPreviousBlock isNil ifTrue:[^ self]. |
763 searchPreviousBlock value: self value: searchText value: ignoreCase value: #current. |
760 searchPreviousBlock value: self value: searchText value: ignoreCase value: #current. |
764 |
761 |
765 "/ self parent |
762 "/ self parent |
766 "/ searchPreviousText: searchText |
763 "/ searchPreviousText: searchText |
777 |
774 |
778 |searchText ignoreCase| |
775 |searchText ignoreCase| |
779 |
776 |
780 searchText := searchTextView contents. |
777 searchText := searchTextView contents. |
781 searchText isEmptyOrNil ifTrue:[^self]. |
778 searchText isEmptyOrNil ifTrue:[^self]. |
782 ignoreCase := self ignoreCaseHolder value. |
779 ignoreCase := self ignoreCase. |
783 searchPreviousBlock isNil ifTrue:[^ self]. |
780 searchPreviousBlock isNil ifTrue:[^ self]. |
784 searchPreviousBlock value: self value: searchText value: ignoreCase value: #end |
781 searchPreviousBlock value: self value: searchText value: ignoreCase value: #end |
785 |
782 |
786 "/ self parent |
783 "/ self parent |
787 "/ searchPreviousTextFromEnd: searchText |
784 "/ searchPreviousTextFromEnd: searchText |
789 ! ! |
786 ! ! |
790 |
787 |
791 !StringSearchTool class methodsFor:'documentation'! |
788 !StringSearchTool class methodsFor:'documentation'! |
792 |
789 |
793 version |
790 version |
794 ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchTool.st,v 1.15 2009-10-09 17:47:01 cg Exp $' |
791 ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchTool.st,v 1.16 2009-10-12 13:00:35 fm Exp $' |
795 ! |
792 ! |
796 |
793 |
797 version_CVS |
794 version_CVS |
798 ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchTool.st,v 1.15 2009-10-09 17:47:01 cg Exp $' |
795 ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchTool.st,v 1.16 2009-10-12 13:00:35 fm Exp $' |
799 ! ! |
796 ! ! |