/[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 47824 - (hide annotations)
Tue Jan 25 01:24:48 2005 UTC (15 years, 1 month ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 99805 byte(s)
We now display content of `indexing.txt' file of a cluster if present.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23