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