/[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 27840 - (hide annotations)
Thu Sep 20 23:34:05 2001 UTC (18 years, 5 months ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 83259 byte(s)
1) Prevented the drop of ace syntax stones into the editor,
2) In the process of changing the design of editor commands, to fix several bugs at a time,
3) Fixed several editor commands, which were sensitive even when the editor was empty.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23