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