/[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 53708 - (hide annotations)
Fri Jul 22 18:48:20 2005 UTC (14 years, 7 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 102242 byte(s)
Ensured that cluster information is shown in a read only format.

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