/[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 56535 - (hide annotations)
Tue Jan 17 01:37:10 2006 UTC (14 years, 1 month ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 126065 byte(s)
Added text of the GPL license to all classes of the compiler.

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