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