Tools__CodeNavigationService.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 19 Sep 2013 10:20:29 +0100
branchjv
changeset 13609 8b400fde34ef
parent 13491 b3afe831ff0a
parent 13536 c7a7ca8afcdd
child 13613 066908b0c801
permissions -rw-r--r--
Merged f0126e42bbef and 452d89fab1a3 (branch default - CVS HEAD)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10076
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     2
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     3
              All Rights Reserved
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10076
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     5
Permission is hereby granted, free of charge, to any person
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     6
obtaining a copy of this software and associated documentation
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     7
files (the 'Software'), to deal in the Software without
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     8
restriction, including without limitation the rights to use,
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
     9
copy, modify, merge, publish, distribute, sublicense, and/or sell
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    10
copies of the Software, and to permit persons to whom the
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    11
Software is furnished to do so, subject to the following
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    12
conditions:
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    13
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    14
The above copyright notice and this permission notice shall be
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    15
included in all copies or substantial portions of the Software.
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    16
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    17
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    18
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    19
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    20
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    21
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    22
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    24
OTHER DEALINGS IN THE SOFTWARE.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"{ NameSpace: Tools }"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
CodeViewService subclass:#CodeNavigationService
13533
827c4bb6abbe class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13463
diff changeset
    31
	instanceVariableNames:'lastHighlightedElement selectorEmphasis variableEmphasis
827c4bb6abbe class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13463
diff changeset
    32
		currentEmphasis currentEmphasisForAssign linesToRedraw menuShown
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    33
		assignmentEmphasis'
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    34
	classVariableNames:'DefaultVariableEmphasis DefaultSelectorEmphasis
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    35
		DefaultAssignmentEmphasis'
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
	poolDictionaries:''
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
	category:'Interface-CodeView'
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!CodeNavigationService class methodsFor:'documentation'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
copyright
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
10076
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    44
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    45
              All Rights Reserved
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    46
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    47
Permission is hereby granted, free of charge, to any person
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    48
obtaining a copy of this software and associated documentation
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    49
files (the 'Software'), to deal in the Software without
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    50
restriction, including without limitation the rights to use,
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    51
copy, modify, merge, publish, distribute, sublicense, and/or sell
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    52
copies of the Software, and to permit persons to whom the
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    53
Software is furnished to do so, subject to the following
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    54
conditions:
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
10076
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    56
The above copyright notice and this permission notice shall be
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    57
included in all copies or substantial portions of the Software.
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    58
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    59
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    60
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    61
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    62
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    63
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    64
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    65
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6d9055a907ff changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9979
diff changeset
    66
OTHER DEALINGS IN THE SOFTWARE.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!CodeNavigationService class methodsFor:'accessing'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
label
13103
307e48c216de class: Tools::LintService
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
    73
    "Answers a short label - for UI"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    ^'Semi-modal Code Navigation'
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    "Created: / 07-03-2010 / 14:00:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10412
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    78
!
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    79
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    80
requiredServices
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    81
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    82
    ^#(#'Tools::CodeHighlightingService')
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    83
cc7a72f29805 Fixes for debugger
vrany
parents: 10361
diff changeset
    84
    "Created: / 27-07-2011 / 11:40:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
!CodeNavigationService class methodsFor:'accessing - defaults'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    89
defaultAssignmentEmphasis
13109
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
    90
    "must only define a background - otherwise, syntax highlight fg is lost"
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
    91
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    92
    DefaultAssignmentEmphasis isNil ifTrue:[
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    93
        ^ Array with:(#backgroundColor -> (UserPreferences current assignmentBackgroundColorForNavigationService))
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    94
    ].
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    95
    ^ DefaultAssignmentEmphasis
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    96
!
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
    97
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
defaultSelectorEmphasis
13109
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
    99
    "must only define a background - otherwise, syntax highlight fg is lost"
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   100
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   101
    DefaultSelectorEmphasis isNil ifTrue:[
12486
0a82f2fcb6b3 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12485
diff changeset
   102
        ^ Array with:(#backgroundColor -> (UserPreferences current selectorBackgroundColorForNavigationService))
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   103
    ].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   104
    ^ DefaultSelectorEmphasis
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   105
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   106
    "Modified: / 21-08-2011 / 09:58:18 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
defaultVariableEmphasis
13109
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   110
    "must only define a background - otherwise, syntax highlight fg is lost"
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   111
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   112
    DefaultVariableEmphasis isNil ifTrue:[
12486
0a82f2fcb6b3 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12485
diff changeset
   113
        ^ Array with:(#backgroundColor -> (UserPreferences current variableBackgroundColorForNavigationService))
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   114
    ].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   115
    ^ DefaultVariableEmphasis
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    "Created: / 25-06-2010 / 13:56:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   118
    "Modified: / 21-08-2011 / 11:04:20 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
13203
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   121
!CodeNavigationService class methodsFor:'testing'!
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   122
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   123
isUsefulFor:aCodeView
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   124
    "this filters useful services.
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   125
     Redefined to return true for myself - not for subclasses"
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   126
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   127
    ^ self == Tools::CodeNavigationService
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   128
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   129
    "Created: / 22-07-2013 / 13:59:20 / cg"
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   130
! !
909820bee403 class: Tools::XXXService
Claus Gittinger <cg@exept.de>
parents: 13109
diff changeset
   131
10651
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   132
!CodeNavigationService methodsFor:'change & update'!
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   133
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   134
update: aspect with: param from: sender
10661
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   135
    sender == textView modifiedChannel ifTrue:[
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   136
        codeView reallyModified ifTrue:[
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   137
            "/ no longer highlight - the info is wrong anyway !!
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   138
            self highlightClear.
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   139
        ].
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   140
    ].
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   141
10653
0f30edd43161 changed halt to breakPoint: in #update:with:from:
vrany
parents: 10651
diff changeset
   142
    "JV: I changed 'halt' to 'breakPoint: #cg'"
10651
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   143
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   144
    "Created: / 22-08-2011 / 16:22:19 / cg"
10653
0f30edd43161 changed halt to breakPoint: in #update:with:from:
vrany
parents: 10651
diff changeset
   145
    "Modified: / 25-08-2011 / 15:10:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10661
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   146
    "Modified: / 05-09-2011 / 05:15:42 / cg"
10651
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   147
! !
7ab02ade36e2 added: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 10631
diff changeset
   148
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
!CodeNavigationService methodsFor:'code services'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   151
browseClass:class 
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   152
    self browser isNil ifTrue:[ ^ NewSystemBrowser browseClass:class ].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    (UserPreferences current alwaysOpenNewTabWhenCtrlClick 
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   154
        or:[ self browser navigationState modified ]) 
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   155
            ifTrue:[
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   156
                self browser 
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   157
                    spawnFullBrowserInClass:class
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   158
                    selector:nil
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   159
                    in:#newBuffer
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   160
            ]
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   161
            ifFalse:[ self browser switchToClass:class ]
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    "Created: / 15-02-2010 / 09:36:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    "Modified: / 25-07-2010 / 11:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   165
    "Modified: / 21-08-2011 / 10:07:30 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
browser
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    ^codeView browserHolder value
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    "Created: / 06-03-2010 / 21:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!CodeNavigationService methodsFor:'event handling'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
button1Press
12171
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   178
    | node |
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
12171
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   180
    node := codeView currentParseNode.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   181
    node isNil ifTrue:[ 
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   182
        ^ self 
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   183
    ].
12171
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   184
    node isSelector ifTrue:[
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   185
        self button1PressForMessageNode: node.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   186
        ^self.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   187
    ].
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   188
    node isVariable ifTrue:[
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   189
        self button1PressForVariableNode: node.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   190
        ^self.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   191
    ].
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   192
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   193
    ^self.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    "Created: / 14-02-2010 / 18:43:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10878
3424d00f9155 changed:
Claus Gittinger <cg@exept.de>
parents: 10727
diff changeset
   196
    "Modified: / 18-11-2011 / 14:58:02 / cg"
12171
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   197
    "Modified: / 21-02-2012 / 14:30:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   198
!
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   199
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   200
button1PressForMessageNode: node
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   201
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   202
    ^self button1PressForSelector: node parent selector.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   203
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   204
    "Created: / 21-02-2012 / 14:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
button1PressForSelector: selector
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   208
    | impls |
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
10254
43001ebe1490 Merged with JV's branch
vrany
parents: 10076
diff changeset
   210
    impls := codeView implementorsOf: selector.
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   211
    "/ impls size = 1 ifTrue:[^codeView browseMethod: impls anyOne].
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   212
    [
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   213
        menuShown := codeView implementorsMenu: impls selector: selector.
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   214
        "/ cg: why is this done?
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   215
        "/ self highlightClear.
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   216
        menuShown showAtPointer.
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   217
    ] ensure:[
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   218
        menuShown := nil
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   219
    ].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    "Created: / 14-02-2010 / 18:50:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10254
43001ebe1490 Merged with JV's branch
vrany
parents: 10076
diff changeset
   222
    "Modified: / 30-06-2011 / 19:34:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10271
44c51d135362 changed: #button1PressForSelector: bug fix
vrany
parents: 10254
diff changeset
   223
    "Modified: / 07-07-2011 / 17:16:23 / jv"
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   224
    "Modified (comment): / 29-08-2013 / 16:27:58 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
12171
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   227
button1PressForVariableNode: node
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   228
    | value |
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
12171
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   230
    node isGlobalVariable ifTrue:[
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   231
        value := Smalltalk at: node name.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   232
        value notNil ifTrue:[
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   233
            value isBehavior ifTrue:[
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   234
                self browseClass: value.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   235
            ] ifFalse:[
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   236
                value inspect.
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   237
            ]
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   238
        ]
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   239
    ]
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   240
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   241
    "Created: / 21-02-2012 / 14:30:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   242
!
09f6735e294b Fixes in CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12170
diff changeset
   243
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
button2Press
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    | sel |
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    sel := codeView syntaxElementSelection.
12176
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12171
diff changeset
   248
    (sel notNil and:[sel node isMessage]) ifTrue:[^self button2PressForSelector: sel node selector].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    "Created: / 14-02-2010 / 18:43:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12176
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12171
diff changeset
   251
    "Modified: / 08-03-2012 / 16:49:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
button2PressForSelector: selector
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   255
    | senders |
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
13422
86835045a828 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   257
    [
86835045a828 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   258
        senders := codeView sendersOf: selector.
86835045a828 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   259
    ] valueWithTimeout:(500 milliseconds). 
86835045a828 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   260
    senders isNil ifTrue:[^ self].
86835045a828 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   261
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   262
    "/ senders size = 1 ifTrue:[ codeView browseMethod: senders anyOne. ^ self].
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   263
    [
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   264
        menuShown := codeView sendersMenu: senders selector: selector.
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   265
        "/ cg: why is this done?
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   266
        "/ self highlightClear.
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   267
        menuShown showAtPointer.
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   268
    ] ensure:[
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   269
        menuShown := nil.
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   270
    ].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    "Created: / 14-02-2010 / 18:50:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10254
43001ebe1490 Merged with JV's branch
vrany
parents: 10076
diff changeset
   273
    "Modified: / 30-06-2011 / 19:34:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   274
    "Modified: / 28-08-2013 / 21:59:26 / cg"
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   275
    "Modified (comment): / 29-08-2013 / 16:28:03 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   278
buttonMotion:button x:x y:y in:view 
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    "Handles an event in given view (a subview of codeView).
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
     If the method returns true, the event will not be processed
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
     by the view."
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   282
    
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   283
    (view == textView and:[ textView sensor metaDown ]) ifTrue:[
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   284
        self highlightElementAtX:x y:y.
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   285
        ^ true
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   286
    ].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   287
    ^ false
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    "Created: / 06-03-2010 / 20:40:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   290
    "Modified (format): / 21-08-2011 / 10:07:15 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
buttonPress: button x:x y:y in: view
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    "Handles an event in given view (a subview of codeView).
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
     If the method returns true, the event will not be processed
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
     by the view."
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   299
    (view == textView) ifTrue:[
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   300
        textView isQuickMenuModifierPressed ifTrue:[
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   301
            button == 1      ifTrue: [^self button1Press].
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   302
            button == #paste ifTrue: [^self button2Press].   
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   303
            button == 2      ifTrue: [^self button2Press]
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   304
        ] ifFalse:[
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   305
            button == 1 ifTrue:[
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   306
                self highlightVariableAtX:x y:y.
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   307
            ]
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
        ]
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   309
    ].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    ^false
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
    "Created: / 06-03-2010 / 21:12:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    "Modified: / 25-06-2010 / 14:53:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   314
    "Modified: / 29-08-2013 / 16:23:55 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
12867
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   317
buttonRelease: button x:x y:y in: view
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   318
    "Handles an event in given view (a subview of codeView).
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   319
     If the method returns true, the event will not be processed
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   320
     by the view."
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   321
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   322
    "/ if I show a quick senders/implementors menu, eat this event
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   323
    ^ menuShown notNil
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   324
!
03a18d91ded1 faster quick senders menu.
Claus Gittinger <cg@exept.de>
parents: 12486
diff changeset
   325
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   326
isQuickMenuModifierPressed
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   327
    ^ textView isQuickMenuModifierPressed
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   328
"/
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   329
"/    sensor := textView sensor.
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   330
"/    UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   331
"/        ^ sensor ctrlDown
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   332
"/    ].
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   333
"/    ^ sensor metaDown
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   334
13405
071eccc590bb class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13203
diff changeset
   335
    "Modified: / 28-08-2013 / 22:13:18 / cg"
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   336
!
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   337
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   338
isQuickMenuModifierReleased
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   339
    |sensor|
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   340
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   341
    sensor := textView sensor.
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   342
    UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   343
        ^ sensor ctrlDown not
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   344
    ].
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   345
    ^ sensor metaDown not
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   346
!
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   347
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
keyPress:key x:x y:y in:view 
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
    "Handles an event in given view (a subview of codeView).
10588
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   350
     If the method returns true, it has eaten the event and it will not be processed
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
     by the view."
10588
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   352
12105
44e930e29b99 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 11741
diff changeset
   353
    <resource: #keyboard (#Control_L #Ctrl 
44e930e29b99 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 11741
diff changeset
   354
                          #CursorRight #CursorDown #CursorLeft #CursorUp)>
44e930e29b99 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 11741
diff changeset
   355
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   356
    |ev p sensor|
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   357
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   358
    (view == textView) ifTrue:[
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   359
        sensor := view sensor.
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   360
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   361
        "/ ("ctrlDown" "key == #'Control_L' or:[ key == #Ctrl ]") ifTrue:[
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   362
        (textView isQuickMenuModifierPressed) ifTrue:[
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   363
            "/ because it is delegated, the position is not correct
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   364
            ev := WindowGroup lastEventQuerySignal query.
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   365
            p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view.
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   366
            sensor 
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   367
                pushUserEvent:#highlightElementAtX:y: 
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   368
                for: self 
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   369
                withArguments:{p x. p y.}.
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   370
            ^ false "/ true. -- no, dont eat the key
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
        ].
10661
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   372
10709
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   373
"/        codeView reallyModified "textView modified" ifTrue:[
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   374
"/            self highlightClear. 
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   375
"/            codeView syntaxElements: nil.
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   376
"/            ^ false
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   377
"/        ].
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   378
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   379
        sensor metaDown ifTrue:[
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   380
            (key == #CursorRight or:[key == #CursorDown]) ifTrue:[
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   381
                sensor pushUserEvent:#findNextVariableFromCursor for:self.
12930
658aaa9b2245 class: Tools::CodeNavigationService
Stefan Vogel <sv@exept.de>
parents: 12913
diff changeset
   382
            ] ifFalse:[(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   383
                sensor pushUserEvent:#findPreviousVariableFromCursor for:self.
12930
658aaa9b2245 class: Tools::CodeNavigationService
Stefan Vogel <sv@exept.de>
parents: 12913
diff changeset
   384
            ]].
10709
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   385
        ] ifFalse:[
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   386
            (key == #CursorRight
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   387
              or:[key == #CursorDown
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   388
              or:[key == #CursorLeft
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   389
              or:[key == #CursorUp]]]
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   390
            ) ifTrue:[
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   391
                sensor pushUserEvent:#highlightVariableAtCursor for:self .
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   392
            ] ifFalse:[
13463
3b75183ce219 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   393
                "/ sensor pushUserEvent:#highlightClear for:self .
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   394
            ]
10709
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   395
        ]
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
    ].
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    ^ false
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
    "Created: / 06-03-2010 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10661
367196dfc3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 10653
diff changeset
   400
    "Modified: / 05-09-2011 / 05:17:30 / cg"
10727
b2fc73a2b1fe Try to fix the redraw bug
vrany
parents: 10709
diff changeset
   401
    "Modified: / 27-09-2011 / 19:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
keyRelease: key x:x y:y in: view
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
    "Handles an event in given view (a subview of codeView).
10588
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   406
     If the method returns true, it has eaten the event and it will not be processed
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
     by the view."
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   409
    |ev p|
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   410
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   411
    (view == textView and:[textView isQuickMenuModifierReleased]) ifTrue:[
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   412
        "/    (view == textView and:[key == #'Control_L' or:[key == #Ctrl]]) ifTrue:[
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   413
        "/ because it is delegated, the position is not correct
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   414
        ev := WindowGroup lastEventQuerySignal query.
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   415
        p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view.
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   416
 "/       self highlightClear. 
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   417
"/        view sensor pushUserEvent:#highlightClear for:self. 
12353
9d725076871b changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents: 12105
diff changeset
   418
        ^ false "/ true -- do not eat the event
10588
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   419
    ].
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   420
    ^ false
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
    "Created: / 06-03-2010 / 21:03:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   423
    "Modified: / 21-08-2011 / 11:32:40 / cg"
10709
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   424
!
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   425
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   426
linesDeletedFrom: start to: end
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   427
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   428
    self highlightClear
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   429
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   430
    "Created: / 06-07-2011 / 17:14:36 / jv"
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   431
    "Created: / 16-09-2011 / 15:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   432
!
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   433
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   434
linesInsertedFrom: start to: end
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   435
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   436
    self highlightClear
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   437
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   438
    "Created: / 06-07-2011 / 17:14:36 / jv"
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   439
    "Created: / 16-09-2011 / 15:39:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   440
!
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   441
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   442
linesModifiedFrom: start to: end
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   443
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   444
    self highlightClear
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   445
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   446
    "Created: / 06-07-2011 / 17:14:36 / jv"
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   447
    "Created: / 16-09-2011 / 15:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
!CodeNavigationService methodsFor:'initialization'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
initialize
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
    super initialize.
13109
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   455
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   456
    "the following must only define a background - otherwise, syntax highlight fg is lost"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
    selectorEmphasis := self class defaultSelectorEmphasis.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
    variableEmphasis := self class defaultVariableEmphasis.
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   459
    assignmentEmphasis := self class defaultAssignmentEmphasis.
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   460
    linesToRedraw := OrderedCollection new.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
    "Created: / 25-06-2010 / 14:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
12994
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   465
!CodeNavigationService methodsFor:'misc'!
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   466
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   467
highlightInstanceVariable:name
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   468
    |element|
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   469
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   470
    element := (codeView syntaxElements ? #()) 
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   471
                    detect:[:e |     
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   472
                        e isVariable
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   473
                        and:[ e isInstanceVariable
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   474
                        and:[ e name = name ]]
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   475
                    ] ifNone:nil.
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   476
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   477
    self highlightClear.
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   478
    codeView syntaxElementSelection:nil.
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   479
    self highlightVariable:element.
12994
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   480
! !
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   481
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
!CodeNavigationService methodsFor:'private'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
elementAtCursor
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    ^self elementAtLine: textView cursorLine col: textView cursorCol - 1
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
    "Created: / 25-06-2010 / 14:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   490
elementAtLine:line col:colArg 
11740
fa674978dc41 changed:
Stefan Vogel <sv@exept.de>
parents: 10878
diff changeset
   491
    |characterPosition syntaxElements index element col|
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   492
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   493
    "/ if beyond end of line, do not advance into next line
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   494
    col := colArg min:(textView listAt:line) size.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    characterPosition := textView characterPositionOfLine:line col:col.
11740
fa674978dc41 changed:
Stefan Vogel <sv@exept.de>
parents: 10878
diff changeset
   497
    syntaxElements := codeView syntaxElements.
11741
3b6f1c31139f changed:
Stefan Vogel <sv@exept.de>
parents: 11740
diff changeset
   498
    syntaxElements isEmptyOrNil ifTrue:[
3b6f1c31139f changed:
Stefan Vogel <sv@exept.de>
parents: 11740
diff changeset
   499
        ^ nil.
3b6f1c31139f changed:
Stefan Vogel <sv@exept.de>
parents: 11740
diff changeset
   500
    ].
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   501
    0"1" to:0 by:-1 do:[:d |
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   502
        index := (syntaxElements indexForInserting:characterPosition) - d.
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   503
        index > syntaxElements size ifTrue:[^nil].
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   504
        element := syntaxElements at:index ifAbsent:nil.
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   505
        element notNil ifTrue:[
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   506
            (characterPosition between: element start - 1 and: element stop) ifTrue:[^element].
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   507
        ].
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   508
    ].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   509
    ^nil
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
    "Created: / 25-06-2010 / 14:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   512
    "Modified: / 21-08-2011 / 11:03:29 / cg"
10709
e3257bcab5de Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents: 10661
diff changeset
   513
    "Modified: / 16-09-2011 / 17:04:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
elementAtX:x y:y 
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
    |visibleLine line col|
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   519
    codeView syntaxElements isNil ifTrue:[^nil].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   520
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
    visibleLine := textView visibleLineOfY:y.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
    col := textView colOfX:x inVisibleLine:visibleLine.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    line := textView visibleLineToAbsoluteLine:visibleLine.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
    ^self elementAtLine:line col:col
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    "Created: / 25-06-2010 / 14:52:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
    "Modified: / 01-08-2010 / 08:50:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   528
    "Modified: / 21-08-2011 / 10:26:08 / cg"
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   529
!
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   530
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   531
foo
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   532
|characterPosition index element |
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   533
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   534
characterPosition := 1
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   535
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   536
    "Created: / 21-08-2011 / 10:48:05 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
highlighEmphasisFor: element
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
10878
3424d00f9155 changed:
Claus Gittinger <cg@exept.de>
parents: 10727
diff changeset
   541
    element isNil ifTrue:[^nil].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   543
    element isSelector ifTrue:[^selectorEmphasis].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   544
    element isVariable ifTrue:[^variableEmphasis].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   545
    element isSelf     ifTrue:[^variableEmphasis].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    ^nil
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
    "Created: / 25-06-2010 / 13:54:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10878
3424d00f9155 changed:
Claus Gittinger <cg@exept.de>
parents: 10727
diff changeset
   550
    "Modified: / 18-11-2011 / 14:58:05 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
highlightClear
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   555
    ^self highlightClear: true.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
    "Modified: / 26-12-2007 / 12:28:05 / janfrog"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
    "Created: / 25-06-2010 / 14:15:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10276
068f02c67fd7 changed:
Claus Gittinger <cg@exept.de>
parents: 10271
diff changeset
   559
    "Modified: / 08-07-2011 / 08:50:45 / cg"
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   560
    "Modified: / 20-07-2011 / 18:52:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   563
highlightClear: redraw
13534
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   564
    lastHighlightedElement := nil.
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   565
    codeView syntaxElementSelection == nil ifTrue:[ ^ self ].
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   566
10878
3424d00f9155 changed:
Claus Gittinger <cg@exept.de>
parents: 10727
diff changeset
   567
    textView list isNil ifTrue:[ ^ self ].
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   568
    textView list withIndexDo:[:line :lineNo | 
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   569
        line isText ifTrue:[ 
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   570
            (line hasEmphasis: currentEmphasis) ifTrue:[
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   571
                line emphasisAllRemove:currentEmphasis.
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   572
                linesToRedraw add: lineNo.
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   573
            ] ifFalse:[
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   574
                (currentEmphasisForAssign notNil and:[line hasEmphasis: currentEmphasisForAssign]) ifTrue:[
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   575
                    line emphasisAllRemove:currentEmphasisForAssign.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   576
                    linesToRedraw add: lineNo.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   577
                ]
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   578
            ]
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   579
        ] 
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   580
    ].
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   581
    codeView syntaxElementSelection:nil.
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   582
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   583
    redraw ifTrue:[self redrawLines].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   585
    "Modified: / 26-12-2007 / 12:28:05 / janfrog"
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   586
    "Created: / 20-07-2011 / 18:52:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10878
3424d00f9155 changed:
Claus Gittinger <cg@exept.de>
parents: 10727
diff changeset
   587
    "Modified: / 18-11-2011 / 14:58:08 / cg"
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   588
!
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   589
13534
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   590
highlightElement:element
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   591
    "walk through the chain of element and highlight each"
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   592
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   593
    |e savedEmphasis currentSelection highlightSingle|
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   594
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   595
    (currentSelection := codeView syntaxElementSelection) == element ifTrue:[ ^ self ]. "/ no change
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   596
    currentSelection notNil ifTrue:[
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   597
        self highlightClear: false.
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   598
    ].
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   599
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   600
    currentEmphasis := savedEmphasis := self highlighEmphasisFor:element.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   601
    currentEmphasisForAssign := nil.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   602
13534
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   603
    highlightSingle :=
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   604
        [:e |
12986
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   605
            e assigned ifTrue:[
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   606
                [
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   607
                    currentEmphasis := currentEmphasisForAssign := assignmentEmphasis.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   608
                    self highlightWithoutClearFrom:e start to:e stop.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   609
                ] ensure:[
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   610
                    currentEmphasis := savedEmphasis.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   611
                ].
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   612
            ] ifFalse:[
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   613
                self highlightWithoutClearFrom:e start to:e stop.
145d28bf105e class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12930
diff changeset
   614
            ].
13534
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   615
        ].
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   616
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   617
    element notNil ifTrue:[ 
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   618
        codeView syntaxElementSelection:element.
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   619
        e := element firstElementInChain.
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   620
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   621
        "/ cg: I thought that this would work, to speedup up the case, where the same
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   622
        "/ element is to be highlighted again (it does, but now, it does not correctly
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   623
        "/ redraw in some situations)
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   624
        "/ can someone check this?
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   625
        false ifTrue:[
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   626
            e == lastHighlightedElement ifTrue:[
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   627
                "/ same chain
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   628
                highlightSingle value:element.
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   629
                ^ self
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   630
            ].
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   631
            lastHighlightedElement := e.    "/ remember
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   632
        ].
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   633
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   634
        [ e notNil ] whileTrue:[
e9982215307d class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
   635
            highlightSingle value:e.
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   636
            e := e nextElement 
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   637
        ].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   638
    ].
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   639
    self redrawLines.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
    "Created: / 14-02-2010 / 16:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   642
    "Modified: / 20-07-2011 / 18:52:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   643
    "Modified: / 21-08-2011 / 10:22:58 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
highlightElementAtCursor
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    self highlightElementAtLine: textView cursorLine col: textView cursorCol
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
    "Created: / 14-02-2010 / 16:17:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
    "Modified: / 06-03-2010 / 19:59:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
highlightElementAtLine:line col:col 
13536
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   654
    |characterPosition syntaxElements index elementOrNil|
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
    characterPosition := textView characterPositionOfLine:line col:col.
11740
fa674978dc41 changed:
Stefan Vogel <sv@exept.de>
parents: 10878
diff changeset
   657
    syntaxElements := codeView syntaxElements.
13536
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   658
    syntaxElements isEmptyOrNil ifTrue:[
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   659
        elementOrNil := nil.
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   660
    ] ifFalse:[
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   661
        index := syntaxElements indexForInserting:characterPosition.
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   662
        index > syntaxElements size ifTrue:[
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   663
            elementOrNil := nil.
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   664
        ] ifFalse:[
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   665
            elementOrNil := syntaxElements at:index.
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   666
            (characterPosition between: elementOrNil start and: elementOrNil stop) ifFalse:[
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   667
                elementOrNil := nil
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   668
            ].
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   669
        ]
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   670
    ].
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   671
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   672
    self highlightElement:elementOrNil
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
    "Created: / 14-02-2010 / 16:17:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
    "Modified: / 01-08-2010 / 08:50:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
highlightElementAtX:x y:y 
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
    |visibleLine line col|
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   681
    codeView syntaxElements isNil ifTrue:[^self].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
    visibleLine := textView visibleLineOfY:y.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
    col := textView colOfX:x inVisibleLine:visibleLine.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    line := textView visibleLineToAbsoluteLine:visibleLine.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
    self highlightElementAtLine:line col:col
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
    "Created: / 14-02-2010 / 16:12:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
    "Modified: / 06-03-2010 / 20:06:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   689
    "Modified: / 21-08-2011 / 10:22:10 / cg"
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   690
!
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   691
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   692
highlightElementOrNil:e
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   693
    e notNil ifTrue:[
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   694
        "/ cg: only if selected !!
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   695
        "/ self halt.
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   696
        self highlightElement:e.
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   697
    ] ifFalse:[
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   698
        self highlightClear
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   699
    ].
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   700
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   701
    "Created: / 25-06-2010 / 14:52:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   702
    "Created: / 21-08-2011 / 09:56:39 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
highlightLine:lineNo fromLine:startLine col:endLine toLine:startCol col:endCol
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
    |line start end|
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   708
    (lineNo between:startLine and:endLine) ifFalse:[ ^ self ].
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   709
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
    line := textView listAt:lineNo.
10291
af5825474e18 changed: #highlightLine:fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 10276
diff changeset
   711
    line isEmpty ifTrue:[^self].
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   712
    start := (lineNo = startLine) 
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   713
                ifTrue:[ startCol  ] 
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   714
                ifFalse:[ line indexOfNonSeparator ].
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   715
    end := (lineNo = endLine) 
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   716
                ifTrue:[ endCol ] 
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   717
                ifFalse:[ line size ].
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   718
    line setRuns:(line runs asArray).
13178
c9bf900fe729 Merged f8f283ea3f4c and 131bed1fbee2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13173 12997
diff changeset
   719
    "/ JV: CG commented following and added the commtent code below.
c9bf900fe729 Merged f8f283ea3f4c and 131bed1fbee2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13173 12997
diff changeset
   720
    "/     however, this clear all other emphasis like bold, color and so on!!
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
    line 
13109
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   722
        emphasisFrom:(start max: 1)
10291
af5825474e18 changed: #highlightLine:fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 10276
diff changeset
   723
        to:(end min: line size)
13109
3eeb533e3874 codeView2 fixes
Claus Gittinger <cg@exept.de>
parents: 13103
diff changeset
   724
        add: currentEmphasis.
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   725
"/    line 
13178
c9bf900fe729 Merged f8f283ea3f4c and 131bed1fbee2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13173 12997
diff changeset
   726
"/        emphasizeFrom:(start max: 1)
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   727
"/        to:(end min: line size)
13178
c9bf900fe729 Merged f8f283ea3f4c and 131bed1fbee2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13173 12997
diff changeset
   728
"/        with: currentEmphasis.
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   729
    line setRuns:(line runs asRunArray).                              
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   730
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   731
    linesToRedraw add: lineNo.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
    "Created: / 25-06-2010 / 14:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10291
af5825474e18 changed: #highlightLine:fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 10276
diff changeset
   734
    "Modified: / 08-07-2011 / 13:02:51 / cg"
13178
c9bf900fe729 Merged f8f283ea3f4c and 131bed1fbee2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13173 12997
diff changeset
   735
    "Modified: / 01-07-2013 / 22:09:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
12994
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   738
highlightVariable:element 
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   739
    (element notNil and:[ element isVariableOrSelf ]) ifTrue:[
0899f74ec3ce class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
   740
        self highlightElement:element.
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
    ] ifFalse:[
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
        self highlightClear.
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   743
    ].
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   744
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   745
    "Modified: / 20-07-2011 / 18:54:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   746
    "Modified: / 21-08-2011 / 09:39:42 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
highlightVariableAtCursor
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   750
    self highlightElementOrNil:(self elementAtCursor)
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
    "Modified: / 25-06-2010 / 14:53:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   753
    "Modified: / 21-08-2011 / 09:56:56 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
highlightVariableAtX:x y:y 
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   757
    self highlightElementOrNil:(self elementAtX:x y:y).
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
    "Created: / 25-06-2010 / 14:52:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10631
7639ba8f13da fixed highlighting
Claus Gittinger <cg@exept.de>
parents: 10588
diff changeset
   760
    "Modified: / 21-08-2011 / 10:24:50 / cg"
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
highlightWithoutClearFrom: start to: end
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
    "Remove underlined emphasis"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
    |startLine startCol endLine endCol|
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
    startLine := textView lineOfCharacterPosition:start.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
    startCol := start - (textView characterPositionOfLine:startLine col:1) + 1.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
    endLine := textView lineOfCharacterPosition:end.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
    endCol := end - (textView characterPositionOfLine:endLine col:1) + 1.
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
    self highlightWithoutClearFromLine: startLine col: startCol toLine: endLine col: endCol
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
    "Created: / 25-06-2010 / 14:15:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
highlightWithoutClearFromLine: startLine col: startCol toLine: endLine col: endCol 
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
12913
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   779
    textView list keysAndValuesDo: [:lineNo :line|
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   780
        line isText ifTrue: [
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   781
            self highlightLine: lineNo fromLine: startLine col: endLine toLine: startCol col: endCol
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   782
        ]
c5fdb1a82ed1 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
   783
    ].
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
    "Created: / 25-06-2010 / 14:15:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
! !
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   788
!CodeNavigationService methodsFor:'redrawing'!
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   789
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   790
redrawLines
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   791
    linesToRedraw do:[:lineNo|
10588
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   792
        textView invalidateLine: lineNo.
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   793
    ].
12997
f03191d56013 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12994
diff changeset
   794
    linesToRedraw := OrderedCollection new
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   795
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   796
    "Created: / 20-07-2011 / 18:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10588
Claus Gittinger <cg@exept.de>
parents: 10412
diff changeset
   797
    "Modified (format): / 18-08-2011 / 16:01:34 / cg"
10361
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   798
! !
1443a20ddac2 Navigation redrawing optimized a bit...
vrany
parents: 10291
diff changeset
   799
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
!CodeNavigationService class methodsFor:'documentation'!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
12486
0a82f2fcb6b3 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12485
diff changeset
   802
version
13536
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   803
    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.37 2013-09-09 11:21:15 cg Exp $'
12486
0a82f2fcb6b3 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12485
diff changeset
   804
!
0a82f2fcb6b3 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 12485
diff changeset
   805
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
version_CVS
13536
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   807
    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.37 2013-09-09 11:21:15 cg Exp $'
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
!
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
12431
9f0c59c742d5 Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12406
diff changeset
   810
version_HG
9f0c59c742d5 Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12406
diff changeset
   811
9f0c59c742d5 Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12406
diff changeset
   812
    ^ '$Changeset: <not expanded> $'
9f0c59c742d5 Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12406
diff changeset
   813
!
9f0c59c742d5 Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12406
diff changeset
   814
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
version_SVN
13536
c7a7ca8afcdd class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 13534
diff changeset
   816
    ^ '$Id: Tools__CodeNavigationService.st,v 1.37 2013-09-09 11:21:15 cg Exp $'
9979
00b306851c88 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
! !
12105
44e930e29b99 class: Tools::CodeNavigationService
Claus Gittinger <cg@exept.de>
parents: 11741
diff changeset
   818