/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
ViewVC logotype

Annotation of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 56527 - (hide annotations)
Sat Jan 14 08:30:04 2006 UTC (14 years, 1 month ago) by jfiat
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 124659 byte(s)
update code to fit recent features renaming related to "preference" term rather than "resource" term


1 manus 26913 indexing
2     description : "Window holding a project tool"
3     date : "$Date$"
4     revision : "$Revision$"
5 jfiat 54401 author : "$Author$"
6 manus 26913
7     class
8     EB_DEVELOPMENT_WINDOW
9    
10     inherit
11     EB_TOOL_MANAGER
12     redefine
13     make,
14     init_size_and_position,
15 rogers 40708 window_displayed,
16 manus 26913 init_commands,
17     build_menu_bar,
18     build_menus,
19     build_file_menu,
20     build_edit_menu,
21     build_view_menu,
22     build_tools_menu,
23     build_favorites_menu,
24     refresh,
25 xavier 27860 recycle,
26 manus 26913 destroy_imp,
27 tedf 55179 destroy,
28     position,
29     pos_container
30 manus 26913 end
31    
32     EB_FILEABLE
33 tedf 55179 export {NONE}
34     set_position,
35     set_pos_container
36 manus 26913 redefine
37     set_stone,
38     reset,
39     stone,
40     on_text_saved,
41     perform_check_before_save,
42     check_passed,
43 tedf 55179 update_save_symbol,
44     position,
45     pos_container
46 manus 26913 select
47     set_stone
48     end
49    
50     EB_FILEABLE
51     rename
52     set_stone as old_set_stone
53     export {NONE}
54 tedf 55179 old_set_stone,
55     set_position,
56     set_pos_container
57 manus 26913 redefine
58     reset,
59     stone,
60     on_text_saved,
61     perform_check_before_save,
62     check_passed,
63 tedf 55179 update_save_symbol,
64     position,
65     pos_container
66 manus 26913 end
67    
68    
69     -- Shared tools & contexts
70    
71     SHARED_EIFFEL_PROJECT
72    
73     PROJECT_CONTEXT
74    
75     EB_SHARED_MANAGERS
76    
77     EB_SHARED_GRAPHICAL_COMMANDS
78    
79 neilc 49534 EB_SHARED_PREFERENCES
80 xavier 30020 export
81     {NONE} all
82     end
83 manus 26913
84     EV_STOCK_PIXMAPS
85    
86     EB_CONFIRM_SAVE_CALLBACK
87    
88     -- Errors
89     EB_GRAPHICAL_ERROR_MANAGER
90    
91     TEXT_OBSERVER
92     redefine
93 manus 51111 on_text_reset, on_text_edited,
94 xavier 27840 on_text_back_to_its_last_saved_state,
95 xavier 29812 on_text_fully_loaded, on_cursor_moved
96 manus 26913 end
97 manus 51111
98 manus 26913 EV_KEY_CONSTANTS
99     export
100     {NONE} All
101     end
102 manus 51111
103 neilc 49534 EIFFEL_ENV
104     export
105     {NONE} All
106     end
107 manus 51111
108 manus 47824 SHARED_TEXT_ITEMS
109     export
110     {NONE} All
111     end
112 manus 26913
113 julieng 37686 create {EB_WINDOW_MANAGER}
114 manus 26913 make,
115 king 55319 make_with_session_data,
116 manus 26913 make_as_context_tool,
117     make_as_editor
118    
119     feature {NONE} -- Initialization
120    
121     make_as_context_tool is
122     -- Create a new development window and expand the context tool.
123     do
124     make
125 rogers 40708 -- Perform window setting from `show_actions', as the
126     -- resizing executed as a result only works correctly
127     -- while the window is displayed.
128     window.show_actions.extend (agent set_context_mode)
129     end
130 manus 51111
131 rogers 40708 set_context_mode is
132     -- Set `current' into context mode, that is the context tool
133     -- maximized, and the non editor panel is hidden.
134     do
135 manus 26913 if not context_tool.shown then
136     context_tool.show
137     end
138     if not unified_stone then
139     toggle_stone_cmd.execute
140     end
141     context_tool.explorer_bar_item.maximize
142 rogers 40708 close_all_bars_except (right_panel)
143 manus 26913 end
144    
145     make_as_editor is
146     -- Create a new development window and expand the editor tool.
147     do
148     make
149 rogers 40708 -- Perform window setting from `show_actions', as the resizing executed
150     -- must be performed after `current' is displayed.
151     window.show_actions.extend (agent (editor_tool.explorer_bar_item).maximize)
152     window.show_actions.extend (agent close_all_bars_except (right_panel))
153 manus 26913 end
154    
155 king 55319 make_with_session_data (a_session_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA) is
156     -- Recreate a previously existing development window using `a_session_data'.
157     local
158     l_class_i: CLASS_I
159     l_class_c_stone: CLASSC_STONE
160     l_cluster_string, l_class_string, l_feature_string: STRING
161     do
162     internal_development_window_data := a_session_data
163 manus 55527 make
164 king 55319 -- Attempt to reload last edited class of `Current'.
165     if a_session_data.file_name /= Void then
166     l_class_i := eiffel_universe.class_with_file_name (a_session_data.file_name)
167     if l_class_i /= Void and then l_class_i.compiled then
168     -- Create compiled class stone and target `Current' to it.
169     create l_class_c_stone.make (l_class_i.compiled_class)
170     set_stone_after_check (l_class_c_stone)
171     if a_session_data.editor_position > 0 then
172     editor_tool.text_area.display_line_when_ready (a_session_data.editor_position, False)
173     end
174     end
175     end
176     if context_tool /= Void then
177     -- Presumption is made that if the strings are not void then they represent
178     -- valid entities in the project.
179     l_cluster_string := a_session_data.context_cluster_string
180     l_class_string := a_session_data.context_class_string
181     l_feature_string := a_session_data.context_feature_string
182     if l_feature_string /= Void then
183     context_tool.address_manager.feature_address.set_text (l_feature_string)
184     context_tool.address_manager.class_address.set_text (l_class_string)
185     context_tool.address_manager.execute_with_feature
186     elseif l_class_string /= Void then
187     context_tool.address_manager.class_address.set_text (l_class_string)
188     context_tool.address_manager.execute_with_class
189     elseif l_cluster_string /= Void then
190     context_tool.address_manager.cluster_address.set_text (l_cluster_string)
191     context_tool.address_manager.execute_with_cluster
192     end
193     -- Set the appropriate notebook tab
194 manus 56322 context_tool.notebook.select_item (context_tool.notebook.i_th (a_session_data.context_tab_index))
195 king 55319 end
196     end
197    
198 manus 26913 make is
199     -- Create a new development window.
200     do
201 neilc 50976 unified_stone := preferences.development_window_data.context_unified_stone
202 manus 26913 -- Build the history manager, the address manager, ...
203     create history_manager.make (Current)
204     create address_manager.make (Current, False)
205     build_formatters
206     address_manager.set_formatters (managed_main_formatters)
207    
208     -- Init commands, build interface, build menus, ...
209     Precursor
210    
211     initialized := False -- Reset the flag since initialization is not yet complete.
212 xavier 28303 set_up_accelerators
213 manus 51111
214 neilc 51796 window.focus_in_actions.extend(agent on_focus)
215    
216 xavier 28514 -- Create the toolbars.
217     build_toolbars_area
218     container.put_front (toolbars_area)
219     container.disable_item_expand (toolbars_area)
220 manus 26913
221     -- Update widgets visibilities
222 rogers 40708 window.show_actions.extend (agent update)
223 xavier 29812 status_bar.remove_cursor_position
224 xavier 29871 address_manager.set_output_line (status_bar.label)
225 manus 26913
226     -- Finish initializing the main editor formatters
227     end_build_formatters
228 manus 51111
229 xavier 28280 address_manager.disable_formatters
230 xavier 28303 if Eiffel_project.manager.is_project_loaded then
231 xavier 28304 on_project_created
232 xavier 28303 on_project_loaded
233 xavier 28304 elseif Eiffel_project.manager.is_created then
234     on_project_unloaded
235     on_project_created
236 xavier 28303 else
237     on_project_unloaded
238     end
239 manus 51111
240 neilc 33858 -- Create feature position table
241     create feature_positions.make (1)
242     feature_positions.compare_objects
243 manus 51111
244 rogers 40708 window.move_actions.force_extend (agent window_moved)
245 manus 26913
246     initialized := True
247     is_destroying := False
248     end
249 manus 51111
250 manus 26913 init_size_and_position is
251     -- Initialize window size.
252     local
253 manus 52172 screen: EB_STUDIO_SCREEN
254     l_x, l_y: INTEGER
255 manus 26913 do
256     create screen
257 manus 51180 window.set_size (
258 king 55319 development_window_data.width.min (screen.width),
259     development_window_data.height.min (screen.height))
260     l_x := development_window_data.x_position
261 manus 52172 if l_x < screen.virtual_left or l_x > screen.virtual_right then
262     -- Somehow screens have changed, reset it to 0
263     l_x := 0
264     end
265 king 55319 l_y := development_window_data.y_position
266 manus 52172 if l_y < screen.virtual_top or l_y > screen.virtual_bottom then
267     -- Somehow screens have changed, reset it to 0
268     l_y := 0
269     end
270     window.set_position (l_x, l_y)
271 rogers 40708 end
272 manus 51111
273 rogers 40708 window_displayed is
274     -- `Current' has been displayed on screen.
275     do
276 king 55319 -- Minimize or Maximize window if needed.
277     if development_window_data.is_maximized then
278 manus 26913 window.maximize
279 king 55319 elseif development_window_data.is_minimized then
280     window.minimize
281 manus 26913 end
282     end
283    
284     init_commands is
285     -- Initialize commands.
286 xavier 27498 local
287     accel: EV_ACCELERATOR
288 manus 26913 do
289     Precursor
290     create toolbarable_commands.make (15)
291    
292     -- Open, save, ...
293     toolbarable_commands.extend (new_editor_cmd)
294    
295     toolbarable_commands.extend (new_context_tool_cmd)
296    
297     create open_cmd.make (Current)
298     toolbarable_commands.extend (open_cmd)
299    
300     create save_cmd.make (Current)
301     toolbarable_commands.extend (save_cmd)
302    
303     create save_as_cmd.make (Current)
304     if editor_tool = Void or else editor_tool.text_area.is_empty then
305     save_as_cmd.disable_sensitive
306     else
307     save_as_cmd.enable_sensitive
308     end
309    
310     create shell_cmd.make (Current)
311     toolbarable_commands.extend (shell_cmd)
312    
313     create print_cmd.make (Current)
314     if is_empty then
315     print_cmd.disable_sensitive
316     else
317     print_cmd.enable_sensitive
318     end
319     toolbarable_commands.extend (print_cmd)
320    
321     -- Compilation
322     create c_workbench_compilation_cmd.make_workbench (Current)
323     create c_finalized_compilation_cmd.make_finalized (Current)
324 xavier 27549 if has_dll_generation then
325     create show_dynamic_lib_tool.make
326 manus 51111 show_dynamic_lib_tool.set_menu_name (Interface_names.m_new_dynamic_lib)
327 manus 36309 show_dynamic_lib_tool.add_agent (agent show_dynamic_library_dialog)
328 xavier 27549 end
329     if has_profiler then
330     create show_profiler
331     end
332 manus 26913
333     -- Undo/redo, cut, copy, paste.
334     create undo_cmd.make (Current)
335     toolbarable_commands.extend (undo_cmd)
336    
337     create redo_cmd.make (Current)
338     toolbarable_commands.extend (redo_cmd)
339    
340     create editor_paste_cmd.make (Current)
341     toolbarable_commands.extend (editor_paste_cmd)
342    
343     create new_cluster_cmd.make (Current)
344     toolbarable_commands.extend (new_cluster_cmd)
345    
346     create new_class_cmd.make (Current)
347     toolbarable_commands.extend (new_class_cmd)
348    
349     create delete_class_cluster_cmd.make (Current)
350     toolbarable_commands.extend (delete_class_cluster_cmd)
351    
352     create new_feature_cmd.make (Current)
353     toolbarable_commands.extend (new_feature_cmd)
354 manus 51111
355 alexk 51136 create toggle_feature_alias_cmd.make (Current)
356     toolbarable_commands.extend (toggle_feature_alias_cmd)
357    
358 jfiat 42965 create toggle_feature_signature_cmd.make (Current)
359 jfiat 42973 toolbarable_commands.extend (toggle_feature_signature_cmd)
360 manus 26913
361 alexk 51887 create toggle_feature_assigner_cmd.make (Current)
362     toolbarable_commands.extend (toggle_feature_assigner_cmd)
363    
364 manus 26913 create toggle_stone_cmd.make (Current)
365     toolbarable_commands.extend (toggle_stone_cmd)
366    
367     create send_stone_to_context_cmd.make
368     send_stone_to_context_cmd.set_pixmaps (Pixmaps.Icon_send_stone_down)
369 manus 51111 send_stone_to_context_cmd.set_tooltip (Interface_names.e_send_stone_to_context)
370     send_stone_to_context_cmd.set_menu_name (Interface_names.m_send_stone_to_context)
371 manus 26913 send_stone_to_context_cmd.set_name ("Send_to_context")
372 manus 51111 send_stone_to_context_cmd.set_tooltext (Interface_names.b_send_stone_to_context)
373 manus 36309 send_stone_to_context_cmd.add_agent (agent send_stone_to_context)
374 xavier 27498 create accel.make_with_key_combination (
375     create {EV_KEY}.make_with_code (Kcst.Key_down), False, True, False
376     )
377 manus 36309 accel.actions.extend (agent send_stone_to_context)
378 xavier 27498 send_stone_to_context_cmd.set_accelerator (accel)
379 manus 26913 send_stone_to_context_cmd.disable_sensitive
380     toolbarable_commands.extend (send_stone_to_context_cmd)
381    
382     toolbarable_commands.extend (window_manager.minimize_all_cmd)
383     window_manager.minimize_all_cmd.enable_sensitive
384     toolbarable_commands.extend (window_manager.raise_all_cmd)
385     window_manager.raise_all_cmd.enable_sensitive
386    
387     toolbarable_commands.extend (New_development_window_cmd)
388     -- Show tool/toolbar commands (will be filled when tools will
389     -- be created)
390     create show_tool_commands.make (7)
391     create show_toolbar_commands.make (3)
392    
393 xavier 28303 new_feature_cmd.disable_sensitive
394 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
395 jfiat 42965 toggle_feature_signature_cmd.disable_sensitive
396 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
397 xavier 28303
398     create editors.make (5)
399 larryl 54857 estudio_debug_cmd.set_main_window (window)
400 xavier 28303 end
401    
402     set_up_accelerators is
403     -- Fill the accelerator of `window' with the accelerators of the `toolbarable_commands'.
404 jfiat 56447 local
405     cmds: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
406 xavier 28303 do
407 jfiat 54580 --| Accelerators related to toolbarable_commands
408 manus 26913 from
409 jfiat 56447 cmds := toolbarable_commands
410     cmds.start
411 manus 26913 until
412 jfiat 56447 cmds.after
413 manus 26913 loop
414 jfiat 56447 if cmds.item.accelerator /= Void then
415     window.accelerators.extend (cmds.item.accelerator)
416 manus 26913 end
417 jfiat 56447 cmds.forth
418 manus 26913 end
419    
420 jfiat 54580 --| Accelerators related to debugging toolbarable_commands
421 manus 26913 from
422 jfiat 56447 cmds := Eb_debugger_manager.toolbarable_commands
423     cmds.start
424 manus 26913 until
425 jfiat 56447 cmds.after
426 manus 26913 loop
427     if
428 jfiat 56447 cmds.item.accelerator /= Void
429 manus 26913 then
430 jfiat 56447 window.accelerators.extend (cmds.item.accelerator)
431 manus 26913 end
432 jfiat 56447 cmds.forth
433 manus 26913 end
434     end
435    
436     build_formatters is
437     -- Build all formatters used.
438     local
439     form: EB_CLASS_TEXT_FORMATTER
440     accel: EV_ACCELERATOR
441     do
442 neilc 33294 create managed_class_formatters.make (17)
443 manus 26913 managed_class_formatters.extend (create {EB_CLICKABLE_FORMATTER}.make (Current))
444     managed_class_formatters.extend (create {EB_FLAT_FORMATTER}.make (Current))
445     managed_class_formatters.extend (create {EB_SHORT_FORMATTER}.make (Current))
446     managed_class_formatters.extend (create {EB_FLAT_SHORT_FORMATTER}.make (Current))
447     managed_class_formatters.extend (Void)
448     managed_class_formatters.extend (create {EB_ANCESTORS_FORMATTER}.make (Current))
449     managed_class_formatters.extend (create {EB_DESCENDANTS_FORMATTER}.make (Current))
450     managed_class_formatters.extend (create {EB_CLIENTS_FORMATTER}.make (Current))
451     managed_class_formatters.extend (create {EB_SUPPLIERS_FORMATTER}.make (Current))
452     managed_class_formatters.extend (Void)
453     managed_class_formatters.extend (create {EB_ATTRIBUTES_FORMATTER}.make (Current))
454     managed_class_formatters.extend (create {EB_ROUTINES_FORMATTER}.make (Current))
455 manus 54560 managed_class_formatters.extend (create {EB_INVARIANTS_FORMATTER}.make (Current))
456 manus 54538 managed_class_formatters.extend (create {EB_CREATORS_FORMATTER}.make (Current))
457 manus 26913 managed_class_formatters.extend (create {EB_DEFERREDS_FORMATTER}.make (Current))
458     managed_class_formatters.extend (create {EB_ONCES_FORMATTER}.make (Current))
459     managed_class_formatters.extend (create {EB_EXTERNALS_FORMATTER}.make (Current))
460     managed_class_formatters.extend (create {EB_EXPORTED_FORMATTER}.make (Current))
461    
462 manus 48565 create managed_feature_formatters.make (12)
463 manus 26913 managed_feature_formatters.extend (create {EB_BASIC_FEATURE_FORMATTER}.make (Current))
464     managed_feature_formatters.extend (create {EB_ROUTINE_FLAT_FORMATTER}.make (Current))
465     managed_feature_formatters.extend (Void)
466 manus 48565 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current, 0))
467     managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
468 manus 49446 {DEPEND_UNIT}.is_in_assignment_flag))
469 manus 51111 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
470 manus 49446 {DEPEND_UNIT}.is_in_creation_flag))
471 manus 48565 managed_feature_formatters.extend (Void)
472 manus 26913 managed_feature_formatters.extend (create {EB_IMPLEMENTERS_FORMATTER}.make (Current))
473     managed_feature_formatters.extend (create {EB_ROUTINE_ANCESTORS_FORMATTER}.make (Current))
474     managed_feature_formatters.extend (create {EB_ROUTINE_DESCENDANTS_FORMATTER}.make (Current))
475 manus 48565 managed_feature_formatters.extend (Void)
476 manus 26913 managed_feature_formatters.extend (create {EB_HOMONYMS_FORMATTER}.make (Current))
477    
478 manus 51111
479 neilc 33294 create managed_main_formatters.make (6)
480 manus 51111
481 manus 26913 create {EB_BASIC_TEXT_FORMATTER} form.make (Current)
482     create accel.make_with_key_combination (
483     create {EV_KEY}.make_with_code (Kcst.Key_t),
484     True, False, True)
485 manus 36309 accel.actions.extend (agent form.execute)
486 manus 26913 form.set_accelerator (accel)
487     managed_main_formatters.extend (form)
488    
489     create {EB_CLICKABLE_FORMATTER} form.make (Current)
490     create accel.make_with_key_combination (
491     create {EV_KEY}.make_with_code (Kcst.Key_c),
492     True, False, True)
493 manus 36309 accel.actions.extend (agent form.execute)
494 manus 26913 form.set_accelerator (accel)
495     managed_main_formatters.extend (form)
496    
497     create {EB_FLAT_FORMATTER} form.make (Current)
498     create accel.make_with_key_combination (
499     create {EV_KEY}.make_with_code (Kcst.Key_f),
500     True, False, True)
501 manus 36309 accel.actions.extend (agent form.execute)
502 manus 26913 form.set_accelerator (accel)
503     managed_main_formatters.extend (form)
504    
505     create {EB_SHORT_FORMATTER} form.make (Current)
506     create accel.make_with_key_combination (
507     create {EV_KEY}.make_with_code (Kcst.Key_o),
508     True, False, True)
509 manus 36309 accel.actions.extend (agent form.execute)
510 manus 26913 form.set_accelerator (accel)
511     managed_main_formatters.extend (form)
512    
513     create {EB_FLAT_SHORT_FORMATTER} form.make (Current)
514     create accel.make_with_key_combination (
515     create {EV_KEY}.make_with_code (Kcst.Key_i),
516     True, False, True)
517 manus 36309 accel.actions.extend (agent form.execute)
518 manus 26913 form.set_accelerator (accel)
519 manus 51111 managed_main_formatters.extend (form)
520 manus 26913 end
521    
522     end_build_formatters is
523 manus 33315 -- Finish initialization of formatters (associate them with editor
524     -- and select a formatter).
525 manus 26913 local
526     f_ind: INTEGER
527     do
528     from
529     managed_class_formatters.start
530     until
531     managed_class_formatters.after
532     loop
533     if managed_class_formatters.item /= Void then
534     managed_class_formatters.item.set_manager (context_tool)
535     end
536     managed_class_formatters.forth
537     end
538     from
539     managed_feature_formatters.start
540     until
541     managed_feature_formatters.after
542     loop
543     if managed_feature_formatters.item /= Void then
544     managed_feature_formatters.item.set_manager (context_tool)
545     end
546     managed_feature_formatters.forth
547     end
548     from
549     managed_main_formatters.start
550     until
551     managed_main_formatters.after
552     loop
553     managed_main_formatters.item.set_editor (editor_tool.text_area)
554     managed_main_formatters.item.on_shown
555     if managed_main_formatters.item.accelerator /= Void then
556     window.accelerators.extend (managed_main_formatters.item.accelerator)
557     end
558     managed_main_formatters.forth
559     end
560    
561     (managed_main_formatters @ 1).enable_select;
562 manus 51111
563 manus 26913 -- We now select the correct class formatter.
564 neilc 53432 f_ind := preferences.context_tool_data.default_class_formatter_index
565 manus 26913 --| This takes the formatter separators in consideration.
566 neilc 33365 if f_ind > 4 then
567 manus 26913 f_ind := f_ind + 1
568     end
569 neilc 33365 if f_ind > 8 then
570 manus 26913 f_ind := f_ind + 1
571     end
572     if f_ind < 1 or f_ind > managed_class_formatters.count then
573 neilc 33365 f_ind := 6
574 manus 26913 end
575 manus 51111 (managed_class_formatters @ f_ind).enable_select;
576 manus 26913 -- We now select the correct feature formatter.
577 neilc 53432 f_ind := preferences.context_tool_data.default_feature_formatter_index
578 manus 26913 if f_ind > 2 then
579     f_ind := f_ind + 1
580     end
581     if f_ind < 1 or f_ind > managed_feature_formatters.count then
582     f_ind := 2
583     end
584 manus 33315 managed_class_formatters.i_th (f_ind).enable_select
585 manus 26913 end
586    
587     build_tools is
588     -- Build all tools that can take place in this window and put them
589     -- in `left_tools' or `bottom_tools'.
590     local
591     show_cmd: EB_SHOW_TOOL_COMMAND
592 tedf 56390 l_accel: EV_ACCELERATOR
593     l_shortcut_preference: SHORTCUT_PREFERENCE
594 manus 26913 do
595 rogers 43098 lock_update
596 manus 26913 -- Build the features tool
597 jfiat 48452 create features_tool.make (Current)
598     features_tool.attach_to_explorer_bar (left_panel)
599 manus 26913 left_tools.extend (features_tool.explorer_bar_item)
600     create show_cmd.make (Current, features_tool.explorer_bar_item)
601     show_tool_commands.extend (show_cmd)
602     toolbarable_commands.extend (show_cmd)
603     add_recyclable (features_tool)
604    
605 jfiat 54610 -- Build the breakpoints tool
606     create breakpoints_tool.make (Current)
607     breakpoints_tool.attach_to_explorer_bar (left_panel)
608     left_tools.extend (breakpoints_tool.explorer_bar_item)
609     create show_cmd.make (Current, breakpoints_tool.explorer_bar_item)
610     show_tool_commands.extend (show_cmd)
611     toolbarable_commands.extend (show_cmd)
612     add_recyclable (breakpoints_tool)
613    
614 manus 26913 -- Build the cluster tool
615 jfiat 48452 create cluster_tool.make (Current, Current)
616     cluster_tool.attach_to_explorer_bar (left_panel)
617 manus 26913 left_tools.extend (cluster_tool.explorer_bar_item)
618     create show_cmd.make (Current, cluster_tool.explorer_bar_item)
619     show_tool_commands.extend (show_cmd)
620     toolbarable_commands.extend (show_cmd)
621     add_recyclable (cluster_tool)
622    
623     -- Build the favorites tool
624 jfiat 48452 create favorites_tool.make (Current, favorites_manager)
625     favorites_tool.attach_to_explorer_bar (left_panel)
626 manus 26913 left_tools.extend (favorites_tool.explorer_bar_item)
627     create show_cmd.make (Current, favorites_tool.explorer_bar_item)
628     show_tool_commands.extend (show_cmd)
629     toolbarable_commands.extend (show_cmd)
630     add_recyclable (favorites_tool)
631    
632     -- Build the windows tool (formerly known as Selector tool)
633 jfiat 48452 create windows_tool.make (Current)
634     windows_tool.attach_to_explorer_bar (left_panel)
635 manus 26913 left_tools.extend (windows_tool.explorer_bar_item)
636     create show_cmd.make (Current, windows_tool.explorer_bar_item)
637     show_tool_commands.extend (show_cmd)
638     toolbarable_commands.extend (show_cmd)
639     add_recyclable (windows_tool)
640 manus 55527
641 tedf 55179 -- Build the search tool
642 tedf 56390 create search_tool.make (Current)
643 tedf 55179 search_tool.attach_to_explorer_bar (right_panel)
644     bottom_tools.extend (search_tool.explorer_bar_item)
645     create show_cmd.make (Current, search_tool.explorer_bar_item)
646 tedf 56390 l_shortcut_preference := preferences.editor_data.shortcuts.item ("show_search_panel")
647     create l_accel.make_with_key_combination (l_shortcut_preference.key, l_shortcut_preference.is_ctrl, l_shortcut_preference.is_alt, l_shortcut_preference.is_shift)
648     l_accel.actions.extend (agent search_tool.prepare_search)
649     show_cmd.set_accelerator (l_accel)
650 tedf 55179 show_tool_commands.extend (show_cmd)
651     toolbarable_commands.extend (show_cmd)
652     add_recyclable (search_tool)
653 manus 26913
654     -- Build the editor tool
655 jfiat 48452 create editor_tool.make (Current)
656     editor_tool.attach_to_explorer_bar (right_panel)
657 manus 26913 bottom_tools.extend (editor_tool.explorer_bar_item)
658     editor_tool.text_area.add_edition_observer(save_cmd)
659     editor_tool.text_area.add_edition_observer(save_as_cmd)
660     editor_tool.text_area.add_edition_observer(print_cmd)
661     editor_tool.text_area.add_edition_observer(Current)
662 tedf 55179 editor_tool.text_area.add_edition_observer(search_tool)
663 manus 36309 editor_tool.text_area.drop_actions.set_veto_pebble_function (agent can_drop)
664 xavier 29812 editor_tool.text_area.add_cursor_observer (Current)
665 tedf 55179 create show_cmd.make(Current, editor_tool.explorer_bar_item)
666     show_tool_commands.extend (show_cmd)
667     toolbarable_commands.extend (show_cmd)
668 manus 51111
669 rogers 40708 -- The minimim height masks a bug on windows to do with the sizing of the editors
670     -- scroll bars, which were affecting the resizing although they should not have done so.
671     -- Having a default minimum height on the editor is perfectly reasonable.
672     editor_tool.widget.set_minimum_height (20)
673 manus 26913 add_recyclable (editor_tool)
674    
675     -- Build the context tool
676 jfiat 48452 create context_tool.make (Current)
677     context_tool.attach_to_explorer_bar (right_panel)
678 manus 26913 bottom_tools.extend (context_tool.explorer_bar_item)
679     create show_cmd.make (Current, context_tool.explorer_bar_item)
680     show_tool_commands.extend (show_cmd)
681     toolbarable_commands.extend (show_cmd)
682     add_recyclable (context_tool)
683    
684     -- Set the flag "Tools initialized"
685     tools_initialized := True
686 manus 51111
687 manus 26913 -- Initialize undo / redo accelerators
688 manus 51111 create undo_accelerator.make_with_key_combination (
689     create {EV_KEY}.make_with_code (Key_z), True, False, False)
690 xavier 27549 if has_case then
691     undo_accelerator.actions.extend (agent (context_tool.editor.undo_cmd).on_ctrl_z)
692     end
693 manus 26913 undo_accelerator.actions.extend (agent undo_cmd.accelerator_execute)
694 manus 51111 create redo_accelerator.make_with_key_combination (
695     create {EV_KEY}.make_with_code (Key_y), True, False, False)
696 xavier 27549 if has_case then
697     redo_accelerator.actions.extend (agent (context_tool.editor.redo_cmd).on_ctrl_y)
698     end
699 manus 26913 redo_accelerator.actions.extend (agent redo_cmd.accelerator_execute)
700     window.accelerators.extend (undo_accelerator)
701     window.accelerators.extend (redo_accelerator)
702 rogers 43098 unlock_update
703 manus 26913 end
704    
705     feature -- Access
706    
707     cluster: CLUSTER_I is
708     -- Cluster for current class. Void if none.
709     local
710     classi_stone: CLASSI_STONE
711     cluster_stone: CLUSTER_STONE
712     do
713     classi_stone ?= stone
714     if classi_stone /= Void then
715     Result := classi_stone.cluster
716     end
717     cluster_stone ?= stone
718     if cluster_stone /= Void then
719     Result := cluster_stone.cluster_i
720     end
721     end
722    
723     class_name: STRING is
724     -- Name of the current class, Void if none.
725     local
726     class_stone: CLASSI_STONE
727     do
728     class_stone ?= stone
729     if class_stone /= Void then
730     Result := class_stone.class_name
731     end
732     end
733    
734     feature_name: STRING is
735     -- Name of the current feature, Void if none.
736     local
737     feature_stone: FEATURE_STONE
738     do
739     feature_stone ?= stone
740     if feature_stone /= Void then
741     Result := feature_stone.feature_name
742     end
743     end
744 manus 51111
745 xavier 30005 feature -- Status setting
746    
747     disable_sensitive is
748     -- Disable sensitivity of all widgets.
749     do
750     window.disable_sensitive
751     end
752    
753     enable_sensitive is
754     -- Enable sensitivity of all widgets.
755     do
756     window.enable_sensitive
757     end
758    
759 manus 26913 feature -- Window Settings
760    
761     set_initialized is
762     -- Set `initialized' to True.
763     do
764     initialized := True
765     end
766    
767     set_text (a_text: STRING) is
768     -- Assign `a_text' to `text'.
769     require
770     a_text_not_void: a_text /= Void
771     do
772 neilc 49534 editor_tool.text_area.set_editor_text (a_text)
773 manus 26913 ensure
774     --| FIXME This needs to work: text_assigned: text.is_equal (a_text)
775     --| FIXME changed_flag_set: changed
776     end
777    
778     feature -- Window Properties
779    
780     changed: BOOLEAN is
781     -- Has something been changed and not yet been saved?
782     do
783     Result := editor_tool.changed
784     end
785    
786     is_empty: BOOLEAN is
787     -- Does `Current's text is empty?
788     do
789     Result := editor_tool = Void or else editor_tool.text_area.is_empty
790     end
791    
792     text: STRING is
793     -- Text representing Current
794     do
795     Result := editor_tool.text_area.text
796     end
797    
798     pixmap: EV_PIXMAP is
799     -- Pixmap representing Current window.
800     do
801     Result := Pixmaps.Icon_development_window
802     end
803    
804     feature -- Pulldown Menus
805    
806     metric_menu: EV_MENU
807     -- Menu for entries of metric tool.
808 manus 51111
809 manus 26913 format_menu: EV_MENU
810     -- ID Menu for formats.
811     -- Only used during debugging
812    
813     compile_menu: EV_MENU
814     -- Compile ID menu.
815    
816     debug_menu: EV_MENU
817     -- Debug ID menu.
818 manus 55527
819 jfiat 54577 debugging_tools_menu: EV_MENU
820     -- Debugging tools menu item
821 manus 26913
822     active_menus (erase: BOOLEAN) is
823     -- Enable all the menus and if `erase' clean
824     -- the content of the Project tool.
825     do
826     compile_menu.enable_sensitive
827     if erase then
828     output_manager.clear
829     end
830     end
831    
832     disable_menus is
833     -- Disable all the menus.
834     do
835     compile_menu.disable_sensitive
836     end
837 manus 55527
838 jfiat 54577 update_debug_menu is
839     -- Update debug menu
840     do
841 jfiat 56447 Eb_debugger_manager.update_debugging_tools_menu_from (Current)
842 jfiat 54577 end
843 manus 26913
844     feature -- Modifiable menus
845    
846     melt_menu_item: EV_MENU_ITEM
847     -- Melt menu entry
848    
849     freeze_menu_item: EV_MENU_ITEM
850     -- Freeze menu entry
851    
852     finalize_menu_item: EV_MENU_ITEM
853     -- Finalize menu entry
854    
855     feature -- Update
856    
857     synchronize is
858     -- Synchronize stones.
859     local
860     st: STONE
861     do
862     during_synchronization := True
863     favorites_manager.refresh
864     context_tool.synchronize
865     cluster_tool.synchronize
866     history_manager.synchronize
867     features_tool.synchronize
868 jfiat 54610 breakpoints_tool.synchronize
869 alexk 53977 -- Update main views
870     managed_main_formatters.i_th (2).invalidate
871     managed_main_formatters.i_th (3).invalidate
872     managed_main_formatters.i_th (4).invalidate
873     managed_main_formatters.i_th (5).invalidate
874 manus 26913 if stone /= Void then
875     st := stone.synchronized_stone
876     end
877 manus 27952 editor_tool.text_area.update_click_list (False)
878 manus 26913 set_stone (st)
879     update_save_symbol
880     address_manager.refresh
881     during_synchronization := False
882     end
883 manus 55527
884 manus 26913 synchronize_routine_tool_to_default is
885     -- Synchronize the editor tool to the debug format.
886     do
887     --| FIXME ARNAUD: To be implemented
888     end
889    
890     clear_object_tool is
891     -- Clear the contents of the object tool if shown.
892     do
893     --| FIXME ARNAUD: To be implemented
894     end
895    
896     build_menus is
897     -- Build all menus displayed in the development window.
898     do
899     -- Build each menu
900     build_file_menu
901     build_edit_menu
902     build_view_menu
903     build_favorites_menu
904     build_project_menu
905     build_debug_menu
906     build_tools_menu
907     build_window_menu
908 manus 55527 build_help_menu
909 manus 26913 -- Build the menu bar.
910     build_menu_bar
911     end
912    
913     build_debug_menu is
914     -- Build the `Debug' menu through the debugger_manager.
915     local
916     conv_mit: EB_COMMAND_MENU_ITEM
917     do
918 jfiat 56447 debug_menu := Eb_debugger_manager.new_debug_menu
919 manus 26913 from
920     debug_menu.start
921     until
922     debug_menu.after
923     loop
924     conv_mit ?= debug_menu.item
925     if conv_mit /= Void then
926     add_recyclable (conv_mit)
927     end
928     debug_menu.forth
929     end
930 jfiat 54577 --| Debugging tools menu
931 jfiat 56447 debugging_tools_menu := Eb_debugger_manager.new_debugging_tools_menu
932 jfiat 54577 debug_menu.extend (create {EV_MENU_SEPARATOR})
933     debug_menu.extend (debugging_tools_menu)
934     update_debug_menu
935 manus 26913 end
936    
937     build_menu_bar is
938     -- Build the menu bar
939     local
940     mb: EV_MENU_BAR
941     do
942     check
943     window.menu_bar /= Void implies not window.menu_bar.is_empty
944     -- If a menu bar was already present, it shouldn't be empty.
945     end
946     if window.menu_bar /= Void then
947     mb := window.menu_bar
948     from
949     mb.start
950     mb.forth
951     until
952     mb.after
953     loop
954     mb.remove
955     end
956     else
957     create mb
958     window.set_menu_bar (mb)
959     mb.extend (file_menu)
960     end
961    
962     if Eiffel_project.manager.is_created then
963     mb.extend (edit_menu)
964     mb.extend (view_menu)
965     mb.extend (favorites_menu)
966     mb.extend (project_menu)
967     mb.extend (debug_menu)
968     else
969     mb.extend (view_menu)
970     end
971     mb.extend (tools_menu)
972     mb.extend (window_menu)
973     mb.extend (help_menu)
974 larryl 54857 estudio_debug_cmd.build_menu_bar
975 manus 26913 end
976    
977     feature -- Graphical Interface
978    
979     build_general_toolbar is
980     -- Set up the general toolbar (New, Save, Search, Shell, Undo, Redo, ...)
981     local
982     cell: EV_CELL
983     hsep: EV_HORIZONTAL_SEPARATOR
984     hbox: EV_HORIZONTAL_BOX
985     do
986     -- Create the toolbar.
987     create general_toolbar
988 king 55319 general_customizable_toolbar := development_window_data.retrieve_general_toolbar (toolbarable_commands)
989     if development_window_data.show_text_in_general_toolbar then
990 king 46348 general_customizable_toolbar.enable_important_text
991 king 55319 elseif development_window_data.show_all_text_in_general_toolbar then
992 manus 26913 general_customizable_toolbar.enable_text_displayed
993     end
994 manus 51111
995 manus 26913 create hbox
996     hbox.extend (general_customizable_toolbar.widget)
997     hbox.disable_item_expand (general_customizable_toolbar.widget)
998    
999     -- Generate the toolbar.
1000     general_customizable_toolbar.update_toolbar
1001    
1002     -- Cell to fill in empty space and receive the right click menu holder.
1003     create cell
1004 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1005 manus 26913 hbox.extend (cell)
1006    
1007     -- Create the vertical layout (separator + toolbar)
1008     create hsep
1009     general_toolbar.set_padding (2)
1010     general_toolbar.extend (hsep)
1011     general_toolbar.disable_item_expand (hsep)
1012     general_toolbar.extend (hbox)
1013    
1014     -- Create the command to show/hide this toolbar.
1015 manus 51111 create show_general_toolbar_command.make (general_toolbar, Interface_names.m_general_toolbar)
1016 manus 26913 show_toolbar_commands.extend (show_general_toolbar_command)
1017 king 55319 if development_window_data.show_general_toolbar then
1018 manus 26913 show_general_toolbar_command.enable_visible
1019     else
1020     show_general_toolbar_command.disable_visible
1021     end
1022    
1023     end
1024    
1025     build_address_toolbar is
1026     -- Set up the address toolbar (Back, Forward, Current, Class name, feature name, ...)
1027     local
1028     tb: EV_TOOL_BAR
1029     -- address_bar: EV_HORIZONTAL_BOX -- Contains "Class" + Combobox + "Feature" + Combobox + "Format" + Combobox
1030     hsep: EV_HORIZONTAL_SEPARATOR
1031     hbox: EV_HORIZONTAL_BOX -- Contains HistoryToolbar (back, forth, current) + `address_bar'
1032     cell: EV_CELL
1033 xavier 27498 accel: EV_ACCELERATOR
1034 manus 26913 do
1035     -- Create the toolbar
1036     create address_toolbar
1037     create hsep
1038     create hbox
1039     -- create address_bar
1040     create tb
1041     address_toolbar.set_padding (2)
1042     address_toolbar.extend (hsep)
1043     address_toolbar.disable_item_expand (hsep)
1044     address_toolbar.extend (hbox)
1045    
1046     hbox.extend (tb)
1047     hbox.disable_item_expand (tb)
1048     -- hbox.extend (address_bar)
1049     -- hbox.disable_item_expand (address_bar)
1050    
1051     -- Back icon
1052     tb.extend (history_manager.back_command.new_toolbar_item (False, False))
1053    
1054     -- Forward icon
1055     tb.extend (history_manager.forth_command.new_toolbar_item (False, False))
1056 manus 51111
1057 xavier 27498 -- Set up the accelerators.
1058     create accel.make_with_key_combination (
1059     create {EV_KEY}.make_with_code (Kcst.Key_right), False, True, False
1060     )
1061 manus 36309 accel.actions.extend (agent on_forth)
1062 xavier 27498 window.accelerators.extend (accel)
1063 manus 51111
1064 xavier 27498 create accel.make_with_key_combination (
1065     create {EV_KEY}.make_with_code (Kcst.Key_left), False, True, False
1066     )
1067 manus 36309 accel.actions.extend (agent on_back)
1068 xavier 27498 window.accelerators.extend (accel)
1069 manus 26913
1070     ------------------------------------------
1071     -- Address bar (Class name & feature name)
1072     ------------------------------------------
1073     hbox.extend (address_manager.widget)
1074 neilc 49534 -- editor_tool.text_area.add_cursor_observer (address_manager)
1075 manus 26913
1076     -- Create the command to show/hide this toolbar.
1077 manus 51111 create show_address_toolbar_command.make (address_toolbar, Interface_names.m_address_toolbar)
1078 manus 26913 show_toolbar_commands.extend (show_address_toolbar_command)
1079    
1080 king 55319 if development_window_data.show_address_toolbar then
1081 manus 26913 show_address_toolbar_command.enable_visible
1082     else
1083     show_address_toolbar_command.disable_visible
1084     end
1085    
1086     -- Cell to fill in empty space and receive the right click menu holder.
1087     create cell
1088 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1089 manus 26913 hbox.extend (cell)
1090     end
1091    
1092     build_project_toolbar is
1093     -- Build toolbar corresponding to the project options bar
1094     local
1095     cell: EV_CELL
1096     hsep: EV_HORIZONTAL_SEPARATOR
1097     hbox: EV_HORIZONTAL_BOX
1098     do
1099     create project_toolbar
1100     create hsep
1101     project_toolbar.extend (hsep)
1102     project_toolbar.disable_item_expand (hsep)
1103    
1104     -- Generate the toolbar.
1105     create hbox
1106 jfiat 56447 project_customizable_toolbar := Eb_debugger_manager.new_toolbar
1107 manus 26913 hbox.extend (project_customizable_toolbar.widget)
1108     hbox.disable_item_expand (project_customizable_toolbar.widget)
1109    
1110     project_customizable_toolbar.update_toolbar
1111    
1112     -- Create the command to show/hide this toolbar.
1113 manus 51111 create show_project_toolbar_command.make (project_toolbar, Interface_names.m_project_toolbar)
1114 manus 26913 show_toolbar_commands.extend (show_project_toolbar_command)
1115 king 55319 if development_window_data.show_project_toolbar then
1116 manus 26913 show_project_toolbar_command.enable_visible
1117     else
1118     show_project_toolbar_command.disable_visible
1119     end
1120    
1121     -- Cell to fill in empty space and receive the right click menu holder.
1122     create cell
1123 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1124 manus 26913 hbox.extend (cell)
1125     project_toolbar.extend (hbox)
1126     end
1127    
1128 manus 45562 feature {NONE} -- Menu Building
1129 manus 26913
1130     build_file_menu is
1131     -- Build the file menu.
1132     local
1133     new_project_cmd: EB_NEW_PROJECT_COMMAND
1134     open_project_cmd: EB_OPEN_PROJECT_COMMAND
1135     send_to_menu: EV_MENU
1136     menu_item: EV_MENU_ITEM
1137     command_menu_item: EB_COMMAND_MENU_ITEM
1138     do
1139 manus 51111 create file_menu.make_with_text (Interface_names.m_file)
1140 manus 26913
1141     -- New
1142     command_menu_item := New_development_window_cmd.new_menu_item
1143     add_recyclable (command_menu_item)
1144     file_menu.extend (command_menu_item)
1145    
1146     -- New editor
1147     command_menu_item := New_editor_cmd.new_menu_item
1148     add_recyclable (command_menu_item)
1149     file_menu.extend (command_menu_item)
1150    
1151     -- New context tool
1152     command_menu_item := New_context_tool_cmd.new_menu_item
1153     add_recyclable (command_menu_item)
1154     file_menu.extend (command_menu_item)
1155    
1156     -- Open
1157     command_menu_item := open_cmd.new_menu_item
1158     add_recyclable (command_menu_item)
1159     file_menu.extend (command_menu_item)
1160    
1161     -- Close
1162 manus 51111 create menu_item.make_with_text (Interface_names.m_close)
1163 manus 36309 menu_item.select_actions.extend (agent destroy)
1164 manus 26913 file_menu.extend (menu_item)
1165    
1166     -- Separator --------------------------------------
1167     file_menu.extend (create {EV_MENU_SEPARATOR})
1168    
1169     -- Save
1170     command_menu_item := save_cmd.new_menu_item
1171     add_recyclable (command_menu_item)
1172     file_menu.extend (command_menu_item)
1173    
1174     -- Save as
1175     command_menu_item := save_as_cmd.new_menu_item
1176     add_recyclable (command_menu_item)
1177     file_menu.extend (command_menu_item)
1178    
1179     -- Sent to
1180 manus 51111 create send_to_menu.make_with_text (Interface_names.m_send_to)
1181 manus 26913 -- External editor
1182     command_menu_item := shell_cmd.new_menu_item
1183     add_recyclable (command_menu_item)
1184     send_to_menu.extend (command_menu_item)
1185     file_menu.extend (send_to_menu)
1186    
1187     -- Separator --------------------------------------
1188     file_menu.extend (create {EV_MENU_SEPARATOR})
1189     command_menu_item := print_cmd.new_menu_item
1190     add_recyclable (command_menu_item)
1191     file_menu.extend (command_menu_item)
1192    
1193     -- Separator --------------------------------------
1194     file_menu.extend (create {EV_MENU_SEPARATOR})
1195    
1196     -- New Project
1197     create new_project_cmd.make_with_parent (window)
1198 manus 51111 create menu_item.make_with_text (Interface_names.m_new_project)
1199 manus 36309 menu_item.select_actions.extend (agent new_project_cmd.execute)
1200 manus 26913 file_menu.extend (menu_item)
1201    
1202     -- Open Project
1203     create open_project_cmd.make_with_parent (window)
1204 manus 51111 create menu_item.make_with_text (Interface_names.m_open_project)
1205 manus 26913 menu_item.select_actions.extend (agent open_project_cmd.execute)
1206     file_menu.extend (menu_item)
1207    
1208     -- Recent Projects
1209     recent_projects_menu := recent_projects_manager.new_menu
1210     add_recyclable (recent_projects_menu)
1211     file_menu.extend (recent_projects_menu)
1212    
1213     -- Separator --------------------------------------
1214     file_menu.extend (create {EV_MENU_SEPARATOR})
1215    
1216     -- Exit
1217     command_menu_item := Exit_application_cmd.new_menu_item
1218     add_recyclable (Command_menu_item)
1219     file_menu.extend (command_menu_item)
1220     end
1221    
1222     build_class_info_menu: EV_MENU is
1223     -- Build the class format sub-menu.
1224     local
1225     form: EB_CLASS_INFO_FORMATTER
1226     empty_menu: EV_MENU_ITEM
1227     i: INTEGER
1228     do
1229 manus 51111 create Result.make_with_text (Interface_names.m_class_info)
1230 manus 26913 i := 1
1231    
1232 manus 51111 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1233 manus 26913 i := i + 1
1234     empty_menu.disable_sensitive
1235     Result.extend (empty_menu)
1236     from
1237     managed_class_formatters.start
1238     until
1239     managed_class_formatters.after
1240     loop
1241     form := managed_class_formatters.item
1242     if form /= Void then
1243     Result.extend (form.new_menu_item)
1244     else
1245 manus 51111 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1246 manus 26913 i := i + 1
1247     empty_menu.disable_sensitive
1248     Result.extend (empty_menu)
1249     end
1250     managed_class_formatters.forth
1251     end
1252     end
1253    
1254     build_feature_info_menu: EV_MENU is
1255     -- Build the feature format sub-menu.
1256     local
1257     form: EB_FEATURE_INFO_FORMATTER
1258     do
1259 manus 51111 create Result.make_with_text (Interface_names.m_feature_info)
1260 manus 26913 from
1261     managed_feature_formatters.start
1262     until
1263     managed_feature_formatters.after
1264     loop
1265     form := managed_feature_formatters.item
1266     if form /= Void then
1267     Result.extend (form.new_menu_item)
1268     end
1269     managed_feature_formatters.forth
1270     end
1271     end
1272    
1273     build_edit_menu is
1274     -- Create and build `edit_menu'
1275     local
1276     command_menu_item: EB_COMMAND_MENU_ITEM
1277     sub_menu: EV_MENU
1278     cmd: EB_EDITOR_COMMAND
1279     os_cmd: EB_ON_SELECTION_COMMAND
1280     editor: EB_SMART_EDITOR
1281 neilc 53728 ln_cmd: EB_TOGGLE_LINE_NUMBERS_COMMAND
1282 manus 26913 do
1283     editor := editor_tool.text_area
1284 xavier 28303 create command_controller.make
1285 manus 26913
1286 manus 51111 create edit_menu.make_with_text (Interface_names.m_edit)
1287 manus 26913
1288     -- Undo
1289     command_menu_item := undo_cmd.new_menu_item
1290     add_recyclable (command_menu_item)
1291     edit_menu.extend (command_menu_item)
1292    
1293     -- Redo
1294     command_menu_item := redo_cmd.new_menu_item
1295     add_recyclable (command_menu_item)
1296     edit_menu.extend (command_menu_item)
1297    
1298     -- Separator --------------------------------------
1299     edit_menu.extend (create {EV_MENU_SEPARATOR})
1300    
1301     -- Cut
1302 xavier 28303 create os_cmd.make (Current)
1303     os_cmd.set_menu_name (Interface_names.M_cut)
1304     os_cmd.set_pixmaps (pixmaps.icon_cut)
1305     os_cmd.set_name ("Editor_cut")
1306     os_cmd.set_tooltip (interface_names.f_cut)
1307 manus 36309 os_cmd.add_agent (agent cut_selection)
1308 manus 51111 os_cmd.set_tooltext (Interface_names.b_cut)
1309 xavier 28303 toolbarable_commands.extend (os_cmd)
1310     os_cmd.set_needs_editable (True)
1311     command_controller.add_selection_command (os_cmd)
1312     command_menu_item := os_cmd.new_menu_item
1313 manus 26913 add_recyclable (command_menu_item)
1314     edit_menu.extend (command_menu_item)
1315    
1316     -- Copy
1317 xavier 28303 create os_cmd.make (Current)
1318     os_cmd.set_menu_name (Interface_names.M_copy)
1319     os_cmd.set_pixmaps (pixmaps.icon_copy)
1320     os_cmd.set_name ("Editor_copy")
1321     os_cmd.set_tooltip (interface_names.f_copy)
1322 manus 51111 os_cmd.set_tooltext (Interface_names.b_copy)
1323 manus 36309 os_cmd.add_agent (agent copy_selection)
1324 xavier 28303 toolbarable_commands.extend (os_cmd)
1325     os_cmd.set_needs_editable (False)
1326     command_controller.add_selection_command (os_cmd)
1327     command_menu_item := os_cmd.new_menu_item
1328 manus 26913 add_recyclable (command_menu_item)
1329     edit_menu.extend (command_menu_item)
1330    
1331     -- Paste
1332     command_menu_item := editor_paste_cmd.new_menu_item
1333     add_recyclable (command_menu_item)
1334     edit_menu.extend (command_menu_item)
1335    
1336     -- Separator --------------------------------------
1337     edit_menu.extend (create {EV_MENU_SEPARATOR})
1338    
1339     -- Select all
1340     create cmd.make
1341     cmd.set_menu_name (Interface_names.m_select_all)
1342 manus 36309 cmd.add_agent (agent select_all)
1343 manus 26913 command_menu_item := cmd.new_menu_item
1344 xavier 28303 command_controller.add_edition_command (cmd)
1345 manus 26913 add_recyclable (command_menu_item)
1346     edit_menu.extend (command_menu_item)
1347    
1348     -- Separator --------------------------------------
1349     edit_menu.extend (create {EV_MENU_SEPARATOR})
1350    
1351 neilc 49534 -- Line numbers
1352 neilc 53728 create ln_cmd.make
1353     command_menu_item := ln_cmd.new_menu_item
1354 neilc 49534 add_recyclable (command_menu_item)
1355     edit_menu.extend (command_menu_item)
1356 neilc 53728 window.accelerators.extend (ln_cmd.accelerator)
1357 neilc 49534
1358 manus 55527
1359 neilc 49534 -- Separator --------------------------------------
1360     edit_menu.extend (create {EV_MENU_SEPARATOR})
1361    
1362 manus 26913 -- Search
1363     create cmd.make
1364 neilc 55887 cmd.set_menu_name (Interface_names.m_search + "%T" + preferences.editor_data.shortcuts.item ("show_search_panel").display_string)
1365 manus 36309 cmd.add_agent (agent search)
1366 manus 26913 command_menu_item := cmd.new_menu_item
1367 xavier 28303 command_controller.add_edition_command (cmd)
1368 manus 26913 add_recyclable (command_menu_item)
1369     edit_menu.extend (command_menu_item)
1370    
1371 neilc 49534 -- Go to
1372     create cmd.make
1373 manus 51111 cmd.set_menu_name (Interface_names.m_go_to)
1374 neilc 49534 cmd.add_agent (agent goto)
1375     cmd.set_needs_editable (True)
1376     command_menu_item := cmd.new_menu_item
1377     command_controller.add_edition_command (cmd)
1378     add_recyclable (command_menu_item)
1379     edit_menu.extend (command_menu_item)
1380    
1381 manus 26913 -- Replace
1382     create cmd.make
1383 neilc 55887 cmd.set_menu_name (Interface_names.m_replace + "%T" + preferences.editor_data.shortcuts.item ("show_search_and_replace_panel").display_string)
1384 manus 36309 cmd.add_agent (agent editor.replace)
1385 xavier 27860 cmd.set_needs_editable (True)
1386 manus 26913 command_menu_item := cmd.new_menu_item
1387 xavier 28303 command_controller.add_edition_command (cmd)
1388 manus 26913 add_recyclable (command_menu_item)
1389     edit_menu.extend (command_menu_item)
1390    
1391     -- Find sub menu
1392    
1393 manus 51111 create sub_menu.make_with_text (Interface_names.m_find)
1394 manus 26913
1395     -- Find next
1396     create cmd.make
1397 neilc 55887 cmd.set_menu_name (Interface_names.m_find_next + "%T" + preferences.editor_data.shortcuts.item ("search_last").display_string)
1398 manus 36309 cmd.add_agent (agent find_next)
1399 manus 26913 command_menu_item := cmd.new_menu_item
1400 xavier 28303 command_controller.add_edition_command (cmd)
1401 manus 26913 add_recyclable (command_menu_item)
1402     sub_menu.extend (command_menu_item)
1403    
1404     -- Find previous
1405     create cmd.make
1406 neilc 55887 cmd.set_menu_name (Interface_names.m_find_previous + "%T" + preferences.editor_data.shortcuts.item ("search_backward").display_string)
1407 manus 36309 cmd.add_agent (agent find_previous)
1408 manus 26913 command_menu_item := cmd.new_menu_item
1409 xavier 28303 command_controller.add_edition_command (cmd)
1410 manus 26913 add_recyclable (command_menu_item)
1411     sub_menu.extend (command_menu_item)
1412    
1413     -- Find selection
1414     create os_cmd.make (Current)
1415 neilc 55887 os_cmd.set_menu_name (Interface_names.m_find_selection + "%T" + preferences.editor_data.shortcuts.item ("search_selection").display_string)
1416 manus 36309 os_cmd.add_agent (agent find_selection)
1417 manus 26913 command_menu_item := os_cmd.new_menu_item
1418 xavier 28303 command_controller.add_selection_command (os_cmd)
1419 manus 26913 add_recyclable (command_menu_item)
1420     sub_menu.extend (command_menu_item)
1421    
1422     edit_menu.extend (sub_menu)
1423    
1424    
1425     -- Separator --------------------------------------
1426     edit_menu.extend (create {EV_MENU_SEPARATOR})
1427    
1428 manus 51111 create sub_menu.make_with_text (Interface_names.m_advanced)
1429 manus 26913
1430     create os_cmd.make (Current)
1431 xavier 27860 os_cmd.set_needs_editable (True)
1432 xavier 28303 command_controller.add_selection_command (os_cmd)
1433 manus 51111 os_cmd.set_menu_name (Interface_names.m_indent)
1434 manus 36309 os_cmd.add_agent (agent editor.indent_selection)
1435 manus 26913 command_menu_item := os_cmd.new_menu_item
1436     add_recyclable (command_menu_item)
1437     sub_menu.extend (command_menu_item)
1438    
1439     create os_cmd.make (Current)
1440 xavier 27860 os_cmd.set_needs_editable (True)
1441 xavier 28303 command_controller.add_selection_command (os_cmd)
1442 manus 51111 os_cmd.set_menu_name (Interface_names.m_unindent)
1443 manus 36309 os_cmd.add_agent (agent editor.unindent_selection)
1444 manus 26913 command_menu_item := os_cmd.new_menu_item
1445     add_recyclable (command_menu_item)
1446     sub_menu.extend (command_menu_item)
1447    
1448     create os_cmd.make (Current)
1449 xavier 27860 os_cmd.set_needs_editable (True)
1450 xavier 28303 command_controller.add_selection_command (os_cmd)
1451 manus 51111 os_cmd.set_menu_name (Interface_names.m_to_lower)
1452 manus 36309 os_cmd.add_agent (agent editor.set_selection_case (True))
1453 manus 26913 command_menu_item := os_cmd.new_menu_item
1454     add_recyclable (command_menu_item)
1455     sub_menu.extend (command_menu_item)
1456    
1457     create os_cmd.make (Current)
1458 xavier 27860 os_cmd.set_needs_editable (True)
1459 xavier 28303 command_controller.add_selection_command (os_cmd)
1460 manus 51111 os_cmd.set_menu_name (Interface_names.m_to_upper)
1461 manus 36309 os_cmd.add_agent (agent editor.set_selection_case (False))
1462 manus 26913 command_menu_item := os_cmd.new_menu_item
1463     add_recyclable (command_menu_item)
1464     sub_menu.extend (command_menu_item)
1465    
1466     create cmd.make
1467 xavier 27860 cmd.set_needs_editable (True)
1468 manus 51111 cmd.set_menu_name (Interface_names.m_comment)
1469 manus 36309 cmd.add_agent (agent editor.comment_selection)
1470 manus 26913 command_menu_item := cmd.new_menu_item
1471 xavier 28303 command_controller.add_edition_command (cmd)
1472 manus 26913 add_recyclable (command_menu_item)
1473     sub_menu.extend (command_menu_item)
1474    
1475     create cmd.make
1476 xavier 27860 cmd.set_needs_editable (True)
1477 manus 51111 cmd.set_menu_name (Interface_names.m_uncomment)
1478 manus 36309 cmd.add_agent (agent editor.uncomment_selection)
1479 manus 26913 command_menu_item := cmd.new_menu_item
1480 xavier 28303 command_controller.add_edition_command (cmd)
1481 manus 26913 add_recyclable (command_menu_item)
1482     sub_menu.extend (command_menu_item)
1483    
1484     -- Separator --------------------------------------
1485     sub_menu.extend (create {EV_MENU_SEPARATOR})
1486    
1487     -- Insert if block
1488     create cmd.make
1489 xavier 27860 cmd.set_needs_editable (True)
1490 manus 51111 cmd.set_menu_name (Interface_names.m_if_block)
1491 manus 36309 cmd.add_agent (agent editor.embed_in_block("if then", 3))
1492 manus 26913 command_menu_item := cmd.new_menu_item
1493 xavier 28303 command_controller.add_edition_command (cmd)
1494 manus 26913 add_recyclable (command_menu_item)
1495     sub_menu.extend (command_menu_item)
1496    
1497     -- Insert debug block
1498     create cmd.make
1499 xavier 27860 cmd.set_needs_editable (True)
1500 manus 26913 cmd.set_menu_name (Interface_names.m_debug_block)
1501 manus 36309 cmd.add_agent (agent editor.embed_in_block("debug", 5))
1502 manus 26913 command_menu_item := cmd.new_menu_item
1503 xavier 28303 command_controller.add_edition_command (cmd)
1504 manus 26913 add_recyclable (command_menu_item)
1505     sub_menu.extend (command_menu_item)
1506    
1507    
1508     -- Separator --------------------------------------
1509     sub_menu.extend (create {EV_MENU_SEPARATOR})
1510    
1511     -- Complete word
1512     create cmd.make
1513 xavier 27860 cmd.set_needs_editable (True)
1514 neilc 55887 cmd.set_menu_name (Interface_names.m_complete_word + "%T" + preferences.editor_data.shortcuts.item ("autocomplete").display_string)
1515 manus 26913 command_menu_item := cmd.new_menu_item
1516 xavier 28303 command_controller.add_edition_command (cmd)
1517 manus 36309 cmd.add_agent (agent editor.complete_feature_name)
1518 manus 26913
1519     add_recyclable (command_menu_item)
1520     sub_menu.extend (command_menu_item)
1521    
1522 etienne 27163 -- Complete class name
1523     create cmd.make
1524 xavier 27860 cmd.set_needs_editable (True)
1525 neilc 55887 cmd.set_menu_name (Interface_names.m_complete_class_name + "%T" + preferences.editor_data.shortcuts.item ("class_autocomplete").display_string)
1526 etienne 27163 command_menu_item := cmd.new_menu_item
1527 xavier 28303 command_controller.add_edition_command (cmd)
1528 manus 36309 cmd.add_agent (agent editor.complete_class_name)
1529 etienne 27163
1530     add_recyclable (command_menu_item)
1531     sub_menu.extend (command_menu_item)
1532    
1533 manus 26913 sub_menu.extend (create {EV_MENU_SEPARATOR})
1534    
1535     -- show/hide formatting marks.
1536     create cmd.make
1537     if editor_tool.text_area.view_invisible_symbols then
1538 manus 51111 cmd.set_menu_name (Interface_names.m_hide_formatting_marks)
1539 manus 26913 else
1540 manus 51111 cmd.set_menu_name (Interface_names.m_show_formatting_marks)
1541 manus 26913 end
1542     formatting_marks_command_menu_item := cmd.new_menu_item
1543 xavier 28303 command_controller.add_edition_command (cmd)
1544 manus 36309 cmd.add_agent (agent toggle_formatting_marks)
1545 manus 26913
1546     add_recyclable (formatting_marks_command_menu_item)
1547     sub_menu.extend (formatting_marks_command_menu_item)
1548    
1549     edit_menu.extend (sub_menu)
1550     end
1551    
1552     build_view_menu is
1553     -- Build the view menu.
1554     local
1555     form: EB_CLASS_INFO_FORMATTER
1556     new_menu_item: EB_COMMAND_MENU_ITEM
1557     new_basic_item: EV_MENU_ITEM
1558     do
1559     Precursor
1560    
1561     new_menu_item := toggle_stone_cmd.new_menu_item
1562     view_menu.extend (new_menu_item)
1563     add_recyclable (new_menu_item)
1564    
1565     new_menu_item := send_stone_to_context_cmd.new_menu_item
1566     view_menu.extend (new_menu_item)
1567     add_recyclable (new_menu_item)
1568     -- Go to menu
1569     new_basic_item := history_manager.new_menu
1570     view_menu.extend (new_basic_item)
1571    
1572     -- Separator --------------------------------------
1573     view_menu.extend (create {EV_MENU_SEPARATOR})
1574     view_menu.extend (build_class_info_menu)
1575     view_menu.extend (build_feature_info_menu)
1576    
1577     -- Separator --------------------------------------
1578     view_menu.extend (create {EV_MENU_SEPARATOR})
1579    
1580     from
1581     managed_main_formatters.start
1582     until
1583     managed_main_formatters.after
1584     loop
1585     form := managed_main_formatters.item
1586     new_basic_item := form.new_menu_item
1587 manus 36309 new_basic_item.select_actions.put_front (agent form.invalidate)
1588 manus 26913 view_menu.extend (new_basic_item)
1589     --add_recyclable (new_basic_item)
1590     managed_main_formatters.forth
1591     end
1592     end
1593 manus 51111
1594 manus 26913 build_favorites_menu is
1595     -- Build the favorites menu
1596     do
1597     Precursor {EB_TOOL_MANAGER}
1598 manus 51111
1599 manus 26913 create show_favorites_menu_item
1600     update_show_favorites_menu_item
1601 manus 36309 show_favorites_menu_item.select_actions.extend (agent execute_show_favorites)
1602 manus 51111
1603 manus 26913 favorites_menu.start
1604     favorites_menu.put_right (show_favorites_menu_item)
1605 manus 36309 favorites_menu.select_actions.extend (agent update_show_favorites_menu_item)
1606 manus 26913 end
1607 manus 51111
1608 jasonw 54933 -- Jason Wei modified the following on Aug 31 2005
1609 manus 26913 build_project_menu is
1610     -- Build the project menu.
1611     local
1612     command_menu_item: EB_COMMAND_MENU_ITEM
1613     do
1614 manus 51111 create project_menu.make_with_text (Interface_names.m_project)
1615 manus 26913
1616     -- Melt
1617     command_menu_item := Melt_project_cmd.new_menu_item
1618     add_recyclable (command_menu_item)
1619     project_menu.extend (command_menu_item)
1620    
1621 xavier 29812 -- Quick melt
1622     command_menu_item := Quick_melt_project_cmd.new_menu_item
1623     add_recyclable (command_menu_item)
1624     project_menu.extend (command_menu_item)
1625    
1626 manus 26913 -- Freeze
1627     command_menu_item := Freeze_project_cmd.new_menu_item
1628     add_recyclable (command_menu_item)
1629     project_menu.extend (command_menu_item)
1630    
1631     -- Finalize
1632     command_menu_item := Finalize_project_cmd.new_menu_item
1633     add_recyclable (command_menu_item)
1634     project_menu.extend (command_menu_item)
1635    
1636     -- Precompile
1637     command_menu_item := precompilation_cmd.new_menu_item
1638     add_recyclable (command_menu_item)
1639     project_menu.extend (command_menu_item)
1640 manus 55527
1641 king 55319 -- Cancel
1642     command_menu_item := project_cancel_cmd.new_menu_item
1643     add_recyclable (command_menu_item)
1644     project_menu.extend (command_menu_item)
1645 manus 26913
1646     -- Separator -------------------------------------------------
1647     project_menu.extend (create {EV_MENU_SEPARATOR})
1648    
1649     -- Compile Workbench C code
1650     command_menu_item := c_workbench_compilation_cmd.new_menu_item
1651     add_recyclable (command_menu_item)
1652     project_menu.extend (command_menu_item)
1653    
1654     -- Compile Finalized C code
1655     command_menu_item := c_finalized_compilation_cmd.new_menu_item
1656     add_recyclable (command_menu_item)
1657     project_menu.extend (command_menu_item)
1658    
1659 jasonw 54933 -- Jason Wei
1660     -- Terminate C compilation
1661     command_menu_item := Terminate_c_compilation_cmd.new_menu_item
1662     add_recyclable (command_menu_item)
1663     project_menu.extend (command_menu_item)
1664     -- Jason Wei
1665 manus 55527
1666 manus 26913 -- Execute Finalized code
1667     command_menu_item := run_finalized_cmd.new_menu_item
1668     add_recyclable (command_menu_item)
1669     project_menu.extend (command_menu_item)
1670    
1671     -- Separator -------------------------------------------------
1672     project_menu.extend (create {EV_MENU_SEPARATOR})
1673    
1674     -- System Tool window
1675     command_menu_item := system_cmd.new_menu_item
1676     add_recyclable (command_menu_item)
1677     project_menu.extend (command_menu_item)
1678    
1679     -- System information
1680     command_menu_item := system_info_cmd.new_menu_item
1681     add_recyclable (command_menu_item)
1682     project_menu.extend (command_menu_item)
1683    
1684     -- Error information
1685     command_menu_item := display_error_help_cmd.new_menu_item
1686     add_recyclable (command_menu_item)
1687     project_menu.extend (command_menu_item)
1688    
1689 xavier 27549 if has_documentation_generation or has_xmi_generation then
1690     -- Separator -------------------------------------------------
1691     project_menu.extend (create {EV_MENU_SEPARATOR})
1692     end
1693 manus 26913
1694 xavier 27549 if has_documentation_generation then
1695     -- Generate Documentation
1696     command_menu_item := document_cmd.new_menu_item
1697     add_recyclable (command_menu_item)
1698     project_menu.extend (command_menu_item)
1699     end
1700 manus 26913
1701 xavier 27549 if has_xmi_generation then
1702     -- Export XMI
1703     command_menu_item := export_cmd.new_menu_item
1704     add_recyclable (command_menu_item)
1705     project_menu.extend (command_menu_item)
1706     end
1707 manus 26913 end
1708    
1709 jasonw 54933 ------- This is the original version
1710     -- build_project_menu is
1711     -- -- Build the project menu.
1712     -- local
1713     -- command_menu_item: EB_COMMAND_MENU_ITEM
1714     -- do
1715     -- create project_menu.make_with_text (Interface_names.m_project)
1716     --
1717     -- -- Melt
1718     -- command_menu_item := Melt_project_cmd.new_menu_item
1719     -- add_recyclable (command_menu_item)
1720     -- project_menu.extend (command_menu_item)
1721     --
1722     -- -- Quick melt
1723     -- command_menu_item := Quick_melt_project_cmd.new_menu_item
1724     -- add_recyclable (command_menu_item)
1725     -- project_menu.extend (command_menu_item)
1726     --
1727     -- -- Freeze
1728     -- command_menu_item := Freeze_project_cmd.new_menu_item
1729     -- add_recyclable (command_menu_item)
1730     -- project_menu.extend (command_menu_item)
1731     --
1732     -- -- Finalize
1733     -- command_menu_item := Finalize_project_cmd.new_menu_item
1734     -- add_recyclable (command_menu_item)
1735     -- project_menu.extend (command_menu_item)
1736     --
1737     -- -- Precompile
1738     -- command_menu_item := precompilation_cmd.new_menu_item
1739     -- add_recyclable (command_menu_item)
1740     -- project_menu.extend (command_menu_item)
1741     --
1742     -- -- Separator -------------------------------------------------
1743     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1744     --
1745     -- -- Compile Workbench C code
1746     -- command_menu_item := c_workbench_compilation_cmd.new_menu_item
1747     -- add_recyclable (command_menu_item)
1748     -- project_menu.extend (command_menu_item)
1749     --
1750     -- -- Compile Finalized C code
1751     -- command_menu_item := c_finalized_compilation_cmd.new_menu_item
1752     -- add_recyclable (command_menu_item)
1753     -- project_menu.extend (command_menu_item)
1754     --
1755     -- -- Execute Finalized code
1756     -- command_menu_item := run_finalized_cmd.new_menu_item
1757     -- add_recyclable (command_menu_item)
1758     -- project_menu.extend (command_menu_item)
1759     --
1760     -- -- Separator -------------------------------------------------
1761     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1762     --
1763     -- -- System Tool window
1764     -- command_menu_item := system_cmd.new_menu_item
1765     -- add_recyclable (command_menu_item)
1766     -- project_menu.extend (command_menu_item)
1767     --
1768     -- -- System information
1769     -- command_menu_item := system_info_cmd.new_menu_item
1770     -- add_recyclable (command_menu_item)
1771     -- project_menu.extend (command_menu_item)
1772     --
1773     -- -- Error information
1774     -- command_menu_item := display_error_help_cmd.new_menu_item
1775     -- add_recyclable (command_menu_item)
1776     -- project_menu.extend (command_menu_item)
1777     --
1778     -- if has_documentation_generation or has_xmi_generation then
1779     -- -- Separator -------------------------------------------------
1780     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1781     -- end
1782     --
1783     -- if has_documentation_generation then
1784     -- -- Generate Documentation
1785     -- command_menu_item := document_cmd.new_menu_item
1786     -- add_recyclable (command_menu_item)
1787     -- project_menu.extend (command_menu_item)
1788     -- end
1789     --
1790     -- if has_xmi_generation then
1791     -- -- Export XMI
1792     -- command_menu_item := export_cmd.new_menu_item
1793     -- add_recyclable (command_menu_item)
1794     -- project_menu.extend (command_menu_item)
1795     -- end
1796     -- end
1797     -- Jason Wei modified the above on Aug 31 2005
1798    
1799 manus 26913 build_tools_menu is
1800     -- Create and build `tools_menu'
1801     local
1802     command_menu_item: EB_COMMAND_MENU_ITEM
1803     menu_item: EV_MENU_ITEM
1804     do
1805 manus 51111 create tools_menu.make_with_text (Interface_names.m_tools)
1806 manus 26913
1807 xavier 28240 -- New Cluster command.
1808     command_menu_item := new_cluster_cmd.new_menu_item
1809     add_recyclable (command_menu_item)
1810     tools_menu.extend (command_menu_item)
1811 manus 26913
1812 xavier 28240 -- New Class command.
1813     command_menu_item := new_class_cmd.new_menu_item
1814     add_recyclable (command_menu_item)
1815     tools_menu.extend (command_menu_item)
1816    
1817     -- New Feature command.
1818     command_menu_item := new_feature_cmd.new_menu_item
1819     add_recyclable (command_menu_item)
1820     tools_menu.extend (command_menu_item)
1821 manus 51111
1822 xavier 28240 -- Delete class/cluster command.
1823     command_menu_item := delete_class_cluster_cmd.new_menu_item
1824     add_recyclable (command_menu_item)
1825     tools_menu.extend (command_menu_item)
1826    
1827     -- Separator --------------------------------------
1828     tools_menu.extend (create {EV_MENU_SEPARATOR})
1829    
1830    
1831 xavier 27549 if has_metrics then
1832     -- Metric tool
1833 xavier 28693 create metric_menu.make_with_text (interface_names.metric_metrics)
1834 xavier 27549 create menu_item.make_with_text (interface_names.metric_calculate)
1835     metric_menu.extend (menu_item)
1836     create menu_item.make_with_text (interface_names.metric_add)
1837     metric_menu.extend (menu_item)
1838     create menu_item.make_with_text (interface_names.metric_delete)
1839     metric_menu.extend (menu_item)
1840     create menu_item.make_with_text (interface_names.metric_details)
1841     metric_menu.extend (menu_item)
1842     create menu_item.make_with_text (interface_names.metric_new_metrics)
1843     metric_menu.extend (menu_item)
1844     create menu_item.make_with_text (interface_names.metric_management)
1845     metric_menu.extend (menu_item)
1846     create menu_item.make_with_text (interface_names.metric_archive)
1847     metric_menu.extend (menu_item)
1848     metric_menu.disable_sensitive
1849     tools_menu.extend (metric_menu)
1850     end
1851 manus 51111
1852 xavier 27549 if has_profiler then
1853     -- Profiler Window
1854     command_menu_item := show_profiler.new_menu_item
1855     add_recyclable (command_menu_item)
1856     tools_menu.extend (command_menu_item)
1857     end
1858 manus 26913
1859     -- Precompile Wizard
1860     command_menu_item := wizard_precompile_cmd.new_menu_item
1861     add_recyclable (command_menu_item)
1862     tools_menu.extend (command_menu_item)
1863    
1864 xavier 27549 if has_dll_generation then
1865     -- Dynamic Library Window
1866     command_menu_item := show_dynamic_lib_tool.new_menu_item
1867     add_recyclable (command_menu_item)
1868     tools_menu.extend (command_menu_item)
1869     end
1870 manus 26913
1871     -- Separator -------------------------------------------------
1872     tools_menu.extend (create {EV_MENU_SEPARATOR})
1873    
1874     -- Preferences
1875     command_menu_item := Show_preferences_cmd.new_menu_item
1876     add_recyclable (command_menu_item)
1877     tools_menu.extend (command_menu_item)
1878 xavier 30005
1879     -- External commands editor
1880     command_menu_item := Edit_external_commands_cmd.new_menu_item
1881     add_recyclable (command_menu_item)
1882     tools_menu.extend (command_menu_item)
1883    
1884     rebuild_tools_menu
1885 manus 26913 end
1886 manus 55527
1887 manus 26913 feature -- Stone process
1888    
1889     stone: STONE
1890     -- Current stone
1891    
1892     toggle_unified_stone is
1893     -- Change the stone management mode.
1894     do
1895     unified_stone := not unified_stone
1896     if unified_stone then
1897     send_stone_to_context
1898     send_stone_to_context_cmd.disable_sensitive
1899     context_tool.link_to_development_window
1900     else
1901     if stone /= Void then
1902     send_stone_to_context_cmd.enable_sensitive
1903     end
1904     context_tool.cut_from_development_window
1905     end
1906     end
1907    
1908     set_stone (a_stone: STONE) is
1909 xavier 29993 -- Change the currently focused stone.
1910     local
1911 xavier 30037 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
1912 xavier 29993 cv_cst: CLASSI_STONE
1913 neilc 49534 ef_stone: EXTERNAL_FILE_STONE
1914 xavier 29993 l: LIST [EB_DEVELOPMENT_WINDOW]
1915 neilc 49534 l_filename: STRING
1916 xavier 29993 do
1917     cv_cst ?= a_stone
1918     if cv_cst /= Void then
1919 neilc 49534 l_filename := cv_cst.class_i.name
1920     else
1921     ef_stone ?= a_stone
1922     if ef_stone /= Void then
1923     l_filename := ef_stone.file_name.string
1924     end
1925     end
1926 manus 51111
1927 neilc 49534 if cv_cst /= Void or ef_stone /= Void then
1928     l := Window_manager.development_windows_with_class (l_filename)
1929     if l.is_empty or else l.has (Current) then
1930 xavier 29993 -- We're not editing the class in another window.
1931     set_stone_after_first_check (a_stone)
1932     else
1933 manus 51111 create cd.make_initialized (2,
1934     preferences.dialog_data.already_editing_class_string,
1935     warning_messages.w_class_already_edited,
1936     Interface_names.l_do_not_show_again,
1937     preferences.preferences)
1938 manus 36309 cd.set_ok_action (agent set_stone_after_first_check (a_stone))
1939 xavier 29993 cd.show_modal_to_window (window)
1940     end
1941 manus 50607 else
1942     set_stone_after_first_check (a_stone)
1943 xavier 29993 end
1944     end
1945    
1946 manus 50607 set_stone_after_first_check (a_stone: STONE) is
1947     -- Display text associated with `a_stone', if any and if possible
1948     local
1949     feature_stone: FEATURE_STONE
1950     old_class_stone: CLASSI_STONE
1951     test_stone: CLASSI_STONE
1952     same_class: BOOLEAN
1953     conv_ferrst: FEATURE_ERROR_STONE
1954     ef_stone: EXTERNAL_FILE_STONE
1955 tedf 55179 cluster_st: CLUSTER_STONE
1956     new_class_stone: CLASSI_STONE
1957     conv_ace: ACE_SYNTAX_STONE
1958     conv_errst: ERROR_STONE
1959     conv_brkstone: BREAKABLE_STONE
1960 manus 50607 do
1961     old_class_stone ?= stone
1962     feature_stone ?= a_stone
1963     ef_stone ?= a_stone
1964 tedf 55179 new_class_stone ?= a_stone
1965     cluster_st ?= a_stone
1966 manus 55527
1967 tedf 55179 -- Update the history.
1968     conv_brkstone ?= a_stone
1969     conv_errst ?= a_stone
1970     conv_ace ?= a_stone
1971 manus 55527 if
1972 tedf 55179 conv_brkstone = Void and
1973     conv_errst = Void and
1974     conv_ace = Void and
1975 manus 55527 ef_stone = Void
1976 tedf 55179 then
1977     if
1978     new_class_stone /= Void
1979     then
1980     history_manager.extend (new_class_stone)
1981     elseif
1982     cluster_st /= Void
1983     then
1984     history_manager.extend (cluster_st)
1985     end
1986     end
1987 manus 55527
1988 manus 50607 if old_class_stone /= Void then
1989     create test_stone.make (old_class_stone.class_i)
1990     same_class := test_stone.same_as (a_stone)
1991     -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
1992     -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
1993     -- we have a CLASSI_STONE.
1994     if same_class and then feature_stone /= Void then
1995     same_class := False
1996     -- if the stone corresponding to a feature of currently opened class is dropped
1997     -- we attempt to scroll to the feature without asking to save the file
1998     -- except if it is during a resynchronization, in which case we do not scroll at all.
1999     if editor_tool.text_area.text_is_fully_loaded then
2000 manus 26913 if not during_synchronization then
2001 tedf 55441 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
2002 tedf 55673 feature_stone_already_processed := True
2003 manus 50607 else
2004     feature_stone_already_processed := True
2005 manus 26913 end
2006 manus 50607 conv_ferrst ?= feature_stone
2007     if feature_stone_already_processed and conv_ferrst /= Void then
2008     -- Scroll to the line of the error.
2009     if not during_synchronization then
2010     editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2011     end
2012     end
2013 manus 26913 end
2014     end
2015 manus 50607 elseif ef_stone /= Void then
2016 manus 26913 end
2017 manus 51111
2018 manus 50607 -- first, let's check if there is already something in this window
2019     -- if there's nothing, there's no need to save anything...
2020     if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
2021     set_stone_after_check (a_stone)
2022     feature_stone_already_processed := False
2023     else
2024     -- there is something to be saved
2025     -- if user chooses to save, current file will be parsed
2026 manus 51111 -- if there is a syntax_error, new file is not loaded
2027 manus 50607 save_and (agent set_stone_after_check (a_stone))
2028     if text_saved and then not syntax_is_correct then
2029     text_saved := False
2030     during_synchronization := True
2031     set_stone_after_check (stone)
2032     during_synchronization := False
2033     address_manager.refresh
2034     end
2035     end
2036 neilc 49534 end
2037 manus 50607
2038     force_stone (s: STONE) is
2039     -- make `s' the new value of `stone', and
2040     -- change the display accordingly. Try to
2041     -- extract a class from `s' whenever possible.
2042     do
2043     if s.is_storable then
2044     set_stone (s)
2045     if not unified_stone then
2046     context_tool.advanced_set_stone (s)
2047     end
2048 manus 26913 end
2049     end
2050    
2051 manus 50607 process_class (s: CLASSI_STONE) is
2052     -- Process class stone
2053     do
2054 neilc 49534 set_stone (s)
2055 manus 50607 end
2056 manus 51111
2057 manus 50607 process_feature_error (s: FEATURE_ERROR_STONE) is
2058     -- Process feature error stone.
2059     local
2060     cl_stone: CLASSC_STONE
2061     e_class: CLASS_C
2062     do
2063     set_default_format
2064     e_class := s.e_feature.written_class
2065     create cl_stone.make (e_class)
2066     set_stone (cl_stone)
2067     editor_tool.text_area.deselect_all
2068     if s.line_number > 0 then
2069     editor_tool.text_area.highlight_selected (s.line_number, s.line_number)
2070 manus 26913 end
2071     end
2072    
2073 manus 50607
2074     process_class_syntax (s: CL_SYNTAX_STONE) is
2075     -- Process class syntax.
2076     local
2077     cl_stone: CLASSC_STONE
2078     do
2079     -- call set_stone to ensure the proper class is displayed
2080     create cl_stone.make (s.e_class)
2081     set_stone (cl_stone)
2082     editor_tool.text_area.deselect_all
2083     editor_tool.text_area.highlight_when_ready (s.line, s.line)
2084 manus 26913 end
2085 manus 51111
2086 manus 50607 refresh is
2087     -- Synchronize clickable elements with text, if possible.
2088     do
2089     --| FIXME ARNAUD
2090     -- synchronise_stone
2091     --| END FIXME
2092     --| FIXME XR: Refresh current display in the editor.
2093     editor_tool.text_area.update_click_list (False)
2094     update_save_symbol
2095     address_manager.refresh
2096     -- The cluster manager should already be refreshed by the window manager.
2097     -- cluster_manager.refresh
2098     -- context_tool.refresh
2099     end
2100 manus 26913
2101 manus 52526 quick_refresh_editors is
2102     -- Redraw editors' drawing area.
2103 manus 50607 do
2104     editor_tool.text_area.refresh
2105 manus 52526 context_tool.quick_refresh_editors
2106 manus 50607 end
2107 manus 26913
2108 manus 52526 quick_refresh_margins is
2109     -- Redraw the main editor's drawing area.
2110     do
2111     editor_tool.text_area.margin.refresh
2112     context_tool.quick_refresh_margins
2113     end
2114    
2115 manus 50607 set_default_format is
2116     -- Default format of windows.
2117     --| FIXME ARNAUD: To be implemented.
2118     -- local
2119     -- f: EB_FORMATTER
2120     do
2121     -- if stone /= Void then
2122     -- if stone.class_i.hide_implementation then
2123     -- f := format_list.precompiled_default_format
2124     -- else
2125     -- f := format_list.default_format
2126     -- end
2127     -- else
2128     -- f := format_list.default_format
2129     -- end
2130     -- set_last_format (f)
2131     --| END FIXME
2132     end
2133 manus 26913
2134 tedf 55179 feature -- Position provider
2135    
2136     position: like position_internal is
2137     -- Currently shown text position in the editor
2138     do
2139     Result := editor_tool.text_area.first_line_displayed
2140 manus 55527 end
2141    
2142 tedf 55179 pos_container: like pos_container_internal is
2143     -- Current selected formatter
2144     local
2145     l_end : BOOLEAN
2146     do
2147     from
2148     managed_main_formatters.start
2149     until
2150     managed_main_formatters.after or l_end
2151     loop
2152     if managed_main_formatters.item.selected then
2153     l_end := true
2154     Result := managed_main_formatters.item
2155     end
2156     managed_main_formatters.forth
2157     end
2158     end
2159    
2160 manus 51111 feature -- Resource Update
2161 manus 26913
2162 manus 50607 update is
2163     -- Update Current with the registered resources.
2164     do
2165     lock_update
2166     -- Show/hide general toolbar
2167 king 55319 if development_window_data.show_general_toolbar then
2168 manus 50607 show_general_toolbar_command.enable_visible
2169     else
2170     show_general_toolbar_command.disable_visible
2171     end
2172 manus 26913
2173 manus 50607 -- Show/hide address toolbar
2174 king 55319 if development_window_data.show_address_toolbar then
2175 manus 50607 show_address_toolbar_command.enable_visible
2176     else
2177     show_address_toolbar_command.disable_visible
2178     end
2179 manus 26913
2180 manus 50607 -- Show/hide project toolbar
2181 king 55319 if development_window_data.show_project_toolbar then
2182 manus 50607 show_project_toolbar_command.enable_visible
2183     else
2184     show_project_toolbar_command.disable_visible
2185     end
2186    
2187 king 55319 left_panel.load_from_resource (development_window_data.left_panel_layout)
2188     right_panel.load_from_resource (development_window_data.right_panel_layout)
2189     splitter_position := development_window_data.left_panel_width
2190 manus 50607 update_splitters
2191     unlock_update
2192 manus 26913 end
2193    
2194 manus 50607 update_splitters is
2195 manus 51111 -- Refresh the position of the splitter on screen according to
2196 manus 50607 -- our internal values.
2197     do
2198     -- Set the interior layout
2199     if panel.full then
2200     panel.set_split_position (splitter_position.max (panel.minimum_split_position))
2201     end
2202 manus 26913 end
2203    
2204 manus 50607 register is
2205     -- Register to preferences we want notification of.
2206     do
2207 manus 26913 end
2208    
2209 manus 50607 unregister is
2210     -- unregister to preferences we want notification of.
2211     do
2212 manus 26913 end
2213    
2214 manus 50607 reset is
2215     -- Reset the window contents
2216     do
2217     Precursor
2218     address_manager.reset
2219 manus 26913
2220 manus 50607 --| FIXME ARNAUD, multiformat not yet implemented.
2221     -- format_list.enable_imp_formats_sensitive
2222     --| END FIXME
2223     end
2224 neilc 49534
2225 manus 50607 rebuild_tools_menu is
2226     -- Refresh the list of external commands.
2227     local
2228     ms: LIST [EB_COMMAND_MENU_ITEM]
2229 paulb 52511 l_sep: EV_MENU_SEPARATOR
2230 manus 50607 do
2231     -- Remove all the external commands, which are at the end of the menu.
2232     from
2233     tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
2234     until
2235     tools_menu.after
2236     loop
2237     tools_menu.remove
2238     end
2239     ms := Edit_external_commands_cmd.menus
2240     number_of_displayed_external_commands := ms.count
2241 manus 55527
2242 paulb 52511 if not ms.is_empty and not tools_menu.is_empty then
2243     l_sep ?= tools_menu.last
2244     if l_sep = Void then
2245     create l_sep
2246     tools_menu.extend (l_sep)
2247     number_of_displayed_external_commands := number_of_displayed_external_commands + 1
2248     end
2249     end
2250    
2251 manus 50607 from
2252     ms.start
2253     until
2254     ms.after
2255     loop
2256     tools_menu.extend (ms.item)
2257     add_recyclable (ms.item)
2258     ms.forth
2259     end
2260     end
2261 neilc 49534
2262 manus 50607 syntax_is_correct: BOOLEAN is
2263     -- file was successfully parsed.
2264     do
2265     Result := editor_tool.text_area.syntax_is_correct
2266     end
2267 manus 26913
2268 manus 50607 on_project_created is
2269     -- Inform tools that the current project has been loaded or re-loaded.
2270     do
2271     build_menu_bar
2272     enable_commands_on_project_created
2273     context_tool.on_project_created
2274     address_manager.on_project_created
2275     if has_dll_generation then
2276     show_dynamic_lib_tool.enable_sensitive
2277     end
2278     if has_profiler then
2279     show_profiler.enable_sensitive
2280     end
2281 xavier 30005 end
2282 manus 50607
2283     on_project_loaded is
2284     -- Inform tools that the current project has been loaded or re-loaded.
2285     do
2286 jfiat 54577 -- cluster_manager.on_project_loaded
2287 manus 50607 enable_commands_on_project_loaded
2288     cluster_tool.on_project_loaded
2289     context_tool.on_project_loaded
2290 jfiat 54610 breakpoints_tool.on_project_loaded
2291 manus 26913 end
2292    
2293 manus 50607 on_project_unloaded is
2294     -- Inform tools that the current project will soon been unloaded.
2295     do
2296 jfiat 54577 -- cluster_manager.on_project_unloaded
2297 manus 50607 disable_commands_on_project_unloaded
2298     cluster_tool.on_project_unloaded
2299     context_tool.on_project_unloaded
2300     address_manager.on_project_unloaded
2301     build_menu_bar
2302     if has_dll_generation then
2303     show_dynamic_lib_tool.disable_sensitive
2304     end
2305     if has_profiler then
2306     show_profiler.disable_sensitive
2307     end
2308 manus 26913 end
2309    
2310 jasonw 56245 on_c_compilation_starts is
2311     -- Enable commands when freezing or finalizing starts.
2312     do
2313     c_workbench_compilation_cmd.disable_sensitive
2314     c_finalized_compilation_cmd.disable_sensitive
2315     end
2316    
2317     on_c_compilation_stops is
2318     -- Disable commands when freezing or finalizing stops.
2319     do
2320     c_workbench_compilation_cmd.enable_sensitive
2321     c_finalized_compilation_cmd.enable_sensitive
2322     end
2323    
2324 manus 50607 save_before_compiling is
2325     -- save the text but do not update clickable positions
2326     do
2327     save_only := True
2328     save_text
2329 manus 26913 end
2330    
2331 manus 50607 perform_check_before_save is
2332     -- Perform any pre-save operations/checks
2333     local
2334     dial: EV_CONFIRMATION_DIALOG
2335     do
2336     debug ("EDITOR")
2337     if editor_tool.text_area.current_text /= Void and then changed then
2338     io.error.put_string ("%N Warning: Attempting to save a non editable format%N")
2339     end
2340 tedf 55302 end
2341 tedf 56466 -- Remove trailing blanks.
2342 tedf 55338 if preferences.editor_data.auto_remove_trailing_blank_when_saving then
2343     editor_tool.text_area.text_displayed.remove_trailing_blanks
2344 tedf 56466 else
2345     editor_tool.text_area.text_displayed.remove_trailing_fake_blanks
2346 tedf 55302 end
2347 tedf 56466 editor_tool.text_area.refresh_now
2348    
2349 manus 50607 if editor_tool.text_area.open_backup then
2350 manus 51111 create dial.make_with_text(Warning_messages.w_save_backup)
2351 manus 50607 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<agent continue_save, agent cancel_save>>)
2352     dial.set_default_push_button(dial.button("Continue"))
2353     dial.set_default_cancel_button(dial.button("Cancel"))
2354     dial.set_title ("Save Backup")
2355     dial.show_modal_to_window (window)
2356     else
2357     check_passed := True
2358     end
2359 manus 26913 end
2360 manus 50607
2361     continue_save is
2362     -- continue saving
2363     do
2364 manus 26913 check_passed := True
2365     end
2366    
2367 manus 50607 cancel_save is
2368     -- cancel saving
2369     do
2370     check_passed := False
2371     end
2372 manus 26913
2373 manus 50607 process is
2374     -- process the user entry in the address bar
2375 tedf 55839 local
2376     l_class_stone: CLASSI_STONE
2377     l_multi_search_tool: EB_MULTI_SEARCH_TOOL
2378 manus 50607 do
2379     save_canceled := False
2380 tedf 55839 l_class_stone ?= stone
2381     if l_class_stone /= Void then
2382     l_multi_search_tool ?= search_tool
2383     if l_multi_search_tool /= Void then
2384     l_multi_search_tool.class_changed (l_class_stone.class_i)
2385     end
2386     end
2387 manus 50607 end
2388 manus 26913
2389 manus 50607 on_text_saved is
2390     -- Notify the editor that the text has been saved
2391     local
2392     str: STRING
2393     do
2394     Precursor
2395     editor_tool.on_text_saved
2396     text_saved := True
2397     if not save_only then
2398     editor_tool.text_area.update_click_list (True)
2399     end
2400     save_only := False
2401     str := title.twin
2402     if str @ 1 = '*' then
2403     str.keep_tail (str.count - 2)
2404     set_title (str)
2405     end
2406     update_formatters
2407     if editor_tool.text_area.syntax_is_correct then
2408     status_bar.display_message ("")
2409     else
2410     status_bar.display_message (Interface_names.L_syntax_error)
2411     end
2412     text_edited := False
2413 manus 26913 end
2414    
2415 neilc 51796 on_focus is
2416     -- Focus gained
2417 neilc 51830 local
2418     editor: TEXT_PANEL
2419 neilc 51796 do
2420 neilc 51830 editor ?= editor_tool.text_area
2421     if editor /= Void then
2422     editor.on_focus
2423     end
2424 neilc 51796 end
2425    
2426 manus 50607 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2427     local
2428     save_dialog: EB_CONFIRM_SAVE_DIALOG
2429     do
2430     save_canceled := True
2431     text_saved := False
2432     create save_dialog.make_and_launch (Current,Current)
2433     if not save_canceled and then syntax_is_correct then
2434     an_action.call(Void)
2435     end
2436 manus 26913 end
2437    
2438 manus 51111 feature -- Window management
2439 manus 26913
2440 manus 50607 show_window is
2441     -- Show the window
2442     do
2443     show
2444     end
2445 manus 26913
2446 manus 50607 raise_window is
2447     -- Show the window and set the focus to it.
2448     do
2449     show
2450     --| FIXME, set the focus.
2451     end
2452 manus 26913
2453 manus 50607 hide_window is
2454     -- Hide the window
2455     do
2456     hide
2457     end
2458 manus 26913
2459 manus 50607 destroy_window is
2460     -- Destroy the window.
2461     do
2462     destroy
2463     end
2464 manus 26913
2465 manus 50607 give_focus is
2466     -- Give the focus to the address manager.
2467     do
2468     address_manager.set_focus
2469 manus 26913 end
2470 manus 51111
2471 manus 50607 save_layout is
2472     -- Store layout of `current'.
2473     do
2474 king 55319 save_layout_to_window_data (development_window_data)
2475     -- Commit saves
2476 jfiat 56527 preferences.preferences.save_preferences
2477 king 55319 end
2478    
2479     save_layout_to_session (a_session: ES_SESSION) is
2480     -- Save session data of `Current' to session object `a_session'.
2481     local
2482     a_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA
2483     a_class_i: CLASSI_STONE
2484     do
2485     create a_window_data.make_from_window_data (preferences.development_window_data)
2486 manus 55527
2487 king 55319 a_class_i ?= stone
2488     if a_class_i /= Void then
2489     a_window_data.save_filename (a_class_i.file_name)
2490     a_window_data.save_editor_position (editor_tool.text_area.current_cursor_position)
2491     end
2492 manus 55527
2493 king 55319 if context_tool /= Void then
2494     a_window_data.save_context_data (
2495     context_tool.address_manager.cluster_label_text,
2496     context_tool.address_manager.class_label_text,
2497     context_tool.address_manager.feature_label_text,
2498     context_tool.notebook.selected_item_index
2499     )
2500     end
2501    
2502     save_layout_to_window_data (a_window_data)
2503 manus 55527
2504 king 55319 -- Add the session data of `Current' to the session object.
2505     a_session.window_session_data.extend (a_window_data)
2506     end
2507    
2508     save_layout_to_window_data (a_window_data: EB_DEVELOPMENT_WINDOW_DATA) is
2509     -- Store window data of `Current' in `a_window_data'.
2510     require
2511     a_window_data_not_void: a_window_data /= Void
2512     do
2513 manus 50607 -- Now save the windows's layout, but only if the
2514     -- debugger is not displayed in `Current'. By saving the layout,
2515     -- we ensure that future windows may use exactly the same layout.
2516 king 55319 -- If the debugger is displayed, the previous layout is already saved,
2517 manus 50607 -- and this is the one that must be used, as only one debugger is ever displayed.
2518 jfiat 56447 if
2519     (Eb_debugger_manager.application_is_executing and Eb_debugger_manager.debugging_window /= Current)
2520     or not Eb_debugger_manager.application_is_executing
2521     then
2522 king 55319 a_window_data.save_left_panel_layout (left_panel.save_to_resource)
2523     a_window_data.save_right_panel_layout (right_panel.save_to_resource)
2524     a_window_data.save_left_panel_width (panel.split_position)
2525 manus 50607 -- Save width & height.
2526 king 55319 a_window_data.save_size (window.width, window.height)
2527     a_window_data.save_window_state (window.is_minimized, window.is_maximized)
2528     a_window_data.save_position (window.x_position, window.y_position)
2529 manus 50607 end
2530 manus 55527 a_window_data.save_show_search_options (search_tool.options_shown)
2531 manus 50607 end
2532 manus 26913
2533 manus 55527
2534 manus 51111 feature -- Tools & Controls
2535 manus 26913
2536 manus 50607 editor_tool: EB_EDITOR_TOOL
2537 manus 26913
2538 manus 50607 favorites_tool: EB_FAVORITES_TOOL
2539 manus 26913
2540 manus 50607 cluster_tool: EB_CLUSTER_TOOL
2541 manus 26913
2542 tedf 56390 search_tool: EB_MULTI_SEARCH_TOOL
2543 manus 26913
2544 manus 50607 features_tool: EB_FEATURES_TOOL
2545 manus 26913
2546 manus 55527 breakpoints_tool: ES_BREAKPOINTS_TOOL
2547    
2548 manus 50607 windows_tool: EB_WINDOWS_TOOL
2549 manus 26913
2550 manus 50607 context_tool: EB_CONTEXT_TOOL
2551     -- Context explorer for current class and system.
2552 manus 26913
2553 manus 50607 address_manager: EB_ADDRESS_MANAGER
2554     -- Text field in the toolbar
2555     -- Allow user to enter the name
2556     -- of the class he wants to edit.
2557 manus 26913
2558 manus 50607 project_manager: EB_PROJECT_MANAGER is
2559     -- Project manager associated to the project the user is working on.
2560     do
2561     Result := Eiffel_project.manager
2562     end
2563 manus 26913
2564 manus 50607 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2565     -- All formatters that operate on a class.
2566 manus 26913
2567 manus 50607 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2568     -- All formatters that operate on a class.
2569 manus 26913
2570 manus 50607 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2571     -- All formatters that can be displayed in the main editor frame.
2572 manus 26913
2573 manus 50607 unified_stone: BOOLEAN
2574     -- Is the stone common with the context tool or not?
2575 manus 51111
2576 manus 50607 arguments_dialog: EB_ARGUMENT_DIALOG
2577     -- The arguments dialog for current, if any
2578 manus 51111
2579 manus 50607 goto_dialog: EB_GOTO_DIALOG
2580     -- The goto dialog for line number access
2581 manus 26913
2582 manus 51111 feature -- Multiple editor management
2583 manus 26913
2584 manus 50607 add_editor_to_list (an_editor: EB_EDITOR) is
2585     -- adds `an_editor' to `editors'
2586     do
2587     editors.extend (an_editor)
2588     end
2589 neilc 49534
2590 manus 50607 current_editor: EB_EDITOR is
2591     -- current editor, if none, main editor
2592     do
2593     if current_editor_index /= 0 then
2594     Result := editors @ current_editor_index
2595     else
2596     Result := editors.first
2597     end
2598 manus 26913 end
2599 manus 51111
2600 manus 50607 set_current_editor (an_editor: EB_EDITOR) is
2601     -- set `an_editor' as main editor
2602     local
2603     old_index: INTEGER
2604     new_index: INTEGER
2605     do
2606     old_index := current_editor_index
2607     new_index := editors.index_of (an_editor, 1)
2608     if
2609     editors.valid_index (new_index) and
2610     old_index /= new_index
2611     then
2612     current_editor_index := new_index
2613     update_paste_cmd
2614     -- Last thing, update the menu entry for the formatting marks.
2615     if current_editor.view_invisible_symbols then
2616 manus 51111 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2617 manus 50607 else
2618 manus 51111 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2619 manus 50607 end
2620     command_controller.set_current_editor (an_editor)
2621 xavier 27840 end
2622 manus 50607 end
2623    
2624     update_paste_cmd is
2625     -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2626     do
2627     if
2628     not current_editor.is_empty and then
2629     current_editor.is_editable and then
2630     current_editor.clipboard.has_text
2631     then
2632     editor_paste_cmd.enable_sensitive
2633 xavier 27860 else
2634 manus 50607 editor_paste_cmd.disable_sensitive
2635 xavier 27860 end
2636     end
2637 neilc 49534
2638 manus 51111 feature {NONE} -- Multiple editor management
2639    
2640 manus 50607 editors: ARRAYED_LIST [EB_EDITOR]
2641     -- editor contained in `Current'
2642    
2643     current_editor_index: INTEGER
2644     -- Index in `editors' of the editor that has the focus.
2645 manus 51111
2646     feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS, DOTNET_CLASS_CONTEXT} -- Feature Clauses
2647    
2648 manus 50607 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2649     -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2650     -- type pertinent to 'a_features'.
2651     require
2652     a_features_not_void: a_features /= Void
2653     do
2654     if feature_clauses = Void then
2655     create feature_clauses.make (5)
2656     end
2657     feature_clauses.put (a_features, a_type)
2658 neilc 49534 end
2659 manus 51111
2660 tedf 56237 set_feature_locating (a_locating: BOOLEAN) is
2661     -- Set `feature_locating' with `a_locating'.
2662     do
2663     feature_locating := a_locating
2664     end
2665    
2666 manus 50607 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2667     -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2668     require
2669     a_type_not_void: a_type /= Void
2670     has_type_clauses: feature_clauses.has (a_type)
2671     do
2672     Result := feature_clauses.item (a_type)
2673     ensure
2674     result_not_void: Result /= Void
2675 neilc 33858 end
2676 manus 51111
2677 manus 50607 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2678     -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2679 manus 51111
2680 manus 50607 feature_positions: HASH_TABLE [INTEGER, E_FEATURE]
2681     -- Features indexed by line position in class text (for .NET features).
2682 manus 26913
2683 tedf 56237 feature_locating: BOOLEAN
2684     -- Is feature tool locating a feature?
2685    
2686 manus 51111 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2687 manus 26913
2688 manus 50607 destroy_imp is
2689     -- Destroy window.
2690     do
2691     -- To avoid reentrance
2692     if not is_destroying then
2693     is_destroying := True
2694     -- If a launched application is still running, kill it.
2695 jfiat 56447 if
2696     Eb_debugger_manager.application_is_executing
2697     and then Eb_debugger_manager.debugging_window = Current
2698     then
2699     Eb_debugger_manager.Application.kill
2700 manus 50607 else
2701 king 55319 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2702     development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2703 manus 50607 end
2704 king 55319 development_window_data.save_left_panel_width (panel.split_position)
2705 manus 50607 -- Save width & height.
2706 king 55319 development_window_data.save_size (window.width, window.height)
2707     development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2708     development_window_data.save_position (window.x_position, window.y_position)
2709 manus 50607 left_panel.wipe_out
2710     right_panel.wipe_out
2711 king 55319 development_window_data.save_show_search_options (search_tool.options_shown)
2712 manus 50607 hide
2713 manus 26913
2714 manus 50607 -- Commit saves
2715 jfiat 56527 preferences.preferences.save_preferences
2716 manus 26913
2717 manus 50607 toolbars_area.wipe_out
2718     address_manager.recycle
2719     project_customizable_toolbar.recycle
2720     Precursor {EB_TOOL_MANAGER}
2721 manus 26913
2722 manus 50607 managed_class_formatters.wipe_out
2723     managed_feature_formatters.wipe_out
2724     managed_main_formatters.wipe_out
2725     toolbarable_commands.wipe_out
2726     editors.wipe_out
2727     stone := Void
2728 neilc 49534 end
2729     end
2730    
2731 jasonw 56493 feature -- C output pixmap management
2732    
2733     start_c_output_pixmap_timer is
2734     -- Start timer to draw c output pixmap.
2735     do
2736     if context_tool /= Void then
2737     context_tool.start_c_output_pixmap_timer
2738     end
2739     end
2740    
2741     stop_c_output_pixmap_timer is
2742     -- Stop timer to draw c output pixmap.
2743     do
2744     if context_tool /= Void then
2745     context_tool.stop_c_output_pixmap_timer
2746     end
2747     end
2748    
2749 manus 51111 feature {NONE} -- Implementation
2750 neilc 49534
2751 manus 50607 set_stone_after_check (a_stone: STONE) is
2752     local
2753     old_stone: STONE
2754     new_class_stone: CLASSI_STONE
2755     old_class_stone: CLASSI_STONE
2756     conv_classc: CLASSC_STONE
2757     conv_brkstone: BREAKABLE_STONE
2758     cluster_st: CLUSTER_STONE
2759 tedf 55179 old_cluster_st: CLUSTER_STONE
2760 manus 50607 feature_stone: FEATURE_STONE
2761     conv_ferrst: FEATURE_ERROR_STONE
2762 manus 51111
2763 manus 50607 ef_stone: EXTERNAL_FILE_STONE
2764     f: FILE
2765 manus 51111
2766 manus 50607 l_format_context: FORMAT_CONTEXT
2767     conv_errst: ERROR_STONE
2768 alexk 51083 cl_syntax_stone: CL_SYNTAX_STONE
2769     error_line: INTEGER
2770 manus 50607 class_file: RAW_FILE
2771     class_text_exists: BOOLEAN
2772     same_class: BOOLEAN
2773     test_stone: CLASSI_STONE
2774     conv_ace: ACE_SYNTAX_STONE
2775     externali: EXTERNAL_CLASS_I
2776     external_cons: CONSUMED_TYPE
2777     str: STRING
2778     dotnet_class: BOOLEAN
2779     l_short_formatter: EB_SHORT_FORMATTER
2780     l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2781 tedf 55179 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2782 jfiat 56447 app_exec: APPLICATION_EXECUTION
2783 manus 50607 do
2784     -- the text does not change if the text was saved with syntax errors
2785     cur_wid := window
2786     if cur_wid = Void then
2787     --| Do nothing.
2788 manus 26913 else
2789 manus 50607 if old_cur = Void then
2790     old_cur := cur_wid.pointer_style
2791     end
2792     -- cur_wid.enable_capture
2793     cur_wid.set_pointer_style (Wait_cursor)
2794 neilc 49534 end
2795 manus 26913
2796 manus 50607 conv_brkstone ?= a_stone
2797     conv_errst ?= a_stone
2798     conv_ace ?= a_stone
2799     ef_stone ?= a_stone
2800     if conv_brkstone /= Void then
2801 jfiat 56447 app_exec := Debugger_manager.application
2802     if app_exec.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2803     app_exec.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2804 manus 50607 else
2805 jfiat 56447 app_exec.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2806 manus 26913 end
2807 jfiat 55044 Debugger_manager.notify_breakpoints_changes
2808 manus 50607 elseif conv_errst /= Void then
2809     display_error_help_cmd.execute_with_stone (conv_errst)
2810     elseif conv_ace /= Void then
2811     --| FIXME XR: What should we do?!
2812     elseif ef_stone /= Void then
2813     f := ef_stone.file
2814     f.make_open_read (f.name)
2815     f.read_stream (f.count)
2816     f.close
2817     editor_tool.text_area.load_text (f.last_string)
2818     else
2819     -- Remember previous stone.
2820     old_stone := stone
2821     old_class_stone ?= stone
2822 tedf 55179 old_cluster_st ?= stone
2823 manus 51111
2824 manus 50607 -- New stone properties
2825     new_class_stone ?= a_stone
2826    
2827     -- Set the stone.
2828     old_set_stone (a_stone)
2829     cluster_st ?= a_stone
2830 manus 51111
2831 manus 50607 new_feature_cmd.disable_sensitive
2832 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
2833 manus 50607 toggle_feature_signature_cmd.disable_sensitive
2834 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
2835 manus 51111
2836 manus 50607 -- We update the state of the `Add to Favorites' command.
2837     if new_class_stone /= Void then
2838     favorites_menu.first.enable_sensitive
2839     else
2840     favorites_menu.first.disable_sensitive
2841 neilc 49534 end
2842 manus 26913
2843 manus 50607 -- Update the address manager if needed.
2844     address_manager.refresh
2845     if new_class_stone /= Void then
2846 manus 54781 -- Text is now editable.
2847     editor_tool.text_area.set_read_only (False)
2848    
2849 manus 50607 -- class stone was dropped
2850     create class_file.make (new_class_stone.class_i.file_name)
2851     class_text_exists := class_file.exists
2852     feature_stone ?= a_stone
2853     --| We have to create a classi_stone to check whether the stones are really similar.
2854     --| Otherwise a redefinition of same_as may be called.
2855     create test_stone.make (new_class_stone.class_i)
2856     if test_stone.same_as (old_class_stone) then
2857     same_class := True
2858     end
2859     if not feature_stone_already_processed then
2860 manus 51111 if same_class and then text_saved then
2861 manus 50607 -- nothing changed in the editor
2862     -- we only have to update click_list
2863     if editor_tool.text_area.is_editable then
2864     editor_tool.text_area.update_click_list (False)
2865     end
2866 manus 26913 else
2867 manus 50607 if changed then
2868     -- user has already chosen not to save the file
2869     -- do not ask again
2870     Feature_positions.wipe_out
2871     editor_tool.text_area.no_save_before_next_load
2872     end
2873 manus 26913 end
2874     end
2875 manus 55527
2876 tedf 55179 conv_classc ?= new_class_stone
2877 neilc 49534
2878 tedf 55179 -- First choose possible formatter
2879     l_main_formatter ?= new_class_stone.pos_container
2880     if l_main_formatter /= Void and not during_synchronization then
2881 manus 55527 if
2882 tedf 55179 not (conv_classc /= Void and class_text_exists and (not changed or not same_class))
2883     then
2884     l_main_formatter.enable_select
2885 manus 55527 elseif feature_stone = Void then
2886 tedf 55179 if l_main_formatter /= pos_container then
2887     l_main_formatter.enable_select
2888     end
2889 tedf 55267 if new_class_stone.position > 0 then
2890     editor_tool.text_area.display_line_at_top_when_ready (new_class_stone.position)
2891 manus 55527 end
2892 tedf 55179 end
2893     end
2894 manus 55527
2895 manus 50607 if conv_classc = Void or else
2896     conv_classc.e_class.is_external or else
2897 manus 51111 feature_stone /= Void and not
2898 manus 50607 feature_stone_already_processed and not
2899     (same_class and context_tool.sending_stone) then
2900     -- If a classi_stone or a feature_stone or a external call
2901     -- has been dropped, check to see if a .NET class.
2902     if class_text_exists then
2903     if new_class_stone.class_i.is_external_class then
2904     externali ?= new_class_stone.class_i
2905 manus 52122 check
2906     externali_not_void: externali /= Void
2907     end
2908     external_cons := externali.external_consumed_type
2909 manus 50607 if external_cons /= Void then
2910     -- A .NET class.
2911     dotnet_class := True
2912     l_short_formatter ?= managed_main_formatters.i_th (4)
2913     l_flat_formatter ?= managed_main_formatters.i_th (5)
2914     if l_short_formatter /= Void then
2915     l_short_formatter.set_dotnet_mode (True)
2916     end
2917     if l_flat_formatter /= Void then
2918     l_flat_formatter.set_dotnet_mode (True)
2919     end
2920 manus 51111 end
2921 tedf 55267 elseif feature_stone /= Void then
2922     from
2923     managed_main_formatters.start
2924     until
2925     managed_main_formatters.after
2926     loop
2927     managed_main_formatters.item.set_stone (new_class_stone)
2928     managed_main_formatters.forth
2929     end
2930 manus 50607 else
2931     managed_main_formatters.first.set_stone (new_class_stone)
2932     managed_main_formatters.first.execute
2933     end
2934     else
2935     editor_tool.text_area.clear_window
2936     editor_tool.text_area.display_message (
2937     Warning_messages.w_file_not_exist (
2938     new_class_stone.class_i.file_name))
2939 neilc 33365 end
2940 manus 50607 end
2941     if conv_classc = Void then
2942     --| The dropped class is not compiled.
2943     --| Display only the textual formatter.
2944     if dotnet_class then
2945     managed_main_formatters.i_th (4).set_stone (new_class_stone)
2946     managed_main_formatters.i_th (5).set_stone (new_class_stone)
2947 manus 51111 managed_main_formatters.i_th (4).execute
2948 manus 50607 end
2949     address_manager.disable_formatters
2950 neilc 33365 else
2951 manus 50607 --| We have a compiled class.
2952     if
2953     class_text_exists and then
2954     Eiffel_project.Workbench.last_reached_degree <= 2
2955     then
2956     new_feature_cmd.enable_sensitive
2957 alexk 51136 toggle_feature_alias_cmd.enable_sensitive
2958 manus 50607 toggle_feature_signature_cmd.enable_sensitive
2959 alexk 51887 toggle_feature_assigner_cmd.enable_sensitive
2960 manus 50607 end
2961    
2962     --address_manager.enable_formatters
2963     update_formatters
2964     if not class_text_exists then
2965     --| Disable the textual formatter.
2966     managed_main_formatters.first.disable_sensitive
2967     from
2968     managed_main_formatters.start
2969     until
2970     managed_main_formatters.after
2971     loop
2972     managed_main_formatters.item.set_stone (new_class_stone)
2973     managed_main_formatters.forth
2974     end
2975     managed_main_formatters.i_th (2).execute
2976     else
2977     if not changed or not same_class then
2978     --| Enable all formatters.
2979     if
2980 tedf 55267 (not feature_stone_already_processed or
2981 manus 55527 not managed_main_formatters.first.selected) and
2982 tedf 55267 feature_stone = Void
2983 manus 50607 then
2984     from
2985     managed_main_formatters.start
2986     until
2987     managed_main_formatters.after
2988     loop
2989     managed_main_formatters.item.set_stone (new_class_stone)
2990     managed_main_formatters.forth
2991     end
2992     end
2993     else
2994 tedf 55673 if not feature_stone_already_processed then
2995     address_manager.disable_formatters
2996     from
2997     managed_main_formatters.start
2998     until
2999     managed_main_formatters.after
3000     loop
3001     managed_main_formatters.item.set_stone (new_class_stone)
3002     managed_main_formatters.forth
3003     end
3004 xavier 28693 end
3005 manus 26913 end
3006     end
3007     end
3008 tedf 56214 if managed_main_formatters.first.selected then
3009     editor_tool.text_area.set_read_only (false)
3010     else
3011     editor_tool.text_area.set_read_only (true)
3012     end
3013 manus 50607 else
3014 manus 51111 -- not a class text : cannot be edited
3015 manus 53708 editor_tool.text_area.set_read_only (True)
3016 manus 50607 address_manager.disable_formatters
3017 manus 26913
3018 manus 50607 --| Disable all formatters.
3019     from
3020     managed_main_formatters.start
3021     until
3022     managed_main_formatters.after
3023     loop
3024     managed_main_formatters.item.set_stone (Void)
3025     managed_main_formatters.forth
3026     end
3027     if cluster_st /= Void then
3028     --| FIXME XR: Really manage cluster display in the main editor
3029 jfiat 54401 l_format_context := formatted_context_for_cluster (cluster_st.cluster_i)
3030 manus 50607 editor_tool.text_area.process_text (l_format_context.text)
3031 tedf 55179 if cluster_st.position > 0 then
3032     editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
3033     end
3034 manus 50607 --| END FIXME
3035     end
3036 neilc 49534 end
3037 alexk 51083 if class_text_exists then
3038     if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
3039     conv_ferrst ?= feature_stone
3040     if conv_ferrst /= Void then
3041     error_line := conv_ferrst.line_number
3042     else
3043     -- if a feature_stone has been dropped
3044     -- scroll to the corresponding feature in the basic text format
3045     if not during_synchronization then
3046     scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
3047     end
3048     end
3049 manus 50607 else
3050 alexk 51083 cl_syntax_stone ?= a_stone
3051     if cl_syntax_stone /= Void then
3052     error_line := cl_syntax_stone.line
3053 manus 50607 end
3054 manus 26913 end
3055 alexk 51083 if error_line > 0 then
3056     -- Scroll to the line of the error.
3057     editor_tool.text_area.display_line_when_ready (error_line, True)
3058     end
3059 manus 26913 end
3060 manus 50607 -- Update the title of the window
3061     if a_stone /= Void then
3062     if changed then
3063     str := a_stone.header.twin
3064     str.prepend ("* ")
3065     set_title (str)
3066     else
3067     set_title (a_stone.header)
3068     end
3069 neilc 49534 else
3070 manus 51111 set_title (Interface_names.t_empty_development_window)
3071 manus 26913 end
3072 manus 50607
3073     -- Refresh the tools.
3074     features_tool.set_stone (a_stone)
3075     cluster_tool.set_stone (a_stone)
3076     -- Update the context tool.
3077     if unified_stone then
3078     context_tool.set_stone (a_stone)
3079     end
3080    
3081 neilc 49534 end
3082 manus 50607 if
3083     stone /= Void and then
3084     not unified_stone
3085     then
3086     send_stone_to_context_cmd.enable_sensitive
3087 manus 26913 else
3088 manus 50607 send_stone_to_context_cmd.disable_sensitive
3089 manus 26913 end
3090 manus 50607 if cur_wid = Void then
3091     --| Do nothing.
3092 manus 51111 else
3093 manus 50607 cur_wid.set_pointer_style (old_cur)
3094     old_cur := Void
3095     -- cur_wid.disable_capture
3096     cur_wid := Void
3097 manus 26913 end
3098     end
3099    
3100 jfiat 54401 formatted_context_for_cluster (a_cluster: CLUSTER_I): FORMAT_CONTEXT is
3101     -- Formatted context representing the list of classes inside `a_cluster'.
3102     require
3103     a_cluster_not_void: a_cluster /= Void
3104     local
3105 jfiat 54437 l_assembly: ASSEMBLY_I
3106 jfiat 54402 l_sorted_cluster: EB_SORTED_CLUSTER
3107 jfiat 54401 l_format_context: FORMAT_CONTEXT
3108     l_indexes: INDEXING_CLAUSE_AS
3109 jfiat 54402 l_classes: LIST [CLASS_I]
3110 manus 55527 l_subclu: LIST [EB_SORTED_CLUSTER]
3111 jfiat 54401 l_cl_i: CLASS_I
3112     l_list_cl_i: LIST [CLASS_I]
3113     l_cluster: CLUSTER_I
3114     l_assert_level: ASSERTION_I
3115     do
3116     create l_format_context.make_for_case
3117 manus 55527
3118 jfiat 54401 l_format_context.put_text_item (ti_indexing_keyword)
3119     l_format_context.put_new_line
3120     l_format_context.indent
3121 jfiat 54437 if a_cluster.is_assembly then
3122     l_assembly ?= a_cluster
3123     check l_assembly /= Void end
3124     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("assembly_name"))
3125     l_format_context.put_text_item_without_tabs (ti_colon)
3126     l_format_context.put_space
3127     l_format_context.put_quoted_string_item (l_assembly.assembly_name)
3128     l_format_context.put_new_line
3129     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("assembly_path"))
3130     l_format_context.put_text_item_without_tabs (ti_colon)
3131     l_format_context.put_space
3132     l_format_context.put_quoted_string_item (l_assembly.assembly_path)
3133     l_format_context.put_new_line
3134 manus 55527
3135 jfiat 54437 end
3136 jfiat 54401 l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("cluster"))
3137     l_format_context.put_text_item_without_tabs (ti_colon)
3138     l_format_context.put_space
3139     l_format_context.put_quoted_string_item (a_cluster.cluster_name)
3140    
3141     l_format_context.put_new_line
3142     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("cluster_path"))
3143     l_format_context.put_text_item_without_tabs (ti_colon)
3144     l_format_context.put_space
3145     l_format_context.put_quoted_string_item (a_cluster.path)
3146     l_format_context.put_new_line
3147     l_indexes := a_cluster.indexes
3148     if l_indexes /= Void then
3149     l_format_context.format_indexing_with_no_keyword (l_indexes)
3150 manus 55527 l_format_context.put_new_line
3151 jfiat 54401 end
3152 manus 55527
3153 jfiat 54401 if a_cluster.parent_cluster /= Void then
3154     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("parent cluster"))
3155     l_format_context.put_text_item_without_tabs (ti_colon)
3156     l_format_context.put_new_line
3157     l_format_context.indent
3158     l_format_context.put_manifest_string (" - ")
3159 manus 55527
3160 jfiat 54401 l_format_context.put_clusteri (a_cluster.parent_cluster)
3161     l_format_context.put_new_line
3162     l_format_context.exdent
3163     end
3164 jfiat 54402
3165     create l_sorted_cluster.make (a_cluster)
3166    
3167     if not l_sorted_cluster.clusters.is_empty then
3168 jfiat 54401 l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("sub cluster(s)"))
3169     l_format_context.put_text_item_without_tabs (ti_colon)
3170     l_format_context.put_new_line
3171     l_format_context.indent
3172     from
3173 jfiat 54402 l_subclu := l_sorted_cluster.clusters
3174 jfiat 54401 l_subclu.start
3175     until
3176     l_subclu.after
3177     loop
3178 jfiat 54402 l_cluster := l_subclu.item.actual_cluster
3179 jfiat 54401 l_format_context.put_manifest_string (" - ")
3180     l_format_context.put_clusteri (l_cluster)
3181     l_format_context.put_space
3182     l_format_context.put_text_item_without_tabs (ti_L_parenthesis)
3183     l_format_context.put_comment_text (l_cluster.classes.count.out)
3184 manus 55527 l_format_context.put_text_item_without_tabs (ti_R_parenthesis)
3185 jfiat 54401 l_format_context.put_new_line
3186     l_subclu.forth
3187     end
3188     l_format_context.exdent
3189     end
3190    
3191 jfiat 54402 if not l_sorted_cluster.classes.is_empty then
3192 jfiat 54401 l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("class(es)"))
3193     l_format_context.put_text_item_without_tabs (ti_colon)
3194     l_format_context.put_new_line
3195     l_format_context.indent
3196     from
3197 jfiat 54402 l_classes := l_sorted_cluster.classes
3198 jfiat 54401 l_classes.start
3199     until
3200     l_classes.after
3201     loop
3202 jfiat 54402 l_cl_i := l_classes.item
3203 jfiat 54401 l_assert_level := l_cl_i.assertion_level
3204     l_format_context.put_manifest_string (" - ")
3205     l_format_context.put_classi (l_cl_i)
3206     l_format_context.put_text_item_without_tabs (ti_colon)
3207 jfiat 54402 if l_cl_i.compiled then
3208     if l_assert_level.check_all then
3209 jfiat 54401 l_format_context.put_space
3210 jfiat 54402 l_format_context.put_text_item_without_tabs (ti_All_keyword)
3211     elseif l_assert_level.level = 0 then
3212 jfiat 54401 l_format_context.put_space
3213 jfiat 54402 l_format_context.put_comment_text (once "None")
3214     else
3215     if l_assert_level.check_precond then
3216     l_format_context.put_space
3217     l_format_context.put_text_item_without_tabs (ti_Require_keyword)
3218     end
3219     if l_assert_level.check_postcond then
3220     l_format_context.put_space
3221     l_format_context.put_text_item_without_tabs (ti_Ensure_keyword)
3222     end
3223     if l_assert_level.check_check then
3224     l_format_context.put_space
3225     l_format_context.put_text_item_without_tabs (ti_Check_keyword)
3226     end
3227     if l_assert_level.check_loop then
3228     l_format_context.put_space
3229     l_format_context.put_text_item_without_tabs (ti_Loop_keyword)
3230     end
3231     if l_assert_level.check_invariant then
3232     l_format_context.put_space
3233     l_format_context.put_text_item_without_tabs (ti_Invariant_keyword)
3234     end
3235 jfiat 54401 end
3236 jfiat 54402 else
3237     l_format_context.put_comment_text (" Not in system.")
3238 jfiat 54401 end
3239     l_format_context.put_new_line
3240     l_classes.forth
3241     end
3242     l_format_context.exdent
3243     end
3244    
3245     if not a_cluster.overriden_classes.is_empty then
3246     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("overriden class(es)"))
3247     l_format_context.put_text_item_without_tabs (ti_colon)
3248     l_format_context.put_new_line
3249     l_format_context.indent
3250     from
3251 jfiat 54402 l_classes := a_cluster.overriden_classes.linear_representation
3252 jfiat 54401 l_classes.start
3253     until
3254     l_classes.after
3255     loop
3256 jfiat 54402 l_cl_i := l_classes.item
3257 jfiat 54401 l_format_context.put_manifest_string (" - ")
3258     l_format_context.put_classi (l_cl_i)
3259     l_list_cl_i := eiffel_universe.classes_with_name (l_cl_i.name)
3260     if l_list_cl_i /= Void and then not l_list_cl_i.is_empty then
3261     l_format_context.put_text_item_without_tabs (ti_colon)
3262     l_format_context.put_comment_text (" overriden by")
3263     from
3264     l_list_cl_i.start
3265     until
3266     l_list_cl_i.after
3267     loop
3268     l_cluster := l_list_cl_i.item.cluster
3269     if l_cluster /= a_cluster then
3270     l_format_context.put_space
3271     l_format_context.put_text_item_without_tabs (ti_double_quote)
3272     l_format_context.put_clusteri (l_list_cl_i.item.cluster)
3273     l_format_context.put_text_item_without_tabs (ti_double_quote)
3274     end
3275     l_list_cl_i.forth
3276     end
3277     end
3278     l_format_context.put_new_line
3279