/[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 32975 - (hide annotations)
Fri Jul 12 22:13:01 2002 UTC (17 years, 7 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 88866 byte(s)
Removed useless `dotnet_cmd'.

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     -- Separator -------------------------------------------------
1600     tools_menu.extend (create {EV_MENU_SEPARATOR})
1601    
1602     -- Preferences
1603     command_menu_item := Show_preferences_cmd.new_menu_item
1604     add_recyclable (command_menu_item)
1605     tools_menu.extend (command_menu_item)
1606 xavier 30005
1607     -- External commands editor
1608     command_menu_item := Edit_external_commands_cmd.new_menu_item
1609     add_recyclable (command_menu_item)
1610     tools_menu.extend (command_menu_item)
1611    
1612     -- Separator -------------------------------------------------
1613     tools_menu.extend (create {EV_MENU_SEPARATOR})
1614    
1615     rebuild_tools_menu
1616 manus 26913 end
1617    
1618     feature -- Stone process
1619    
1620     stone: STONE
1621     -- Current stone
1622    
1623     toggle_unified_stone is
1624     -- Change the stone management mode.
1625     do
1626     unified_stone := not unified_stone
1627     if unified_stone then
1628     send_stone_to_context
1629     send_stone_to_context_cmd.disable_sensitive
1630     context_tool.link_to_development_window
1631     else
1632     if stone /= Void then
1633     send_stone_to_context_cmd.enable_sensitive
1634     end
1635     context_tool.cut_from_development_window
1636     end
1637     end
1638    
1639     set_stone (a_stone: STONE) is
1640 xavier 29993 -- Change the currently focused stone.
1641     local
1642 xavier 30037 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
1643 xavier 29993 cv_cst: CLASSI_STONE
1644     l: LIST [EB_DEVELOPMENT_WINDOW]
1645     do
1646     cv_cst ?= a_stone
1647     if cv_cst /= Void then
1648     l := Window_manager.development_windows_with_class (cv_cst.class_i.name)
1649     if l.is_empty or else l.count = 1 and then l.first = Current then
1650     -- We're not editing the class in another window.
1651     set_stone_after_first_check (a_stone)
1652     else
1653     create cd.make_initialized (2, "already_editing_class", warning_messages.w_Class_already_edited, Interface_names.L_do_not_show_again)
1654     cd.set_ok_action (~set_stone_after_first_check (a_stone))
1655     cd.show_modal_to_window (window)
1656     end
1657     else
1658     set_stone_after_first_check (a_stone)
1659     end
1660     end
1661    
1662     set_stone_after_first_check (a_stone: STONE) is
1663 manus 26913 -- Display text associated with `a_stone', if any and if possible
1664     local
1665     feature_stone: FEATURE_STONE
1666     old_class_stone: CLASSI_STONE
1667     test_stone: CLASSI_STONE
1668     same_class: BOOLEAN
1669     conv_ferrst: FEATURE_ERROR_STONE
1670     do
1671     old_class_stone ?= stone
1672     feature_stone ?= a_stone
1673     if old_class_stone /= Void then
1674     create test_stone.make (old_class_stone.class_i)
1675     same_class := test_stone.same_as (a_stone)
1676     -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
1677     -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
1678     -- we have a CLASSI_STONE.
1679     if same_class and then feature_stone /= Void then
1680     same_class := False
1681     -- if the stone corresponding to a feature of currently opened class is dropped
1682     -- we attempt to scroll to the feature without asking to save the file
1683     -- except if it is during a resynchronization, in which case we do not scroll at all.
1684     if editor_tool.text_area.text_is_fully_loaded then
1685     if not during_synchronization then
1686     editor_tool.text_area.find_feature_named (feature_stone.feature_name)
1687     feature_stone_already_processed := editor_tool.text_area.found_feature
1688     else
1689     feature_stone_already_processed := True
1690     end
1691     conv_ferrst ?= feature_stone
1692     if feature_stone_already_processed and conv_ferrst /= Void then
1693     -- Scroll to the line of the error.
1694     if not during_synchronization then
1695     editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
1696     end
1697     end
1698     end
1699     end
1700     end
1701     -- first, let's check if there is already something in this window
1702     -- if there's nothing, there's no need to save anything...
1703     if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
1704     set_stone_after_check (a_stone)
1705     feature_stone_already_processed := False
1706     else
1707     -- there is something to be saved
1708     -- if user chooses to save, current file will be parsed
1709     -- if there is a syntax_error, new file is not loaded
1710     save_and (~set_stone_after_check (a_stone))
1711     if text_saved and then not syntax_is_correct then
1712     text_saved := False
1713     during_synchronization := True
1714     set_stone_after_check (stone)
1715     during_synchronization := False
1716     address_manager.refresh
1717     end
1718     end
1719     end
1720    
1721     force_stone (s: STONE) is
1722     -- make `s' the new value of `stone', and
1723     -- change the display accordingly. Try to
1724     -- extract a class from `s' whenever possible.
1725     do
1726     if s.is_storable then
1727     set_stone (s)
1728     if not unified_stone then
1729     context_tool.advanced_set_stone (s)
1730     end
1731     end
1732     end
1733    
1734     process_class (s: CLASSI_STONE) is
1735     -- Process class stone
1736     do
1737     set_stone (s)
1738     end
1739    
1740     process_feature_error (s: FEATURE_ERROR_STONE) is
1741     -- Process feature error stone.
1742     local
1743     cl_stone: CLASSC_STONE
1744     e_class: CLASS_C
1745     txt: STRING
1746     pos, end_pos: INTEGER
1747     do
1748     set_default_format
1749     e_class := s.e_feature.written_class
1750 manus 31058 create cl_stone.make (e_class)
1751     set_stone (cl_stone)
1752     editor_tool.text_area.deselect_all
1753     pos := s.error_position
1754     txt := text
1755     if txt.count > pos then
1756     if txt.item (pos) = '%N' then
1757     end_pos := txt.index_of ('%N', pos + 1)
1758     else
1759     end_pos := txt.index_of ('%N', pos)
1760 manus 26913 end
1761 manus 31058 if pos /= 0 then
1762     editor_tool.text_area.highlight_selected (pos, end_pos)
1763     end
1764 manus 26913 end
1765     end
1766    
1767    
1768     process_class_syntax (s: CL_SYNTAX_STONE) is
1769     -- Process class syntax.
1770     local
1771     cl_stone: CLASSC_STONE
1772     do
1773     -- call set_stone to ensure the proper class is displayed
1774     create cl_stone.make (s.e_class)
1775     set_stone (cl_stone)
1776     editor_tool.text_area.deselect_all
1777     editor_tool.text_area.highlight_when_ready (s.start_position + 1, s.end_position + 1)
1778     end
1779    
1780     refresh is
1781     -- Synchronize clickable elements with text, if possible.
1782     do
1783     --| FIXME ARNAUD
1784     -- synchronise_stone
1785     --| END FIXME
1786     --| FIXME XR: Refresh current display in the editor.
1787     editor_tool.text_area.update_click_list (False)
1788     update_save_symbol
1789     address_manager.refresh
1790     -- The cluster manager should already be refreshed by the window manager.
1791     -- cluster_manager.refresh
1792     -- context_tool.refresh
1793     end
1794    
1795     quick_refresh is
1796     -- Redraw the main editor's drawing area.
1797     do
1798     editor_tool.text_area.refresh
1799     context_tool.quick_refresh
1800     end
1801    
1802     set_default_format is
1803     -- Default format of windows.
1804     --| FIXME ARNAUD: To be implemented.
1805     -- local
1806     -- f: EB_FORMATTER
1807     do
1808     -- if stone /= Void then
1809     -- if stone.class_i.hide_implementation then
1810     -- f := format_list.precompiled_default_format
1811     -- else
1812     -- f := format_list.default_format
1813     -- end
1814     -- else
1815     -- f := format_list.default_format
1816     -- end
1817     -- set_last_format (f)
1818     --| END FIXME
1819     end
1820    
1821     feature -- Resource Update
1822    
1823     update is
1824 xavier 27214 -- Update Current with the registered resources.
1825 manus 26913 do
1826     -- Show/hide general toolbar
1827 xavier 30020 if show_general_toolbar then
1828 manus 26913 show_general_toolbar_command.enable_visible
1829     else
1830     show_general_toolbar_command.disable_visible
1831     end
1832    
1833     -- Show/hide address toolbar
1834 xavier 30020 if show_address_toolbar then
1835 manus 26913 show_address_toolbar_command.enable_visible
1836     else
1837     show_address_toolbar_command.disable_visible
1838     end
1839    
1840     -- Show/hide project toolbar
1841 xavier 30020 if show_project_toolbar then
1842 manus 26913 show_project_toolbar_command.enable_visible
1843     else
1844     show_project_toolbar_command.disable_visible
1845     end
1846    
1847 xavier 30020 left_panel.load_from_resource (left_panel_layout)
1848     right_panel.load_from_resource (right_panel_layout)
1849 manus 26913 end
1850    
1851     update_splitters is
1852     -- Refresh the position of the splitter on screen according to
1853     -- our internal values.
1854     do
1855     -- Set the interior layout
1856     if panel.full then
1857     panel.set_split_position (splitter_position.max (panel.minimum_split_position).min (panel.maximum_split_position))
1858     end
1859     left_panel.refresh_splitter
1860     right_panel.refresh_splitter
1861     end
1862    
1863     register is
1864     -- Register to preferences we want notification of.
1865     do
1866     end
1867    
1868     unregister is
1869     -- unregister to preferences we want notification of.
1870     do
1871     end
1872    
1873     reset is
1874     -- Reset the window contents
1875     do
1876     Precursor
1877     address_manager.reset
1878    
1879     --| FIXME ARNAUD, multiformat not yet implemented.
1880     -- format_list.enable_imp_formats_sensitive
1881     --| END FIXME
1882     end
1883    
1884 xavier 30005 rebuild_tools_menu is
1885     -- Refresh the list of external commands.
1886     local
1887 manus 32663 ms: LIST [EB_COMMAND_MENU_ITEM]
1888 xavier 30005 do
1889     -- Remove all the external commands, which are at the end of the menu.
1890     from
1891     tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
1892     until
1893     tools_menu.after
1894     loop
1895     tools_menu.remove
1896     end
1897     ms := Edit_external_commands_cmd.menus
1898     number_of_displayed_external_commands := ms.count
1899     from
1900     ms.start
1901     until
1902     ms.after
1903     loop
1904     tools_menu.extend (ms.item)
1905 manus 32663 add_recyclable (ms.item)
1906 xavier 30005 ms.forth
1907     end
1908     end
1909    
1910 manus 26913 syntax_is_correct: BOOLEAN is
1911     -- file was successfully parsed.
1912     do
1913     Result := editor_tool.text_area.syntax_is_correct
1914     end
1915    
1916     on_project_created is
1917     -- Inform tools that the current project has been loaded or re-loaded.
1918     do
1919     build_menu_bar
1920     enable_commands_on_project_created
1921 xavier 28304 context_tool.on_project_created
1922 manus 26913 address_manager.on_project_created
1923 xavier 28303 if has_dll_generation then
1924     show_dynamic_lib_tool.enable_sensitive
1925     end
1926     if has_profiler then
1927     show_profiler.enable_sensitive
1928     end
1929 manus 26913 end
1930    
1931     on_project_loaded is
1932     -- Inform tools that the current project has been loaded or re-loaded.
1933     do
1934     -- cluster_manager.on_project_loaded
1935     enable_commands_on_project_loaded
1936     cluster_tool.on_project_loaded
1937     context_tool.on_project_loaded
1938     end
1939    
1940     on_project_unloaded is
1941     -- Inform tools that the current project will soon been unloaded.
1942     do
1943     -- cluster_manager.on_project_unloaded
1944     disable_commands_on_project_unloaded
1945     cluster_tool.on_project_unloaded
1946     context_tool.on_project_unloaded
1947     address_manager.on_project_unloaded
1948     build_menu_bar
1949 xavier 28303 if has_dll_generation then
1950     show_dynamic_lib_tool.disable_sensitive
1951     end
1952     if has_profiler then
1953     show_profiler.disable_sensitive
1954     end
1955 manus 26913 end
1956    
1957     save_before_compiling is
1958     -- save the text but do not update clickable positions
1959     do
1960     save_only := True
1961     save_text
1962     end
1963    
1964     perform_check_before_save is
1965     local
1966     dial: EV_CONFIRMATION_DIALOG
1967     do
1968     debug ("EDITOR")
1969     if editor_tool.text_area.current_text /= Void and then changed then
1970     io.error.putstring ("%N Warning: Attempting to save a non editable format%N")
1971     end
1972     end
1973     if editor_tool.text_area.open_backup then
1974     create dial.make_with_text(Warning_messages.w_Save_backup)
1975     dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<~continue_save, ~cancel_save>>)
1976     dial.set_default_push_button(dial.button("Continue"))
1977     dial.set_default_cancel_button(dial.button("Cancel"))
1978     dial.set_title ("Save Backup")
1979     dial.show_modal_to_window (window)
1980     else
1981     check_passed := True
1982     end
1983     end
1984    
1985     continue_save is
1986     -- continue saving
1987     do
1988     check_passed := True
1989     end
1990    
1991     cancel_save is
1992     -- cancel saving
1993     do
1994     check_passed := False
1995     end
1996    
1997     process is
1998     -- process the user entry in the address bar
1999     do
2000     save_canceled := False
2001     end
2002    
2003     on_text_saved is
2004     -- Notify the editor that the text has been saved
2005     local
2006     str: STRING
2007     do
2008     Precursor
2009     editor_tool.on_text_saved
2010     text_saved := True
2011     if not save_only then
2012     editor_tool.text_area.update_click_list (True)
2013     end
2014     save_only := False
2015     str := clone (title)
2016     if str @ 1 = '*' then
2017 xavier 29812 str.keep_tail (str.count - 2)
2018 manus 26913 set_title (str)
2019     end
2020 xavier 27866 update_formatters
2021 xavier 29812 if editor_tool.text_area.syntax_is_correct then
2022     status_bar.display_message ("")
2023     else
2024     status_bar.display_message (Interface_names.L_syntax_error)
2025     end
2026     text_edited := False
2027 manus 26913 end
2028    
2029     save_and (an_action: PROCEDURE [ANY, TUPLE []]) is
2030     local
2031     save_dialog: EB_CONFIRM_SAVE_DIALOG
2032     do
2033     save_canceled := True
2034     text_saved := False
2035     create save_dialog.make_and_launch (Current,Current)
2036     if not save_canceled and then syntax_is_correct then
2037     an_action.call([])
2038     end
2039     end
2040    
2041     feature -- Window management
2042    
2043     show_window is
2044     -- Show the window
2045     do
2046     show
2047     end
2048    
2049     raise_window is
2050     -- Show the window and set the focus to it.
2051     do
2052     show
2053     --| FIXME, set the focus.
2054     end
2055    
2056     hide_window is
2057     -- Hide the window
2058     do
2059     hide
2060     end
2061    
2062     destroy_window is
2063     -- Destroy the window.
2064     do
2065     destroy
2066     end
2067    
2068     give_focus is
2069     -- Give the focus to the address manager.
2070     do
2071     address_manager.set_focus
2072     end
2073    
2074     feature -- Tools & Controls
2075    
2076     editor_tool: EB_EDITOR_TOOL
2077    
2078     favorites_tool: EB_FAVORITES_TOOL
2079    
2080     cluster_tool: EB_CLUSTER_TOOL
2081    
2082     search_tool: EB_SEARCH_TOOL
2083    
2084     features_tool: EB_FEATURES_TOOL
2085    
2086     windows_tool: EB_WINDOWS_TOOL
2087    
2088     context_tool: EB_CONTEXT_TOOL
2089     -- Context explorer for current class and system.
2090    
2091     address_manager: EB_ADDRESS_MANAGER
2092     -- Text field in the toolbar
2093     -- Allow user to enter the name
2094     -- of the class he wants to edit.
2095    
2096     project_manager: EB_PROJECT_MANAGER is
2097     -- Project manager associated to the project the user is working on.
2098     do
2099     Result := Eiffel_project.manager
2100     end
2101    
2102     managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2103     -- All formatters that operate on a class.
2104    
2105     managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2106     -- All formatters that operate on a class.
2107    
2108     managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2109     -- All formatters that can be displayed in the main editor frame.
2110    
2111     unified_stone: BOOLEAN
2112     -- Is the stone common with the context tool or not?
2113    
2114     feature -- Multiple editor management
2115    
2116     add_editor_to_list (an_editor: EB_EDITOR) is
2117     -- adds `an_editor' to `editors'
2118     do
2119     editors.extend (an_editor)
2120     end
2121    
2122     current_editor: EB_EDITOR is
2123     -- current editor, if none, main editor
2124     do
2125     if current_editor_index /= 0 then
2126     Result := editors @ current_editor_index
2127     else
2128     Result := editors.first
2129     end
2130     end
2131    
2132     set_current_editor (an_editor: EB_EDITOR) is
2133     -- set `an_editor' as main editor
2134     local
2135     old_index: INTEGER
2136 xavier 27860 new_index: INTEGER
2137 manus 26913 do
2138     old_index := current_editor_index
2139 xavier 27860 new_index := editors.index_of (an_editor, 1)
2140     if
2141     editors.valid_index (new_index) and
2142     old_index /= new_index
2143     then
2144     current_editor_index := new_index
2145 manus 26913 from
2146     editors.start
2147     until
2148     editors.after
2149     loop
2150     if editors.index /= current_editor_index and then editors.item.has_selection then
2151     editors.item.disable_selection
2152     end
2153     editors.forth
2154     end
2155 xavier 27860 update_paste_cmd
2156     -- Last thing, update the menu entry for the formatting marks.
2157     if current_editor.view_invisible_symbols then
2158     formatting_marks_command_menu_item.set_text (Interface_names.m_Hide_formatting_marks)
2159     else
2160     formatting_marks_command_menu_item.set_text(Interface_names.m_Show_formatting_marks)
2161     end
2162 xavier 28303 command_controller.set_current_editor (an_editor)
2163 xavier 27840 end
2164 manus 26913 end
2165    
2166 xavier 27860 update_paste_cmd is
2167     -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2168     local
2169     txt: STRING
2170     do
2171     txt := current_editor.clipboard.text
2172     if
2173     not current_editor.is_empty and then
2174     current_editor.is_editable and then
2175     txt /= Void and then
2176     not txt.is_empty
2177     then
2178     editor_paste_cmd.enable_sensitive
2179     else
2180     editor_paste_cmd.disable_sensitive
2181     end
2182     end
2183    
2184 manus 26913 feature {NONE} -- Multiple editor management
2185    
2186     editors: ARRAYED_LIST [EB_EDITOR]
2187     -- editor contained in `Current'
2188    
2189     current_editor_index: INTEGER
2190 xavier 28303 -- Index in `editors' of the editor that has the focus.
2191 manus 26913
2192     feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2193    
2194     destroy_imp is
2195     -- Destroy window.
2196     do
2197     -- To avoid reentrance
2198     if not is_destroying then
2199     is_destroying := True
2200 xavier 30020 save_left_panel_layout (left_panel.save_to_resource)
2201     save_right_panel_layout (right_panel.save_to_resource)
2202     save_search_tool_options (search_tool)
2203 manus 26913 hide
2204    
2205     -- Commit saves
2206 xavier 30020 save_resources
2207 manus 26913
2208     -- If a launched application is still running, kill it.
2209     if
2210     Application.is_running and then
2211     debugger_manager.debugging_window = Current
2212     then
2213     Application.kill
2214     end
2215     toolbars_area.wipe_out
2216     address_manager.recycle
2217     project_customizable_toolbar.recycle
2218     Precursor {EB_TOOL_MANAGER}
2219    
2220     -- These components are automatically recycled through `add_recyclable'.
2221     -- cluster_tool.recycle
2222     -- context_tool.recycle
2223     -- editor_tool.recycle
2224     -- favorites_tool.recycle
2225     -- features_tool.recycle
2226     -- search_tool.recycle
2227     -- windows_tool.recycle
2228    
2229     -- The compile menu is never created !!!
2230     -- compile_menu.destroy
2231     -- debug_menu.destroy
2232     -- project_menu.destroy
2233    
2234     managed_class_formatters.wipe_out
2235     managed_feature_formatters.wipe_out
2236     managed_main_formatters.wipe_out
2237     toolbarable_commands.wipe_out
2238     editors.wipe_out
2239     stone := Void
2240     end
2241     end
2242    
2243     feature {NONE} -- Implementation
2244    
2245     set_stone_after_check (a_stone: STONE) is
2246     local
2247     old_stone: STONE
2248     new_class_stone: CLASSI_STONE
2249     old_class_stone: CLASSI_STONE
2250     conv_classc: CLASSC_STONE
2251     conv_brkstone: BREAKABLE_STONE
2252     cluster_st: CLUSTER_STONE
2253     feature_stone: FEATURE_STONE
2254     conv_ferrst: FEATURE_ERROR_STONE
2255     tmp_structured_text: STRUCTURED_TEXT
2256     conv_errst: ERROR_STONE
2257     class_file: RAW_FILE
2258     class_text_exists: BOOLEAN
2259     same_class: BOOLEAN
2260     test_stone: CLASSI_STONE
2261 xavier 27840 conv_ace: ACE_SYNTAX_STONE
2262 manus 26913 str: STRING
2263     do
2264     -- the text does not change if the text was saved with syntax errors
2265     cur_wid := window
2266     if cur_wid = Void then
2267     --| Do nothing.
2268     else
2269     if old_cur = Void then
2270     old_cur := cur_wid.pointer_style
2271     end
2272     -- cur_wid.enable_capture
2273     cur_wid.set_pointer_style (Wait_cursor)
2274     end
2275    
2276     conv_brkstone ?= a_stone
2277     conv_errst ?= a_stone
2278 xavier 27840 conv_ace ?= a_stone
2279 manus 26913 if conv_brkstone /= Void then
2280     if Application.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2281     Application.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2282     else
2283     Application.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2284     end
2285     output_manager.display_stop_points
2286     window_manager.quick_refresh_all
2287     elseif conv_errst /= Void then
2288     display_error_help_cmd.execute_with_stone (conv_errst)
2289 xavier 27840 elseif conv_ace /= Void then
2290     --| FIXME XR: What should we do?!
2291 manus 26913 else
2292    
2293     -- Remember previous stone.
2294     old_stone := stone
2295     old_class_stone ?= stone
2296    
2297     -- New stone properties
2298     new_class_stone ?= a_stone
2299    
2300     -- Set the stone.
2301     old_set_stone (a_stone)
2302     cluster_st ?= a_stone
2303    
2304     new_feature_cmd.disable_sensitive
2305     -- We update the state of the `Add to Favorites' command.
2306     if new_class_stone /= Void then
2307     favorites_menu.first.enable_sensitive
2308     else
2309     favorites_menu.first.disable_sensitive
2310     end
2311    
2312     -- Update the history.
2313     if
2314     new_class_stone /= Void
2315     then
2316     history_manager.extend (new_class_stone)
2317     elseif
2318     cluster_st /= Void
2319     then
2320     history_manager.extend (cluster_st)
2321     end
2322     -- Update the address manager if needed.
2323     address_manager.refresh
2324     if
2325     new_class_stone /= Void
2326     then
2327     -- class stone was dropped
2328     create class_file.make (new_class_stone.class_i.file_name)
2329     class_text_exists := class_file.exists
2330     feature_stone ?= a_stone
2331     --| We have to create a classi_stone to check whether the stones are really similar.
2332     --| Otherwise a redefinition of same_as may be called.
2333     create test_stone.make (new_class_stone.class_i)
2334     if test_stone.same_as (old_class_stone) then
2335     same_class := True
2336     end
2337     if not feature_stone_already_processed then
2338     if
2339     same_class and then text_saved
2340     then
2341     -- nothing changed in the editor
2342     -- we only have to update click_list
2343     if editor_tool.text_area.is_editable then
2344     editor_tool.text_area.update_click_list (False)
2345     end
2346     else
2347     if changed then
2348     -- user has already chosen not to save the file
2349     -- do not ask again
2350     editor_tool.text_area.no_save_before_next_load
2351     end
2352     end
2353     end
2354    
2355     conv_classc ?= new_class_stone
2356 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
2357 manus 26913 -- If a classi_stone or a feature_stone has been dropped,
2358     -- display the basic text formatter.
2359     if class_text_exists then
2360     managed_main_formatters.first.set_stone (new_class_stone)
2361     managed_main_formatters.first.execute
2362     else
2363     editor_tool.text_area.clear_window
2364     editor_tool.text_area.display_message (Warning_messages.w_file_not_exist (new_class_stone.class_i.file_name))
2365     end
2366     end
2367     if conv_classc = Void then
2368     --| The dropped class is not compiled.
2369     --| Display only the textual formatter.
2370     address_manager.disable_formatters
2371     else
2372     --| We have a compiled class.
2373     if
2374     class_text_exists and then
2375     Eiffel_project.Workbench.last_reached_degree <= 2
2376     then
2377     new_feature_cmd.enable_sensitive
2378     end
2379    
2380     address_manager.enable_formatters
2381     if not class_text_exists then
2382     --| Disable the textual formatter.
2383     managed_main_formatters.first.disable_sensitive
2384     from
2385     managed_main_formatters.start
2386     managed_main_formatters.forth
2387     until
2388     managed_main_formatters.after
2389     loop
2390     managed_main_formatters.item.set_stone (new_class_stone)
2391     managed_main_formatters.forth
2392     end
2393     managed_main_formatters.i_th (2).execute
2394     else
2395 xavier 28693 if not changed or not same_class then
2396 manus 26913 --| Enable all formatters.
2397 xavier 28469 if
2398     not feature_stone_already_processed or
2399     not managed_main_formatters.first.selected
2400     then
2401 manus 26913 from
2402     managed_main_formatters.start
2403     until
2404     managed_main_formatters.after
2405     loop
2406     managed_main_formatters.item.set_stone (new_class_stone)
2407     managed_main_formatters.forth
2408     end
2409     end
2410     else
2411     address_manager.disable_formatters
2412 xavier 28693 from
2413     managed_main_formatters.start
2414     until
2415     managed_main_formatters.after
2416     loop
2417     managed_main_formatters.item.set_stone (new_class_stone)
2418     managed_main_formatters.forth
2419     end
2420 manus 26913 end
2421     end
2422     end
2423     else
2424     -- not a class text : cannot be edited
2425     editor_tool.text_area.disable_editable
2426     address_manager.disable_formatters
2427    
2428     --| Disable all formatters.
2429     from
2430     managed_main_formatters.start
2431     until
2432     managed_main_formatters.after
2433     loop
2434     managed_main_formatters.item.set_stone (Void)
2435     managed_main_formatters.forth
2436     end
2437     if cluster_st /= Void then
2438     --| FIXME XR: Really manage cluster display in the main editor
2439     create tmp_structured_text.make
2440     tmp_structured_text.add_string ("Cluster: " + cluster_st.cluster_i.cluster_name)
2441     tmp_structured_text.add_new_line
2442     tmp_structured_text.add_string ("Cluster path: " + cluster_st.cluster_i.path)
2443     editor_tool.text_area.process_text (tmp_structured_text)
2444     --| END FIXME
2445     end
2446     end
2447 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
2448 manus 26913 conv_ferrst ?= feature_stone
2449     if conv_ferrst /= Void then
2450     -- Scroll to the line of the error.
2451     editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2452     else
2453     -- if a feature_stone has been dropped
2454     -- scroll to the corresponding feature in the basic text format
2455     if feature_stone.e_feature.ast /= Void and not during_synchronization then
2456     scroll_to_feature (feature_stone.e_feature.ast, new_class_stone.class_i)
2457     end
2458     end
2459     end
2460     -- Update the title of the window
2461     if a_stone /= Void then
2462     if changed then
2463     str := clone (a_stone.header)
2464     str.prepend ("* ")
2465     set_title (str)
2466     else
2467     set_title (a_stone.header)
2468     end
2469     else
2470     set_title (Interface_names.t_Empty_development_window)
2471     end
2472    
2473     -- Refresh the tools.
2474     features_tool.set_stone (a_stone)
2475     cluster_tool.set_stone (a_stone)
2476     -- Update the context tool.
2477     if unified_stone then
2478     context_tool.set_stone (a_stone)
2479     end
2480    
2481     end
2482     if
2483     stone /= Void and then
2484     not unified_stone
2485     then
2486     send_stone_to_context_cmd.enable_sensitive
2487     else
2488     send_stone_to_context_cmd.disable_sensitive
2489     end
2490     if cur_wid = Void then
2491     --| Do nothing.
2492     else
2493     cur_wid.set_pointer_style (old_cur)
2494     old_cur := Void
2495     -- cur_wid.disable_capture
2496     cur_wid := Void
2497     end
2498     end
2499    
2500     scroll_to_feature (feat_as: FEATURE_AS; displayed_class: CLASS_I) is
2501     -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
2502     require
2503     class_is_not_void: displayed_class /= Void
2504     feat_as_is_not_void: feat_as /= Void
2505     local
2506     begin_index, offset: INTEGER
2507     tmp_text: STRING
2508     do
2509     begin_index := feat_as.start_position
2510     if platform_constants.is_windows then
2511     tmp_text := displayed_class.text.substring (1, begin_index)
2512     offset := tmp_text.occurrences('%R')
2513     end
2514     editor_tool.text_area.scroll_to_when_ready (begin_index - offset)
2515     end
2516    
2517    
2518     check_passed: BOOLEAN
2519    
2520     save_canceled: BOOLEAN
2521     -- did user cancel save ?
2522    
2523     save_only: BOOLEAN
2524     -- skip parse and update after save ?
2525    
2526     text_saved: BOOLEAN
2527     -- has the user chosen to save the file
2528    
2529     is_destroying: BOOLEAN
2530     -- Is `current' being currently destroyed?
2531    
2532     feature_stone_already_processed: BOOLEAN
2533     -- Is the processed stone a feature stone and has it
2534     -- been already processed by the editor ?
2535    
2536     feature {NONE} -- Implementation
2537    
2538     update_save_symbol is
2539     do
2540     {EB_FILEABLE} Precursor
2541     if changed then
2542     save_cmd.enable_sensitive
2543     address_manager.disable_formatters
2544     else
2545     save_cmd.disable_sensitive
2546 xavier 27866 update_formatters
2547 manus 26913 end
2548     if is_empty then
2549     print_cmd.disable_sensitive
2550     save_as_cmd.disable_sensitive
2551     else
2552     print_cmd.enable_sensitive
2553     save_as_cmd.enable_sensitive
2554     end
2555     end
2556    
2557 xavier 27866 update_formatters is
2558     -- Give a correct sensitivity to formatters.
2559     local
2560 xavier 28280 cist: CLASSI_STONE
2561 xavier 27866 cst: CLASSC_STONE
2562     file: RAW_FILE
2563     do
2564     cst ?= stone
2565     if cst /= Void then
2566     if changed then
2567     address_manager.disable_formatters
2568     else
2569     address_manager.enable_formatters
2570     create file.make (cst.e_class.lace_class.file_name)
2571     if not file.exists then
2572 xavier 28280 if managed_main_formatters.first.selected then
2573     managed_main_formatters.i_th (2).execute
2574     end
2575 xavier 27866 managed_main_formatters.first.disable_sensitive
2576     end
2577     end
2578     else
2579     address_manager.disable_formatters
2580 xavier 28303 cist ?= stone
2581     if cist /= Void then
2582     managed_main_formatters.first.execute
2583     end
2584 xavier 27866 end
2585     end
2586    
2587 manus 26913 on_text_reset is
2588 etienne 27144 -- The main editor has just been wiped out
2589     -- before loading a new file.
2590 manus 26913 local
2591     str: STRING
2592     do
2593     str := clone (title)
2594     if str @ 1 = '*' then
2595 xavier 29812 str.keep_tail (str.count - 2)
2596 manus 26913 set_title (str)
2597     end
2598 xavier 27866 address_manager.disable_formatters
2599 xavier 29812 status_bar.display_message ("")
2600     status_bar.remove_cursor_position
2601 xavier 29832 text_edited := False
2602 manus 26913 end
2603    
2604 xavier 29812 on_cursor_moved is
2605     -- The cursor has moved, reflect the change in the status bar.
2606     do
2607     refresh_cursor_position
2608     end
2609    
2610 xavier 27840 on_text_fully_loaded is
2611     -- The main editor has just been reloaded.
2612     do
2613     update_paste_cmd
2614 xavier 27866 update_formatters
2615 xavier 29812 if editor_tool.text_area.syntax_is_correct then
2616     status_bar.display_message ("")
2617     else
2618     status_bar.display_message (Interface_names.L_syntax_error)
2619     end
2620     refresh_cursor_position
2621 xavier 29832 text_edited := False
2622 xavier 27840 end
2623    
2624 etienne 27144 on_text_back_to_its_last_saved_state is
2625     local
2626     str: STRING
2627     do
2628     str := clone (title)
2629     if str @ 1 = '*' then
2630 xavier 29812 str.keep_tail (str.count - 2)
2631 etienne 27144 set_title (str)
2632     end
2633 xavier 27866 update_formatters
2634 xavier 29812 text_edited := False
2635 etienne 27144 end
2636 xavier 29812
2637     text_edited: BOOLEAN
2638     -- Do we know that the text was edited?
2639     -- If so, no need to update the display each time it is edited.
2640 etienne 27144
2641 manus 26913 on_text_edited (unused: BOOLEAN) is
2642     -- The text in the editor is modified, add the '*' in the title.
2643     -- Gray out the formatters.
2644     local
2645     str: STRING
2646 xavier 29812 cst: CLASSI_STONE
2647 manus 26913 do
2648 xavier 29812 if not text_edited then
2649     str := clone (title)
2650     if str @ 1 /= '*' then
2651     str.prepend ("* ")
2652     set_title (str)
2653     end
2654     address_manager.disable_formatters
2655     cst ?= stone
2656     if cst /= Void then
2657     Eiffel_project.Manager.class_is_edited (cst.class_i)
2658     end
2659     text_edited := True
2660 manus 26913 end
2661 xavier 29812 status_bar.display_message ("")
2662 manus 26913 end
2663    
2664 xavier 27498 on_back is
2665     -- User pressed Alt+left.
2666     -- Go back in the history (or the context history).
2667     do
2668     if context_tool_has_focus then
2669     if context_tool.history_manager.is_back_possible then
2670     context_tool.history_manager.back_command.execute
2671     end
2672     elseif history_manager.is_back_possible then
2673     history_manager.back_command.execute
2674     end
2675     end
2676    
2677     on_forth is
2678     -- User pressed Alt+right.
2679     -- Go forth in the history (or the context history).
2680     do
2681     if context_tool_has_focus then
2682     if context_tool.history_manager.is_forth_possible then
2683     context_tool.history_manager.forth_command.execute
2684     end
2685     elseif history_manager.is_forth_possible then
2686     history_manager.forth_command.execute
2687     end
2688     end
2689    
2690     context_tool_has_focus: BOOLEAN is
2691     -- Does the context tool or one of its children has the focus?
2692     local
2693     fw: EV_WIDGET
2694     cont: EV_CONTAINER
2695     wid: EV_WIDGET
2696     do
2697     fw := (create {EV_ENVIRONMENT}).application.focused_widget
2698     wid := context_tool.explorer_bar_item.widget
2699     if wid = fw then
2700     Result := True
2701     elseif fw = Void then
2702     Result := False
2703     else
2704     from
2705     cont := fw.parent
2706     until
2707     cont = wid or cont = Void
2708     loop
2709     cont := cont.parent
2710     end
2711     if cont = wid then
2712     Result := True
2713     end
2714     end
2715     end
2716    
2717 manus 26913 saved_cursor: CURSOR
2718     -- Saved cursor position for displaying the stack.
2719    
2720 xavier 27840 can_drop (st: ANY): BOOLEAN is
2721     -- Can the user drop the stone `st'?
2722     local
2723     conv_ace: ACE_SYNTAX_STONE
2724     do
2725     conv_ace ?= st
2726     Result := conv_ace = Void
2727     end
2728    
2729 manus 26913 quick_refresh_on_class_drop (unused: CLASSI_STONE) is
2730     -- Quick refresh all windows.
2731     do
2732     window_manager.quick_refresh_all
2733     end
2734    
2735     quick_refresh_on_brk_drop (unused: BREAKABLE_STONE) is
2736     -- Quick refresh all windows.
2737     do
2738     window_manager.quick_refresh_all
2739     end
2740    
2741     send_stone_to_context is
2742     -- Send current stone to the context tool.
2743     -- Used by `send_stone_to_context_cmd'.
2744     do
2745     if stone /= Void then
2746     context_tool.set_stone (stone)
2747     end
2748     end
2749    
2750     destroy is
2751     -- check if current text has been saved and destroy
2752     local
2753     dialog_w: EB_WARNING_DIALOG
2754     do
2755     if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
2756 xavier 28747 if Window_manager.development_windows_count > 1 then
2757     create dialog_w.make_with_text (Warning_messages.w_Save_before_closing)
2758     dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<~save_and_destroy, ~force_destroy, ~do_nothing>>)
2759     dialog_w.set_default_push_button (dialog_w.button("Yes"))
2760     dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
2761     dialog_w.show_modal_to_window (window)
2762     else
2763     -- We let the window manager handle the saving, along with other windows
2764     -- (not development windows)
2765     force_destroy
2766     end
2767 manus 26913 else
2768     Precursor {EB_TOOL_MANAGER}
2769     end
2770     end
2771    
2772     save_and_destroy is
2773     do
2774     save_text
2775     destroy
2776     end
2777    
2778     force_destroy is
2779     -- Destroy without asking.
2780     do
2781     confirmed := True
2782     destroy
2783     confirmed := False
2784     end
2785    
2786     confirmed: BOOLEAN
2787     -- Did the user say he wanted to exit?
2788    
2789     show_dynamic_library_dialog is
2790     -- Create a new dynamic library window and display it.
2791     do
2792     Window_manager.create_dynamic_lib_window
2793     end
2794    
2795 xavier 27860 recycle is
2796     -- Call the precursors.
2797 manus 26913 do
2798 xavier 27860 {EB_TOOL_MANAGER} Precursor
2799 xavier 28303 command_controller.recycle
2800 manus 26913 end
2801    
2802 xavier 27860 feature {NONE} -- Implementation: Editor commands
2803 xavier 27840
2804 xavier 29812 refresh_cursor_position is
2805     -- Display the current cursor position in the status bar.
2806     require
2807     text_loaded: not is_empty
2808     local
2809     l, c: INTEGER
2810     do
2811     l := editor_tool.text_area.cursor_y_position
2812     c := editor_tool.text_area.cursor_x_position
2813     status_bar.set_cursor_position (l, c)
2814     end
2815    
2816 xavier 27840 select_all is
2817     -- Select the whole text in the focused editor.
2818     do
2819     current_editor.select_all
2820     end
2821    
2822 xavier 28693 search is
2823     -- Search some text in the focused editor.
2824     local
2825     cv_ced: EB_CLICKABLE_EDITOR
2826     do
2827     cv_ced ?= current_editor
2828     if cv_ced /= Void then
2829     cv_ced.search
2830     end
2831     end
2832    
2833 xavier 28280 find_next is
2834     -- Find the next occurrence of the search text.
2835     local
2836     cv_ced: EB_CLICKABLE_EDITOR
2837     do
2838     if search_tool.currently_searched /= Void then
2839     cv_ced ?= current_editor
2840     if cv_ced /= Void then
2841     cv_ced.find_next
2842     end
2843     else
2844 xavier 29149 search_tool.show_and_set_focus
2845 xavier 28280 end
2846     end
2847    
2848     find_previous is
2849     -- Find the previous occurrence of the search text.
2850     local
2851     cv_ced: EB_CLICKABLE_EDITOR
2852     do
2853     if search_tool.currently_searched /= Void then
2854     cv_ced ?= current_editor
2855     if cv_ced /= Void then
2856     cv_ced.find_previous
2857     end
2858     else
2859 xavier 29149 search_tool.show_and_set_focus
2860 xavier 28280 end
2861     end
2862    
2863     find_selection is
2864     -- Find the next occurrence of the selection.
2865     local
2866     cv_ced: EB_CLICKABLE_EDITOR
2867     do
2868     cv_ced ?= current_editor
2869     if cv_ced /= Void then
2870     cv_ced.find_selection
2871     end
2872     end
2873    
2874 xavier 28303 cut_selection is
2875     -- Cut the selection in the current editor.
2876     do
2877     current_editor.cut_selection
2878     end
2879    
2880     copy_selection is
2881     -- Cut the selection in the current editor.
2882     do
2883     current_editor.copy_selection
2884     end
2885    
2886 xavier 27860 toggle_formatting_marks is
2887     -- Show/Hide formatting marks in the editor and update related menu item.
2888     do
2889     current_editor.toggle_view_invisible_symbols
2890     if current_editor.view_invisible_symbols then
2891     formatting_marks_command_menu_item.set_text (Interface_names.m_Hide_formatting_marks)
2892     else
2893     formatting_marks_command_menu_item.set_text(Interface_names.m_Show_formatting_marks)
2894     end
2895     end
2896    
2897 manus 26913 feature {NONE} -- Implementation / Menus
2898    
2899 xavier 30005 number_of_displayed_external_commands: INTEGER
2900     -- Number of external commands in the tools menu.
2901    
2902 manus 26913 old_cur: EV_CURSOR
2903     -- Cursor saved while displaying the hourglass cursor.
2904    
2905     cur_wid: EV_WIDGET
2906     -- Widget on which the hourglass cursor was set.
2907    
2908     project_menu: EV_MENU
2909     -- Menu for entries relative to the Project.
2910    
2911     recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
2912     -- SubMenu for recent projects.
2913    
2914     during_synchronization: BOOLEAN
2915     -- Are we during a resynchronization?
2916    
2917     formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
2918     -- Menu item used to shw/hide formatting marks.
2919    
2920     undo_accelerator: EV_ACCELERATOR
2921     -- Accelerator for Ctrl+Z
2922    
2923     redo_accelerator: EV_ACCELERATOR
2924     -- Accelerator for Ctrl+Y
2925    
2926     feature {EB_TOOL} -- Implementation / Commands
2927    
2928     shell_cmd: EB_OPEN_SHELL_COMMAND
2929     -- Command to use an external editor.
2930    
2931     undo_cmd: EB_UNDO_COMMAND
2932     -- Command to undo in the editor.
2933    
2934     redo_cmd: EB_REDO_COMMAND
2935     -- Command to redo in the editor.
2936    
2937 xavier 28303 editor_cut_cmd: EB_ON_SELECTION_COMMAND
2938 manus 26913 -- Command to cut text in the editor.
2939    
2940 xavier 28303 editor_copy_cmd: EB_ON_SELECTION_COMMAND
2941 manus 26913 -- Command to copy text in the editor.
2942    
2943     editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
2944     -- Command to paste text in the editor.
2945    
2946     melt_cmd: EB_MELT_PROJECT_COMMAND
2947     -- Command to start compilation.
2948    
2949     freeze_cmd: EB_FREEZE_PROJECT_COMMAND
2950     -- Command to Freeze the project.
2951    
2952     finalize_cmd: EB_FINALIZE_PROJECT_COMMAND
2953     -- Command to Finalize the project.
2954    
2955     c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
2956     -- Command to compile the workbench C code.
2957    
2958     c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
2959     -- Command to compile the finalized C code.
2960    
2961     new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
2962     -- Command to create a new cluster.
2963    
2964     new_class_cmd: EB_NEW_CLASS_COMMAND
2965     -- Command to create a new class.
2966    
2967     new_feature_cmd: EB_NEW_FEATURE_COMMAND
2968     -- Command to execute the feature wizard.
2969    
2970     toggle_stone_cmd: EB_UNIFY_STONE_CMD
2971     -- Command to toggle between the stone management modes.
2972    
2973     delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
2974     -- Command to remove a class or a cluster from the system
2975     -- (permanent deletion).
2976    
2977     show_profiler: EB_SHOW_PROFILE_TOOL
2978     -- What allows us to display the profiler window.
2979    
2980     toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
2981     -- All commands that can be put in a toolbar.
2982    
2983 xavier 28303 command_controller: EB_EDITOR_COMMAND_CONTROLLER
2984     -- Object that takes care of updating the sensitivity of all editor commands.
2985 xavier 27840
2986 manus 26913 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
2987     -- Command to save a class with a different file name.
2988    
2989 xavier 30005 Edit_external_commands_cmd: EB_EXTERNAL_COMMANDS_EDITOR is
2990     -- Command that lets the user add new external commands to the tools menu.
2991     once
2992     create Result.make
2993     Result.enable_sensitive
2994     end
2995    
2996 manus 26913 system_info_cmd: EB_STANDARD_CMD is
2997     -- Command to display information about the system (root class,...)
2998     do
2999     Result := debugger_manager.system_info_cmd
3000     end
3001    
3002     display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
3003     -- Command to pop up a dialog giving help on compilation errors.
3004     do
3005     Result := debugger_manager.display_error_help_cmd
3006     end
3007    
3008     send_stone_to_context_cmd: EB_STANDARD_CMD
3009     -- Command to send the current stone to the context tool.
3010    
3011     print_cmd: EB_PRINT_COMMAND
3012     -- Command to print the content of editor with focus
3013    
3014 neilc 32880 eac_browser_cmd: EB_OPEN_EAC_BROWSER_CMD is
3015     -- Command to display the eac browser
3016     do
3017     Result := Debugger_manager.eac_browser_cmd
3018     end
3019 manus 26913
3020     show_favorites_menu_item: EV_MENU_ITEM
3021     -- Show/Hide favorites menu item.
3022    
3023     update_show_favorites_menu_item is
3024     -- Update `show_favorites_menu_item' menu label.
3025     do
3026     if favorites_tool.shown then
3027     show_favorites_menu_item.set_text (Interface_names.m_Hide_favorites)
3028     else
3029     show_favorites_menu_item.set_text (Interface_names.m_Show_favorites)
3030     end
3031     end
3032    
3033     execute_show_favorites is
3034     -- Show `favorites_tool' if it is closed, close
3035     -- it in the opposite case.
3036     do
3037     update_show_favorites_menu_item
3038     if favorites_tool.shown then
3039     favorites_tool.close
3040     else
3041     favorites_tool.show
3042     end
3043     end
3044    
3045     feature {NONE} -- external edition handling
3046    
3047     on_focus is
3048     -- check if the text has not been modified by an external editor
3049     local
3050     dialog: EV_INFORMATION_DIALOG
3051     button_labels: ARRAY [STRING]
3052     actions: ARRAY [PROCEDURE [ANY, TUPLE]]
3053     do
3054     debug ("DEBUGGER_INTERFACE")
3055     io.putstring ("Took focus!%N")
3056     end
3057     if not editor_tool.edited_file_is_up_to_date then
3058     if not editor_tool.file_date_already_checked then
3059     if not editor_tool.changed and Editor_preferences.automatic_update
3060     then
3061     editor_tool.reload
3062     else
3063     create dialog.make_with_text (warning_messages.w_file_modified_by_another_editor)
3064     create button_labels.make (1, 2)
3065     create actions.make (1, 2)
3066     button_labels.put (interface_names.b_Reload, 1)
3067     actions.put (editor_tool~reload, 1)
3068     button_labels.put (interface_names.b_Continue_anyway, 2)
3069     actions.put (editor_tool~set_changed (True), 2)
3070     dialog.set_buttons_and_actions (button_labels,actions)
3071     dialog.set_default_push_button (dialog.button (button_labels @ 1))
3072     dialog.set_default_cancel_button (dialog.button (button_labels @ 2))
3073     dialog.set_title (interface_names.t_External_edition)
3074     dialog.show_modal_to_window (window)
3075     end
3076     end
3077     end
3078     end
3079    
3080     feature {NONE} -- Execution
3081    
3082     Kcst: EV_KEY_CONSTANTS is
3083     -- A way to access key constants.
3084     once
3085     create Result
3086     end
3087    
3088     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
3089     -- Action called when the user right-click in the toolbar.
3090     -- Display a popup menu to show/hide toolbars and customize the general toolbar.
3091     local
3092     popup_menu: EV_MENU
3093     do
3094     if a_button = 3 then
3095     popup_menu := build_toolbar_menu
3096     popup_menu.show
3097     end
3098     end
3099    
3100     enable_commands_on_project_created is
3101     -- Enable commands when a new project has been created (not yet compiled)
3102     do
3103     system_info_cmd.enable_sensitive
3104     if
3105     stone /= Void and then
3106     not unified_stone
3107     then
3108     send_stone_to_context_cmd.enable_sensitive
3109     end
3110     end
3111    
3112     enable_commands_on_project_loaded is
3113     -- Enable commands when a new project has been created and compiled
3114     do
3115 xavier 27549 if has_profiler then
3116     show_profiler.enable_sensitive
3117     end
3118     if has_dll_generation then
3119     show_dynamic_lib_tool.enable_sensitive
3120     end
3121 manus 26913 open_cmd.enable_sensitive
3122     new_class_cmd.enable_sensitive
3123     new_cluster_cmd.enable_sensitive
3124     system_info_cmd.enable_sensitive
3125     if unified_stone then
3126     send_stone_to_context_cmd.disable_sensitive
3127     elseif stone /= Void then
3128     send_stone_to_context_cmd.enable_sensitive
3129     end
3130     new_class_cmd.enable_sensitive
3131     new_cluster_cmd.enable_sensitive
3132     delete_class_cluster_cmd.enable_sensitive
3133     c_workbench_compilation_cmd.enable_sensitive
3134     c_finalized_compilation_cmd.enable_sensitive
3135     end
3136    
3137     disable_commands_on_project_unloaded is
3138     -- Enable commands when a project has been closed.
3139     do
3140 xavier 27549 if has_dll_generation then
3141     show_dynamic_lib_tool.disable_sensitive
3142     end
3143     if has_profiler then
3144     show_profiler.disable_sensitive
3145     end
3146 manus 26913 open_cmd.disable_sensitive
3147     new_class_cmd.disable_sensitive
3148     new_cluster_cmd.disable_sensitive
3149     if not project_manager.is_created then
3150     system_info_cmd.disable_sensitive
3151     send_stone_to_context_cmd.disable_sensitive
3152     end
3153     delete_class_cluster_cmd.disable_sensitive
3154     c_workbench_compilation_cmd.disable_sensitive
3155     c_finalized_compilation_cmd.disable_sensitive
3156     end
3157    
3158     end -- class EB_DEVELOPMENT_WINDOW
3159    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23