/[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 28747 - (hide annotations)
Sat Nov 3 02:00:29 2001 UTC (18 years, 3 months ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 85369 byte(s)
Changed the way EiffelStudio is exited. The previous implementation was a real mess. There is a chance that the new implementation will introduce bugs, but at least they should be straightforward to fix (and I tested my implementation rather well).

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

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23