/[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 30020 - (hide annotations)
Thu Jan 3 03:14:23 2002 UTC (18 years, 1 month ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 89140 byte(s)
Refactored the preferences to make a real library out of them.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23