/[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 51830 - (hide annotations)
Tue Jun 7 16:22:07 2005 UTC (14 years, 8 months ago) by neilc
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 101919 byte(s)
Change call when getting focus so not to give drawing area auto focus

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