/[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 56410 - (hide annotations)
Wed Dec 28 21:34:54 2005 UTC (14 years, 1 month ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 124264 byte(s)
Fixed, on Unix, feature tree scrolls to the located item.

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