1 | /****************************** Module Header *******************************
|
---|
2 | *
|
---|
3 | * Module Name: popup.e
|
---|
4 | *
|
---|
5 | * Copyright (c) Netlabs EPM Distribution Project 2004
|
---|
6 | *
|
---|
7 | * $Id: popup.e 3705 2019-11-01 00:52:51Z aschn $
|
---|
8 | *
|
---|
9 | * ===========================================================================
|
---|
10 | *
|
---|
11 | * This file is part of the Netlabs EPM Distribution package and is free
|
---|
12 | * software. You can redistribute it and/or modify it under the terms of the
|
---|
13 | * GNU General Public License as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * Netlabs EPM Distribution. This library is distributed in the hope that it
|
---|
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
---|
17 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | * General Public License for more details.
|
---|
19 | *
|
---|
20 | ****************************************************************************/
|
---|
21 |
|
---|
22 | ; Popup menu defs, moved from MOUSE.E.
|
---|
23 |
|
---|
24 | compile if not defined( SMALL) -- If compiled separately
|
---|
25 | EA_comment 'This defines the popup menu.'
|
---|
26 |
|
---|
27 | define
|
---|
28 | INCLUDING_FILE = 'POPUP.E'
|
---|
29 |
|
---|
30 | include 'stdconst.e'
|
---|
31 | const
|
---|
32 | tryinclude 'mycnf.e'
|
---|
33 | const
|
---|
34 | compile if not defined( NLS_LANGUAGE)
|
---|
35 | NLS_LANGUAGE = 'ENGLISH'
|
---|
36 | compile endif
|
---|
37 | include NLS_LANGUAGE'.e'
|
---|
38 | compile endif
|
---|
39 |
|
---|
40 | ; ---------------------------------------------------------------------------
|
---|
41 | const
|
---|
42 | compile if not defined( WANT_TEXT_PROCS)
|
---|
43 | WANT_TEXT_PROCS = 1
|
---|
44 | compile endif
|
---|
45 | compile if not defined( CHECK_FOR_LEXAM)
|
---|
46 | CHECK_FOR_LEXAM = 0
|
---|
47 | compile endif
|
---|
48 |
|
---|
49 | ; ---------------------------------------------------------------------------
|
---|
50 | const
|
---|
51 | FILL_MARK_MENU__MSG = '~Fill mark'
|
---|
52 | FILL_MARK_MENUP__MSG = \1'Fill marked region with a character, overlaying current contents.'
|
---|
53 | HP_POPUP_FILL = 0
|
---|
54 | REFLOW_MARK_MENU__MSG = '~Reflow mark'
|
---|
55 | REFLOW_MARK_MENUP__MSG = \1'Reflow text in marked region.'
|
---|
56 | HP_POPUP_REFLOW = 0
|
---|
57 | MARK_WORD_MENU__MSG = 'Mark ~word'
|
---|
58 | MARK_WORD_MENUP__MSG = \1'Mark space-delimited word under mouse pointer.'
|
---|
59 | HP_POPUP_MARKWORD = 0
|
---|
60 | MARK_TOKEN_MENU__MSG = 'Mark ~identifier'
|
---|
61 | MARK_TOKEN_MENUP__MSG = \1'Mark the C-language identifier under the mouse pointer.'
|
---|
62 | HP_POPUP_MARKTOKEN = 0
|
---|
63 | FIND_TOKEN_MENU__MSG = '~Find identifier'
|
---|
64 | FIND_TOKEN_MENUP__MSG = \1'Find the next occurrence of the identifier under the mouse pointer.'
|
---|
65 | HP_POPUP_FINDTOKEN = 0
|
---|
66 | compile if WANT_TEXT_PROCS
|
---|
67 | MARK_SENTENCE_MENU__MSG = 'Mark s~entence'
|
---|
68 | MARK_SENTENCE_MENUP__MSG = \1'Mark sentence around mouse pointer.'
|
---|
69 | HP_POPUP_MARKSENTENCE = 0
|
---|
70 | MARK_PARAGRAPH_MENU__MSG = 'Mark para~graph'
|
---|
71 | MARK_PARAGRAPH_MENUP__MSG = \1'Mark paragraph around mouse pointer.'
|
---|
72 | HP_POPUP_MARKPARAGRAPH = 0
|
---|
73 | EXTEND_SENTENCE_MENU__MSG = 'E~xtend sentence mark'
|
---|
74 | EXTEND_SENTENCE_MENUP__MSG = \1'Extend character mark through end of next sentence.'
|
---|
75 | HP_POPUP_EXTENDSENTENCE = 0
|
---|
76 | EXTEND_PARAGRAPH_MENU__MSG = 'Extend p~aragraph mark'
|
---|
77 | EXTEND_PARAGRAPH_MENUP__MSG = \1'Extend character mark through end of next paragraph.'
|
---|
78 | HP_POPUP_EXTENDPARAGRAPH = 0
|
---|
79 | compile endif -- WANT_TEXT_PROCS
|
---|
80 | UPCASE_MARK_MENU__MSG = '~Uppercase mark'
|
---|
81 | UPCASE_MARK_MENUP__MSG = \1'Translate selected text to upper case.'
|
---|
82 | HP_POPUP_UPCASEMARK = 0
|
---|
83 | LOCASE_MARK_MENU__MSG = '~Lowercase mark'
|
---|
84 | LOCASE_MARK_MENUP__MSG = \1'Translate selected text to lower case.'
|
---|
85 | HP_POPUP_LOCASEMARK = 0
|
---|
86 | UPCASE_WORD_MENU__MSG = '~Uppercase word'
|
---|
87 | UPCASE_WORD_MENUP__MSG = \1'Translate word under mouse pointer to upper case.'
|
---|
88 | HP_POPUP_UPCASEWORD = 0
|
---|
89 | LOCASE_WORD_MENU__MSG = '~Lowercase word'
|
---|
90 | LOCASE_WORD_MENUP__MSG = \1'Translate word under mouse pointer to lower case.'
|
---|
91 | HP_POPUP_LOCASEWORD = 0
|
---|
92 | SHIFT_MENU__MSG = '~Shift'
|
---|
93 | SHIFT_MENUP__MSG = \1'Shift marked text left or right.'
|
---|
94 | HP_POPUP_SHIFT = 0
|
---|
95 | SHIFTLEFT_MENU__MSG = 'Shift ~left 1'
|
---|
96 | SHIFTLEFT_MENUP__MSG = \1'Shift marked text left 1 character.'
|
---|
97 | HP_POPUP_SHIFTLEFT = 0
|
---|
98 | SHIFTLEFT3_MENU__MSG = 'Shift l~eft 3'
|
---|
99 | SHIFTLEFT3_MENUP__MSG = \1'Shift marked text left 3 characters.'
|
---|
100 | HP_POPUP_SHIFTLEFT3 = 0
|
---|
101 | SHIFTLEFT8_MENU__MSG = 'Shift le~ft 8'
|
---|
102 | SHIFTLEFT8_MENUP__MSG = \1'Shift marked text left 8 characters.'
|
---|
103 | HP_POPUP_SHIFTLEFT8 = 0
|
---|
104 | SHIFTRIGHT_MENU__MSG = 'Shift right ~1'
|
---|
105 | SHIFTRIGHT_MENUP__MSG = \1'Shift marked text right 1 character.'
|
---|
106 | HP_POPUP_SHIFTRIGHT = 0
|
---|
107 | SHIFTRIGHT3_MENU__MSG = 'Shift right ~3'
|
---|
108 | SHIFTRIGHT3_MENUP__MSG = \1'Shift marked text right 3 characters.'
|
---|
109 | HP_POPUP_SHIFTRIGHT3 = 0
|
---|
110 | SHIFTRIGHT8_MENU__MSG = 'Shift right ~8'
|
---|
111 | SHIFTRIGHT8_MENUP__MSG = \1'Shift marked text right 8 characters.'
|
---|
112 | HP_POPUP_SHIFTRIGHT8 = 0
|
---|
113 | CENTER_LINE_MENU__MSG = 'Cen~ter line'
|
---|
114 | CENTER_LINE_MENUP__MSG = \1'Center line under mouse pointer vertically in window.'
|
---|
115 | HP_POPUP_CENTERLINE = 0
|
---|
116 | CENTER_MARK_MENU__MSG = 'Cen~ter text'
|
---|
117 | CENTER_MARK_MENUP__MSG = \1'Center marked text within margins or block mark.'
|
---|
118 | HP_POPUP_CENTERMARK = 0
|
---|
119 | SORT_MARK_MENU__MSG = 'S~ort'
|
---|
120 | SORT_MARK_MENUP__MSG = \1'Sort marked lines, using block mark (if present) as key.'
|
---|
121 | HP_POPUP_SORT = 0
|
---|
122 | TOP_LINE_MENU__MSG = 'Scro~ll to top'
|
---|
123 | TOP_LINE_MENUP__MSG = \1'Scroll so line under mouse pointer is at top of window.'
|
---|
124 | HP_POPUP_TOP = 0
|
---|
125 |
|
---|
126 | ;compile if WANT_TREE
|
---|
127 | LOAD_FILE_MENU__MSG = '~Load file'
|
---|
128 | SORT_ASCENDING_MENU__MSG = '~Sort ascending'
|
---|
129 | SORT_DATE_MENU__MSG = 'Sort by ~date'
|
---|
130 | SORT_TIME_MENU__MSG = 'Sort by ~time'
|
---|
131 | SORT_SIZE_MENU__MSG = 'Sort by ~size'
|
---|
132 | SORT_EASIZE_MENU__MSG = 'Sort by ~EA size'
|
---|
133 | SORT_FULLNAME_MENU__MSG = 'Sort by ~fully-qualified filename'
|
---|
134 | SORT_NAME_MENU__MSG = 'Sort by ~name'
|
---|
135 | SORT_EXTENSION_MENU__MSG = 'Sort by ~extension'
|
---|
136 | SORT_DESCENDING_MENU__MSG = 'Sort ~descending'
|
---|
137 |
|
---|
138 | LOAD_FILE_MENUP__MSG = \1'Load the file or list the directory under the cursor'
|
---|
139 | SORT_ASCENDING_MENUP__MSG = \1'Sort the file or marked lines from smallest to largest'
|
---|
140 | SORT_XXXX_MENUP__MSG = \1'Sort the file or marked lines by the indicated attribute'
|
---|
141 | SORT_DESCENDING_MENUP__MSG = \1'Sort the file or marked lines from largest to smallest'
|
---|
142 | ;compile endif
|
---|
143 |
|
---|
144 | ; ---------------------------------------------------------------------------
|
---|
145 | definit
|
---|
146 | call SetAVar( 'mid_popup', 80)
|
---|
147 |
|
---|
148 | ; ---------------------------------------------------------------------------
|
---|
149 | const
|
---|
150 | -- Cascade menu is now replaced by inline menu items, because it doesnot
|
---|
151 | -- work correctly:
|
---|
152 | -- The frame around the submenu arrow is only painted after activating
|
---|
153 | -- that menu item. Before that, one thinks that's a normal submenu item
|
---|
154 | -- that won't execute something on selecting it.
|
---|
155 | POPUP_ENABLE_CASCADE = 0 -- 0|1
|
---|
156 |
|
---|
157 | ; ---------------------------------------------------------------------------
|
---|
158 | defc MH_popup
|
---|
159 | universal activemenu
|
---|
160 |
|
---|
161 | menuname = 'popup'
|
---|
162 | activemenu = menuname -- required for DefSubMenu and DefSubMenuItem
|
---|
163 |
|
---|
164 | -- Optionally move cursor to pointer before:
|
---|
165 | --'MH_gotoposition'
|
---|
166 |
|
---|
167 | deletemenu menuname, 0, 0, 0
|
---|
168 |
|
---|
169 | -- For a popup menu, the submenu item itself is invisible. Therefore simply
|
---|
170 | -- use the same name here as for the popup menu:
|
---|
171 | DefSubMenu( menuname, -- Popup ----------
|
---|
172 | '',
|
---|
173 | '',
|
---|
174 | '')
|
---|
175 |
|
---|
176 | -- Add menu items
|
---|
177 | mt = strip( leftstr( marktype(), 1))
|
---|
178 | fInMark = mouse_in_mark()
|
---|
179 | if upcase( leftstr( .filename, 5)) = '.TREE' then
|
---|
180 | call PopupMenuItemsTree()
|
---|
181 | elseif fInMark then -- inside-mark
|
---|
182 | call PopupMenuItemsInsideMark()
|
---|
183 | elseif mt <> '' then -- outside-mark
|
---|
184 | call PopupMenuItemsOutsideMark()
|
---|
185 | else -- no-mark
|
---|
186 | call PopupMenuItemsNoMark()
|
---|
187 | endif
|
---|
188 | if upcase( leftstr( .filename, 5)) <> '.TREE' then
|
---|
189 | call PopupMenuItemsCommon()
|
---|
190 | endif
|
---|
191 |
|
---|
192 | showmenu menuname, 1 -- 0 = standard menu (default for missing parameter), 1 = popup menu, 2 = undefined, 3 = UC menu (toolbar)
|
---|
193 |
|
---|
194 | -- Cascade menu is now replaced by inline menu items, because it doesnot
|
---|
195 | -- work correctly:
|
---|
196 | -- The frame around the submenu arrow is only painted after activating
|
---|
197 | -- that menu item. Before that, one thinks that's a normal submenu item
|
---|
198 | -- that won't execute something on selecting it.
|
---|
199 | compile if POPUP_ENABLE_CASCADE
|
---|
200 | 'postme add_cascade_popupmenu'
|
---|
201 | compile endif
|
---|
202 |
|
---|
203 | ; ---------------------------------------------------------------------------
|
---|
204 | defproc PopupMenuItemsTree
|
---|
205 | fBackupTreeDir = 0
|
---|
206 | BackupDir = GetBackupDir()
|
---|
207 | if pos( '.TREEBACKUP', upcase( .filename)) = 1 &
|
---|
208 | pos( upcase( BackupDir), upcase( .filename)) > 0 then
|
---|
209 | fBackupTreeDir = 1
|
---|
210 | endif
|
---|
211 |
|
---|
212 | DefMenuItem( '', -- Load file
|
---|
213 | LOAD_FILE_MENU__MSG''MenuAccelString( 'alt_1'),
|
---|
214 | 'Mc /MH_GoToPosition/dokey a_1',
|
---|
215 | LOAD_FILE_MENUP__MSG,
|
---|
216 | '')
|
---|
217 | DefMenuSep() --------------------
|
---|
218 |
|
---|
219 | if fBackupTreeDir then
|
---|
220 | DefMenuItem( '', -- Compare file
|
---|
221 | 'Comp~are',
|
---|
222 | 'Mc /MH_GoToPosition/CompareBackupFile',
|
---|
223 | 'Compare backup file under cursor with original file',
|
---|
224 | '')
|
---|
225 | DefMenuItem( '', -- Restore file
|
---|
226 | '~Restore...',
|
---|
227 | 'Mc /MH_GoToPosition/RestoreFromTreeFile',
|
---|
228 | 'Restore backup file under cursor to original file',
|
---|
229 | '')
|
---|
230 | DefMenuSep() --------------------
|
---|
231 | endif
|
---|
232 |
|
---|
233 | DefNextItemStartsSubMenu()
|
---|
234 | DefMenuItem( '', -- Sort ascending >
|
---|
235 | SORT_ASCENDING_MENU__MSG,
|
---|
236 | '',
|
---|
237 | SORT_ASCENDING_MENUP__MSG,
|
---|
238 | '')
|
---|
239 | DefMenuItem( '', -- Sort by date
|
---|
240 | SORT_DATE_MENU__MSG,
|
---|
241 | 'treesort' 'D',
|
---|
242 | SORT_XXXX_MENUP__MSG,
|
---|
243 | '')
|
---|
244 | DefMenuItem( '', -- Sort by time
|
---|
245 | SORT_TIME_MENU__MSG,
|
---|
246 | 'treesort' 'T',
|
---|
247 | SORT_XXXX_MENUP__MSG,
|
---|
248 | '')
|
---|
249 | DefMenuItem( '', -- Sort by size
|
---|
250 | SORT_SIZE_MENU__MSG,
|
---|
251 | 'treesort' 'S',
|
---|
252 | SORT_XXXX_MENUP__MSG,
|
---|
253 | '')
|
---|
254 | DefMenuItem( '', -- Sort by EA size
|
---|
255 | SORT_EASIZE_MENU__MSG,
|
---|
256 | 'treesort' 'EA',
|
---|
257 | SORT_XXXX_MENUP__MSG,
|
---|
258 | '')
|
---|
259 | DefMenuItem( '', -- Sort by fully-qualified filename
|
---|
260 | SORT_FULLNAME_MENU__MSG,
|
---|
261 | 'treesort' 'F',
|
---|
262 | SORT_XXXX_MENUP__MSG,
|
---|
263 | '')
|
---|
264 | DefMenuItem( '', -- Sort by name
|
---|
265 | SORT_NAME_MENU__MSG,
|
---|
266 | 'treesort' 'N',
|
---|
267 | SORT_XXXX_MENUP__MSG,
|
---|
268 | '')
|
---|
269 | DefNextItemEndsSubMenu()
|
---|
270 | DefMenuItem( '', -- Sort by extension
|
---|
271 | SORT_EXTENSION_MENU__MSG,
|
---|
272 | 'treesort' 'EX',
|
---|
273 | SORT_XXXX_MENUP__MSG,
|
---|
274 | '')
|
---|
275 | DefNextItemStartsSubMenu()
|
---|
276 | DefMenuItem( '', -- Sort descending >
|
---|
277 | SORT_DESCENDING_MENU__MSG,
|
---|
278 | '',
|
---|
279 | SORT_DESCENDING_MENUP__MSG,
|
---|
280 | '')
|
---|
281 | DefMenuItem( '', -- Sort by date
|
---|
282 | SORT_DATE_MENU__MSG,
|
---|
283 | 'treesort' '/R' 'D',
|
---|
284 | SORT_XXXX_MENUP__MSG,
|
---|
285 | '')
|
---|
286 | DefMenuItem( '', -- Sort by time
|
---|
287 | SORT_TIME_MENU__MSG,
|
---|
288 | 'treesort' '/R' 'T',
|
---|
289 | SORT_XXXX_MENUP__MSG,
|
---|
290 | '')
|
---|
291 | DefMenuItem( '', -- Sort by size
|
---|
292 | SORT_SIZE_MENU__MSG,
|
---|
293 | 'treesort' '/R' 'S',
|
---|
294 | SORT_XXXX_MENUP__MSG,
|
---|
295 | '')
|
---|
296 | DefMenuItem( '', -- Sort by EA size
|
---|
297 | SORT_EASIZE_MENU__MSG,
|
---|
298 | 'treesort' '/R' 'EA',
|
---|
299 | SORT_XXXX_MENUP__MSG,
|
---|
300 | '')
|
---|
301 | DefMenuItem( '', -- Sort by fully-qualified filename
|
---|
302 | SORT_FULLNAME_MENU__MSG,
|
---|
303 | 'treesort' '/R' 'F',
|
---|
304 | SORT_XXXX_MENUP__MSG,
|
---|
305 | '')
|
---|
306 | DefMenuItem( '', -- Sort by name
|
---|
307 | SORT_NAME_MENU__MSG,
|
---|
308 | 'treesort' '/R' 'N',
|
---|
309 | SORT_XXXX_MENUP__MSG,
|
---|
310 | '')
|
---|
311 | DefNextItemEndsSubMenu()
|
---|
312 | DefMenuItem( '', -- Sort by extension
|
---|
313 | SORT_EXTENSION_MENU__MSG,
|
---|
314 | 'treesort' '/R' 'EX',
|
---|
315 | SORT_XXXX_MENUP__MSG,
|
---|
316 | '')
|
---|
317 |
|
---|
318 | ; ---------------------------------------------------------------------------
|
---|
319 | defproc PopupMenuItemsInsideMark
|
---|
320 | universal nodismiss
|
---|
321 | compile if CHECK_FOR_LEXAM
|
---|
322 | universal LEXAM_is_available
|
---|
323 | compile endif
|
---|
324 |
|
---|
325 | mt = strip( leftstr( marktype(), 1))
|
---|
326 | -- Disable some menu items if char mark is active
|
---|
327 | fCharMark = (mt = 'C')
|
---|
328 | if fCharMark then
|
---|
329 | miaformatable = 'DISABLED'
|
---|
330 | else
|
---|
331 | miaformatable = ''
|
---|
332 | endif
|
---|
333 |
|
---|
334 | DefMenuItem( '', -- Unmark
|
---|
335 | UNMARK_MARK_MENU__MSG,
|
---|
336 | 'UnMark',
|
---|
337 | UNMARK_MARK_MENUP__MSG,
|
---|
338 | HP_EDIT_UNMARK)
|
---|
339 | DefMenuItem( '', -- Delete mark
|
---|
340 | DELETE_MARK_MENU__MSG,
|
---|
341 | 'DeleteMark',
|
---|
342 | DELETE_MARK_MENUP__MSG,
|
---|
343 | HP_EDIT_DELETE)
|
---|
344 | DefMenuItem( '', -- Fill mark
|
---|
345 | FILL_MARK_MENU__MSG,
|
---|
346 | 'FillMark',
|
---|
347 | FILL_MARK_MENUP__MSG,
|
---|
348 | HP_POPUP_FILL)
|
---|
349 | DefMenuItem( '', -- Reflow mark
|
---|
350 | REFLOW_MARK_MENU__MSG,
|
---|
351 | 'ReflowPar2ReflowMargins',
|
---|
352 | REFLOW_MARK_MENUP__MSG,
|
---|
353 | HP_POPUP_REFLOW,
|
---|
354 | miaformatable)
|
---|
355 | DefMenuItem( '', -- Uppercase mark
|
---|
356 | UPCASE_MARK_MENU__MSG,
|
---|
357 | 'UppercaseMark',
|
---|
358 | UPCASE_MARK_MENUP__MSG,
|
---|
359 | HP_POPUP_UPCASEMARK)
|
---|
360 | DefMenuItem( '', -- Lowercase mark
|
---|
361 | LOCASE_MARK_MENU__MSG,
|
---|
362 | 'LowercaseMark',
|
---|
363 | LOCASE_MARK_MENUP__MSG,
|
---|
364 | HP_POPUP_LOCASEMARK)
|
---|
365 | DefMenuItem( '', -- Sort
|
---|
366 | SORT_MARK_MENU__MSG,
|
---|
367 | 'Sort',
|
---|
368 | SORT_MARK_MENUP__MSG,
|
---|
369 | HP_POPUP_SORT,
|
---|
370 | miaformatable)
|
---|
371 | DefMenuSep() --------------------
|
---|
372 |
|
---|
373 | DefMenuItem( '', -- Find mark
|
---|
374 | 'Fi~nd mark',
|
---|
375 | 'FindMark',
|
---|
376 | 'Find marked string in text',
|
---|
377 | '')
|
---|
378 | DefMenuSep() --------------------
|
---|
379 |
|
---|
380 | DefMenuItem( '', -- Comment
|
---|
381 | '~Comment',
|
---|
382 | 'Comment',
|
---|
383 | 'Comment marked lines',
|
---|
384 | '')
|
---|
385 | DefMenuItem( '', -- Uncomment
|
---|
386 | 'Unco~mment',
|
---|
387 | 'Uncomment',
|
---|
388 | 'Uncomment marked lines',
|
---|
389 | '')
|
---|
390 | DefMenuSep() --------------------
|
---|
391 |
|
---|
392 | compile if WANT_TEXT_PROCS
|
---|
393 | DefMenuItem( '', -- Extend sentence mark
|
---|
394 | EXTEND_SENTENCE_MENU__MSG,
|
---|
395 | 'ExtendSentence',
|
---|
396 | EXTEND_SENTENCE_MENUP__MSG,
|
---|
397 | HP_POPUP_EXTENDSENTENCE)
|
---|
398 | DefMenuItem( '', -- Extend paragraph mark
|
---|
399 | EXTEND_PARAGRAPH_MENU__MSG,
|
---|
400 | 'ExtendParagraph',
|
---|
401 | EXTEND_PARAGRAPH_MENUP__MSG,
|
---|
402 | HP_POPUP_EXTENDPARAGRAPH)
|
---|
403 | DefMenuSep() --------------------
|
---|
404 |
|
---|
405 | compile endif -- WANT_TEXT_PROCS
|
---|
406 | DefNextItemStartsSubMenu()
|
---|
407 | DefMenuItem( '', -- Shift >
|
---|
408 | 'S~hift' /*SHIFT_MENU__MSG*/,
|
---|
409 | '',
|
---|
410 | SHIFT_MENUP__MSG,
|
---|
411 | HP_POPUP_SHIFT)
|
---|
412 | DefMenuItem( '', -- Shift left 1
|
---|
413 | SHIFTLEFT_MENU__MSG''MenuAccelString( 'ShiftLeft'),
|
---|
414 | 'DoCmd 1 ShiftLeft',
|
---|
415 | SHIFTLEFT_MENUP__MSG,
|
---|
416 | HP_POPUP_SHIFTLEFT,
|
---|
417 | nodismiss)
|
---|
418 | DefMenuItem( '', -- Shift left 3
|
---|
419 | SHIFTLEFT3_MENU__MSG,
|
---|
420 | 'DoCmd 3 ShiftLeft',
|
---|
421 | SHIFTLEFT3_MENUP__MSG,
|
---|
422 | HP_POPUP_SHIFTLEFT3,
|
---|
423 | nodismiss)
|
---|
424 | DefMenuItem( '', -- Shift left 8
|
---|
425 | SHIFTLEFT8_MENU__MSG,
|
---|
426 | 'DoCmd 8 ShiftLeft',
|
---|
427 | SHIFTLEFT8_MENUP__MSG,
|
---|
428 | HP_POPUP_SHIFTLEFT8,
|
---|
429 | nodismiss)
|
---|
430 | DefMenuItem( '', -- Shift right 1
|
---|
431 | SHIFTRIGHT_MENU__MSG''MenuAccelString( 'ShiftRight'),
|
---|
432 | 'DoCmd 1 ShiftRight',
|
---|
433 | SHIFTRIGHT_MENUP__MSG,
|
---|
434 | HP_POPUP_SHIFTRIGHT,
|
---|
435 | 'BREAKSEPARATOR' nodismiss)
|
---|
436 | DefMenuItem( '', -- Shift right 3
|
---|
437 | SHIFTRIGHT3_MENU__MSG,
|
---|
438 | 'DoCmd 3 ShiftRight',
|
---|
439 | SHIFTRIGHT3_MENUP__MSG,
|
---|
440 | HP_POPUP_SHIFTRIGHT3,
|
---|
441 | nodismiss)
|
---|
442 | DefNextItemEndsSubMenu()
|
---|
443 | DefMenuItem( '', -- Shift right 8
|
---|
444 | SHIFTRIGHT8_MENU__MSG,
|
---|
445 | 'DoCmd 8 ShiftRight',
|
---|
446 | SHIFTRIGHT8_MENUP__MSG,
|
---|
447 | HP_POPUP_SHIFTRIGHT8,
|
---|
448 | nodismiss)
|
---|
449 | DefMenuItem( '', -- Center text
|
---|
450 | CENTER_MARK_MENU__MSG,
|
---|
451 | 'CenterMark',
|
---|
452 | CENTER_MARK_MENUP__MSG,
|
---|
453 | HP_POPUP_CENTERMARK,
|
---|
454 | miaformatable)
|
---|
455 | DefMenuSep() --------------------
|
---|
456 |
|
---|
457 | DefMenuItem( '', -- Copy
|
---|
458 | CLIP_COPY_MENU__MSG,
|
---|
459 | 'Copy2Clip',
|
---|
460 | CLIP_COPY_MENUP__MSG,
|
---|
461 | HP_EDIT_COPY)
|
---|
462 | DefMenuItem( '', -- Cut
|
---|
463 | CUT_MENU__MSG,
|
---|
464 | 'Cut',
|
---|
465 | CUT_MENUP__MSG,
|
---|
466 | HP_EDIT_CUT)
|
---|
467 | DefMenuSep() --------------------
|
---|
468 |
|
---|
469 | DefMenuItem( '', -- Style...
|
---|
470 | STYLE_MENU__MSG,
|
---|
471 | 'FontList',
|
---|
472 | STYLE_MENUP__MSG,
|
---|
473 | HP_OPTIONS_STYLE)
|
---|
474 | compile if CHECK_FOR_LEXAM
|
---|
475 | if LEXAM_is_available then
|
---|
476 | compile endif
|
---|
477 | DefMenuSep() --------------------
|
---|
478 |
|
---|
479 | DefMenuItem( '', -- Proof
|
---|
480 | PROOF_MENU__MSG,
|
---|
481 | 'Proof',
|
---|
482 | PROOF_MENUP__MSG,
|
---|
483 | HP_OPTIONS_PROOF)
|
---|
484 | compile if CHECK_FOR_LEXAM
|
---|
485 | endif
|
---|
486 | compile endif
|
---|
487 | DefMenuSep() --------------------
|
---|
488 |
|
---|
489 | DefMenuItem( '', -- Print mark...
|
---|
490 | PRT_MARK_MENU__MSG'...',
|
---|
491 | 'PrintDlg M',
|
---|
492 | ENHPRT_MARK_MENUP__MSG,
|
---|
493 | HP_EDIT_ENHPRINT)
|
---|
494 |
|
---|
495 | ; ---------------------------------------------------------------------------
|
---|
496 | defproc PopupMenuItemsOutsideMark
|
---|
497 | universal CUA_marking_switch
|
---|
498 | on = (marktype() <> '')
|
---|
499 | if CUA_marking_switch then
|
---|
500 | cua_on = 1
|
---|
501 | else
|
---|
502 | cua_on = 0
|
---|
503 | endif
|
---|
504 | if (on & not cua_on) then
|
---|
505 | miamark = ''
|
---|
506 | else
|
---|
507 | miamark = 'DISABLED'
|
---|
508 | endif
|
---|
509 | DefMenuItem( '', -- Copy mark
|
---|
510 | COPY_MARK_MENU__MSG,
|
---|
511 | 'CopyMark',
|
---|
512 | COPY_MARK_MENUP__MSG,
|
---|
513 | HP_EDIT_COPYMARK,
|
---|
514 | miamark)
|
---|
515 | DefMenuItem( '', -- Move mark
|
---|
516 | MOVE_MARK_MENU__MSG,
|
---|
517 | 'MoveMark',
|
---|
518 | MOVE_MARK_MENUP__MSG,
|
---|
519 | HP_EDIT_MOVE,
|
---|
520 | miamark)
|
---|
521 | DefMenuItem( '', -- Overlay mark
|
---|
522 | OVERLAY_MARK_MENU__MSG,
|
---|
523 | 'OverlayMark',
|
---|
524 | OVERLAY_MARK_MENUP__MSG,
|
---|
525 | HP_EDIT_OVERLAY,
|
---|
526 | miamark)
|
---|
527 | DefMenuItem( '', -- Adjust mark
|
---|
528 | ADJUST_MARK_MENU__MSG,
|
---|
529 | 'AdjustMark',
|
---|
530 | ADJUST_MARK_MENUP__MSG,
|
---|
531 | HP_EDIT_ADJUST,
|
---|
532 | miamark)
|
---|
533 | DefMenuSep() --------------------
|
---|
534 |
|
---|
535 | DefMenuItem( '', -- Unmark
|
---|
536 | UNMARK_MARK_MENU__MSG,
|
---|
537 | 'Unmark',
|
---|
538 | UNMARK_MARK_MENUP__MSG,
|
---|
539 | HP_EDIT_UNMARK)
|
---|
540 |
|
---|
541 | ; ---------------------------------------------------------------------------
|
---|
542 | defproc PopupMenuItemsNoMark
|
---|
543 | -- Disable menu items if cursor is on a space char
|
---|
544 | ch = substr( textline(.line), .col, 1)
|
---|
545 | fCurCharIsMarkable = (ch <> ' ' & .line)
|
---|
546 | if fCurCharIsMarkable then
|
---|
547 | miamarkable = ''
|
---|
548 | else
|
---|
549 | miamarkable = 'DISABLED'
|
---|
550 | endif
|
---|
551 |
|
---|
552 | -- Disable menu items if clipboard is empty or file is not editable
|
---|
553 | fPasteEnabled = (clipcheck(format) & (format = 1024) & not (browse() | .readonly))
|
---|
554 | if fPasteEnabled then
|
---|
555 | miapastable = ''
|
---|
556 | else
|
---|
557 | miapastable = 'DISABLED'
|
---|
558 | endif
|
---|
559 |
|
---|
560 | -- Build MenuAccelString dynamically, depending on the definition for
|
---|
561 | -- DefaultPaste and AlternatePaste
|
---|
562 | KeyPath = '\NEPMD\User\Mark\DefaultPaste'
|
---|
563 | next = substr( upcase( QueryConfigKey( KeyPath)), 1, 1)
|
---|
564 | if next = 'L' then
|
---|
565 | style = 'L'
|
---|
566 | altstyle = 'C'
|
---|
567 | elseif next = 'B' then
|
---|
568 | style = 'B'
|
---|
569 | altstyle = 'C'
|
---|
570 | else
|
---|
571 | style = 'C'
|
---|
572 | altstyle = 'L'
|
---|
573 | endif
|
---|
574 | if style = 'C' then
|
---|
575 | PasteCMenuAccelString = MenuAccelString( 'DefaultPaste')
|
---|
576 | elseif altstyle = 'C' then
|
---|
577 | PasteCMenuAccelString = MenuAccelString( 'AlternatePaste')
|
---|
578 | else
|
---|
579 | PasteCMenuAccelString = ''
|
---|
580 | endif
|
---|
581 | if style = 'L' then
|
---|
582 | PasteLMenuAccelString = MenuAccelString( 'DefaultPaste')
|
---|
583 | elseif altstyle = 'L' then
|
---|
584 | PasteLMenuAccelString = MenuAccelString( 'AlternatePaste')
|
---|
585 | else
|
---|
586 | PasteLMenuAccelString = ''
|
---|
587 | endif
|
---|
588 | if style = 'B' then
|
---|
589 | PasteBMenuAccelString = MenuAccelString( 'DefaultPaste')
|
---|
590 | elseif altstyle = 'B' then
|
---|
591 | PasteBMenuAccelString = MenuAccelString( 'AlternatePaste')
|
---|
592 | else
|
---|
593 | PasteBMenuAccelString = ''
|
---|
594 | endif
|
---|
595 |
|
---|
596 | DefMenuItem( '', -- Mark identifier
|
---|
597 | MARK_TOKEN_MENU__MSG,
|
---|
598 | 'MarkToken',
|
---|
599 | MARK_TOKEN_MENUP__MSG,
|
---|
600 | HP_POPUP_MARKTOKEN,
|
---|
601 | miamarkable)
|
---|
602 | DefMenuItem( '', -- Mark word
|
---|
603 | MARK_WORD_MENU__MSG,
|
---|
604 | 'MarkWord',
|
---|
605 | MARK_WORD_MENUP__MSG,
|
---|
606 | HP_POPUP_MARKWORD,
|
---|
607 | miamarkable)
|
---|
608 | DefMenuItem( '', -- Find identifier
|
---|
609 | FIND_TOKEN_MENU__MSG,
|
---|
610 | 'FindToken',
|
---|
611 | FIND_TOKEN_MENUP__MSG,
|
---|
612 | HP_POPUP_FINDTOKEN,
|
---|
613 | miamarkable)
|
---|
614 | DefMenuSep() --------------------
|
---|
615 |
|
---|
616 | compile if WANT_TEXT_PROCS
|
---|
617 | DefMenuItem( '', -- Mark sentence
|
---|
618 | MARK_SENTENCE_MENU__MSG,
|
---|
619 | 'MarkSentence',
|
---|
620 | MARK_SENTENCE_MENUP__MSG,
|
---|
621 | HP_POPUP_MARKSENTENCE)
|
---|
622 | DefMenuItem( '', -- Mark paragraph
|
---|
623 | MARK_PARAGRAPH_MENU__MSG,
|
---|
624 | 'MarkParagraph',
|
---|
625 | MARK_PARAGRAPH_MENUP__MSG,
|
---|
626 | HP_POPUP_MARKPARAGRAPH)
|
---|
627 | DefMenuSep() --------------------
|
---|
628 |
|
---|
629 | compile endif -- WANT_TEXT_PROCS
|
---|
630 | DefMenuItem( '', -- Reflow paragraph
|
---|
631 | '~Reflow paragraph',
|
---|
632 | 'ReflowPar2ReflowMargins',
|
---|
633 | 'Reflow text from cursor to next empty line',
|
---|
634 | HP_POPUP_REFLOW)
|
---|
635 | DefMenuSep() --------------------
|
---|
636 |
|
---|
637 | DefMenuItem( '', -- Toggle case of word
|
---|
638 | 'Toggle ~case of word',
|
---|
639 | 'CaseWord',
|
---|
640 | 'Rotate case: lower -> mixed -> upper',
|
---|
641 | HP_POPUP_UPCASEWORD,
|
---|
642 | miamarkable)
|
---|
643 | DefMenuItem( '', -- Uppercase word
|
---|
644 | UPCASE_WORD_MENU__MSG,
|
---|
645 | 'UppercaseWord',
|
---|
646 | UPCASE_WORD_MENUP__MSG,
|
---|
647 | HP_POPUP_UPCASEWORD,
|
---|
648 | miamarkable)
|
---|
649 | DefMenuItem( '', -- Lowercase word
|
---|
650 | LOCASE_WORD_MENU__MSG,
|
---|
651 | 'LowercaseWord',
|
---|
652 | LOCASE_WORD_MENUP__MSG,
|
---|
653 | HP_POPUP_LOCASEWORD,
|
---|
654 | miamarkable)
|
---|
655 | DefMenuSep() --------------------
|
---|
656 |
|
---|
657 | DefMenuItem( '', -- Center line
|
---|
658 | CENTER_LINE_MENU__MSG,
|
---|
659 | 'CenterLine',
|
---|
660 | CENTER_LINE_MENUP__MSG,
|
---|
661 | HP_POPUP_CENTERLINE)
|
---|
662 | DefMenuItem( '', -- Scroll to top
|
---|
663 | TOP_LINE_MENU__MSG,
|
---|
664 | 'NewTop',
|
---|
665 | TOP_LINE_MENUP__MSG,
|
---|
666 | HP_POPUP_TOP)
|
---|
667 | DefMenuSep() --------------------
|
---|
668 |
|
---|
669 | compile if POPUP_ENABLE_CASCADE
|
---|
670 | -- Cascade menu now replaced by inline menu items, because it doesnot work correctly:
|
---|
671 | DefNextItemStartsSubMenu()
|
---|
672 | DefMenuItem( 'popup_paste', -- Paste >
|
---|
673 | PASTE_C_MENU__MSG,
|
---|
674 | PASTE_C_MENUP__MSG ,
|
---|
675 | '',
|
---|
676 | HP_EDIT_PASTEMENU)
|
---|
677 | DefMenuItem( 'popup_pastec', -- Paste
|
---|
678 | PASTE_C_MENU__MSG''PasteCMenuAccelString,
|
---|
679 | 'Paste C',
|
---|
680 | PASTE_C_MENUP__MSG,
|
---|
681 | HP_EDIT_PASTEC)
|
---|
682 | DefMenuItem( 'popup_pastel', -- Paste lines
|
---|
683 | PASTE_L_MENU__MSG''PasteLMenuAccelString,
|
---|
684 | 'Paste',
|
---|
685 | PASTE_L_MENUP__MSG,
|
---|
686 | HP_EDIT_PASTE)
|
---|
687 | DefNextItemEndsSubMenu()
|
---|
688 | DefMenuItem( 'popup_pasteb', -- Paste block
|
---|
689 | PASTE_B_MENU__MSG''PasteBMenuAccelString,
|
---|
690 | 'Paste B',
|
---|
691 | PASTE_B_MENUP__MSG,
|
---|
692 | HP_EDIT_PASTEB)
|
---|
693 | compile else
|
---|
694 | DefMenuItem( '', -- Paste
|
---|
695 | PASTE_C_MENU__MSG''PasteCMenuAccelString,
|
---|
696 | 'Paste C',
|
---|
697 | PASTE_C_MENUP__MSG,
|
---|
698 | HP_EDIT_PASTEC,
|
---|
699 | miapastable)
|
---|
700 | DefMenuItem( '', -- Paste lines
|
---|
701 | PASTE_L_MENU__MSG''PasteLMenuAccelString,
|
---|
702 | 'Paste',
|
---|
703 | PASTE_L_MENUP__MSG,
|
---|
704 | HP_EDIT_PASTE,
|
---|
705 | miapastable)
|
---|
706 | DefMenuItem( '', -- Paste block
|
---|
707 | PASTE_B_MENU__MSG''PasteBMenuAccelString,
|
---|
708 | 'Paste B',
|
---|
709 | PASTE_B_MENUP__MSG,
|
---|
710 | HP_EDIT_PASTEB,
|
---|
711 | miapastable)
|
---|
712 | compile endif
|
---|
713 |
|
---|
714 | ; ---------------------------------------------------------------------------
|
---|
715 | ; These items are appended, except for .Tree files
|
---|
716 | defproc PopupMenuItemsCommon
|
---|
717 | -- Disable TagScan menu item if mode is not supported
|
---|
718 | 'LinkVerify tags' -- Remains linked afterwards
|
---|
719 | if leftstr( .filename, 1) = '.' then -- virtual file
|
---|
720 | miatagssupported = 'DISABLED'
|
---|
721 | elseif tags_supported( GetMode()) then
|
---|
722 | miatagssupported = ''
|
---|
723 | else
|
---|
724 | miatagssupported = 'DISABLED'
|
---|
725 | endif
|
---|
726 |
|
---|
727 | DefMenuSep() --------------------
|
---|
728 |
|
---|
729 | DefMenuItem( '', -- Open extracted string
|
---|
730 | 'Open e~xtracted string',
|
---|
731 | 'Alt_1',
|
---|
732 | 'Load file or URL under cursor',
|
---|
733 | '')
|
---|
734 | DefMenuSep() --------------------
|
---|
735 |
|
---|
736 | DefMenuItem( '', -- Scan file for tags
|
---|
737 | '~Scan file for tags' /*SCAN_TAGS_MENU__MSG*/,
|
---|
738 | 'TagScan',
|
---|
739 | SCAN_TAGS_MENUP__MSG,
|
---|
740 | HP_SEARCH_TAGS,
|
---|
741 | miatagssupported)
|
---|
742 |
|
---|
743 | if isadefc( 'PrefsPopupMenu') then
|
---|
744 | DefMenuSep() --------------------
|
---|
745 |
|
---|
746 | DefMenuItem( 'preferences', -- Preferences...
|
---|
747 | 'Pre~ferences...',
|
---|
748 | 'PrefsPopupMenu',
|
---|
749 | 'Menus related to editor settings',
|
---|
750 | '')
|
---|
751 | endif
|
---|
752 |
|
---|
753 | ; ---------------------------------------------------------------------------
|
---|
754 | -- Cascade menu is now replaced by inline menu items, because it doesnot
|
---|
755 | -- work correctly:
|
---|
756 | -- The frame around the submenu arrow is only painted after activating
|
---|
757 | -- that menu item. Before that, one thinks that's a normal submenu item
|
---|
758 | -- that won't execute something on selecting it.
|
---|
759 | compile if POPUP_ENABLE_CASCADE
|
---|
760 | defc add_cascade_popupmenu
|
---|
761 | KeyPath = "\NEPMD\User\Mark\DefaultPaste"
|
---|
762 | DefaultPaste = QueryConfigKey( KeyPath)
|
---|
763 | if DefaultPaste = 'C' then
|
---|
764 | AlternatePaste = 'L'
|
---|
765 | else
|
---|
766 | AlternatePaste = 'C'
|
---|
767 | endif
|
---|
768 | if DefaultPaste = 'L' then -- arg for defc paste maybe 'C', 'B' or ''
|
---|
769 | DefaultPaste = ''
|
---|
770 | endif
|
---|
771 | if AlternatePaste = 'L' then -- arg for defc paste maybe 'C', 'B' or ''
|
---|
772 | AlternatePaste = ''
|
---|
773 | endif
|
---|
774 |
|
---|
775 | if DefaultPaste = 'C' then
|
---|
776 | 'cascade_menu popup_paste popup_pastec' -- Paste cascade; default is Paste (character mark)
|
---|
777 | elseif DefaultPaste = 'B' then
|
---|
778 | 'cascade_menu popup_paste popup_pasteb' -- Paste cascade; default is Paste Block
|
---|
779 | else
|
---|
780 | 'cascade_menu popup_paste popup_pastel' -- Paste cascade; default is Paste Lines
|
---|
781 | endif
|
---|
782 | compile endif
|
---|
783 |
|
---|