/[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 44790 - (hide annotations)
Tue Aug 17 04:12:45 2004 UTC (15 years, 6 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 98941 byte(s)
Removed redundant call to `toolbar_right_click_action' (on GTK it seems to
 be triggered, so possibly a windows bug of vision2).

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23