/[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 55302 - (hide annotations)
Fri Oct 21 15:58:00 2005 UTC (14 years, 4 months ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 117471 byte(s)
Added auto-removing trailed blanks when saving.

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