/[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 41150 - (hide annotations)
Thu Jan 29 14:44:08 2004 UTC (16 years, 1 month ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 98173 byte(s)
Fixed a bug where if the first time you drop a C external feature stone
then we would not target editor to the external declaration, this was
because `is_external' englobed both C externals (which can be seen) and
.NET externals which do not have an associated text (text is manually
built from the XML documentation)

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23