/[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 52511 - (hide annotations)
Wed Jun 22 23:57:52 2005 UTC (14 years, 8 months ago) by paulb
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 102346 byte(s)
End menu separator is now only shown when there are external tools.

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 49534 f_ind := preferences.formatter_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 49534 f_ind := preferences.formatter_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 manus 50607 editor_tool.text_area.find_feature_named (feature_stone.feature_name)
1766     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 50607 quick_refresh is
1866     -- Redraw the main editor's drawing area.
1867     do
1868     editor_tool.text_area.refresh
1869     context_tool.quick_refresh
1870     end
1871 manus 26913
1872 manus 50607 set_default_format is
1873     -- Default format of windows.
1874     --| FIXME ARNAUD: To be implemented.
1875     -- local
1876     -- f: EB_FORMATTER
1877     do
1878     -- if stone /= Void then
1879     -- if stone.class_i.hide_implementation then
1880     -- f := format_list.precompiled_default_format
1881     -- else
1882     -- f := format_list.default_format
1883     -- end
1884     -- else
1885     -- f := format_list.default_format
1886     -- end
1887     -- set_last_format (f)
1888     --| END FIXME
1889     end
1890 manus 26913
1891 manus 51111 feature -- Resource Update
1892 manus 26913
1893 manus 50607 update is
1894     -- Update Current with the registered resources.
1895     do
1896     lock_update
1897     -- Show/hide general toolbar
1898     if preferences.development_window_data.show_general_toolbar then
1899     show_general_toolbar_command.enable_visible
1900     else
1901     show_general_toolbar_command.disable_visible
1902     end
1903 manus 26913
1904 manus 50607 -- Show/hide address toolbar
1905     if preferences.development_window_data.show_address_toolbar then
1906     show_address_toolbar_command.enable_visible
1907     else
1908     show_address_toolbar_command.disable_visible
1909     end
1910 manus 26913
1911 manus 50607 -- Show/hide project toolbar
1912     if preferences.development_window_data.show_project_toolbar then
1913     show_project_toolbar_command.enable_visible
1914     else
1915     show_project_toolbar_command.disable_visible
1916     end
1917    
1918     left_panel.load_from_resource (preferences.development_window_data.left_panel_layout)
1919     right_panel.load_from_resource (preferences.development_window_data.right_panel_layout)
1920     splitter_position := preferences.development_window_data.left_panel_width
1921     update_splitters
1922     unlock_update
1923 manus 26913 end
1924    
1925 manus 50607 update_splitters is
1926 manus 51111 -- Refresh the position of the splitter on screen according to
1927 manus 50607 -- our internal values.
1928     do
1929     -- Set the interior layout
1930     if panel.full then
1931     panel.set_split_position (splitter_position.max (panel.minimum_split_position))
1932     end
1933 manus 26913 end
1934    
1935 manus 50607 register is
1936     -- Register to preferences we want notification of.
1937     do
1938 manus 26913 end
1939    
1940 manus 50607 unregister is
1941     -- unregister to preferences we want notification of.
1942     do
1943 manus 26913 end
1944    
1945 manus 50607 reset is
1946     -- Reset the window contents
1947     do
1948     Precursor
1949     address_manager.reset
1950 manus 26913
1951 manus 50607 --| FIXME ARNAUD, multiformat not yet implemented.
1952     -- format_list.enable_imp_formats_sensitive
1953     --| END FIXME
1954     end
1955 neilc 49534
1956 manus 50607 rebuild_tools_menu is
1957     -- Refresh the list of external commands.
1958     local
1959     ms: LIST [EB_COMMAND_MENU_ITEM]
1960 paulb 52511 l_sep: EV_MENU_SEPARATOR
1961 manus 50607 do
1962     -- Remove all the external commands, which are at the end of the menu.
1963     from
1964     tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
1965     until
1966     tools_menu.after
1967     loop
1968     tools_menu.remove
1969     end
1970     ms := Edit_external_commands_cmd.menus
1971     number_of_displayed_external_commands := ms.count
1972 paulb 52511
1973     if not ms.is_empty and not tools_menu.is_empty then
1974     l_sep ?= tools_menu.last
1975     if l_sep = Void then
1976     create l_sep
1977     tools_menu.extend (l_sep)
1978     number_of_displayed_external_commands := number_of_displayed_external_commands + 1
1979     end
1980     end
1981    
1982 manus 50607 from
1983     ms.start
1984     until
1985     ms.after
1986     loop
1987     tools_menu.extend (ms.item)
1988     add_recyclable (ms.item)
1989     ms.forth
1990     end
1991     end
1992 neilc 49534
1993 manus 50607 syntax_is_correct: BOOLEAN is
1994     -- file was successfully parsed.
1995     do
1996     Result := editor_tool.text_area.syntax_is_correct
1997     end
1998 manus 26913
1999 manus 50607 on_project_created is
2000     -- Inform tools that the current project has been loaded or re-loaded.
2001     do
2002     build_menu_bar
2003     enable_commands_on_project_created
2004     context_tool.on_project_created
2005     address_manager.on_project_created
2006     if has_dll_generation then
2007     show_dynamic_lib_tool.enable_sensitive
2008     end
2009     if has_profiler then
2010     show_profiler.enable_sensitive
2011     end
2012 xavier 30005 end
2013 manus 50607
2014     on_project_loaded is
2015     -- Inform tools that the current project has been loaded or re-loaded.
2016     do
2017     -- cluster_manager.on_project_loaded
2018     enable_commands_on_project_loaded
2019     cluster_tool.on_project_loaded
2020     context_tool.on_project_loaded
2021 manus 26913 end
2022    
2023 manus 50607 on_project_unloaded is
2024     -- Inform tools that the current project will soon been unloaded.
2025     do
2026     -- cluster_manager.on_project_unloaded
2027     disable_commands_on_project_unloaded
2028     cluster_tool.on_project_unloaded
2029     context_tool.on_project_unloaded
2030     address_manager.on_project_unloaded
2031     build_menu_bar
2032     if has_dll_generation then
2033     show_dynamic_lib_tool.disable_sensitive
2034     end
2035     if has_profiler then
2036     show_profiler.disable_sensitive
2037     end
2038 manus 26913 end
2039    
2040 manus 50607 save_before_compiling is
2041     -- save the text but do not update clickable positions
2042     do
2043     save_only := True
2044     save_text
2045 manus 26913 end
2046    
2047 manus 50607 perform_check_before_save is
2048     -- Perform any pre-save operations/checks
2049     local
2050     dial: EV_CONFIRMATION_DIALOG
2051     do
2052     debug ("EDITOR")
2053     if editor_tool.text_area.current_text /= Void and then changed then
2054     io.error.put_string ("%N Warning: Attempting to save a non editable format%N")
2055     end
2056 neilc 51713 end
2057 manus 50607 if editor_tool.text_area.open_backup then
2058 manus 51111 create dial.make_with_text(Warning_messages.w_save_backup)
2059 manus 50607 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<agent continue_save, agent cancel_save>>)
2060     dial.set_default_push_button(dial.button("Continue"))
2061     dial.set_default_cancel_button(dial.button("Cancel"))
2062     dial.set_title ("Save Backup")
2063     dial.show_modal_to_window (window)
2064     else
2065     check_passed := True
2066     end
2067 manus 26913 end
2068 manus 50607
2069     continue_save is
2070     -- continue saving
2071     do
2072 manus 26913 check_passed := True
2073     end
2074    
2075 manus 50607 cancel_save is
2076     -- cancel saving
2077     do
2078     check_passed := False
2079     end
2080 manus 26913
2081 manus 50607 process is
2082     -- process the user entry in the address bar
2083     do
2084     save_canceled := False
2085     end
2086 manus 26913
2087 manus 50607 on_text_saved is
2088     -- Notify the editor that the text has been saved
2089     local
2090     str: STRING
2091     do
2092     Precursor
2093     editor_tool.on_text_saved
2094     text_saved := True
2095     if not save_only then
2096     editor_tool.text_area.update_click_list (True)
2097     end
2098     save_only := False
2099     str := title.twin
2100     if str @ 1 = '*' then
2101     str.keep_tail (str.count - 2)
2102     set_title (str)
2103     end
2104     update_formatters
2105     if editor_tool.text_area.syntax_is_correct then
2106     status_bar.display_message ("")
2107     else
2108     status_bar.display_message (Interface_names.L_syntax_error)
2109     end
2110     text_edited := False
2111 manus 26913 end
2112    
2113 neilc 51796 on_focus is
2114     -- Focus gained
2115 neilc 51830 local
2116     editor: TEXT_PANEL
2117 neilc 51796 do
2118 neilc 51830 editor ?= editor_tool.text_area
2119     if editor /= Void then
2120     editor.on_focus
2121     end
2122 neilc 51796 end
2123    
2124 manus 50607 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2125     local
2126     save_dialog: EB_CONFIRM_SAVE_DIALOG
2127     do
2128     save_canceled := True
2129     text_saved := False
2130     create save_dialog.make_and_launch (Current,Current)
2131     if not save_canceled and then syntax_is_correct then
2132     an_action.call(Void)
2133     end
2134 manus 26913 end
2135    
2136 manus 51111 feature -- Window management
2137 manus 26913
2138 manus 50607 show_window is
2139     -- Show the window
2140     do
2141     show
2142     end
2143 manus 26913
2144 manus 50607 raise_window is
2145     -- Show the window and set the focus to it.
2146     do
2147     show
2148     --| FIXME, set the focus.
2149     end
2150 manus 26913
2151 manus 50607 hide_window is
2152     -- Hide the window
2153     do
2154     hide
2155     end
2156 manus 26913
2157 manus 50607 destroy_window is
2158     -- Destroy the window.
2159     do
2160     destroy
2161     end
2162 manus 26913
2163 manus 50607 give_focus is
2164     -- Give the focus to the address manager.
2165     do
2166     address_manager.set_focus
2167 manus 26913 end
2168 manus 51111
2169 manus 50607 save_layout is
2170     -- Store layout of `current'.
2171     do
2172     -- Now save the windows's layout, but only if the
2173     -- debugger is not displayed in `Current'. By saving the layout,
2174     -- we ensure that future windows may use exactly the same layout.
2175     -- If the debugger is displayed, the previopus layout is already saved,
2176     -- and this is the one that must be used, as only one debugger is ever displayed.
2177     if (Application.is_running and debugger_manager.debugging_window /= Current) or not application.is_running then
2178     preferences.development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2179     preferences.development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2180     preferences.development_window_data.save_left_panel_width (panel.split_position)
2181     -- Save width & height.
2182     preferences.development_window_data.save_size (window.width, window.height, window.is_maximized)
2183 manus 51180 preferences.development_window_data.save_position (window.x_position, window.y_position)
2184 manus 50607 end
2185     preferences.development_window_data.save_search_tool_options (search_tool)
2186     -- Commit saves
2187 manus 51180 preferences.preferences.save_resources
2188 manus 50607 end
2189 manus 26913
2190 manus 51111 feature -- Tools & Controls
2191 manus 26913
2192 manus 50607 editor_tool: EB_EDITOR_TOOL
2193 manus 26913
2194 manus 50607 favorites_tool: EB_FAVORITES_TOOL
2195 manus 26913
2196 manus 50607 cluster_tool: EB_CLUSTER_TOOL
2197 manus 26913
2198 manus 50607 search_tool: EB_SEARCH_TOOL
2199 manus 26913
2200 manus 50607 features_tool: EB_FEATURES_TOOL
2201 manus 26913
2202 manus 50607 windows_tool: EB_WINDOWS_TOOL
2203 manus 26913
2204 manus 50607 context_tool: EB_CONTEXT_TOOL
2205     -- Context explorer for current class and system.
2206 manus 26913
2207 manus 50607 address_manager: EB_ADDRESS_MANAGER
2208     -- Text field in the toolbar
2209     -- Allow user to enter the name
2210     -- of the class he wants to edit.
2211 manus 26913
2212 manus 50607 project_manager: EB_PROJECT_MANAGER is
2213     -- Project manager associated to the project the user is working on.
2214     do
2215     Result := Eiffel_project.manager
2216     end
2217 manus 26913
2218 manus 50607 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2219     -- All formatters that operate on a class.
2220 manus 26913
2221 manus 50607 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2222     -- All formatters that operate on a class.
2223 manus 26913
2224 manus 50607 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2225     -- All formatters that can be displayed in the main editor frame.
2226 manus 26913
2227 manus 50607 unified_stone: BOOLEAN
2228     -- Is the stone common with the context tool or not?
2229 manus 51111
2230 manus 50607 arguments_dialog: EB_ARGUMENT_DIALOG
2231     -- The arguments dialog for current, if any
2232 manus 51111
2233 manus 50607 goto_dialog: EB_GOTO_DIALOG
2234     -- The goto dialog for line number access
2235 manus 26913
2236 manus 51111 feature -- Multiple editor management
2237 manus 26913
2238 manus 50607 add_editor_to_list (an_editor: EB_EDITOR) is
2239     -- adds `an_editor' to `editors'
2240     do
2241     editors.extend (an_editor)
2242     end
2243 neilc 49534
2244 manus 50607 current_editor: EB_EDITOR is
2245     -- current editor, if none, main editor
2246     do
2247     if current_editor_index /= 0 then
2248     Result := editors @ current_editor_index
2249     else
2250     Result := editors.first
2251     end
2252 manus 26913 end
2253 manus 51111
2254 manus 50607 set_current_editor (an_editor: EB_EDITOR) is
2255     -- set `an_editor' as main editor
2256     local
2257     old_index: INTEGER
2258     new_index: INTEGER
2259     do
2260     old_index := current_editor_index
2261     new_index := editors.index_of (an_editor, 1)
2262     if
2263     editors.valid_index (new_index) and
2264     old_index /= new_index
2265     then
2266     current_editor_index := new_index
2267     from
2268     editors.start
2269     until
2270     editors.after
2271     loop
2272     if editors.index /= current_editor_index and then editors.item.has_selection then
2273     editors.item.disable_selection
2274     end
2275     editors.forth
2276 manus 26913 end
2277 manus 50607 update_paste_cmd
2278     -- Last thing, update the menu entry for the formatting marks.
2279     if current_editor.view_invisible_symbols then
2280 manus 51111 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2281 manus 50607 else
2282 manus 51111 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2283 manus 50607 end
2284     command_controller.set_current_editor (an_editor)
2285 xavier 27840 end
2286 manus 50607 end
2287    
2288     update_paste_cmd is
2289     -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2290     do
2291     if
2292     not current_editor.is_empty and then
2293     current_editor.is_editable and then
2294     current_editor.clipboard.has_text
2295     then
2296     editor_paste_cmd.enable_sensitive
2297 xavier 27860 else
2298 manus 50607 editor_paste_cmd.disable_sensitive
2299 xavier 27860 end
2300     end
2301 neilc 49534
2302 manus 51111 feature {NONE} -- Multiple editor management
2303    
2304 manus 50607 editors: ARRAYED_LIST [EB_EDITOR]
2305     -- editor contained in `Current'
2306    
2307     current_editor_index: INTEGER
2308     -- Index in `editors' of the editor that has the focus.
2309 manus 51111
2310     feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS, DOTNET_CLASS_CONTEXT} -- Feature Clauses
2311    
2312 manus 50607 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2313     -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2314     -- type pertinent to 'a_features'.
2315     require
2316     a_features_not_void: a_features /= Void
2317     do
2318     if feature_clauses = Void then
2319     create feature_clauses.make (5)
2320     end
2321     feature_clauses.put (a_features, a_type)
2322 neilc 49534 end
2323 manus 51111
2324 manus 50607 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2325     -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2326     require
2327     a_type_not_void: a_type /= Void
2328     has_type_clauses: feature_clauses.has (a_type)
2329     do
2330     Result := feature_clauses.item (a_type)
2331     ensure
2332     result_not_void: Result /= Void
2333 neilc 33858 end
2334 manus 51111
2335 manus 50607 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2336     -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2337 manus 51111
2338 manus 50607 feature_positions: HASH_TABLE [INTEGER, E_FEATURE]
2339     -- Features indexed by line position in class text (for .NET features).
2340 manus 26913
2341 manus 51111 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2342 manus 26913
2343 manus 50607 destroy_imp is
2344     -- Destroy window.
2345     do
2346     -- To avoid reentrance
2347     if not is_destroying then
2348     is_destroying := True
2349     -- If a launched application is still running, kill it.
2350     if Application.is_running and then debugger_manager.debugging_window = Current then
2351     Application.kill
2352     else
2353     preferences.development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2354     preferences.development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2355     end
2356     preferences.development_window_data.save_left_panel_width (panel.split_position)
2357     -- Save width & height.
2358     preferences.development_window_data.save_size (window.width, window.height, window.is_maximized)
2359 manus 51180 preferences.development_window_data.save_position (window.x_position, window.y_position)
2360 manus 50607 left_panel.wipe_out
2361     right_panel.wipe_out
2362     preferences.development_window_data.save_search_tool_options (search_tool)
2363     hide
2364 manus 26913
2365 manus 50607 -- Commit saves
2366 manus 51180 preferences.preferences.save_resources
2367 manus 26913
2368 manus 50607 toolbars_area.wipe_out
2369     address_manager.recycle
2370     project_customizable_toolbar.recycle
2371     Precursor {EB_TOOL_MANAGER}
2372 manus 26913
2373 manus 50607 managed_class_formatters.wipe_out
2374     managed_feature_formatters.wipe_out
2375     managed_main_formatters.wipe_out
2376     toolbarable_commands.wipe_out
2377     editors.wipe_out
2378     stone := Void
2379 neilc 49534 end
2380     end
2381    
2382 manus 51111 feature {NONE} -- Implementation
2383 neilc 49534
2384 manus 50607 set_stone_after_check (a_stone: STONE) is
2385     local
2386     old_stone: STONE
2387     new_class_stone: CLASSI_STONE
2388     old_class_stone: CLASSI_STONE
2389     conv_classc: CLASSC_STONE
2390     conv_brkstone: BREAKABLE_STONE
2391     cluster_st: CLUSTER_STONE
2392     feature_stone: FEATURE_STONE
2393     conv_ferrst: FEATURE_ERROR_STONE
2394 manus 51111
2395 manus 50607 ef_stone: EXTERNAL_FILE_STONE
2396     f: FILE
2397 manus 51111
2398 manus 50607 l_format_context: FORMAT_CONTEXT
2399     l_indexes: EIFFEL_LIST [INDEX_AS]
2400     conv_errst: ERROR_STONE
2401 alexk 51083 cl_syntax_stone: CL_SYNTAX_STONE
2402     error_line: INTEGER
2403 manus 50607 class_file: RAW_FILE
2404     class_text_exists: BOOLEAN
2405     same_class: BOOLEAN
2406     test_stone: CLASSI_STONE
2407     conv_ace: ACE_SYNTAX_STONE
2408     externali: EXTERNAL_CLASS_I
2409     external_cons: CONSUMED_TYPE
2410     str: STRING
2411     dotnet_class: BOOLEAN
2412     l_short_formatter: EB_SHORT_FORMATTER
2413     l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2414     do
2415     -- the text does not change if the text was saved with syntax errors
2416     cur_wid := window
2417     if cur_wid = Void then
2418     --| Do nothing.
2419 manus 26913 else
2420 manus 50607 if old_cur = Void then
2421     old_cur := cur_wid.pointer_style
2422     end
2423     -- cur_wid.enable_capture
2424     cur_wid.set_pointer_style (Wait_cursor)
2425 neilc 49534 end
2426 manus 26913
2427 manus 50607 conv_brkstone ?= a_stone
2428     conv_errst ?= a_stone
2429     conv_ace ?= a_stone
2430     ef_stone ?= a_stone
2431     if conv_brkstone /= Void then
2432     if Application.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2433     Application.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2434     else
2435     Application.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2436 manus 26913 end
2437 manus 50607 output_manager.display_stop_points
2438     window_manager.quick_refresh_all
2439     elseif conv_errst /= Void then
2440     display_error_help_cmd.execute_with_stone (conv_errst)
2441     elseif conv_ace /= Void then
2442     --| FIXME XR: What should we do?!
2443     elseif ef_stone /= Void then
2444     f := ef_stone.file
2445     f.make_open_read (f.name)
2446     f.read_stream (f.count)
2447     f.close
2448     editor_tool.text_area.load_text (f.last_string)
2449     else
2450     -- Remember previous stone.
2451     old_stone := stone
2452     old_class_stone ?= stone
2453 manus 51111
2454 manus 50607 -- New stone properties
2455     new_class_stone ?= a_stone
2456    
2457     -- Set the stone.
2458     old_set_stone (a_stone)
2459     cluster_st ?= a_stone
2460 manus 51111
2461 manus 50607 new_feature_cmd.disable_sensitive
2462 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
2463 manus 50607 toggle_feature_signature_cmd.disable_sensitive
2464 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
2465 manus 51111
2466 manus 50607 -- We update the state of the `Add to Favorites' command.
2467     if new_class_stone /= Void then
2468     favorites_menu.first.enable_sensitive
2469     else
2470     favorites_menu.first.disable_sensitive
2471 neilc 49534 end
2472 manus 26913
2473 manus 50607 -- Update the history.
2474     if
2475     new_class_stone /= Void
2476     then
2477     history_manager.extend (new_class_stone)
2478     elseif
2479     cluster_st /= Void
2480     then
2481     history_manager.extend (cluster_st)
2482     end
2483     -- Update the address manager if needed.
2484     address_manager.refresh
2485     if new_class_stone /= Void then
2486     -- class stone was dropped
2487     create class_file.make (new_class_stone.class_i.file_name)
2488     class_text_exists := class_file.exists
2489     feature_stone ?= a_stone
2490     --| We have to create a classi_stone to check whether the stones are really similar.
2491     --| Otherwise a redefinition of same_as may be called.
2492     create test_stone.make (new_class_stone.class_i)
2493     if test_stone.same_as (old_class_stone) then
2494     same_class := True
2495     end
2496     if not feature_stone_already_processed then
2497 manus 51111 if same_class and then text_saved then
2498 manus 50607 -- nothing changed in the editor
2499     -- we only have to update click_list
2500     if editor_tool.text_area.is_editable then
2501     editor_tool.text_area.update_click_list (False)
2502     end
2503 manus 26913 else
2504 manus 50607 if changed then
2505     -- user has already chosen not to save the file
2506     -- do not ask again
2507     Feature_positions.wipe_out
2508     editor_tool.text_area.no_save_before_next_load
2509     end
2510 manus 26913 end
2511     end
2512 neilc 49534
2513 manus 50607 conv_classc ?= new_class_stone
2514     if conv_classc = Void or else
2515     conv_classc.e_class.is_external or else
2516 manus 51111 feature_stone /= Void and not
2517 manus 50607 feature_stone_already_processed and not
2518     (same_class and context_tool.sending_stone) then
2519     -- If a classi_stone or a feature_stone or a external call
2520     -- has been dropped, check to see if a .NET class.
2521     if class_text_exists then
2522     if new_class_stone.class_i.is_external_class then
2523     externali ?= new_class_stone.class_i
2524 manus 52122 check
2525     externali_not_void: externali /= Void
2526     end
2527     external_cons := externali.external_consumed_type
2528 manus 50607 if external_cons /= Void then
2529     -- A .NET class.
2530     dotnet_class := True
2531     l_short_formatter ?= managed_main_formatters.i_th (4)
2532     l_flat_formatter ?= managed_main_formatters.i_th (5)
2533     if l_short_formatter /= Void then
2534     l_short_formatter.set_dotnet_mode (True)
2535     end
2536     if l_flat_formatter /= Void then
2537     l_flat_formatter.set_dotnet_mode (True)
2538     end
2539 manus 51111 end
2540 manus 50607 else
2541     managed_main_formatters.first.set_stone (new_class_stone)
2542     managed_main_formatters.first.execute
2543     end
2544     else
2545     editor_tool.text_area.clear_window
2546     editor_tool.text_area.display_message (
2547     Warning_messages.w_file_not_exist (
2548     new_class_stone.class_i.file_name))
2549 neilc 33365 end
2550 manus 50607 end
2551     if conv_classc = Void then
2552     --| The dropped class is not compiled.
2553     --| Display only the textual formatter.
2554     if dotnet_class then
2555     managed_main_formatters.i_th (4).set_stone (new_class_stone)
2556     managed_main_formatters.i_th (5).set_stone (new_class_stone)
2557 manus 51111 managed_main_formatters.i_th (4).execute
2558 manus 50607 end
2559     address_manager.disable_formatters
2560 neilc 33365 else
2561 manus 50607 --| We have a compiled class.
2562     if
2563     class_text_exists and then
2564     Eiffel_project.Workbench.last_reached_degree <= 2
2565     then
2566     new_feature_cmd.enable_sensitive
2567 alexk 51136 toggle_feature_alias_cmd.enable_sensitive
2568 manus 50607 toggle_feature_signature_cmd.enable_sensitive
2569 alexk 51887 toggle_feature_assigner_cmd.enable_sensitive
2570 manus 50607 end
2571    
2572     --address_manager.enable_formatters
2573     update_formatters
2574     if not class_text_exists then
2575     --| Disable the textual formatter.
2576     managed_main_formatters.first.disable_sensitive
2577     from
2578     managed_main_formatters.start
2579     until
2580     managed_main_formatters.after
2581     loop
2582     managed_main_formatters.item.set_stone (new_class_stone)
2583     managed_main_formatters.forth
2584     end
2585     managed_main_formatters.i_th (2).execute
2586     else
2587     if not changed or not same_class then
2588     --| Enable all formatters.
2589     if
2590     not feature_stone_already_processed or
2591     not managed_main_formatters.first.selected
2592     then
2593     from
2594     managed_main_formatters.start
2595     until
2596     managed_main_formatters.after
2597     loop
2598     managed_main_formatters.item.set_stone (new_class_stone)
2599     managed_main_formatters.forth
2600     end
2601     end
2602     else
2603     address_manager.disable_formatters
2604 xavier 28693 from
2605 neilc 33365 managed_main_formatters.start
2606 xavier 28693 until
2607 neilc 33365 managed_main_formatters.after
2608 xavier 28693 loop
2609 neilc 33365 managed_main_formatters.item.set_stone (new_class_stone)
2610     managed_main_formatters.forth
2611 xavier 28693 end
2612 manus 26913 end
2613     end
2614     end
2615 manus 50607 else
2616 manus 51111 -- not a class text : cannot be edited
2617 manus 50607 editor_tool.text_area.disable_editable
2618     address_manager.disable_formatters
2619 manus 26913
2620 manus 50607 --| Disable all formatters.
2621     from
2622     managed_main_formatters.start
2623     until
2624     managed_main_formatters.after
2625     loop
2626     managed_main_formatters.item.set_stone (Void)
2627     managed_main_formatters.forth
2628     end
2629     if cluster_st /= Void then
2630     --| FIXME XR: Really manage cluster display in the main editor
2631     create l_format_context.make_for_case
2632     l_format_context.put_text_item (ti_indexing_keyword)
2633     l_format_context.put_new_line
2634     l_format_context.indent
2635     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("cluster"))
2636     l_format_context.put_text_item_without_tabs (ti_colon)
2637     l_format_context.put_space
2638     l_format_context.put_string ("%"" + cluster_st.cluster_i.cluster_name + "%"")
2639     l_format_context.put_new_line
2640     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("cluster_path"))
2641     l_format_context.put_text_item_without_tabs (ti_colon)
2642     l_format_context.put_space
2643     l_format_context.put_string ("%"" + cluster_st.cluster_i.path + "%"")
2644     l_format_context.put_new_line
2645     l_indexes := cluster_st.cluster_i.indexes
2646     if l_indexes /= Void then
2647     l_format_context.set_new_line_between_tokens
2648     l_format_context.format_ast (l_indexes)
2649     l_format_context.exdent
2650     end
2651     l_format_context.put_new_line
2652     editor_tool.text_area.process_text (l_format_context.text)
2653     --| END FIXME
2654     end
2655 neilc 49534 end
2656 alexk 51083 if class_text_exists then
2657     if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
2658     conv_ferrst ?= feature_stone
2659     if conv_ferrst /= Void then
2660     error_line := conv_ferrst.line_number
2661     else
2662     -- if a feature_stone has been dropped
2663     -- scroll to the corresponding feature in the basic text format
2664     if not during_synchronization then
2665     scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
2666     end
2667     end
2668 manus 50607 else
2669 alexk 51083 cl_syntax_stone ?= a_stone
2670     if cl_syntax_stone /= Void then
2671     error_line := cl_syntax_stone.line
2672 manus 50607 end
2673 manus 26913 end
2674 alexk 51083 if error_line > 0 then
2675     -- Scroll to the line of the error.
2676     editor_tool.text_area.display_line_when_ready (error_line, True)
2677     end
2678 manus 26913 end
2679 manus 50607 -- Update the title of the window
2680     if a_stone /= Void then
2681     if changed then
2682     str := a_stone.header.twin
2683     str.prepend ("* ")
2684     set_title (str)
2685     else
2686     set_title (a_stone.header)
2687     end
2688 neilc 49534 else
2689 manus 51111 set_title (Interface_names.t_empty_development_window)
2690 manus 26913 end
2691 manus 50607
2692     -- Refresh the tools.
2693     features_tool.set_stone (a_stone)
2694     cluster_tool.set_stone (a_stone)
2695     -- Update the context tool.
2696     if unified_stone then
2697     context_tool.set_stone (a_stone)
2698     end
2699    
2700 neilc 49534 end
2701 manus 50607 if
2702     stone /= Void and then
2703     not unified_stone
2704     then
2705     send_stone_to_context_cmd.enable_sensitive
2706 manus 26913 else
2707 manus 50607 send_stone_to_context_cmd.disable_sensitive
2708 manus 26913 end
2709 manus 50607 if cur_wid = Void then
2710     --| Do nothing.
2711 manus 51111 else
2712 manus 50607 cur_wid.set_pointer_style (old_cur)
2713     old_cur := Void
2714     -- cur_wid.disable_capture
2715     cur_wid := Void
2716 manus 26913 end
2717     end
2718    
2719 manus 50607 scroll_to_feature (feat_as: E_FEATURE; displayed_class: CLASS_I) is
2720     -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
2721     require
2722     class_is_not_void: displayed_class /= Void
2723     feat_as_is_not_void: feat_as /= Void
2724     local
2725     begin_index, offset: INTEGER
2726     tmp_text: STRING
2727     do
2728     if not feat_as.is_il_external then
2729     if feat_as.ast /= Void then
2730     begin_index := feat_as.ast.start_position
2731     if platform_constants.is_windows then
2732     tmp_text := displayed_class.text.substring (1, begin_index)
2733     offset := tmp_text.occurrences('%R')
2734     end
2735     editor_tool.text_area.scroll_to_when_ready (begin_index.item - offset)
2736     end
2737     else
2738     -- FIXME NC: Doesn't work properly for .NET features
2739     -- .NET formatted feature.
2740     begin_index := feature_positions.item (feat_as)
2741 neilc 33858 if platform_constants.is_windows then
2742     tmp_text := displayed_class.text.substring (1, begin_index)
2743 manus 50607 offset := tmp_text.occurrences('%N')
2744 neilc 33858 end
2745 manus 50607 editor_tool.text_area.scroll_to_when_ready (begin_index // 2) -- - offset)
2746 manus 26913 end
2747     end
2748    
2749 manus 50607 check_passed: BOOLEAN
2750 manus 26913
2751 manus 50607 save_canceled: BOOLEAN
2752     -- did user cancel save ?
2753 manus 26913
2754 manus 50607 save_only: BOOLEAN
2755     -- skip parse and update after save ?
2756 manus 26913
2757 manus 50607 text_saved: BOOLEAN
2758     -- has the user chosen to save the file
2759 manus 26913
2760 manus 50607 is_destroying: BOOLEAN
2761     -- Is `current' being currently destroyed?
2762 manus 26913
2763 manus 50607 feature_stone_already_processed: BOOLEAN
2764     -- Is the processed stone a feature stone and has it
2765     -- been already processed by the editor ?
2766 neilc 49534
2767 manus 51111 feature {NONE} -- Implementation
2768 manus 26913
2769 manus 50607 update_save_symbol is
2770     do
2771     Precursor {EB_FILEABLE}
2772     if changed then
2773     save_cmd.enable_sensitive
2774     address_manager.disable_formatters
2775     else
2776     save_cmd.disable_sensitive
2777     update_formatters
2778     end
2779     if is_empty then
2780     print_cmd.disable_sensitive
2781     save_as_cmd.disable_sensitive
2782     else
2783     print_cmd.enable_sensitive
2784     save_as_cmd.enable_sensitive
2785     end
2786 manus 26913 end
2787    
2788 manus 50607 is_stone_external: BOOLEAN
2789     -- Does 'stone' contain a .NET consumed type?
2790 neilc 33294
2791 manus 50607 update_formatters is
2792     -- Give a correct sensitivity to formatters.
2793     local
2794     cist: CLASSI_STONE
2795     cst: CLASSC_STONE
2796     type_changed: BOOLEAN
2797     do
2798     cst ?= stone
2799     cist ?= stone
2800     -- Check to if formatting context has changed.
2801     if cst /= Void then
2802     type_changed := (cst.e_class.is_true_external and not is_stone_external) or
2803     (not cst.e_class.is_true_external and is_stone_external)
2804     elseif cist /= Void then
2805     type_changed := (cist.class_i.is_external_class and not is_stone_external) or
2806     (not cist.class_i.is_external_class and is_stone_external)
2807     end
2808 manus 51111
2809 manus 50607 if type_changed then
2810     -- Toggle stone flag.
2811     is_stone_external := not is_stone_external
2812 manus 51111 end
2813 neilc 33365
2814 manus 50607 if cst /= Void then
2815     address_manager.enable_formatters
2816     if is_stone_external then
2817     -- Change formatters to .NET sensitivity (from normal).
2818     enable_dotnet_formatters
2819     if type_changed then
2820     managed_main_formatters.i_th (4).enable_select
2821     end
2822     else
2823     if changed then
2824 manus 51111 address_manager.disable_formatters
2825 manus 50607 else
2826     --managed_main_formatters.first.disable_sensitive
2827     end
2828     end
2829     elseif cist /= Void and is_stone_external then
2830 neilc 33365 -- Change formatters to .NET sensitivity (from normal).
2831 manus 38124 enable_dotnet_formatters
2832     if type_changed then
2833     managed_main_formatters.i_th (4).enable_select
2834     end
2835     else
2836 manus 50607 address_manager.disable_formatters
2837     if cist /= stone then
2838     managed_main_formatters.first.execute
2839 manus 38124 end
2840 neilc 33365 end
2841     end
2842    
2843 manus 50607 enable_dotnet_formatters is
2844     -- Enable only the .NET class text formatters.
2845     do
2846     from
2847     managed_main_formatters.start
2848     until
2849     managed_main_formatters.after
2850     loop
2851     if managed_main_formatters.item.is_dotnet_formatter then
2852     managed_main_formatters.item.enable_sensitive
2853     else
2854     managed_main_formatters.item.disable_sensitive
2855     end
2856     managed_main_formatters.forth
2857 xavier 27866 end
2858     end
2859    
2860 manus 51111
2861 manus 50607 on_text_reset is
2862     -- The main editor has just been wiped out
2863     -- before loading a new file.
2864     local
2865     str: STRING
2866     do
2867     str := title.twin
2868     if str @ 1 = '*' then
2869     str.keep_tail (str.count - 2)
2870     set_title (str)
2871     end
2872     address_manager.disable_formatters
2873     status_bar.display_message ("")
2874     status_bar.remove_cursor_position
2875     text_edited := False
2876 manus 26913 end
2877    
2878 manus 50607 on_cursor_moved is
2879     -- The cursor has moved, reflect the change in the status bar.
2880     do
2881     refresh_cursor_position
2882 xavier 29812 end
2883    
2884 manus 50607 on_text_fully_loaded is
2885     -- The main editor has just been reloaded.
2886     do
2887     update_paste_cmd
2888     update_formatters
2889     if editor_tool.text_area.syntax_is_correct then
2890     status_bar.display_message ("")
2891     else
2892     status_bar.display_message (Interface_names.L_syntax_error)
2893     end
2894     refresh_cursor_position
2895     text_edited := False
2896 xavier 27840 end
2897    
2898 manus 50607 on_text_back_to_its_last_saved_state is
2899     local
2900     str: STRING
2901     do
2902 manus 40756 str := title.twin
2903 manus 50607 if str @ 1 = '*' then
2904     str.keep_tail (str.count - 2)
2905 etienne 27144 set_title (str)
2906     end
2907 manus 50607 update_formatters
2908     text_edited := False
2909 manus 51111 end
2910 manus 50607
2911     text_edited: BOOLEAN
2912     -- Do we know that the text was edited?
2913     -- If so, no need to update the display each time it is edited.
2914    
2915     on_text_edited (unused: BOOLEAN) is
2916     -- The text in the editor is modified, add the '*' in the title.
2917     -- Gray out the formatters.
2918     local
2919     str: STRING
2920     cst: CLASSI_STONE
2921     do
2922     if not text_edited then
2923     str := title.twin
2924     if str @ 1 /= '*' then
2925     str.prepend ("* ")
2926     set_title (str)
2927     end
2928     address_manager.disable_formatters
2929     cst ?= stone
2930     if cst /= Void then
2931     Eiffel_project.Manager.class_is_edited (cst.class_i)
2932     end
2933     text_edited := True
2934 manus 26913 end
2935 manus 50607 status_bar.display_message ("")
2936 manus 26913 end
2937    
2938 manus 50607 on_back is
2939     -- User pressed Alt+left.
2940     -- Go back in the history (or the context history).
2941     do
2942     if context_tool_has_focus then
2943     if context_tool.history_manager.is_back_possible then
2944     context_tool.history_manager.back_command.execute
2945     end
2946     elseif history_manager.is_back_possible then
2947 manus 51111 history_manager.back_command.execute
2948 xavier 27498 end
2949     end
2950    
2951 manus 50607 on_forth is
2952     -- User pressed Alt+right.
2953     -- Go forth in the history (or the context history).
2954     do
2955     if context_tool_has_focus then
2956     if context_tool.history_manager.is_forth_possible then
2957     context_tool.history_manager.forth_command.execute
2958     end
2959     elseif history_manager.is_forth_possible then
2960 neilc 52263 history_manager.forth_command.execute
2961 xavier 27498 end
2962     end
2963    
2964 manus 50607 context_tool_has_focus: BOOLEAN is
2965     -- Does the context tool or one of its children has the focus?
2966     local
2967     fw: EV_WIDGET
2968     cont: EV_CONTAINER
2969     wid: EV_WIDGET
2970     do
2971     fw := (create {EV_ENVIRONMENT}).application.focused_widget
2972     wid := context_tool.explorer_bar_item.widget
2973     if wid = fw then
2974 xavier 27498 Result := True
2975 manus 50607 elseif fw = Void then
2976     Result := False
2977     else
2978     from
2979     cont := fw.parent
2980     until
2981     cont = wid or cont = Void
2982     loop
2983     cont := cont.parent
2984     end
2985     if cont = wid then
2986     Result := True
2987     end
2988 xavier 27498 end
2989     end
2990    
2991 manus 50607 saved_cursor: CURSOR
2992     -- Saved cursor position for displaying the stack.
2993 manus 26913
2994 manus 50607 can_drop (st: ANY): BOOLEAN is
2995     -- Can the user drop the stone `st'?
2996     local
2997     conv_ace: ACE_SYNTAX_STONE
2998     do
2999     conv_ace ?= st
3000     Result := conv_ace = Void
3001     end
3002 xavier 27840
3003 manus 50607 quick_refresh_on_class_drop (unused: CLASSI_STONE) is
3004     -- Quick refresh all windows.
3005     do
3006     window_manager.quick_refresh_all
3007     end
3008 manus 26913
3009 manus 50607 quick_refresh_on_brk_drop (unused: BREAKABLE_STONE) is
3010     -- Quick refresh all windows.
3011     do
3012     window_manager.quick_refresh_all
3013     end
3014 manus 26913
3015 manus 50607 send_stone_to_context is
3016     -- Send current stone to the context tool.
3017     -- Used by `send_stone_to_context_cmd'.
3018     do
3019     if stone /= Void then
3020     context_tool.set_stone (stone)
3021     end
3022 manus 26913 end
3023    
3024 manus 51111 destroy is
3025 manus 50607 -- check if current text has been saved and destroy
3026     local
3027     dialog_w: EB_WARNING_DIALOG
3028     do
3029     if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
3030     if Window_manager.development_windows_count > 1 then
3031 manus 51111 create dialog_w.make_with_text (Warning_messages.w_save_before_closing)
3032 manus 50607 dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<agent save_and_destroy, agent force_destroy, agent do_nothing>>)
3033     dialog_w.set_default_push_button (dialog_w.button("Yes"))
3034     dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
3035     dialog_w.show_modal_to_window (window)
3036     else
3037     -- We let the window manager handle the saving, along with other windows
3038     -- (not development windows)
3039     force_destroy
3040     end
3041 manus 26913 else
3042 manus 50607 Precursor {EB_TOOL_MANAGER}
3043 manus 26913 end
3044     end
3045    
3046 manus 50607 save_and_destroy is
3047     do
3048     save_text
3049     destroy
3050     end
3051 manus 26913
3052 manus 50607 force_destroy is
3053     -- Destroy without asking.
3054     do
3055     confirmed := True
3056     destroy
3057     confirmed := False
3058     end
3059 manus 26913
3060 manus 50607 confirmed: BOOLEAN
3061     -- Did the user say he wanted to exit?
3062 manus 26913
3063 manus 50607 show_dynamic_library_dialog is
3064     -- Create a new dynamic library window and display it.
3065     do
3066     Window_manager.create_dynamic_lib_window
3067     end
3068 manus 26913
3069 manus 50607 recycle is
3070     -- Call the precursors.
3071     do
3072     Precursor {EB_TOOL_MANAGER}
3073     command_controller.recycle
3074     end
3075 manus 26913
3076 manus 51111 feature {NONE} -- Implementation: Editor commands
3077 xavier 27840
3078 manus 50607 refresh_cursor_position is
3079     -- Display the current cursor position in the status bar.
3080     require
3081     text_loaded: not is_empty
3082     local
3083     l, c: INTEGER
3084     do
3085     l := editor_tool.text_area.cursor_y_position
3086     c := editor_tool.text_area.cursor_x_position
3087     status_bar.set_cursor_position (l, c)
3088     end
3089 xavier 29812
3090 manus 50607 select_all is
3091     -- Select the whole text in the focused editor.
3092     do
3093     current_editor.select_all
3094     end
3095 neilc 49534
3096 manus 50607 search is
3097     -- Search some text in the focused editor.
3098     local
3099     cv_ced: EB_CLICKABLE_EDITOR
3100     do
3101     cv_ced ?= current_editor
3102     if cv_ced /= Void then
3103     cv_ced.search
3104     end
3105 xavier 27840 end
3106    
3107 manus 50607 goto is
3108     -- Display a dialog to select a line to go to in the editor.
3109     local
3110     ed: EB_EDITOR
3111     do
3112     ed ?= current_editor
3113     if ed /= Void then
3114     create goto_dialog.make (ed)
3115     goto_dialog.show_modal_to_window (Current.window)
3116     end
3117 xavier 28693 end
3118    
3119 manus 50607 toggle_line_number_display is
3120     -- Toggle line number display on/off in editor
3121     local
3122     ed: EB_EDITOR
3123     do
3124     ed ?= current_editor
3125     if ed /= Void then
3126     ed.toggle_line_number_display
3127     end
3128 xavier 28280 end
3129    
3130 manus 50607 find_next is
3131     -- Find the next occurrence of the search text.
3132     local
3133     cv_ced: EB_CLICKABLE_EDITOR
3134     do
3135     if search_tool.currently_searched /= Void then
3136     cv_ced ?= current_editor
3137     if cv_ced /= Void then
3138     cv_ced.find_next
3139     end
3140     else
3141     search_tool.show_and_set_focus
3142 xavier 28280 end
3143     end
3144    
3145 manus 50607 find_previous is
3146     -- Find the previous occurrence of the search text.
3147     local
3148     cv_ced: EB_CLICKABLE_EDITOR
3149     do
3150     if search_tool.currently_searched /= Void then
3151     cv_ced ?= current_editor
3152     if cv_ced /= Void then
3153     cv_ced.find_previous
3154     end
3155     else
3156     search_tool.show_and_set_focus
3157     end
3158     end
3159    
3160     find_selection is
3161     -- Find the next occurrence of the selection.
3162     local
3163     cv_ced: EB_CLICKABLE_EDITOR
3164     do
3165 xavier 28280 cv_ced ?= current_editor
3166     if cv_ced /= Void then
3167 manus 50607 cv_ced.find_selection
3168 xavier 28280 end
3169     end
3170    
3171 manus 50607 cut_selection is
3172     -- Cut the selection in the current editor.
3173     do
3174     current_editor.cut_selection
3175 xavier 28303 end
3176    
3177 manus 50607 copy_selection is
3178     -- Cut the selection in the current editor.
3179     do
3180     current_editor.copy_selection
3181     end
3182 xavier 28303
3183 manus 50607 toggle_formatting_marks is
3184     -- Show/Hide formatting marks in the editor and update related menu item.
3185     do
3186     current_editor.toggle_view_invisible_symbols
3187     if current_editor.view_invisible_symbols then
3188 manus 51111 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
3189 manus 50607 else
3190 manus 51111 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
3191 manus 50607 end
3192 xavier 27860 end
3193    
3194 manus 51111 feature {NONE} -- Implementation / Menus
3195 manus 26913
3196 manus 50607 number_of_displayed_external_commands: INTEGER
3197     -- Number of external commands in the tools menu.
3198 xavier 30005
3199 manus 50607 old_cur: EV_CURSOR
3200     -- Cursor saved while displaying the hourglass cursor.
3201 manus 26913
3202 manus 50607 cur_wid: EV_WIDGET
3203     -- Widget on which the hourglass cursor was set.
3204 manus 26913
3205 manus 50607 project_menu: EV_MENU
3206     -- Menu for entries relative to the Project.
3207 manus 26913
3208 manus 50607 recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
3209     -- SubMenu for recent projects.
3210 manus 26913
3211 manus 50607 during_synchronization: BOOLEAN
3212     -- Are we during a resynchronization?
3213 manus 26913
3214 manus 50607 formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
3215     -- Menu item used to shw/hide formatting marks.
3216 manus 26913
3217 manus 50607 undo_accelerator: EV_ACCELERATOR
3218     -- Accelerator for Ctrl+Z
3219 manus 26913
3220 manus 50607 redo_accelerator: EV_ACCELERATOR
3221     -- Accelerator for Ctrl+Y
3222 manus 26913
3223 manus 51111 feature {EB_TOOL} -- Implementation / Commands
3224 manus 26913
3225 manus 50607 shell_cmd: EB_OPEN_SHELL_COMMAND
3226     -- Command to use an external editor.
3227 manus 26913
3228 manus 50607 undo_cmd: EB_UNDO_COMMAND
3229     -- Command to undo in the editor.
3230 manus 26913
3231 manus 50607 redo_cmd: EB_REDO_COMMAND
3232     -- Command to redo in the editor.
3233 manus 26913
3234 manus 50607 editor_cut_cmd: EB_ON_SELECTION_COMMAND
3235     -- Command to cut text in the editor.
3236 manus 26913
3237 manus 50607 editor_copy_cmd: EB_ON_SELECTION_COMMAND
3238     -- Command to copy text in the editor.
3239 manus 26913
3240 manus 50607 editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
3241     -- Command to paste text in the editor.
3242 manus 26913
3243 manus 50607 melt_cmd: EB_MELT_PROJECT_COMMAND
3244     -- Command to start compilation.
3245 manus 26913
3246 manus 50607 freeze_cmd: EB_FREEZE_PROJECT_COMMAND
3247     -- Command to Freeze the project.
3248 manus 26913
3249 manus 50607 finalize_cmd: EB_FINALIZE_PROJECT_COMMAND
3250     -- Command to Finalize the project.
3251 manus 26913
3252 manus 50607 c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
3253     -- Command to compile the workbench C code.
3254 manus 26913
3255 manus 50607 c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
3256     -- Command to compile the finalized C code.
3257 manus 26913
3258 manus 50607 new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
3259     -- Command to create a new cluster.
3260 manus 26913
3261 manus 50607 new_class_cmd: EB_NEW_CLASS_COMMAND
3262     -- Command to create a new class.
3263 manus 26913
3264 manus 50607 new_feature_cmd: EB_NEW_FEATURE_COMMAND
3265     -- Command to execute the feature wizard.
3266 manus 51111
3267 alexk 51136 toggle_feature_alias_cmd: EB_TOGGLE_FEATURE_ALIAS_COMMAND
3268     -- Show/Hide alias name of feature node in eb_feature_tool
3269    
3270 manus 50607 toggle_feature_signature_cmd: EB_TOGGLE_FEATURE_SIGNATURE_COMMAND
3271     -- Show/Hide signature of feature node in eb_feature_tool
3272 manus 26913
3273 alexk 51887 toggle_feature_assigner_cmd: EB_TOGGLE_FEATURE_ASSIGNER_COMMAND
3274     -- Show/Hide assigner name of feature node in eb_feature_tool
3275    
3276 manus 50607 toggle_stone_cmd: EB_UNIFY_STONE_CMD
3277     -- Command to toggle between the stone management modes.
3278 manus 26913
3279 manus 50607 delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
3280     -- Command to remove a class or a cluster from the system
3281     -- (permanent deletion).
3282 xavier 30005
3283 manus 50607 show_profiler: EB_SHOW_PROFILE_TOOL
3284     -- What allows us to display the profiler window.
3285 manus 26913
3286 manus 50607 toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
3287     -- All commands that can be put in a toolbar.
3288 manus 26913
3289 manus 50607 command_controller: EB_EDITOR_COMMAND_CONTROLLER
3290     -- Object that takes care of updating the sensitivity of all editor commands.
3291 manus 26913
3292 manus 50607 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
3293     -- Command to save a class with a different file name.
3294 manus 26913
3295 manus 50607 Edit_external_commands_cmd: EB_EXTERNAL_COMMANDS_EDITOR is
3296     -- Command that lets the user add new external commands to the tools menu.
3297     once
3298     create Result.make
3299     Result.enable_sensitive
3300     end
3301 manus 26913
3302 manus 50607 system_info_cmd: EB_STANDARD_CMD is
3303     -- Command to display information about the system (root class,...)
3304     do
3305     Result := debugger_manager.system_info_cmd
3306     end
3307 neilc 49534
3308 manus 50607 display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
3309     -- Command to pop up a dialog giving help on compilation errors.
3310     do
3311     Result := debugger_manager.display_error_help_cmd
3312     end
3313 neilc 49534
3314 manus 50607 send_stone_to_context_cmd: EB_STANDARD_CMD
3315     -- Command to send the current stone to the context tool.
3316 neilc 49534
3317 manus 50607 print_cmd: EB_PRINT_COMMAND
3318     -- Command to print the content of editor with focus
3319 neilc 49534
3320 manus 50607 eac_browser_cmd: EB_OPEN_EAC_BROWSER_CMD is
3321     -- Command to display the eac browser
3322     do
3323     Result := Debugger_manager.eac_browser_cmd
3324 manus 51111 end
3325 neilc 49534
3326 manus 50607 show_favorites_menu_item: EV_MENU_ITEM
3327     -- Show/Hide favorites menu item.
3328 neilc 49534
3329 manus 50607 update_show_favorites_menu_item is
3330     -- Update `show_favorites_menu_item' menu label.
3331     do
3332     if favorites_tool.shown then
3333 manus 51111 show_favorites_menu_item.set_text (Interface_names.m_hide_favorites)
3334 manus 50607 else
3335 manus 51111 show_favorites_menu_item.set_text (Interface_names.m_show_favorites)
3336 manus 50607 end
3337 manus 26913 end
3338    
3339 manus 50607 execute_show_favorites is
3340     -- Show `favorites_tool' if it is closed, close
3341     -- it in the opposite case.
3342     do
3343     update_show_favorites_menu_item
3344     if favorites_tool.shown then
3345     favorites_tool.close