/[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 52122 - (hide annotations)
Tue Jun 14 19:30:13 2005 UTC (14 years, 8 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 102309 byte(s)
Improved code resue, by using new routine `external_consumed_type' from
  EXTERNAL_CLASS_I to retrieve the associated CONSUMED_TYPE object.

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