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