author | Patrik Svestka <patrik.svestka@gmail.com> |
Wed, 14 Nov 2018 12:15:50 +0100 | |
branch | jv |
changeset 6509 | 110f6a02e2d5 |
parent 6360 | 1091acf82a3e |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
70 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2300
68fc714627e8
Remove leading and trailing whitwpsace when accepting a method.
Stefan Vogel <sv@exept.de>
parents:
2097
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
68fc714627e8
Remove leading and trailing whitwpsace when accepting a method.
Stefan Vogel <sv@exept.de>
parents:
2097
diff
changeset
|
13 |
|
5530 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
0 | 16 |
Workspace subclass:#CodeView |
6360
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
17 |
instanceVariableNames:'explainAction formatAction pointerOverWordAction theme' |
3022 | 18 |
classVariableNames:'' |
419 | 19 |
poolDictionaries:'' |
2097 | 20 |
category:'Views-Text' |
0 | 21 |
! |
22 |
||
32 | 23 |
!CodeView class methodsFor:'documentation'! |
24 |
||
38 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
70 | 28 |
All Rights Reserved |
38 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
32 | 39 |
documentation |
40 |
" |
|
125 | 41 |
a view for text which is known to be smalltalk code. |
419 | 42 |
It adds 'explain' to the menu, and defines another action: |
125 | 43 |
explainAction to be performed for explain. |
32 | 44 |
|
125 | 45 |
This action is to be defined by the user of this view |
917
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
46 |
(i.e. usually the owning browser) |
121 | 47 |
|
419 | 48 |
In addition, uncomment/comment are added to the controlMenu. |
49 |
These are smalltalk specific - if you plan to edit other language code, |
|
50 |
you need a different kind of CodeView for that. |
|
51 |
||
125 | 52 |
If used with a model, accept sends the changeMsg to it (as defined in EditTextView). |
419 | 53 |
(however, it is possible to define both changeMsg and acceptAction) |
123 | 54 |
|
419 | 55 |
See how doIt/printIt/inspectIt are handled in the superclass: Workspace. |
123 | 56 |
|
57 |
Caveat: |
|
419 | 58 |
in this version, CodeView does not yet support MVC setups for doIt |
59 |
and explain. |
|
60 |
If required, simulate this by setting the doItAction and |
|
61 |
explainAction, to notify the model manually about whats going on. |
|
583 | 62 |
|
917
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
63 |
[instance variables:] |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
64 |
commentStrings <Array> an array with 2 entries; |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
65 |
the first defining the EOL-comment string, |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
66 |
the 2nd (another array) defining opening |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
67 |
and closing comment strings. |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
68 |
Default to ST/X comments, |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
69 |
can be changed in an instance for other |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
70 |
programming languages. |
7b66af482567
generalized commenting/uncommenting.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
71 |
|
583 | 72 |
[author:] |
73 |
Claus Gittinger |
|
74 |
||
75 |
[see also:] |
|
76 |
Workspace EditTextView TextView |
|
32 | 77 |
" |
201 | 78 |
! ! |
79 |
||
4276 | 80 |
!CodeView class methodsFor:'others'! |
81 |
||
82 |
version_CVS |
|
5530 | 83 |
^ '$Header$' |
4276 | 84 |
! ! |
85 |
||
201 | 86 |
!CodeView methodsFor:'accessing'! |
87 |
||
88 |
explainAction:aBlock |
|
89 |
"set the action to be performed on explain" |
|
90 |
||
91 |
explainAction := aBlock |
|
1625 | 92 |
! |
93 |
||
94 |
formatAction:aBlock |
|
95 |
"set the action to be performed on format" |
|
96 |
||
97 |
formatAction := aBlock |
|
98 |
||
99 |
"Created: / 17.2.1998 / 17:05:13 / cg" |
|
1749
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
100 |
! |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
101 |
|
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
102 |
pointerOverWordAction:aBlock |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
103 |
pointerOverWordAction := aBlock. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
104 |
pointerOverWordAction notNil ifTrue:[ |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
105 |
self enableMotionEvents. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
106 |
] ifFalse:[ |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
107 |
self disableMotionEvents |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
108 |
] |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
109 |
|
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
110 |
|
201 | 111 |
! ! |
112 |
||
3021 | 113 |
!CodeView methodsFor:'cursor handling'! |
114 |
||
115 |
cursorReturn |
|
5530 | 116 |
self cursorReturn:false |
117 |
! |
|
118 |
||
119 |
cursorReturn:withPossibleAutoindent |
|
120 |
"added an argument to disable autoindent, because this method is called from other |
|
121 |
places as well..." |
|
122 |
||
3021 | 123 |
|wasOn line newCol | |
124 |
||
125 |
"/ make Jan's enhancement dependent on |
|
4594 | 126 |
"/ the autoIndent-flag setting - to avoid confusing |
3291 | 127 |
"/ those who are used to the old behavior. |
3021 | 128 |
"/ for Jan: |
4594 | 129 |
"/ autoIndent is configured in the settings-Editor dialog (for all new editors) |
130 |
"/ or in the per-editor popup menu (misc) |
|
131 |
"/ |
|
3022 | 132 |
"/ and saved/restored with the userPreferences. |
133 |
||
5530 | 134 |
(withPossibleAutoindent not |
135 |
or:[ autoIndent not |
|
4594 | 136 |
or:[ cursorLine == 1 |
5530 | 137 |
or:[ self sensor shiftDown]]]) ifTrue:[ |
3021 | 138 |
super cursorReturn. |
139 |
^ self. |
|
140 |
]. |
|
4813 | 141 |
"/ autoIndent |
4594 | 142 |
|
4813 | 143 |
wasOn := self hideCursor. |
144 |
"/ |
|
145 |
"/ line := self listAt:cursorLine. |
|
146 |
"/ newCol := line size == 0 |
|
147 |
"/ ifTrue:[1] |
|
148 |
"/ ifFalse:[line indexOfNonSeparator]. |
|
149 |
"/ super cursorReturn. |
|
150 |
"/ line := self listAt:cursorLine. |
|
151 |
"/ |
|
152 |
"/ newCol := line size == 0 |
|
153 |
"/ ifTrue:[newCol] |
|
154 |
"/ ifFalse:[line indexOfNonSeparator]. |
|
155 |
||
3021 | 156 |
super cursorReturn. |
4813 | 157 |
newCol := (self leftIndentForLine:cursorLine)+1. |
3021 | 158 |
|
3022 | 159 |
self setCursorCol:newCol. |
160 |
self makeCursorVisibleAndShowCursor:wasOn |
|
3021 | 161 |
|
162 |
"Created: / 8.8.2004 / 18:59:55 / janfrog" |
|
163 |
"Modified: / 8.8.2004 / 20:32:48 / janfrog" |
|
164 |
! ! |
|
165 |
||
201 | 166 |
!CodeView methodsFor:'event handling'! |
167 |
||
2382 | 168 |
buttonMotion:buttonState x:x y:y |
1749
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
169 |
|col line word| |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
170 |
|
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
171 |
pointerOverWordAction notNil ifTrue:[ |
2382 | 172 |
buttonState == 0 ifTrue:[ |
1749
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
173 |
line := self visibleLineOfY:y. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
174 |
col := self colOfX:x inVisibleLine:line. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
175 |
line := self visibleLineToAbsoluteLine:line. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
176 |
|
3891 | 177 |
self wordAtLine:line col:col do:[ |
178 |
:selectLine :beginCol :endLine :endCol :flag | |
|
179 |
||
1749
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
180 |
word := self listAt:selectLine from:beginCol to:endCol. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
181 |
word notNil ifTrue:[ |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
182 |
pointerOverWordAction value:word value:line value:col |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
183 |
] |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
184 |
]. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
185 |
^ self |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
186 |
]. |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
187 |
]. |
2382 | 188 |
super buttonMotion:buttonState x:x y:y |
1749
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
189 |
! |
0d0f27322523
hook for pointerOverWord actions (quick explain)
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
190 |
|
201 | 191 |
keyPress:key x:x y:y |
192 |
"catch keyboard shortcuts" |
|
193 |
||
4586 | 194 |
<resource: #keyboard (#Format #Explain #Help)> |
201 | 195 |
|
3798 | 196 |
(key == #Format) ifTrue:[self format. ^ self]. |
197 |
(key == #Explain) ifTrue:[self explain. ^ self]. |
|
198 |
(key == #Help) ifTrue:[self explain. ^ self]. |
|
201 | 199 |
|
200 |
super keyPress:key x:x y:y |
|
922 | 201 |
|
1625 | 202 |
"Modified: / 17.2.1998 / 17:05:23 / cg" |
32 | 203 |
! ! |
204 |
||
6360
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
205 |
!CodeView methodsFor:'initialization'! |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
206 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
207 |
initStyle |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
208 |
"initialize style specific stuff" |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
209 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
210 |
| theme | |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
211 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
212 |
super initStyle. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
213 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
214 |
theme := UserPreferences current codeViewTheme. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
215 |
theme notNil ifTrue:[ |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
216 |
fgColor := theme defaultSyntaxColor ? fgColor. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
217 |
bgColor := theme defaultSyntaxBackground ? bgColor. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
218 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
219 |
cursorFgColor := theme cursorColor. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
220 |
cursorBgColor := theme cursorBackground. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
221 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
222 |
]. |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
223 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
224 |
"Created: / 11-12-2017 / 17:30:07 / jv" |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
225 |
! ! |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
226 |
|
419 | 227 |
!CodeView methodsFor:'menu & menu actions'! |
228 |
||
229 |
accept |
|
230 |
"redefined accept action; |
|
231 |
save cursor and selection to allow restore in case of an error |
|
232 |
(we are typically compiling here ... and the compiler may show |
|
233 |
errors by highlighting them)" |
|
234 |
||
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
235 |
acceptEnabled == false ifTrue:[ |
3047
24bcca846c20
Send #beep to window instead of device
Stefan Vogel <sv@exept.de>
parents:
3022
diff
changeset
|
236 |
self beep. |
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
237 |
^ self |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
238 |
]. |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
239 |
|
419 | 240 |
codeStartPosition := 1. |
241 |
[ |
|
4866
1c27f7ed2e77
AbortSignal -> AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
4813
diff
changeset
|
242 |
AbortOperationRequest handle:[:ex | |
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
243 |
self cursor:Cursor normal. |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
244 |
"redraw selection in normal color" |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
245 |
self selectFromLine:selectionStartLine col:selectionStartCol |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
246 |
toLine:selectionEndLine col:selectionEndCol. |
4276 | 247 |
self invalidate. |
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
248 |
ex return |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
249 |
] do:[ |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
250 |
super accept. |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
251 |
] |
2522
d80496af7eaf
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2460
diff
changeset
|
252 |
] ensure:[ |
4276 | 253 |
self cursor:Cursor normal. |
254 |
"/ self unselect. |
|
419 | 255 |
] |
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
256 |
|
4276 | 257 |
"Modified: / 30-06-2011 / 19:41:39 / cg" |
419 | 258 |
! |
259 |
||
97 | 260 |
editMenu |
121 | 261 |
"return the popUpMenu; |
262 |
to make this independent from what is defined in superclasses, |
|
263 |
get the superclass menu and add my functions." |
|
131 | 264 |
|
2460 | 265 |
<resource: #keyboard ( |
2046 | 266 |
#Accept #Explain #Format)> |
1261
bdb18f73205c
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
267 |
<resource: #programMenu> |
489 | 268 |
|
3252 | 269 |
|m sub subsub sensor| |
38 | 270 |
|
97 | 271 |
m := super editMenu. |
3252 | 272 |
((sensor := self sensor) notNil and:[sensor ctrlDown and:[sensor shiftDown not]]) ifTrue:[ |
2460 | 273 |
sub := m. |
274 |
m := nil. |
|
275 |
] ifFalse:[ |
|
276 |
sub := m subMenuAt:#others. |
|
277 |
]. |
|
0 | 278 |
|
2460 | 279 |
m notNil ifTrue:[ |
430 | 280 |
" |
281 |
codeViews do support #accept |
|
282 |
... add it after #inspectIt |
|
283 |
" |
|
2867 | 284 |
m |
285 |
addItemList:#( |
|
286 |
('-') |
|
287 |
('Accept' accept Accept) |
|
288 |
) |
|
2922
70e3f3ec7980
oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
289 |
resources:resources |
464 | 290 |
after:#inspectIt. |
131 | 291 |
|
1293
c0806b73dc48
disable accept menuItem, if there is no acceptAction
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
292 |
(acceptEnabled == false |
c0806b73dc48
disable accept menuItem, if there is no acceptAction
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
293 |
or:[acceptAction isNil]) ifTrue:[ |
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
294 |
m disable:#accept |
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
295 |
]. |
2460 | 296 |
]. |
1106
7afde7c75396
added #disableAccept interface
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
297 |
|
2460 | 298 |
sub notNil ifTrue:[ |
430 | 299 |
" |
300 |
and add #explain after $gotoLine in the extra menu |
|
301 |
" |
|
2867 | 302 |
sub |
303 |
addItemList:#( |
|
304 |
('-') |
|
305 |
('Explain' explain Explain) |
|
306 |
) |
|
2922
70e3f3ec7980
oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
307 |
resources:resources |
2867 | 308 |
after:#gotoLine. |
430 | 309 |
|
2460 | 310 |
formatAction notNil ifTrue:[ |
2867 | 311 |
subsub := sub subMenuAt:#tools. |
312 |
||
313 |
subsub notNil ifTrue:[ |
|
314 |
subsub |
|
315 |
addItemList:#( |
|
316 |
('Format' format Format) |
|
317 |
) |
|
2922
70e3f3ec7980
oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
318 |
resources:resources |
2867 | 319 |
after:#indent. |
320 |
]. |
|
2460 | 321 |
]. |
322 |
(self hasSelection not |
|
323 |
or:[explainAction isNil]) ifTrue:[ |
|
324 |
sub disable:#explain |
|
430 | 325 |
]. |
59 | 326 |
]. |
2460 | 327 |
^ m ? sub. |
430 | 328 |
|
2460 | 329 |
"Modified: / 12.11.2001 / 16:04:46 / cg" |
136 | 330 |
! |
331 |
||
201 | 332 |
explain |
333 |
"explain action; |
|
334 |
evaluate the explainBlock passing whole contents and |
|
335 |
selection as arguments." |
|
336 |
||
337 |
|text| |
|
338 |
||
339 |
explainAction notNil ifTrue:[ |
|
340 |
text := self selection. |
|
341 |
text notNil ifTrue:[ |
|
342 |
explainAction value:(self contents) value:(text asString) |
|
343 |
] |
|
344 |
] |
|
1625 | 345 |
! |
346 |
||
347 |
format |
|
348 |
"format action; |
|
349 |
evaluate the formatBlock passing whole contents as argument." |
|
350 |
||
351 |
|text| |
|
352 |
||
353 |
formatAction notNil ifTrue:[ |
|
3128 | 354 |
text := self contents. |
355 |
text notNil ifTrue:[ |
|
356 |
self |
|
357 |
undoableDo:[ formatAction value:(text asString) ] |
|
3784 | 358 |
info:'Format' |
3128 | 359 |
] |
1625 | 360 |
] |
361 |
||
362 |
"Created: / 17.2.1998 / 17:06:18 / cg" |
|
363 |
"Modified: / 17.2.1998 / 18:25:33 / cg" |
|
0 | 364 |
! ! |
365 |
||
206 | 366 |
!CodeView class methodsFor:'documentation'! |
367 |
||
368 |
version |
|
5530 | 369 |
^ '$Header$' |
6360
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
370 |
! |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
371 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
372 |
version_HG |
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
373 |
|
1091acf82a3e
Editor theme: introduced an abstract theme class `CodeViewTheme`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5530
diff
changeset
|
374 |
^ '$Changeset: <not expanded> $' |
206 | 375 |
! ! |
4586 | 376 |