/[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 43076 - (hide annotations)
Tue May 18 03:42:22 2004 UTC (15 years, 9 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 98718 byte(s)
Used two words names instead of just one for `put_xx', `read_xx' and `last_xxx' routines.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23