/[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 61261 - (hide annotations)
Wed Jul 12 23:53:47 2006 UTC (13 years, 7 months ago) by manus
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 140301 byte(s)
Fixed crash reported in bug#10538.

1 manus 26913 indexing
2     description : "Window holding a project tool"
3 manus 56535 legal: "See notice at end of class."
4     status: "See notice at end of class."
5 manus 26913 date : "$Date$"
6     revision : "$Revision$"
7 jfiat 54401 author : "$Author$"
8 manus 26913
9     class
10     EB_DEVELOPMENT_WINDOW
11    
12     inherit
13     EB_TOOL_MANAGER
14     redefine
15     make,
16     init_size_and_position,
17 rogers 40708 window_displayed,
18 manus 26913 init_commands,
19     build_menu_bar,
20     build_menus,
21     build_file_menu,
22     build_edit_menu,
23     build_view_menu,
24     build_tools_menu,
25     build_favorites_menu,
26     refresh,
27 xavier 27860 recycle,
28 manus 26913 destroy_imp,
29 tedf 55179 destroy,
30     position,
31     pos_container
32 manus 26913 end
33    
34     EB_FILEABLE
35 tedf 55179 export {NONE}
36     set_position,
37     set_pos_container
38 manus 26913 redefine
39     set_stone,
40     reset,
41     stone,
42     on_text_saved,
43     perform_check_before_save,
44     check_passed,
45 tedf 55179 update_save_symbol,
46     position,
47     pos_container
48 manus 26913 select
49     set_stone
50     end
51    
52     EB_FILEABLE
53     rename
54     set_stone as old_set_stone
55     export {NONE}
56 tedf 55179 old_set_stone,
57     set_position,
58     set_pos_container
59 manus 26913 redefine
60     reset,
61     stone,
62     on_text_saved,
63     perform_check_before_save,
64     check_passed,
65 tedf 55179 update_save_symbol,
66     position,
67     pos_container
68 manus 26913 end
69    
70    
71     -- Shared tools & contexts
72    
73     SHARED_EIFFEL_PROJECT
74    
75     PROJECT_CONTEXT
76    
77     EB_SHARED_MANAGERS
78    
79     EB_SHARED_GRAPHICAL_COMMANDS
80    
81 neilc 49534 EB_SHARED_PREFERENCES
82 xavier 30020 export
83     {NONE} all
84     end
85 manus 26913
86     EV_STOCK_PIXMAPS
87    
88     EB_CONFIRM_SAVE_CALLBACK
89    
90     -- Errors
91     EB_GRAPHICAL_ERROR_MANAGER
92    
93     TEXT_OBSERVER
94     redefine
95 manus 51111 on_text_reset, on_text_edited,
96 xavier 27840 on_text_back_to_its_last_saved_state,
97 xavier 29812 on_text_fully_loaded, on_cursor_moved
98 manus 26913 end
99 manus 51111
100 manus 26913 EV_KEY_CONSTANTS
101     export
102     {NONE} All
103     end
104 manus 51111
105 neilc 49534 EIFFEL_ENV
106     export
107     {NONE} All
108     end
109 manus 51111
110 manus 47824 SHARED_TEXT_ITEMS
111     export
112     {NONE} All
113     end
114 manus 26913
115 manus 61261 REFACTORING_HELPER
116     export
117     {NONE} all
118     end
119    
120 julieng 37686 create {EB_WINDOW_MANAGER}
121 manus 26913 make,
122 king 55319 make_with_session_data,
123 manus 26913 make_as_context_tool,
124     make_as_editor
125    
126     feature {NONE} -- Initialization
127    
128     make_as_context_tool is
129     -- Create a new development window and expand the context tool.
130     do
131     make
132 rogers 40708 -- Perform window setting from `show_actions', as the
133     -- resizing executed as a result only works correctly
134     -- while the window is displayed.
135     window.show_actions.extend (agent set_context_mode)
136     end
137 manus 51111
138 rogers 40708 set_context_mode is
139     -- Set `current' into context mode, that is the context tool
140     -- maximized, and the non editor panel is hidden.
141     do
142 manus 26913 if not context_tool.shown then
143     context_tool.show
144     end
145     if not unified_stone then
146     toggle_stone_cmd.execute
147     end
148     context_tool.explorer_bar_item.maximize
149 rogers 40708 close_all_bars_except (right_panel)
150 manus 26913 end
151    
152     make_as_editor is
153     -- Create a new development window and expand the editor tool.
154     do
155     make
156 rogers 40708 -- Perform window setting from `show_actions', as the resizing executed
157     -- must be performed after `current' is displayed.
158     window.show_actions.extend (agent (editor_tool.explorer_bar_item).maximize)
159     window.show_actions.extend (agent close_all_bars_except (right_panel))
160 manus 26913 end
161    
162 king 55319 make_with_session_data (a_session_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA) is
163     -- Recreate a previously existing development window using `a_session_data'.
164     local
165     l_class_i: CLASS_I
166     l_class_c_stone: CLASSC_STONE
167     l_cluster_string, l_class_string, l_feature_string: STRING
168     do
169     internal_development_window_data := a_session_data
170 manus 55527 make
171 king 55319 -- Attempt to reload last edited class of `Current'.
172     if a_session_data.file_name /= Void then
173 patrickr 57792 conf_todo
174     -- l_class_i := eiffel_universe.class_with_file_name (a_session_data.file_name)
175 king 55319 if l_class_i /= Void and then l_class_i.compiled then
176     -- Create compiled class stone and target `Current' to it.
177     create l_class_c_stone.make (l_class_i.compiled_class)
178     set_stone_after_check (l_class_c_stone)
179     if a_session_data.editor_position > 0 then
180     editor_tool.text_area.display_line_when_ready (a_session_data.editor_position, False)
181     end
182     end
183     end
184     if context_tool /= Void then
185     -- Presumption is made that if the strings are not void then they represent
186     -- valid entities in the project.
187     l_cluster_string := a_session_data.context_cluster_string
188     l_class_string := a_session_data.context_class_string
189     l_feature_string := a_session_data.context_feature_string
190     if l_feature_string /= Void then
191     context_tool.address_manager.feature_address.set_text (l_feature_string)
192     context_tool.address_manager.class_address.set_text (l_class_string)
193     context_tool.address_manager.execute_with_feature
194     elseif l_class_string /= Void then
195     context_tool.address_manager.class_address.set_text (l_class_string)
196     context_tool.address_manager.execute_with_class
197     elseif l_cluster_string /= Void then
198     context_tool.address_manager.cluster_address.set_text (l_cluster_string)
199     context_tool.address_manager.execute_with_cluster
200     end
201     -- Set the appropriate notebook tab
202 manus 56322 context_tool.notebook.select_item (context_tool.notebook.i_th (a_session_data.context_tab_index))
203 king 55319 end
204     end
205    
206 manus 26913 make is
207     -- Create a new development window.
208     do
209 neilc 50976 unified_stone := preferences.development_window_data.context_unified_stone
210 manus 26913 -- Build the history manager, the address manager, ...
211     create history_manager.make (Current)
212     create address_manager.make (Current, False)
213 tedf 60107 build_viewpoints
214 manus 26913 build_formatters
215     address_manager.set_formatters (managed_main_formatters)
216 tedf 60107 address_manager.set_viewpoints (view_points_widget)
217 manus 26913
218 tedf 60107
219 manus 26913 -- Init commands, build interface, build menus, ...
220     Precursor
221    
222     initialized := False -- Reset the flag since initialization is not yet complete.
223 xavier 28303 set_up_accelerators
224 manus 51111
225 neilc 51796 window.focus_in_actions.extend(agent on_focus)
226    
227 xavier 28514 -- Create the toolbars.
228     build_toolbars_area
229     container.put_front (toolbars_area)
230     container.disable_item_expand (toolbars_area)
231 manus 26913
232     -- Update widgets visibilities
233 rogers 40708 window.show_actions.extend (agent update)
234 xavier 29812 status_bar.remove_cursor_position
235 xavier 29871 address_manager.set_output_line (status_bar.label)
236 manus 26913
237     -- Finish initializing the main editor formatters
238     end_build_formatters
239 manus 51111
240 xavier 28280 address_manager.disable_formatters
241 xavier 28303 if Eiffel_project.manager.is_project_loaded then
242 xavier 28304 on_project_created
243 xavier 28303 on_project_loaded
244 xavier 28304 elseif Eiffel_project.manager.is_created then
245     on_project_unloaded
246     on_project_created
247 xavier 28303 else
248     on_project_unloaded
249     end
250 manus 51111
251 rogers 40708 window.move_actions.force_extend (agent window_moved)
252 manus 26913
253     initialized := True
254     is_destroying := False
255     end
256 manus 51111
257 manus 26913 init_size_and_position is
258     -- Initialize window size.
259     local
260 manus 52172 screen: EB_STUDIO_SCREEN
261     l_x, l_y: INTEGER
262 manus 26913 do
263     create screen
264 manus 51180 window.set_size (
265 king 55319 development_window_data.width.min (screen.width),
266     development_window_data.height.min (screen.height))
267     l_x := development_window_data.x_position
268 manus 52172 if l_x < screen.virtual_left or l_x > screen.virtual_right then
269     -- Somehow screens have changed, reset it to 0
270     l_x := 0
271     end
272 king 55319 l_y := development_window_data.y_position
273 manus 52172 if l_y < screen.virtual_top or l_y > screen.virtual_bottom then
274     -- Somehow screens have changed, reset it to 0
275     l_y := 0
276     end
277     window.set_position (l_x, l_y)
278 rogers 40708 end
279 manus 51111
280 rogers 40708 window_displayed is
281     -- `Current' has been displayed on screen.
282     do
283 king 55319 -- Minimize or Maximize window if needed.
284     if development_window_data.is_maximized then
285 manus 26913 window.maximize
286 king 55319 elseif development_window_data.is_minimized then
287     window.minimize
288 manus 26913 end
289     end
290    
291     init_commands is
292     -- Initialize commands.
293 xavier 27498 local
294     accel: EV_ACCELERATOR
295 manus 26913 do
296     Precursor
297     create toolbarable_commands.make (15)
298    
299     -- Open, save, ...
300     toolbarable_commands.extend (new_editor_cmd)
301    
302     toolbarable_commands.extend (new_context_tool_cmd)
303    
304     create open_cmd.make (Current)
305     toolbarable_commands.extend (open_cmd)
306    
307     create save_cmd.make (Current)
308     toolbarable_commands.extend (save_cmd)
309    
310     create save_as_cmd.make (Current)
311     if editor_tool = Void or else editor_tool.text_area.is_empty then
312     save_as_cmd.disable_sensitive
313     else
314     save_as_cmd.enable_sensitive
315     end
316    
317     create shell_cmd.make (Current)
318     toolbarable_commands.extend (shell_cmd)
319    
320     create print_cmd.make (Current)
321     if is_empty then
322     print_cmd.disable_sensitive
323     else
324     print_cmd.enable_sensitive
325     end
326     toolbarable_commands.extend (print_cmd)
327    
328     -- Compilation
329     create c_workbench_compilation_cmd.make_workbench (Current)
330     create c_finalized_compilation_cmd.make_finalized (Current)
331 xavier 27549 if has_dll_generation then
332     create show_dynamic_lib_tool.make
333 manus 51111 show_dynamic_lib_tool.set_menu_name (Interface_names.m_new_dynamic_lib)
334 manus 36309 show_dynamic_lib_tool.add_agent (agent show_dynamic_library_dialog)
335 xavier 27549 end
336     if has_profiler then
337     create show_profiler
338     end
339 manus 26913
340     -- Undo/redo, cut, copy, paste.
341     create undo_cmd.make (Current)
342     toolbarable_commands.extend (undo_cmd)
343    
344     create redo_cmd.make (Current)
345     toolbarable_commands.extend (redo_cmd)
346    
347     create editor_paste_cmd.make (Current)
348     toolbarable_commands.extend (editor_paste_cmd)
349    
350     create new_cluster_cmd.make (Current)
351     toolbarable_commands.extend (new_cluster_cmd)
352    
353 patrickr 60478 create new_library_cmd.make (Current)
354     toolbarable_commands.extend (new_library_cmd)
355    
356     create new_assembly_cmd.make (Current)
357     toolbarable_commands.extend (new_assembly_cmd)
358    
359 manus 26913 create new_class_cmd.make (Current)
360     toolbarable_commands.extend (new_class_cmd)
361    
362     create delete_class_cluster_cmd.make (Current)
363     toolbarable_commands.extend (delete_class_cluster_cmd)
364    
365     create new_feature_cmd.make (Current)
366     toolbarable_commands.extend (new_feature_cmd)
367 manus 51111
368 alexk 51136 create toggle_feature_alias_cmd.make (Current)
369     toolbarable_commands.extend (toggle_feature_alias_cmd)
370    
371 jfiat 42965 create toggle_feature_signature_cmd.make (Current)
372 jfiat 42973 toolbarable_commands.extend (toggle_feature_signature_cmd)
373 manus 26913
374 alexk 51887 create toggle_feature_assigner_cmd.make (Current)
375     toolbarable_commands.extend (toggle_feature_assigner_cmd)
376    
377 manus 26913 create toggle_stone_cmd.make (Current)
378     toolbarable_commands.extend (toggle_stone_cmd)
379    
380     create send_stone_to_context_cmd.make
381 paulb 59907 send_stone_to_context_cmd.set_pixmap (pixmaps.icon_pixmaps.context_sync_icon)
382 manus 51111 send_stone_to_context_cmd.set_tooltip (Interface_names.e_send_stone_to_context)
383     send_stone_to_context_cmd.set_menu_name (Interface_names.m_send_stone_to_context)
384 manus 26913 send_stone_to_context_cmd.set_name ("Send_to_context")
385 manus 51111 send_stone_to_context_cmd.set_tooltext (Interface_names.b_send_stone_to_context)
386 manus 36309 send_stone_to_context_cmd.add_agent (agent send_stone_to_context)
387 xavier 27498 create accel.make_with_key_combination (
388 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_down), False, True, False
389 xavier 27498 )
390 manus 36309 accel.actions.extend (agent send_stone_to_context)
391 xavier 27498 send_stone_to_context_cmd.set_accelerator (accel)
392 manus 26913 send_stone_to_context_cmd.disable_sensitive
393     toolbarable_commands.extend (send_stone_to_context_cmd)
394    
395     toolbarable_commands.extend (window_manager.minimize_all_cmd)
396     window_manager.minimize_all_cmd.enable_sensitive
397     toolbarable_commands.extend (window_manager.raise_all_cmd)
398     window_manager.raise_all_cmd.enable_sensitive
399    
400     toolbarable_commands.extend (New_development_window_cmd)
401     -- Show tool/toolbar commands (will be filled when tools will
402     -- be created)
403     create show_tool_commands.make (7)
404     create show_toolbar_commands.make (3)
405    
406 xavier 28303 new_feature_cmd.disable_sensitive
407 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
408 jfiat 42965 toggle_feature_signature_cmd.disable_sensitive
409 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
410 xavier 28303
411     create editors.make (5)
412     end
413    
414     set_up_accelerators is
415     -- Fill the accelerator of `window' with the accelerators of the `toolbarable_commands'.
416 jfiat 56447 local
417     cmds: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
418 jasonw 58955 i: INTEGER
419 xavier 28303 do
420 jfiat 54580 --| Accelerators related to toolbarable_commands
421 manus 26913 from
422 jfiat 56447 cmds := toolbarable_commands
423     cmds.start
424 manus 26913 until
425 jfiat 56447 cmds.after
426 manus 26913 loop
427 jfiat 56447 if cmds.item.accelerator /= Void then
428     window.accelerators.extend (cmds.item.accelerator)
429 manus 26913 end
430 jfiat 56447 cmds.forth
431 manus 26913 end
432    
433 jfiat 54580 --| Accelerators related to debugging toolbarable_commands
434 manus 26913 from
435 jfiat 56447 cmds := Eb_debugger_manager.toolbarable_commands
436     cmds.start
437 manus 26913 until
438 jfiat 56447 cmds.after
439 manus 26913 loop
440     if
441 jfiat 56447 cmds.item.accelerator /= Void
442 manus 26913 then
443 jfiat 56447 window.accelerators.extend (cmds.item.accelerator)
444 manus 26913 end
445 jfiat 56447 cmds.forth
446 manus 26913 end
447 jasonw 58955
448     --| Accelerators related to external commands
449     from
450     i := 0
451     until
452     i > 9
453     loop
454     window.accelerators.extend (edit_external_commands_cmd.accelerators.item (i))
455     i := i + 1
456     end
457 manus 26913 end
458    
459     build_formatters is
460     -- Build all formatters used.
461     local
462     form: EB_CLASS_TEXT_FORMATTER
463     accel: EV_ACCELERATOR
464     do
465 neilc 33294 create managed_class_formatters.make (17)
466 manus 26913 managed_class_formatters.extend (create {EB_CLICKABLE_FORMATTER}.make (Current))
467     managed_class_formatters.extend (create {EB_FLAT_FORMATTER}.make (Current))
468     managed_class_formatters.extend (create {EB_SHORT_FORMATTER}.make (Current))
469     managed_class_formatters.extend (create {EB_FLAT_SHORT_FORMATTER}.make (Current))
470     managed_class_formatters.extend (Void)
471     managed_class_formatters.extend (create {EB_ANCESTORS_FORMATTER}.make (Current))
472     managed_class_formatters.extend (create {EB_DESCENDANTS_FORMATTER}.make (Current))
473     managed_class_formatters.extend (create {EB_CLIENTS_FORMATTER}.make (Current))
474     managed_class_formatters.extend (create {EB_SUPPLIERS_FORMATTER}.make (Current))
475     managed_class_formatters.extend (Void)
476     managed_class_formatters.extend (create {EB_ATTRIBUTES_FORMATTER}.make (Current))
477     managed_class_formatters.extend (create {EB_ROUTINES_FORMATTER}.make (Current))
478 manus 54560 managed_class_formatters.extend (create {EB_INVARIANTS_FORMATTER}.make (Current))
479 manus 54538 managed_class_formatters.extend (create {EB_CREATORS_FORMATTER}.make (Current))
480 manus 26913 managed_class_formatters.extend (create {EB_DEFERREDS_FORMATTER}.make (Current))
481     managed_class_formatters.extend (create {EB_ONCES_FORMATTER}.make (Current))
482     managed_class_formatters.extend (create {EB_EXTERNALS_FORMATTER}.make (Current))
483     managed_class_formatters.extend (create {EB_EXPORTED_FORMATTER}.make (Current))
484    
485 manus 48565 create managed_feature_formatters.make (12)
486 manus 26913 managed_feature_formatters.extend (create {EB_BASIC_FEATURE_FORMATTER}.make (Current))
487     managed_feature_formatters.extend (create {EB_ROUTINE_FLAT_FORMATTER}.make (Current))
488     managed_feature_formatters.extend (Void)
489 manus 48565 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current, 0))
490     managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
491 manus 49446 {DEPEND_UNIT}.is_in_assignment_flag))
492 manus 51111 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
493 manus 49446 {DEPEND_UNIT}.is_in_creation_flag))
494 manus 48565 managed_feature_formatters.extend (Void)
495 jasonw 59060
496     managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current, 0))
497     managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current,
498     {DEPEND_UNIT}.is_in_assignment_flag))
499     managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current,
500     {DEPEND_UNIT}.is_in_creation_flag))
501     managed_feature_formatters.extend (Void)
502    
503 manus 26913 managed_feature_formatters.extend (create {EB_IMPLEMENTERS_FORMATTER}.make (Current))
504     managed_feature_formatters.extend (create {EB_ROUTINE_ANCESTORS_FORMATTER}.make (Current))
505     managed_feature_formatters.extend (create {EB_ROUTINE_DESCENDANTS_FORMATTER}.make (Current))
506 manus 48565 managed_feature_formatters.extend (Void)
507 manus 26913 managed_feature_formatters.extend (create {EB_HOMONYMS_FORMATTER}.make (Current))
508    
509 manus 51111
510 neilc 33294 create managed_main_formatters.make (6)
511 manus 51111
512 manus 26913 create {EB_BASIC_TEXT_FORMATTER} form.make (Current)
513     create accel.make_with_key_combination (
514 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_t),
515 manus 26913 True, False, True)
516 manus 36309 accel.actions.extend (agent form.execute)
517 manus 26913 form.set_accelerator (accel)
518 tedf 60107 form.set_viewpoints (view_points_combo)
519     form.post_execution_action.extend (agent update_viewpoints)
520 manus 26913 managed_main_formatters.extend (form)
521    
522     create {EB_CLICKABLE_FORMATTER} form.make (Current)
523     create accel.make_with_key_combination (
524 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_c),
525 manus 26913 True, False, True)
526 manus 36309 accel.actions.extend (agent form.execute)
527 manus 26913 form.set_accelerator (accel)
528 tedf 60107 form.set_viewpoints (view_points_combo)
529     form.post_execution_action.extend (agent update_viewpoints)
530 manus 26913 managed_main_formatters.extend (form)
531    
532     create {EB_FLAT_FORMATTER} form.make (Current)
533     create accel.make_with_key_combination (
534 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_f),
535 manus 26913 True, False, True)
536 manus 36309 accel.actions.extend (agent form.execute)
537 manus 26913 form.set_accelerator (accel)
538 tedf 60107 form.set_viewpoints (view_points_combo)
539     form.post_execution_action.extend (agent update_viewpoints)
540 manus 26913 managed_main_formatters.extend (form)
541    
542     create {EB_SHORT_FORMATTER} form.make (Current)
543     create accel.make_with_key_combination (
544 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_o),
545 manus 26913 True, False, True)
546 manus 36309 accel.actions.extend (agent form.execute)
547 manus 26913 form.set_accelerator (accel)
548 tedf 60107 form.set_viewpoints (view_points_combo)
549     form.post_execution_action.extend (agent update_viewpoints)
550 manus 26913 managed_main_formatters.extend (form)
551    
552     create {EB_FLAT_SHORT_FORMATTER} form.make (Current)
553     create accel.make_with_key_combination (
554 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_i),
555 manus 26913 True, False, True)
556 manus 36309 accel.actions.extend (agent form.execute)
557 manus 26913 form.set_accelerator (accel)
558 tedf 60107 form.set_viewpoints (view_points_combo)
559     form.post_execution_action.extend (agent update_viewpoints)
560 manus 51111 managed_main_formatters.extend (form)
561 manus 26913 end
562    
563     end_build_formatters is
564 manus 33315 -- Finish initialization of formatters (associate them with editor
565     -- and select a formatter).
566 manus 26913 local
567     f_ind: INTEGER
568     do
569     from
570     managed_class_formatters.start
571     until
572     managed_class_formatters.after
573     loop
574     if managed_class_formatters.item /= Void then
575     managed_class_formatters.item.set_manager (context_tool)
576     end
577     managed_class_formatters.forth
578     end
579     from
580     managed_feature_formatters.start
581     until
582     managed_feature_formatters.after
583     loop
584     if managed_feature_formatters.item /= Void then
585     managed_feature_formatters.item.set_manager (context_tool)
586     end
587     managed_feature_formatters.forth
588     end
589     from
590     managed_main_formatters.start
591     until
592     managed_main_formatters.after
593     loop
594     managed_main_formatters.item.set_editor (editor_tool.text_area)
595     managed_main_formatters.item.on_shown
596     if managed_main_formatters.item.accelerator /= Void then
597     window.accelerators.extend (managed_main_formatters.item.accelerator)
598     end
599     managed_main_formatters.forth
600     end
601    
602     (managed_main_formatters @ 1).enable_select;
603 manus 51111
604 manus 26913 -- We now select the correct class formatter.
605 neilc 53432 f_ind := preferences.context_tool_data.default_class_formatter_index
606 manus 26913 --| This takes the formatter separators in consideration.
607 neilc 33365 if f_ind > 4 then
608 manus 26913 f_ind := f_ind + 1
609     end
610 neilc 33365 if f_ind > 8 then
611 manus 26913 f_ind := f_ind + 1
612     end
613     if f_ind < 1 or f_ind > managed_class_formatters.count then
614 neilc 33365 f_ind := 6
615 manus 26913 end
616 manus 51111 (managed_class_formatters @ f_ind).enable_select;
617 manus 26913 -- We now select the correct feature formatter.
618 neilc 53432 f_ind := preferences.context_tool_data.default_feature_formatter_index
619 manus 26913 if f_ind > 2 then
620     f_ind := f_ind + 1
621     end
622     if f_ind < 1 or f_ind > managed_feature_formatters.count then
623     f_ind := 2
624     end
625 manus 33315 managed_class_formatters.i_th (f_ind).enable_select
626 manus 26913 end
627    
628     build_tools is
629     -- Build all tools that can take place in this window and put them
630     -- in `left_tools' or `bottom_tools'.
631     local
632     show_cmd: EB_SHOW_TOOL_COMMAND
633 tedf 56390 l_accel: EV_ACCELERATOR
634     l_shortcut_preference: SHORTCUT_PREFERENCE
635 manus 26913 do
636 rogers 43098 lock_update
637 manus 26913 -- Build the features tool
638 jfiat 48452 create features_tool.make (Current)
639     features_tool.attach_to_explorer_bar (left_panel)
640 manus 26913 left_tools.extend (features_tool.explorer_bar_item)
641     create show_cmd.make (Current, features_tool.explorer_bar_item)
642     show_tool_commands.extend (show_cmd)
643     toolbarable_commands.extend (show_cmd)
644     add_recyclable (features_tool)
645    
646 jfiat 54610 -- Build the breakpoints tool
647     create breakpoints_tool.make (Current)
648     breakpoints_tool.attach_to_explorer_bar (left_panel)
649     left_tools.extend (breakpoints_tool.explorer_bar_item)
650     create show_cmd.make (Current, breakpoints_tool.explorer_bar_item)
651     show_tool_commands.extend (show_cmd)
652     toolbarable_commands.extend (show_cmd)
653     add_recyclable (breakpoints_tool)
654    
655 manus 26913 -- Build the cluster tool
656 jfiat 48452 create cluster_tool.make (Current, Current)
657     cluster_tool.attach_to_explorer_bar (left_panel)
658 manus 26913 left_tools.extend (cluster_tool.explorer_bar_item)
659     create show_cmd.make (Current, cluster_tool.explorer_bar_item)
660     show_tool_commands.extend (show_cmd)
661     toolbarable_commands.extend (show_cmd)
662     add_recyclable (cluster_tool)
663    
664     -- Build the favorites tool
665 jfiat 48452 create favorites_tool.make (Current, favorites_manager)
666     favorites_tool.attach_to_explorer_bar (left_panel)
667 manus 26913 left_tools.extend (favorites_tool.explorer_bar_item)
668     create show_cmd.make (Current, favorites_tool.explorer_bar_item)
669     show_tool_commands.extend (show_cmd)
670     toolbarable_commands.extend (show_cmd)
671     add_recyclable (favorites_tool)
672    
673 patrickr 61081 -- Build the properties tool
674     create properties_tool.make (Current)
675     properties_tool.attach_to_explorer_bar (left_panel)
676     left_tools.extend (properties_tool.explorer_bar_item)
677     create show_cmd.make (Current, properties_tool.explorer_bar_item)
678     show_tool_commands.extend (show_cmd)
679     toolbarable_commands.extend (show_cmd)
680     add_recyclable (properties_tool)
681    
682 manus 26913 -- Build the windows tool (formerly known as Selector tool)
683 jfiat 48452 create windows_tool.make (Current)
684     windows_tool.attach_to_explorer_bar (left_panel)
685 manus 26913 left_tools.extend (windows_tool.explorer_bar_item)
686     create show_cmd.make (Current, windows_tool.explorer_bar_item)
687     show_tool_commands.extend (show_cmd)
688     toolbarable_commands.extend (show_cmd)
689     add_recyclable (windows_tool)
690 manus 55527
691 tedf 55179 -- Build the search tool
692 tedf 56390 create search_tool.make (Current)
693 tedf 55179 search_tool.attach_to_explorer_bar (right_panel)
694     bottom_tools.extend (search_tool.explorer_bar_item)
695     create show_cmd.make (Current, search_tool.explorer_bar_item)
696 tedf 56390 l_shortcut_preference := preferences.editor_data.shortcuts.item ("show_search_panel")
697     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)
698     l_accel.actions.extend (agent search_tool.prepare_search)
699     show_cmd.set_accelerator (l_accel)
700 tedf 55179 show_tool_commands.extend (show_cmd)
701     toolbarable_commands.extend (show_cmd)
702     add_recyclable (search_tool)
703 manus 26913
704     -- Build the editor tool
705 jfiat 48452 create editor_tool.make (Current)
706     editor_tool.attach_to_explorer_bar (right_panel)
707 manus 26913 bottom_tools.extend (editor_tool.explorer_bar_item)
708     editor_tool.text_area.add_edition_observer(save_cmd)
709     editor_tool.text_area.add_edition_observer(save_as_cmd)
710     editor_tool.text_area.add_edition_observer(print_cmd)
711     editor_tool.text_area.add_edition_observer(Current)
712 tedf 55179 editor_tool.text_area.add_edition_observer(search_tool)
713 xavier 29812 editor_tool.text_area.add_cursor_observer (Current)
714 tedf 55179 create show_cmd.make(Current, editor_tool.explorer_bar_item)
715     show_tool_commands.extend (show_cmd)
716     toolbarable_commands.extend (show_cmd)
717 manus 51111
718 rogers 40708 -- The minimim height masks a bug on windows to do with the sizing of the editors
719     -- scroll bars, which were affecting the resizing although they should not have done so.
720     -- Having a default minimum height on the editor is perfectly reasonable.
721     editor_tool.widget.set_minimum_height (20)
722 manus 26913 add_recyclable (editor_tool)
723    
724     -- Build the context tool
725 jfiat 48452 create context_tool.make (Current)
726     context_tool.attach_to_explorer_bar (right_panel)
727 manus 26913 bottom_tools.extend (context_tool.explorer_bar_item)
728     create show_cmd.make (Current, context_tool.explorer_bar_item)
729     show_tool_commands.extend (show_cmd)
730     toolbarable_commands.extend (show_cmd)
731     add_recyclable (context_tool)
732    
733 patrickr 56781 -- Build the refactoring tools
734     toolbarable_commands.extend (refactoring_manager.pull_command)
735     toolbarable_commands.extend (refactoring_manager.rename_command)
736     toolbarable_commands.extend (refactoring_manager.undo_command)
737     toolbarable_commands.extend (refactoring_manager.redo_command)
738    
739 manus 26913 -- Set the flag "Tools initialized"
740     tools_initialized := True
741 manus 51111
742 manus 26913 -- Initialize undo / redo accelerators
743 manus 51111 create undo_accelerator.make_with_key_combination (
744     create {EV_KEY}.make_with_code (Key_z), True, False, False)
745 xavier 27549 if has_case then
746     undo_accelerator.actions.extend (agent (context_tool.editor.undo_cmd).on_ctrl_z)
747     end
748 manus 51111 create redo_accelerator.make_with_key_combination (
749     create {EV_KEY}.make_with_code (Key_y), True, False, False)
750 xavier 27549 if has_case then
751     redo_accelerator.actions.extend (agent (context_tool.editor.redo_cmd).on_ctrl_y)
752     end
753 manus 26913 window.accelerators.extend (undo_accelerator)
754     window.accelerators.extend (redo_accelerator)
755 rogers 43098 unlock_update
756 manus 26913 end
757    
758 tedf 60107 build_viewpoints is
759     -- Build viewpoint selection list
760     local
761     l_label: EV_LABEL
762     do
763     create view_points_widget
764     create l_label.make_with_text (interface_names.l_viewpoints)
765     view_points_widget.extend (l_label)
766     view_points_widget.disable_item_expand (l_label)
767    
768     create view_points_combo
769     view_points_combo.disable_sensitive
770     view_points_combo.select_actions.extend (agent on_viewpoint_changed)
771     view_points_combo.disable_edit
772     view_points_combo.set_minimum_width (120)
773    
774     view_points_widget.extend (view_points_combo)
775     view_points_widget.disable_item_expand (view_points_combo)
776     end
777    
778 manus 26913 feature -- Access
779    
780 manus 57886 group: CONF_GROUP is
781     -- Group of current class. Void if none.
782 manus 26913 local
783     classi_stone: CLASSI_STONE
784     cluster_stone: CLUSTER_STONE
785     do
786 manus 57886 classi_stone ?= stone
787     if classi_stone /= Void then
788     Result := classi_stone.group
789     end
790     cluster_stone ?= stone
791     if cluster_stone /= Void then
792     Result := cluster_stone.group
793     end
794 manus 26913 end
795    
796     class_name: STRING is
797     -- Name of the current class, Void if none.
798     local
799     class_stone: CLASSI_STONE
800     do
801     class_stone ?= stone
802     if class_stone /= Void then
803     Result := class_stone.class_name
804     end
805     end
806    
807     feature_name: STRING is
808     -- Name of the current feature, Void if none.
809     local
810     feature_stone: FEATURE_STONE
811     do
812     feature_stone ?= stone
813     if feature_stone /= Void then
814     Result := feature_stone.feature_name
815     end
816     end
817 manus 51111
818 xavier 30005 feature -- Status setting
819    
820     disable_sensitive is
821     -- Disable sensitivity of all widgets.
822     do
823     window.disable_sensitive
824     end
825    
826     enable_sensitive is
827     -- Enable sensitivity of all widgets.
828     do
829     window.enable_sensitive
830     end
831    
832 manus 26913 feature -- Window Settings
833    
834     set_initialized is
835     -- Set `initialized' to True.
836     do
837     initialized := True
838     end
839    
840     set_text (a_text: STRING) is
841     -- Assign `a_text' to `text'.
842     require
843     a_text_not_void: a_text /= Void
844     do
845 neilc 49534 editor_tool.text_area.set_editor_text (a_text)
846 manus 26913 ensure
847     --| FIXME This needs to work: text_assigned: text.is_equal (a_text)
848     --| FIXME changed_flag_set: changed
849     end
850    
851     feature -- Window Properties
852    
853     changed: BOOLEAN is
854     -- Has something been changed and not yet been saved?
855     do
856     Result := editor_tool.changed
857     end
858    
859     is_empty: BOOLEAN is
860     -- Does `Current's text is empty?
861     do
862     Result := editor_tool = Void or else editor_tool.text_area.is_empty
863     end
864    
865     text: STRING is
866     -- Text representing Current
867     do
868     Result := editor_tool.text_area.text
869     end
870    
871     pixmap: EV_PIXMAP is
872     -- Pixmap representing Current window.
873     do
874 paulb 60407 Result := pixmaps.icon_pixmaps.general_dialog_icon
875 manus 26913 end
876    
877     feature -- Pulldown Menus
878    
879     metric_menu: EV_MENU
880     -- Menu for entries of metric tool.
881 manus 51111
882 manus 26913 format_menu: EV_MENU
883     -- ID Menu for formats.
884     -- Only used during debugging
885    
886     compile_menu: EV_MENU
887     -- Compile ID menu.
888    
889     debug_menu: EV_MENU
890     -- Debug ID menu.
891 manus 55527
892 jfiat 54577 debugging_tools_menu: EV_MENU
893     -- Debugging tools menu item
894 manus 26913
895     active_menus (erase: BOOLEAN) is
896     -- Enable all the menus and if `erase' clean
897     -- the content of the Project tool.
898     do
899     compile_menu.enable_sensitive
900     if erase then
901     output_manager.clear
902     end
903     end
904    
905     disable_menus is
906     -- Disable all the menus.
907     do
908     compile_menu.disable_sensitive
909     end
910 manus 55527
911 jfiat 54577 update_debug_menu is
912     -- Update debug menu
913     do
914 jfiat 56447 Eb_debugger_manager.update_debugging_tools_menu_from (Current)
915 jfiat 54577 end
916 manus 26913
917     feature -- Modifiable menus
918    
919     melt_menu_item: EV_MENU_ITEM
920     -- Melt menu entry
921    
922     freeze_menu_item: EV_MENU_ITEM
923     -- Freeze menu entry
924    
925     finalize_menu_item: EV_MENU_ITEM
926     -- Finalize menu entry
927    
928     feature -- Update
929    
930     synchronize is
931     -- Synchronize stones.
932     local
933     st: STONE
934 patrickr 56804 l_text_area: EB_SMART_EDITOR
935 manus 26913 do
936     during_synchronization := True
937     favorites_manager.refresh
938     context_tool.synchronize
939     cluster_tool.synchronize
940     history_manager.synchronize
941     features_tool.synchronize
942 jfiat 54610 breakpoints_tool.synchronize
943 alexk 53977 -- Update main views
944     managed_main_formatters.i_th (2).invalidate
945     managed_main_formatters.i_th (3).invalidate
946     managed_main_formatters.i_th (4).invalidate
947     managed_main_formatters.i_th (5).invalidate
948 manus 26913 if stone /= Void then
949     st := stone.synchronized_stone
950     end
951 patrickr 56804 l_text_area := editor_tool.text_area
952     l_text_area.update_click_list (False)
953     if l_text_area.file_loaded then
954     editor_tool.text_area.check_document_modifications_and_reload
955     end
956 manus 26913 set_stone (st)
957     update_save_symbol
958     address_manager.refresh
959     during_synchronization := False
960 tedf 58075 search_tool.rebuild_scope_list
961 manus 26913 end
962 manus 55527
963 manus 26913 synchronize_routine_tool_to_default is
964     -- Synchronize the editor tool to the debug format.
965     do
966     --| FIXME ARNAUD: To be implemented
967     end
968    
969     clear_object_tool is
970     -- Clear the contents of the object tool if shown.
971     do
972     --| FIXME ARNAUD: To be implemented
973     end
974    
975     build_menus is
976     -- Build all menus displayed in the development window.
977     do
978     -- Build each menu
979     build_file_menu
980     build_edit_menu
981     build_view_menu
982     build_favorites_menu
983     build_project_menu
984     build_debug_menu
985     build_tools_menu
986     build_window_menu
987 manus 55527 build_help_menu
988 manus 26913 -- Build the menu bar.
989     build_menu_bar
990     end
991    
992     build_debug_menu is
993     -- Build the `Debug' menu through the debugger_manager.
994     local
995     conv_mit: EB_COMMAND_MENU_ITEM
996     do
997 jfiat 56447 debug_menu := Eb_debugger_manager.new_debug_menu
998 manus 26913 from
999     debug_menu.start
1000     until
1001     debug_menu.after
1002     loop
1003     conv_mit ?= debug_menu.item
1004     if conv_mit /= Void then
1005     add_recyclable (conv_mit)
1006     end
1007     debug_menu.forth
1008     end
1009 jfiat 54577 --| Debugging tools menu
1010 jfiat 56447 debugging_tools_menu := Eb_debugger_manager.new_debugging_tools_menu
1011 jfiat 54577 debug_menu.extend (create {EV_MENU_SEPARATOR})
1012     debug_menu.extend (debugging_tools_menu)
1013     update_debug_menu
1014 manus 26913 end
1015    
1016     build_menu_bar is
1017     -- Build the menu bar
1018     local
1019     mb: EV_MENU_BAR
1020     do
1021     check
1022     window.menu_bar /= Void implies not window.menu_bar.is_empty
1023     -- If a menu bar was already present, it shouldn't be empty.
1024     end
1025     if window.menu_bar /= Void then
1026     mb := window.menu_bar
1027     from
1028     mb.start
1029     mb.forth
1030     until
1031     mb.after
1032     loop
1033     mb.remove
1034     end
1035     else
1036     create mb
1037     window.set_menu_bar (mb)
1038     mb.extend (file_menu)
1039     end
1040    
1041     if Eiffel_project.manager.is_created then
1042     mb.extend (edit_menu)
1043     mb.extend (view_menu)
1044     mb.extend (favorites_menu)
1045     mb.extend (project_menu)
1046     mb.extend (debug_menu)
1047     else
1048     mb.extend (view_menu)
1049     end
1050     mb.extend (tools_menu)
1051     mb.extend (window_menu)
1052     mb.extend (help_menu)
1053 jfiat 59618
1054     estudio_debug_cmd.attach_window (window)
1055 manus 26913 end
1056    
1057     feature -- Graphical Interface
1058    
1059     build_general_toolbar is
1060     -- Set up the general toolbar (New, Save, Search, Shell, Undo, Redo, ...)
1061     local
1062     cell: EV_CELL
1063     hsep: EV_HORIZONTAL_SEPARATOR
1064     hbox: EV_HORIZONTAL_BOX
1065     do
1066     -- Create the toolbar.
1067     create general_toolbar
1068 king 55319 general_customizable_toolbar := development_window_data.retrieve_general_toolbar (toolbarable_commands)
1069     if development_window_data.show_text_in_general_toolbar then
1070 king 46348 general_customizable_toolbar.enable_important_text
1071 king 55319 elseif development_window_data.show_all_text_in_general_toolbar then
1072 manus 26913 general_customizable_toolbar.enable_text_displayed
1073     end
1074 manus 51111
1075 manus 26913 create hbox
1076     hbox.extend (general_customizable_toolbar.widget)
1077     hbox.disable_item_expand (general_customizable_toolbar.widget)
1078    
1079     -- Generate the toolbar.
1080     general_customizable_toolbar.update_toolbar
1081    
1082     -- Cell to fill in empty space and receive the right click menu holder.
1083     create cell
1084 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1085 manus 26913 hbox.extend (cell)
1086    
1087     -- Create the vertical layout (separator + toolbar)
1088     create hsep
1089     general_toolbar.set_padding (2)
1090     general_toolbar.extend (hsep)
1091     general_toolbar.disable_item_expand (hsep)
1092     general_toolbar.extend (hbox)
1093    
1094     -- Create the command to show/hide this toolbar.
1095 manus 51111 create show_general_toolbar_command.make (general_toolbar, Interface_names.m_general_toolbar)
1096 manus 26913 show_toolbar_commands.extend (show_general_toolbar_command)
1097 king 55319 if development_window_data.show_general_toolbar then
1098 manus 26913 show_general_toolbar_command.enable_visible
1099     else
1100     show_general_toolbar_command.disable_visible
1101     end
1102    
1103     end
1104    
1105     build_address_toolbar is
1106     -- Set up the address toolbar (Back, Forward, Current, Class name, feature name, ...)
1107     local
1108     tb: EV_TOOL_BAR
1109     -- address_bar: EV_HORIZONTAL_BOX -- Contains "Class" + Combobox + "Feature" + Combobox + "Format" + Combobox
1110     hsep: EV_HORIZONTAL_SEPARATOR
1111     hbox: EV_HORIZONTAL_BOX -- Contains HistoryToolbar (back, forth, current) + `address_bar'
1112     cell: EV_CELL
1113 xavier 27498 accel: EV_ACCELERATOR
1114 manus 26913 do
1115     -- Create the toolbar
1116     create address_toolbar
1117     create hsep
1118     create hbox
1119     -- create address_bar
1120     create tb
1121     address_toolbar.set_padding (2)
1122     address_toolbar.extend (hsep)
1123     address_toolbar.disable_item_expand (hsep)
1124     address_toolbar.extend (hbox)
1125    
1126     hbox.extend (tb)
1127     hbox.disable_item_expand (tb)
1128     -- hbox.extend (address_bar)
1129     -- hbox.disable_item_expand (address_bar)
1130    
1131     -- Back icon
1132 king 56761 tb.extend (history_manager.back_command.new_toolbar_item (False))
1133 manus 26913
1134     -- Forward icon
1135 king 56761 tb.extend (history_manager.forth_command.new_toolbar_item (False))
1136 manus 51111
1137 xavier 27498 -- Set up the accelerators.
1138     create accel.make_with_key_combination (
1139 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_right), False, True, False
1140 xavier 27498 )
1141 manus 36309 accel.actions.extend (agent on_forth)
1142 xavier 27498 window.accelerators.extend (accel)
1143 manus 51111
1144 xavier 27498 create accel.make_with_key_combination (
1145 king 56761 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_left), False, True, False
1146 xavier 27498 )
1147 manus 36309 accel.actions.extend (agent on_back)
1148 xavier 27498 window.accelerators.extend (accel)
1149 manus 26913
1150     ------------------------------------------
1151     -- Address bar (Class name & feature name)
1152     ------------------------------------------
1153     hbox.extend (address_manager.widget)
1154 neilc 49534 -- editor_tool.text_area.add_cursor_observer (address_manager)
1155 manus 26913
1156     -- Create the command to show/hide this toolbar.
1157 manus 51111 create show_address_toolbar_command.make (address_toolbar, Interface_names.m_address_toolbar)
1158 manus 26913 show_toolbar_commands.extend (show_address_toolbar_command)
1159    
1160 king 55319 if development_window_data.show_address_toolbar then
1161 manus 26913 show_address_toolbar_command.enable_visible
1162     else
1163     show_address_toolbar_command.disable_visible
1164     end
1165    
1166     -- Cell to fill in empty space and receive the right click menu holder.
1167     create cell
1168 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1169 manus 26913 hbox.extend (cell)
1170     end
1171    
1172     build_project_toolbar is
1173     -- Build toolbar corresponding to the project options bar
1174     local
1175     cell: EV_CELL
1176     hsep: EV_HORIZONTAL_SEPARATOR
1177     hbox: EV_HORIZONTAL_BOX
1178     do
1179     create project_toolbar
1180     create hsep
1181     project_toolbar.extend (hsep)
1182     project_toolbar.disable_item_expand (hsep)
1183    
1184     -- Generate the toolbar.
1185     create hbox
1186 jfiat 56447 project_customizable_toolbar := Eb_debugger_manager.new_toolbar
1187 manus 26913 hbox.extend (project_customizable_toolbar.widget)
1188     hbox.disable_item_expand (project_customizable_toolbar.widget)
1189    
1190     project_customizable_toolbar.update_toolbar
1191    
1192     -- Create the command to show/hide this toolbar.
1193 manus 51111 create show_project_toolbar_command.make (project_toolbar, Interface_names.m_project_toolbar)
1194 manus 26913 show_toolbar_commands.extend (show_project_toolbar_command)
1195 king 55319 if development_window_data.show_project_toolbar then
1196 manus 26913 show_project_toolbar_command.enable_visible
1197     else
1198     show_project_toolbar_command.disable_visible
1199     end
1200    
1201     -- Cell to fill in empty space and receive the right click menu holder.
1202     create cell
1203 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1204 manus 26913 hbox.extend (cell)
1205     project_toolbar.extend (hbox)
1206     end
1207    
1208 patrickr 56781 build_refactoring_toolbar is
1209     -- Build refactoring toolbar.
1210     local
1211     cell: EV_CELL
1212     hsep: EV_HORIZONTAL_SEPARATOR
1213     hbox: EV_HORIZONTAL_BOX
1214     do
1215     -- Create the toolbar.
1216     create refactoring_toolbar
1217     refactoring_customizable_toolbar := development_window_data.retrieve_refactoring_toolbar (toolbarable_commands)
1218     if development_window_data.show_text_in_refactoring_toolbar then
1219     refactoring_customizable_toolbar.enable_important_text
1220     elseif development_window_data.show_all_text_in_refactoring_toolbar then
1221     refactoring_customizable_toolbar.enable_text_displayed
1222     end
1223    
1224     create hbox
1225     hbox.extend (refactoring_customizable_toolbar.widget)
1226     hbox.disable_item_expand (refactoring_customizable_toolbar.widget)
1227    
1228     -- Generate the toolbar.
1229     refactoring_customizable_toolbar.update_toolbar
1230    
1231     -- Cell to fill in empty space and receive the right click menu holder.
1232     create cell
1233     cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1234     hbox.extend (cell)
1235    
1236     -- Create the vertical layout (separator + toolbar)
1237     create hsep
1238     refactoring_toolbar.set_padding (2)
1239     refactoring_toolbar.extend (hsep)
1240     refactoring_toolbar.disable_item_expand (hsep)
1241     refactoring_toolbar.extend (hbox)
1242    
1243     -- Create the command to show/hide this toolbar.
1244     create show_refactoring_toolbar_command.make (refactoring_toolbar, Interface_names.m_refactoring_toolbar)
1245     show_toolbar_commands.extend (show_refactoring_toolbar_command)
1246     if development_window_data.show_refactoring_toolbar then
1247     show_refactoring_toolbar_command.enable_visible
1248     else
1249     show_refactoring_toolbar_command.disable_visible
1250     end
1251     end
1252    
1253    
1254 manus 45562 feature {NONE} -- Menu Building
1255 manus 26913
1256     build_file_menu is
1257     -- Build the file menu.
1258     local
1259     new_project_cmd: EB_NEW_PROJECT_COMMAND
1260     open_project_cmd: EB_OPEN_PROJECT_COMMAND
1261     menu_item: EV_MENU_ITEM
1262     command_menu_item: EB_COMMAND_MENU_ITEM
1263     do
1264 manus 51111 create file_menu.make_with_text (Interface_names.m_file)
1265 manus 26913
1266     -- New
1267     command_menu_item := New_development_window_cmd.new_menu_item
1268     add_recyclable (command_menu_item)
1269     file_menu.extend (command_menu_item)
1270    
1271     -- New editor
1272     command_menu_item := New_editor_cmd.new_menu_item
1273     add_recyclable (command_menu_item)
1274     file_menu.extend (command_menu_item)
1275    
1276     -- New context tool
1277     command_menu_item := New_context_tool_cmd.new_menu_item
1278     add_recyclable (command_menu_item)
1279     file_menu.extend (command_menu_item)
1280    
1281     -- Open
1282     command_menu_item := open_cmd.new_menu_item
1283     add_recyclable (command_menu_item)
1284     file_menu.extend (command_menu_item)
1285    
1286     -- Close
1287 manus 51111 create menu_item.make_with_text (Interface_names.m_close)
1288 manus 36309 menu_item.select_actions.extend (agent destroy)
1289 manus 26913 file_menu.extend (menu_item)
1290    
1291     -- Separator --------------------------------------
1292     file_menu.extend (create {EV_MENU_SEPARATOR})
1293    
1294     -- Save
1295     command_menu_item := save_cmd.new_menu_item
1296     add_recyclable (command_menu_item)
1297     file_menu.extend (command_menu_item)
1298    
1299     -- Save as
1300     command_menu_item := save_as_cmd.new_menu_item
1301     add_recyclable (command_menu_item)
1302     file_menu.extend (command_menu_item)
1303    
1304 manus 61201 -- External editor
1305     command_menu_item := shell_cmd.new_menu_item
1306     add_recyclable (command_menu_item)
1307     file_menu.extend (command_menu_item)
1308 manus 26913
1309     -- Separator --------------------------------------
1310     file_menu.extend (create {EV_MENU_SEPARATOR})
1311     command_menu_item := print_cmd.new_menu_item
1312     add_recyclable (command_menu_item)
1313     file_menu.extend (command_menu_item)
1314    
1315     -- Separator --------------------------------------
1316     file_menu.extend (create {EV_MENU_SEPARATOR})
1317    
1318     -- New Project
1319     create new_project_cmd.make_with_parent (window)
1320 manus 51111 create menu_item.make_with_text (Interface_names.m_new_project)
1321 manus 36309 menu_item.select_actions.extend (agent new_project_cmd.execute)
1322 manus 26913 file_menu.extend (menu_item)
1323    
1324     -- Open Project
1325     create open_project_cmd.make_with_parent (window)
1326 manus 51111 create menu_item.make_with_text (Interface_names.m_open_project)
1327 manus 26913 menu_item.select_actions.extend (agent open_project_cmd.execute)
1328     file_menu.extend (menu_item)
1329    
1330     -- Recent Projects
1331     recent_projects_menu := recent_projects_manager.new_menu
1332     add_recyclable (recent_projects_menu)
1333     file_menu.extend (recent_projects_menu)
1334    
1335     -- Separator --------------------------------------
1336     file_menu.extend (create {EV_MENU_SEPARATOR})
1337    
1338     -- Exit
1339     command_menu_item := Exit_application_cmd.new_menu_item
1340     add_recyclable (Command_menu_item)
1341     file_menu.extend (command_menu_item)
1342     end
1343    
1344     build_class_info_menu: EV_MENU is
1345     -- Build the class format sub-menu.
1346     local
1347     form: EB_CLASS_INFO_FORMATTER
1348     empty_menu: EV_MENU_ITEM
1349     i: INTEGER
1350     do
1351 manus 51111 create Result.make_with_text (Interface_names.m_class_info)
1352 manus 26913 i := 1
1353    
1354 manus 51111 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1355 manus 26913 i := i + 1
1356     empty_menu.disable_sensitive
1357     Result.extend (empty_menu)
1358     from
1359     managed_class_formatters.start
1360     until
1361     managed_class_formatters.after
1362     loop
1363     form := managed_class_formatters.item
1364     if form /= Void then
1365     Result.extend (form.new_menu_item)
1366     else
1367 manus 51111 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1368 manus 26913 i := i + 1
1369     empty_menu.disable_sensitive
1370     Result.extend (empty_menu)
1371     end
1372     managed_class_formatters.forth
1373     end
1374     end
1375    
1376     build_feature_info_menu: EV_MENU is
1377     -- Build the feature format sub-menu.
1378     local
1379     form: EB_FEATURE_INFO_FORMATTER
1380     do
1381 manus 51111 create Result.make_with_text (Interface_names.m_feature_info)
1382 manus 26913 from
1383     managed_feature_formatters.start
1384     until
1385     managed_feature_formatters.after
1386     loop
1387     form := managed_feature_formatters.item
1388     if form /= Void then
1389     Result.extend (form.new_menu_item)
1390     end
1391     managed_feature_formatters.forth
1392     end
1393     end
1394    
1395     build_edit_menu is
1396     -- Create and build `edit_menu'
1397     local
1398     command_menu_item: EB_COMMAND_MENU_ITEM
1399     sub_menu: EV_MENU
1400     cmd: EB_EDITOR_COMMAND
1401     os_cmd: EB_ON_SELECTION_COMMAND
1402     editor: EB_SMART_EDITOR
1403 neilc 53728 ln_cmd: EB_TOGGLE_LINE_NUMBERS_COMMAND
1404 manus 26913 do
1405     editor := editor_tool.text_area
1406 xavier 28303 create command_controller.make
1407 manus 26913
1408 manus 51111 create edit_menu.make_with_text (Interface_names.m_edit)
1409 manus 26913
1410     -- Undo
1411     command_menu_item := undo_cmd.new_menu_item
1412     add_recyclable (command_menu_item)
1413     edit_menu.extend (command_menu_item)
1414    
1415     -- Redo
1416     command_menu_item := redo_cmd.new_menu_item
1417     add_recyclable (command_menu_item)
1418     edit_menu.extend (command_menu_item)
1419    
1420     -- Separator --------------------------------------
1421     edit_menu.extend (create {EV_MENU_SEPARATOR})
1422    
1423     -- Cut
1424 xavier 28303 create os_cmd.make (Current)
1425     os_cmd.set_menu_name (Interface_names.M_cut)
1426 paulb 60017 os_cmd.set_pixmap (pixmaps.icon_pixmaps.general_cut_icon)
1427 xavier 28303 os_cmd.set_name ("Editor_cut")
1428     os_cmd.set_tooltip (interface_names.f_cut)
1429 manus 36309 os_cmd.add_agent (agent cut_selection)
1430 manus 51111 os_cmd.set_tooltext (Interface_names.b_cut)
1431 xavier 28303 toolbarable_commands.extend (os_cmd)
1432     os_cmd.set_needs_editable (True)
1433     command_controller.add_selection_command (os_cmd)
1434     command_menu_item := os_cmd.new_menu_item
1435 manus 26913 add_recyclable (command_menu_item)
1436     edit_menu.extend (command_menu_item)
1437    
1438     -- Copy
1439 xavier 28303 create os_cmd.make (Current)
1440     os_cmd.set_menu_name (Interface_names.M_copy)
1441 paulb 59980 os_cmd.set_pixmap (pixmaps.icon_pixmaps.general_copy_icon)
1442 xavier 28303 os_cmd.set_name ("Editor_copy")
1443     os_cmd.set_tooltip (interface_names.f_copy)
1444 manus 51111 os_cmd.set_tooltext (Interface_names.b_copy)
1445 manus 36309 os_cmd.add_agent (agent copy_selection)
1446 xavier 28303 toolbarable_commands.extend (os_cmd)
1447     os_cmd.set_needs_editable (False)
1448     command_controller.add_selection_command (os_cmd)
1449     command_menu_item := os_cmd.new_menu_item
1450 manus 26913 add_recyclable (command_menu_item)
1451     edit_menu.extend (command_menu_item)
1452    
1453     -- Paste
1454     command_menu_item := editor_paste_cmd.new_menu_item
1455     add_recyclable (command_menu_item)
1456     edit_menu.extend (command_menu_item)
1457    
1458     -- Separator --------------------------------------
1459     edit_menu.extend (create {EV_MENU_SEPARATOR})
1460    
1461     -- Select all
1462     create cmd.make
1463     cmd.set_menu_name (Interface_names.m_select_all)
1464 manus 36309 cmd.add_agent (agent select_all)
1465 manus 26913 command_menu_item := cmd.new_menu_item
1466 xavier 28303 command_controller.add_edition_command (cmd)
1467 manus 26913 add_recyclable (command_menu_item)
1468     edit_menu.extend (command_menu_item)
1469    
1470     -- Separator --------------------------------------
1471     edit_menu.extend (create {EV_MENU_SEPARATOR})
1472    
1473 neilc 49534 -- Line numbers
1474 neilc 53728 create ln_cmd.make
1475     command_menu_item := ln_cmd.new_menu_item
1476 neilc 49534 add_recyclable (command_menu_item)
1477     edit_menu.extend (command_menu_item)
1478 neilc 53728 window.accelerators.extend (ln_cmd.accelerator)
1479 neilc 49534
1480 manus 55527
1481 neilc 49534 -- Separator --------------------------------------
1482     edit_menu.extend (create {EV_MENU_SEPARATOR})
1483    
1484 manus 26913 -- Search
1485     create cmd.make
1486 neilc 55887 cmd.set_menu_name (Interface_names.m_search + "%T" + preferences.editor_data.shortcuts.item ("show_search_panel").display_string)
1487 manus 36309 cmd.add_agent (agent search)
1488 manus 26913 command_menu_item := cmd.new_menu_item
1489 xavier 28303 command_controller.add_edition_command (cmd)
1490 manus 26913 add_recyclable (command_menu_item)
1491     edit_menu.extend (command_menu_item)
1492    
1493 neilc 49534 -- Go to
1494     create cmd.make
1495 manus 51111 cmd.set_menu_name (Interface_names.m_go_to)
1496 neilc 49534 cmd.add_agent (agent goto)
1497     cmd.set_needs_editable (True)
1498     command_menu_item := cmd.new_menu_item
1499     command_controller.add_edition_command (cmd)
1500     add_recyclable (command_menu_item)
1501     edit_menu.extend (command_menu_item)
1502    
1503 manus 26913 -- Replace
1504     create cmd.make
1505 neilc 55887 cmd.set_menu_name (Interface_names.m_replace + "%T" + preferences.editor_data.shortcuts.item ("show_search_and_replace_panel").display_string)
1506 manus 36309 cmd.add_agent (agent editor.replace)
1507 xavier 27860 cmd.set_needs_editable (True)
1508 manus 26913 command_menu_item := cmd.new_menu_item
1509 xavier 28303 command_controller.add_edition_command (cmd)
1510 manus 26913 add_recyclable (command_menu_item)
1511     edit_menu.extend (command_menu_item)
1512    
1513     -- Find sub menu
1514    
1515 manus 51111 create sub_menu.make_with_text (Interface_names.m_find)
1516 manus 26913
1517     -- Find next
1518     create cmd.make
1519 neilc 55887 cmd.set_menu_name (Interface_names.m_find_next + "%T" + preferences.editor_data.shortcuts.item ("search_last").display_string)
1520 manus 36309 cmd.add_agent (agent find_next)
1521 manus 26913 command_menu_item := cmd.new_menu_item
1522 xavier 28303 command_controller.add_edition_command (cmd)
1523 manus 26913 add_recyclable (command_menu_item)
1524     sub_menu.extend (command_menu_item)
1525    
1526     -- Find previous
1527     create cmd.make
1528 neilc 55887 cmd.set_menu_name (Interface_names.m_find_previous + "%T" + preferences.editor_data.shortcuts.item ("search_backward").display_string)
1529 manus 36309 cmd.add_agent (agent find_previous)
1530 manus 26913 command_menu_item := cmd.new_menu_item
1531 xavier 28303 command_controller.add_edition_command (cmd)
1532 manus 26913 add_recyclable (command_menu_item)
1533     sub_menu.extend (command_menu_item)
1534    
1535     -- Find selection
1536     create os_cmd.make (Current)
1537 neilc 55887 os_cmd.set_menu_name (Interface_names.m_find_selection + "%T" + preferences.editor_data.shortcuts.item ("search_selection").display_string)
1538 manus 36309 os_cmd.add_agent (agent find_selection)
1539 manus 26913 command_menu_item := os_cmd.new_menu_item
1540 xavier 28303 command_controller.add_selection_command (os_cmd)
1541 manus 26913 add_recyclable (command_menu_item)
1542     sub_menu.extend (command_menu_item)
1543    
1544     edit_menu.extend (sub_menu)
1545    
1546    
1547     -- Separator --------------------------------------
1548     edit_menu.extend (create {EV_MENU_SEPARATOR})
1549    
1550 manus 51111 create sub_menu.make_with_text (Interface_names.m_advanced)
1551 manus 26913
1552     create os_cmd.make (Current)
1553 xavier 27860 os_cmd.set_needs_editable (True)
1554 xavier 28303 command_controller.add_selection_command (os_cmd)
1555 manus 51111 os_cmd.set_menu_name (Interface_names.m_indent)
1556 manus 36309 os_cmd.add_agent (agent editor.indent_selection)
1557 manus 26913 command_menu_item := os_cmd.new_menu_item
1558     add_recyclable (command_menu_item)
1559     sub_menu.extend (command_menu_item)
1560    
1561     create os_cmd.make (Current)
1562 xavier 27860 os_cmd.set_needs_editable (True)
1563 xavier 28303 command_controller.add_selection_command (os_cmd)
1564 manus 51111 os_cmd.set_menu_name (Interface_names.m_unindent)
1565 manus 36309 os_cmd.add_agent (agent editor.unindent_selection)
1566 manus 26913 command_menu_item := os_cmd.new_menu_item
1567     add_recyclable (command_menu_item)
1568     sub_menu.extend (command_menu_item)
1569    
1570     create os_cmd.make (Current)
1571 xavier 27860 os_cmd.set_needs_editable (True)
1572 xavier 28303 command_controller.add_selection_command (os_cmd)
1573 manus 51111 os_cmd.set_menu_name (Interface_names.m_to_lower)
1574 manus 36309 os_cmd.add_agent (agent editor.set_selection_case (True))
1575 manus 26913 command_menu_item := os_cmd.new_menu_item
1576     add_recyclable (command_menu_item)
1577     sub_menu.extend (command_menu_item)
1578    
1579     create os_cmd.make (Current)
1580 xavier 27860 os_cmd.set_needs_editable (True)
1581 xavier 28303 command_controller.add_selection_command (os_cmd)
1582 manus 51111 os_cmd.set_menu_name (Interface_names.m_to_upper)
1583 manus 36309 os_cmd.add_agent (agent editor.set_selection_case (False))
1584 manus 26913 command_menu_item := os_cmd.new_menu_item
1585     add_recyclable (command_menu_item)
1586     sub_menu.extend (command_menu_item)
1587    
1588     create cmd.make
1589 xavier 27860 cmd.set_needs_editable (True)
1590 manus 51111 cmd.set_menu_name (Interface_names.m_comment)
1591 manus 36309 cmd.add_agent (agent editor.comment_selection)
1592 manus 26913 command_menu_item := cmd.new_menu_item
1593 xavier 28303 command_controller.add_edition_command (cmd)
1594 manus 26913 add_recyclable (command_menu_item)
1595     sub_menu.extend (command_menu_item)
1596    
1597     create cmd.make
1598 xavier 27860 cmd.set_needs_editable (True)
1599 manus 51111 cmd.set_menu_name (Interface_names.m_uncomment)
1600 manus 36309 cmd.add_agent (agent editor.uncomment_selection)
1601 manus 26913 command_menu_item := cmd.new_menu_item
1602 xavier 28303 command_controller.add_edition_command (cmd)
1603 manus 26913 add_recyclable (command_menu_item)
1604     sub_menu.extend (command_menu_item)
1605    
1606     -- Separator --------------------------------------
1607     sub_menu.extend (create {EV_MENU_SEPARATOR})
1608    
1609     -- Insert if block
1610     create cmd.make
1611 xavier 27860 cmd.set_needs_editable (True)
1612 manus 51111 cmd.set_menu_name (Interface_names.m_if_block)
1613 manus 36309 cmd.add_agent (agent editor.embed_in_block("if then", 3))
1614 manus 26913 command_menu_item := cmd.new_menu_item
1615 xavier 28303 command_controller.add_edition_command (cmd)
1616 manus 26913 add_recyclable (command_menu_item)
1617     sub_menu.extend (command_menu_item)
1618    
1619     -- Insert debug block
1620     create cmd.make
1621 xavier 27860 cmd.set_needs_editable (True)
1622 manus 26913 cmd.set_menu_name (Interface_names.m_debug_block)
1623 manus 36309 cmd.add_agent (agent editor.embed_in_block("debug", 5))
1624 manus 26913 command_menu_item := cmd.new_menu_item
1625 xavier 28303 command_controller.add_edition_command (cmd)
1626 manus 26913 add_recyclable (command_menu_item)
1627     sub_menu.extend (command_menu_item)
1628    
1629    
1630     -- Separator --------------------------------------
1631     sub_menu.extend (create {EV_MENU_SEPARATOR})
1632    
1633     -- Complete word
1634     create cmd.make
1635 xavier 27860 cmd.set_needs_editable (True)
1636 neilc 55887 cmd.set_menu_name (Interface_names.m_complete_word + "%T" + preferences.editor_data.shortcuts.item ("autocomplete").display_string)
1637 manus 26913 command_menu_item := cmd.new_menu_item
1638 xavier 28303 command_controller.add_edition_command (cmd)
1639 manus 36309 cmd.add_agent (agent editor.complete_feature_name)
1640 manus 26913
1641     add_recyclable (command_menu_item)
1642     sub_menu.extend (command_menu_item)
1643    
1644 etienne 27163 -- Complete class name
1645     create cmd.make
1646 xavier 27860 cmd.set_needs_editable (True)
1647 neilc 55887 cmd.set_menu_name (Interface_names.m_complete_class_name + "%T" + preferences.editor_data.shortcuts.item ("class_autocomplete").display_string)
1648 etienne 27163 command_menu_item := cmd.new_menu_item
1649 xavier 28303 command_controller.add_edition_command (cmd)
1650 manus 36309 cmd.add_agent (agent editor.complete_class_name)
1651 etienne 27163
1652     add_recyclable (command_menu_item)
1653     sub_menu.extend (command_menu_item)
1654    
1655 manus 26913 sub_menu.extend (create {EV_MENU_SEPARATOR})
1656    
1657     -- show/hide formatting marks.
1658     create cmd.make
1659     if editor_tool.text_area.view_invisible_symbols then
1660 manus 51111 cmd.set_menu_name (Interface_names.m_hide_formatting_marks)
1661 manus 26913 else
1662 manus 51111 cmd.set_menu_name (Interface_names.m_show_formatting_marks)
1663 manus 26913 end
1664     formatting_marks_command_menu_item := cmd.new_menu_item
1665 xavier 28303 command_controller.add_edition_command (cmd)
1666 manus 36309 cmd.add_agent (agent toggle_formatting_marks)
1667 manus 26913
1668     add_recyclable (formatting_marks_command_menu_item)
1669     sub_menu.extend (formatting_marks_command_menu_item)
1670    
1671     edit_menu.extend (sub_menu)
1672     end
1673    
1674     build_view_menu is
1675     -- Build the view menu.
1676     local
1677     form: EB_CLASS_INFO_FORMATTER
1678     new_menu_item: EB_COMMAND_MENU_ITEM
1679     new_basic_item: EV_MENU_ITEM
1680     do
1681     Precursor
1682    
1683     new_menu_item := toggle_stone_cmd.new_menu_item
1684     view_menu.extend (new_menu_item)
1685     add_recyclable (new_menu_item)
1686    
1687     new_menu_item := send_stone_to_context_cmd.new_menu_item
1688     view_menu.extend (new_menu_item)
1689     add_recyclable (new_menu_item)
1690     -- Go to menu
1691     new_basic_item := history_manager.new_menu
1692     view_menu.extend (new_basic_item)
1693    
1694     -- Separator --------------------------------------
1695     view_menu.extend (create {EV_MENU_SEPARATOR})
1696     view_menu.extend (build_class_info_menu)
1697     view_menu.extend (build_feature_info_menu)
1698    
1699     -- Separator --------------------------------------
1700     view_menu.extend (create {EV_MENU_SEPARATOR})
1701    
1702     from
1703     managed_main_formatters.start
1704     until
1705     managed_main_formatters.after
1706     loop
1707     form := managed_main_formatters.item
1708     new_basic_item := form.new_menu_item
1709 manus 36309 new_basic_item.select_actions.put_front (agent form.invalidate)
1710 manus 26913 view_menu.extend (new_basic_item)
1711     --add_recyclable (new_basic_item)
1712     managed_main_formatters.forth
1713     end
1714     end
1715 manus 51111
1716 manus 26913 build_favorites_menu is
1717     -- Build the favorites menu
1718     do
1719     Precursor {EB_TOOL_MANAGER}
1720 manus 51111
1721 manus 26913 create show_favorites_menu_item
1722     update_show_favorites_menu_item
1723 manus 36309 show_favorites_menu_item.select_actions.extend (agent execute_show_favorites)
1724 manus 51111
1725 manus 26913 favorites_menu.start
1726     favorites_menu.put_right (show_favorites_menu_item)
1727 manus 36309 favorites_menu.select_actions.extend (agent update_show_favorites_menu_item)
1728 manus 26913 end
1729 manus 51111
1730 jasonw 54933 -- Jason Wei modified the following on Aug 31 2005
1731 manus 26913 build_project_menu is
1732     -- Build the project menu.
1733     local
1734     command_menu_item: EB_COMMAND_MENU_ITEM
1735     do
1736 manus 51111 create project_menu.make_with_text (Interface_names.m_project)
1737 manus 26913
1738     -- Melt
1739     command_menu_item := Melt_project_cmd.new_menu_item
1740     add_recyclable (command_menu_item)
1741     project_menu.extend (command_menu_item)
1742    
1743 xavier 29812 -- Quick melt
1744     command_menu_item := Quick_melt_project_cmd.new_menu_item
1745     add_recyclable (command_menu_item)
1746     project_menu.extend (command_menu_item)
1747    
1748 manus 26913 -- Freeze
1749     command_menu_item := Freeze_project_cmd.new_menu_item
1750     add_recyclable (command_menu_item)
1751     project_menu.extend (command_menu_item)
1752    
1753     -- Finalize
1754     command_menu_item := Finalize_project_cmd.new_menu_item
1755     add_recyclable (command_menu_item)
1756     project_menu.extend (command_menu_item)
1757    
1758     -- Precompile
1759     command_menu_item := precompilation_cmd.new_menu_item
1760     add_recyclable (command_menu_item)
1761     project_menu.extend (command_menu_item)
1762 manus 55527
1763 king 55319 -- Cancel
1764     command_menu_item := project_cancel_cmd.new_menu_item
1765     add_recyclable (command_menu_item)
1766     project_menu.extend (command_menu_item)
1767 manus 26913
1768     -- Separator -------------------------------------------------
1769     project_menu.extend (create {EV_MENU_SEPARATOR})
1770    
1771     -- Compile Workbench C code
1772     command_menu_item := c_workbench_compilation_cmd.new_menu_item
1773     add_recyclable (command_menu_item)
1774     project_menu.extend (command_menu_item)
1775    
1776     -- Compile Finalized C code
1777     command_menu_item := c_finalized_compilation_cmd.new_menu_item
1778     add_recyclable (command_menu_item)
1779     project_menu.extend (command_menu_item)
1780    
1781 jasonw 54933 -- Jason Wei
1782     -- Terminate C compilation
1783     command_menu_item := Terminate_c_compilation_cmd.new_menu_item
1784     add_recyclable (command_menu_item)
1785     project_menu.extend (command_menu_item)
1786     -- Jason Wei
1787 manus 55527
1788 manus 26913 -- Execute Finalized code
1789     command_menu_item := run_finalized_cmd.new_menu_item
1790     add_recyclable (command_menu_item)
1791     project_menu.extend (command_menu_item)
1792    
1793     -- Separator -------------------------------------------------
1794     project_menu.extend (create {EV_MENU_SEPARATOR})
1795    
1796     -- System Tool window
1797     command_menu_item := system_cmd.new_menu_item
1798     add_recyclable (command_menu_item)
1799     project_menu.extend (command_menu_item)
1800    
1801     -- System information
1802     command_menu_item := system_info_cmd.new_menu_item
1803     add_recyclable (command_menu_item)
1804     project_menu.extend (command_menu_item)
1805    
1806     -- Error information
1807     command_menu_item := display_error_help_cmd.new_menu_item
1808     add_recyclable (command_menu_item)
1809     project_menu.extend (command_menu_item)
1810    
1811 xavier 27549 if has_documentation_generation or has_xmi_generation then
1812     -- Separator -------------------------------------------------
1813     project_menu.extend (create {EV_MENU_SEPARATOR})
1814     end
1815 manus 26913
1816 xavier 27549 if has_documentation_generation then
1817     -- Generate Documentation
1818     command_menu_item := document_cmd.new_menu_item
1819     add_recyclable (command_menu_item)
1820     project_menu.extend (command_menu_item)
1821     end
1822 manus 26913
1823 xavier 27549 if has_xmi_generation then
1824     -- Export XMI
1825     command_menu_item := export_cmd.new_menu_item
1826     add_recyclable (command_menu_item)
1827     project_menu.extend (command_menu_item)
1828     end
1829 manus 26913 end
1830    
1831 jasonw 54933 ------- This is the original version
1832     -- build_project_menu is
1833     -- -- Build the project menu.
1834     -- local
1835     -- command_menu_item: EB_COMMAND_MENU_ITEM
1836     -- do
1837     -- create project_menu.make_with_text (Interface_names.m_project)
1838     --
1839     -- -- Melt
1840     -- command_menu_item := Melt_project_cmd.new_menu_item
1841     -- add_recyclable (command_menu_item)
1842     -- project_menu.extend (command_menu_item)
1843     --
1844     -- -- Quick melt
1845     -- command_menu_item := Quick_melt_project_cmd.new_menu_item
1846     -- add_recyclable (command_menu_item)
1847     -- project_menu.extend (command_menu_item)
1848     --
1849     -- -- Freeze
1850     -- command_menu_item := Freeze_project_cmd.new_menu_item
1851     -- add_recyclable (command_menu_item)
1852     -- project_menu.extend (command_menu_item)
1853     --
1854     -- -- Finalize
1855     -- command_menu_item := Finalize_project_cmd.new_menu_item
1856     -- add_recyclable (command_menu_item)
1857     -- project_menu.extend (command_menu_item)
1858     --
1859     -- -- Precompile
1860     -- command_menu_item := precompilation_cmd.new_menu_item
1861     -- add_recyclable (command_menu_item)
1862     -- project_menu.extend (command_menu_item)
1863     --
1864     -- -- Separator -------------------------------------------------
1865     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1866     --
1867     -- -- Compile Workbench C code
1868     -- command_menu_item := c_workbench_compilation_cmd.new_menu_item
1869     -- add_recyclable (command_menu_item)
1870     -- project_menu.extend (command_menu_item)
1871     --
1872     -- -- Compile Finalized C code
1873     -- command_menu_item := c_finalized_compilation_cmd.new_menu_item
1874     -- add_recyclable (command_menu_item)
1875     -- project_menu.extend (command_menu_item)
1876     --
1877     -- -- Execute Finalized code
1878     -- command_menu_item := run_finalized_cmd.new_menu_item
1879     -- add_recyclable (command_menu_item)
1880     -- project_menu.extend (command_menu_item)
1881     --
1882     -- -- Separator -------------------------------------------------
1883     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1884     --
1885     -- -- System Tool window
1886     -- command_menu_item := system_cmd.new_menu_item
1887     -- add_recyclable (command_menu_item)
1888     -- project_menu.extend (command_menu_item)
1889     --
1890     -- -- System information
1891     -- command_menu_item := system_info_cmd.new_menu_item
1892     -- add_recyclable (command_menu_item)
1893     -- project_menu.extend (command_menu_item)
1894     --
1895     -- -- Error information
1896     -- command_menu_item := display_error_help_cmd.new_menu_item
1897     -- add_recyclable (command_menu_item)
1898     -- project_menu.extend (command_menu_item)
1899     --
1900     -- if has_documentation_generation or has_xmi_generation then
1901     -- -- Separator -------------------------------------------------
1902     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1903     -- end
1904     --
1905     -- if has_documentation_generation then
1906     -- -- Generate Documentation
1907     -- command_menu_item := document_cmd.new_menu_item
1908     -- add_recyclable (command_menu_item)
1909     -- project_menu.extend (command_menu_item)
1910     -- end
1911     --
1912     -- if has_xmi_generation then
1913     -- -- Export XMI
1914     -- command_menu_item := export_cmd.new_menu_item
1915     -- add_recyclable (command_menu_item)
1916     -- project_menu.extend (command_menu_item)
1917     -- end
1918     -- end
1919     -- Jason Wei modified the above on Aug 31 2005
1920    
1921 manus 26913 build_tools_menu is
1922     -- Create and build `tools_menu'
1923     local
1924     command_menu_item: EB_COMMAND_MENU_ITEM
1925     menu_item: EV_MENU_ITEM
1926     do
1927 manus 51111 create tools_menu.make_with_text (Interface_names.m_tools)
1928 manus 26913
1929 xavier 28240 -- New Cluster command.
1930     command_menu_item := new_cluster_cmd.new_menu_item
1931     add_recyclable (command_menu_item)
1932     tools_menu.extend (command_menu_item)
1933 manus 26913
1934 patrickr 60478 -- New Library command.
1935     command_menu_item := new_library_cmd.new_menu_item
1936     add_recyclable (command_menu_item)
1937     tools_menu.extend (command_menu_item)
1938    
1939     -- New Assembly command.
1940     command_menu_item := new_assembly_cmd.new_menu_item
1941     add_recyclable (command_menu_item)
1942     tools_menu.extend (command_menu_item)
1943    
1944 xavier 28240 -- New Class command.
1945     command_menu_item := new_class_cmd.new_menu_item
1946     add_recyclable (command_menu_item)
1947     tools_menu.extend (command_menu_item)
1948    
1949     -- New Feature command.
1950     command_menu_item := new_feature_cmd.new_menu_item
1951     add_recyclable (command_menu_item)
1952     tools_menu.extend (command_menu_item)
1953 manus 51111
1954 xavier 28240 -- Delete class/cluster command.
1955     command_menu_item := delete_class_cluster_cmd.new_menu_item
1956     add_recyclable (command_menu_item)
1957     tools_menu.extend (command_menu_item)
1958    
1959     -- Separator --------------------------------------
1960     tools_menu.extend (create {EV_MENU_SEPARATOR})
1961    
1962    
1963 xavier 27549 if has_metrics then
1964     -- Metric tool
1965 xavier 28693 create metric_menu.make_with_text (interface_names.metric_metrics)
1966 xavier 27549 create menu_item.make_with_text (interface_names.metric_calculate)
1967     metric_menu.extend (menu_item)
1968     create menu_item.make_with_text (interface_names.metric_add)
1969     metric_menu.extend (menu_item)
1970     create menu_item.make_with_text (interface_names.metric_delete)
1971     metric_menu.extend (menu_item)
1972     create menu_item.make_with_text (interface_names.metric_details)
1973     metric_menu.extend (menu_item)
1974     create menu_item.make_with_text (interface_names.metric_new_metrics)
1975     metric_menu.extend (menu_item)
1976     create menu_item.make_with_text (interface_names.metric_management)
1977     metric_menu.extend (menu_item)
1978     create menu_item.make_with_text (interface_names.metric_archive)
1979     metric_menu.extend (menu_item)
1980     metric_menu.disable_sensitive
1981     tools_menu.extend (metric_menu)
1982     end
1983 manus 51111
1984 xavier 27549 if has_profiler then
1985     -- Profiler Window
1986     command_menu_item := show_profiler.new_menu_item
1987     add_recyclable (command_menu_item)
1988     tools_menu.extend (command_menu_item)
1989     end
1990 manus 26913
1991     -- Precompile Wizard
1992     command_menu_item := wizard_precompile_cmd.new_menu_item
1993     add_recyclable (command_menu_item)
1994     tools_menu.extend (command_menu_item)
1995    
1996 xavier 27549 if has_dll_generation then
1997     -- Dynamic Library Window
1998     command_menu_item := show_dynamic_lib_tool.new_menu_item
1999     add_recyclable (command_menu_item)
2000     tools_menu.extend (command_menu_item)
2001     end
2002 manus 26913
2003     -- Separator -------------------------------------------------
2004     tools_menu.extend (create {EV_MENU_SEPARATOR})
2005    
2006     -- Preferences
2007     command_menu_item := Show_preferences_cmd.new_menu_item
2008     add_recyclable (command_menu_item)
2009     tools_menu.extend (command_menu_item)
2010 xavier 30005
2011     -- External commands editor
2012     command_menu_item := Edit_external_commands_cmd.new_menu_item
2013     add_recyclable (command_menu_item)
2014     tools_menu.extend (command_menu_item)
2015    
2016     rebuild_tools_menu
2017 manus 26913 end
2018 manus 55527
2019 manus 26913 feature -- Stone process
2020    
2021     stone: STONE
2022     -- Current stone
2023    
2024     toggle_unified_stone is
2025     -- Change the stone management mode.
2026     do
2027     unified_stone := not unified_stone
2028     if unified_stone then
2029     send_stone_to_context
2030     send_stone_to_context_cmd.disable_sensitive
2031     context_tool.link_to_development_window
2032     else
2033     if stone /= Void then
2034     send_stone_to_context_cmd.enable_sensitive
2035     end
2036     context_tool.cut_from_development_window
2037     end
2038     end
2039    
2040     set_stone (a_stone: STONE) is
2041 xavier 29993 -- Change the currently focused stone.
2042     local
2043 xavier 30037 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
2044 xavier 29993 cv_cst: CLASSI_STONE
2045 neilc 49534 ef_stone: EXTERNAL_FILE_STONE
2046 xavier 29993 l: LIST [EB_DEVELOPMENT_WINDOW]
2047 neilc 49534 l_filename: STRING
2048 xavier 29993 do
2049     cv_cst ?= a_stone
2050     if cv_cst /= Void then
2051 neilc 49534 l_filename := cv_cst.class_i.name
2052     else
2053     ef_stone ?= a_stone
2054     if ef_stone /= Void then
2055     l_filename := ef_stone.file_name.string
2056     end
2057     end
2058 manus 51111
2059 neilc 49534 if cv_cst /= Void or ef_stone /= Void then
2060     l := Window_manager.development_windows_with_class (l_filename)
2061     if l.is_empty or else l.has (Current) then
2062 xavier 29993 -- We're not editing the class in another window.
2063     set_stone_after_first_check (a_stone)
2064     else
2065 manus 51111 create cd.make_initialized (2,
2066     preferences.dialog_data.already_editing_class_string,
2067     warning_messages.w_class_already_edited,
2068     Interface_names.l_do_not_show_again,
2069     preferences.preferences)
2070 manus 36309 cd.set_ok_action (agent set_stone_after_first_check (a_stone))
2071 xavier 29993 cd.show_modal_to_window (window)
2072     end
2073 manus 50607 else
2074     set_stone_after_first_check (a_stone)
2075 xavier 29993 end
2076     end
2077    
2078 manus 50607 set_stone_after_first_check (a_stone: STONE) is
2079     -- Display text associated with `a_stone', if any and if possible
2080     local
2081     feature_stone: FEATURE_STONE
2082     old_class_stone: CLASSI_STONE
2083     test_stone: CLASSI_STONE
2084     same_class: BOOLEAN
2085     conv_ferrst: FEATURE_ERROR_STONE
2086     ef_stone: EXTERNAL_FILE_STONE
2087 tedf 55179 cluster_st: CLUSTER_STONE
2088     new_class_stone: CLASSI_STONE
2089     conv_errst: ERROR_STONE
2090     conv_brkstone: BREAKABLE_STONE
2091 manus 50607 do
2092     old_class_stone ?= stone
2093     feature_stone ?= a_stone
2094     ef_stone ?= a_stone
2095 tedf 55179 new_class_stone ?= a_stone
2096     cluster_st ?= a_stone
2097 manus 55527
2098 tedf 55179 -- Update the history.
2099     conv_brkstone ?= a_stone
2100     conv_errst ?= a_stone
2101 manus 55527 if
2102 tedf 55179 conv_brkstone = Void and
2103     conv_errst = 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 patrickr 61081 properties_tool: EB_PROPERTIES_TOOL
2694    
2695 manus 50607 cluster_tool: EB_CLUSTER_TOOL
2696 manus 26913
2697 tedf 56390 search_tool: EB_MULTI_SEARCH_TOOL
2698 manus 26913
2699 manus 50607 features_tool: EB_FEATURES_TOOL
2700 manus 26913
2701 manus 55527 breakpoints_tool: ES_BREAKPOINTS_TOOL
2702    
2703 manus 50607 windows_tool: EB_WINDOWS_TOOL
2704 manus 26913
2705 manus 50607 context_tool: EB_CONTEXT_TOOL
2706     -- Context explorer for current class and system.
2707 manus 26913
2708 manus 50607 address_manager: EB_ADDRESS_MANAGER
2709     -- Text field in the toolbar
2710     -- Allow user to enter the name
2711     -- of the class he wants to edit.
2712 manus 26913
2713 manus 50607 project_manager: EB_PROJECT_MANAGER is
2714     -- Project manager associated to the project the user is working on.
2715     do
2716     Result := Eiffel_project.manager
2717     end
2718 manus 26913
2719 manus 50607 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2720     -- All formatters that operate on a class.
2721 manus 26913
2722 manus 50607 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2723     -- All formatters that operate on a class.
2724 manus 26913
2725 manus 50607 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2726     -- All formatters that can be displayed in the main editor frame.
2727 manus 26913
2728 tedf 60107 view_points_combo: EB_VIEWPOINT_COMBO_BOX
2729     -- Combo box used to a select viewpoints
2730    
2731     view_points_widget: EV_HORIZONTAL_BOX
2732     -- Widget to contain viewpoints box
2733    
2734 manus 50607 unified_stone: BOOLEAN
2735     -- Is the stone common with the context tool or not?
2736 manus 51111
2737 manus 50607 arguments_dialog: EB_ARGUMENT_DIALOG
2738     -- The arguments dialog for current, if any
2739 manus 51111
2740 manus 50607 goto_dialog: EB_GOTO_DIALOG
2741     -- The goto dialog for line number access
2742 manus 26913
2743 manus 51111 feature -- Multiple editor management
2744 manus 26913
2745 manus 50607 add_editor_to_list (an_editor: EB_EDITOR) is
2746     -- adds `an_editor' to `editors'
2747     do
2748     editors.extend (an_editor)
2749     end
2750 neilc 49534
2751 manus 50607 current_editor: EB_EDITOR is
2752     -- current editor, if none, main editor
2753     do
2754     if current_editor_index /= 0 then
2755     Result := editors @ current_editor_index
2756     else
2757     Result := editors.first
2758     end
2759 manus 26913 end
2760 manus 51111
2761 manus 50607 set_current_editor (an_editor: EB_EDITOR) is
2762     -- set `an_editor' as main editor
2763     local
2764     old_index: INTEGER
2765     new_index: INTEGER
2766     do
2767     old_index := current_editor_index
2768     new_index := editors.index_of (an_editor, 1)
2769     if
2770     editors.valid_index (new_index) and
2771     old_index /= new_index
2772     then
2773     current_editor_index := new_index
2774     update_paste_cmd
2775     -- Last thing, update the menu entry for the formatting marks.
2776     if current_editor.view_invisible_symbols then
2777 manus 51111 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2778 manus 50607 else
2779 manus 51111 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2780 manus 50607 end
2781     command_controller.set_current_editor (an_editor)
2782 xavier 27840 end
2783 manus 50607 end
2784    
2785     update_paste_cmd is
2786     -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2787     do
2788     if
2789     not current_editor.is_empty and then
2790     current_editor.is_editable and then
2791     current_editor.clipboard.has_text
2792     then
2793     editor_paste_cmd.enable_sensitive
2794 xavier 27860 else
2795 manus 50607 editor_paste_cmd.disable_sensitive
2796 xavier 27860 end
2797     end
2798 neilc 49534
2799 manus 51111 feature {NONE} -- Multiple editor management
2800    
2801 manus 50607 editors: ARRAYED_LIST [EB_EDITOR]
2802     -- editor contained in `Current'
2803    
2804     current_editor_index: INTEGER
2805     -- Index in `editors' of the editor that has the focus.
2806 manus 51111
2807 manus 59743 feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS} -- Feature Clauses
2808 manus 51111
2809 manus 50607 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2810     -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2811     -- type pertinent to 'a_features'.
2812     require
2813     a_features_not_void: a_features /= Void
2814     do
2815     if feature_clauses = Void then
2816     create feature_clauses.make (5)
2817     end
2818     feature_clauses.put (a_features, a_type)
2819 neilc 49534 end
2820 manus 51111
2821 tedf 56237 set_feature_locating (a_locating: BOOLEAN) is
2822     -- Set `feature_locating' with `a_locating'.
2823     do
2824     feature_locating := a_locating
2825     end
2826    
2827 manus 50607 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2828     -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2829     require
2830     a_type_not_void: a_type /= Void
2831     has_type_clauses: feature_clauses.has (a_type)
2832     do
2833     Result := feature_clauses.item (a_type)
2834     ensure
2835     result_not_void: Result /= Void
2836 neilc 33858 end
2837 manus 51111
2838 manus 50607 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2839     -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2840 manus 51111
2841 tedf 56237 feature_locating: BOOLEAN
2842     -- Is feature tool locating a feature?
2843    
2844 manus 51111 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2845 manus 26913
2846 manus 50607 destroy_imp is
2847     -- Destroy window.
2848     do
2849     -- To avoid reentrance
2850     if not is_destroying then
2851     is_destroying := True
2852     -- If a launched application is still running, kill it.
2853 jfiat 56447 if
2854     Eb_debugger_manager.application_is_executing
2855     and then Eb_debugger_manager.debugging_window = Current
2856     then
2857     Eb_debugger_manager.Application.kill
2858 manus 50607 else
2859 king 55319 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2860     development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2861 manus 50607 end
2862 king 55319 development_window_data.save_left_panel_width (panel.split_position)
2863 manus 50607 -- Save width & height.
2864 king 55319 development_window_data.save_size (window.width, window.height)
2865     development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2866     development_window_data.save_position (window.x_position, window.y_position)
2867 manus 50607 hide
2868 manus 26913
2869 manus 50607 -- Commit saves
2870 jfiat 56527 preferences.preferences.save_preferences
2871 manus 26913
2872 jfiat 59618 estudio_debug_cmd.unattach_window (window)
2873 manus 50607 toolbars_area.wipe_out
2874     address_manager.recycle
2875     project_customizable_toolbar.recycle
2876 patrickr 56781 refactoring_customizable_toolbar.recycle
2877 manus 50607 Precursor {EB_TOOL_MANAGER}
2878 tedf 59163 left_panel.recycle
2879     right_panel.recycle
2880 manus 50607 managed_class_formatters.wipe_out
2881     managed_feature_formatters.wipe_out
2882     managed_main_formatters.wipe_out
2883     toolbarable_commands.wipe_out
2884     editors.wipe_out
2885 tedf 59163 editors := Void
2886 manus 50607 stone := Void
2887 neilc 49534 end
2888     end
2889    
2890 jasonw 56493 feature -- C output pixmap management
2891    
2892     start_c_output_pixmap_timer is
2893     -- Start timer to draw c output pixmap.
2894     do
2895     if context_tool /= Void then
2896     context_tool.start_c_output_pixmap_timer
2897     end
2898     end
2899    
2900     stop_c_output_pixmap_timer is
2901     -- Stop timer to draw c output pixmap.
2902     do
2903     if context_tool /= Void then
2904     context_tool.stop_c_output_pixmap_timer
2905     end
2906     end
2907    
2908 manus 51111 feature {NONE} -- Implementation
2909 neilc 49534
2910 manus 50607 set_stone_after_check (a_stone: STONE) is
2911     local
2912     old_stone: STONE
2913     new_class_stone: CLASSI_STONE
2914     old_class_stone: CLASSI_STONE
2915     conv_classc: CLASSC_STONE
2916     conv_brkstone: BREAKABLE_STONE
2917     cluster_st: CLUSTER_STONE
2918 tedf 55179 old_cluster_st: CLUSTER_STONE
2919 manus 50607 feature_stone: FEATURE_STONE
2920     conv_ferrst: FEATURE_ERROR_STONE
2921 patrickr 61226 target_stone: TARGET_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     externali: EXTERNAL_CLASS_I
2934     external_cons: CONSUMED_TYPE
2935     str: STRING
2936     dotnet_class: BOOLEAN
2937     l_short_formatter: EB_SHORT_FORMATTER
2938     l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2939 tedf 55179 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2940 jfiat 56447 app_exec: APPLICATION_EXECUTION
2941 manus 50607 do
2942     -- the text does not change if the text was saved with syntax errors
2943     cur_wid := window
2944     if cur_wid = Void then
2945     --| Do nothing.
2946 manus 26913 else
2947 manus 50607 if old_cur = Void then
2948     old_cur := cur_wid.pointer_style
2949     end
2950     -- cur_wid.enable_capture
2951     cur_wid.set_pointer_style (Wait_cursor)
2952 neilc 49534 end
2953 manus 26913
2954 manus 50607 conv_brkstone ?= a_stone
2955     conv_errst ?= a_stone
2956     ef_stone ?= a_stone
2957 patrickr 61226 target_stone ?= a_stone
2958 manus 50607 if conv_brkstone /= Void then
2959 jfiat 56447 app_exec := Debugger_manager.application
2960     if app_exec.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2961     app_exec.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2962 manus 50607 else
2963 jfiat 56447 app_exec.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2964 manus 26913 end
2965 jfiat 55044 Debugger_manager.notify_breakpoints_changes
2966 manus 50607 elseif conv_errst /= Void then
2967     display_error_help_cmd.execute_with_stone (conv_errst)
2968     elseif ef_stone /= Void then
2969     f := ef_stone.file
2970     f.make_open_read (f.name)
2971     f.read_stream (f.count)
2972     f.close
2973 tedf 58663 editor_tool.text_area.set_stone (a_stone)
2974 manus 50607 editor_tool.text_area.load_text (f.last_string)
2975 patrickr 61226 elseif target_stone /= Void then
2976     properties_tool.add_stone (target_stone)
2977 manus 50607 else
2978     -- Remember previous stone.
2979     old_stone := stone
2980     old_class_stone ?= stone
2981 tedf 55179 old_cluster_st ?= stone
2982 manus 51111
2983 manus 50607 -- New stone properties
2984     new_class_stone ?= a_stone
2985    
2986     -- Set the stone.
2987     old_set_stone (a_stone)
2988     cluster_st ?= a_stone
2989 manus 51111
2990 manus 50607 new_feature_cmd.disable_sensitive
2991 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
2992 manus 50607 toggle_feature_signature_cmd.disable_sensitive
2993 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
2994 manus 51111
2995 manus 50607 -- We update the state of the `Add to Favorites' command.
2996     if new_class_stone /= Void then
2997     favorites_menu.first.enable_sensitive
2998     else
2999     favorites_menu.first.disable_sensitive
3000 neilc 49534 end
3001 manus 26913
3002 manus 50607 -- Update the address manager if needed.
3003     address_manager.refresh
3004     if new_class_stone /= Void then
3005 tedf 60107 if not during_synchronization then
3006     view_points_combo.set_conf_class (new_class_stone.class_i.config_class)
3007     end
3008 manus 54781 -- Text is now editable.
3009     editor_tool.text_area.set_read_only (False)
3010    
3011 patrickr 61226 properties_tool.add_stone (new_class_stone)
3012    
3013 manus 50607 -- class stone was dropped
3014     create class_file.make (new_class_stone.class_i.file_name)
3015     class_text_exists := class_file.exists
3016     feature_stone ?= a_stone
3017     --| We have to create a classi_stone to check whether the stones are really similar.
3018     --| Otherwise a redefinition of same_as may be called.
3019     create test_stone.make (new_class_stone.class_i)
3020     if test_stone.same_as (old_class_stone) then
3021     same_class := True
3022     end
3023     if not feature_stone_already_processed then
3024 manus 51111 if same_class and then text_saved then
3025 manus 50607 -- nothing changed in the editor
3026     -- we only have to update click_list
3027     if editor_tool.text_area.is_editable then
3028     editor_tool.text_area.update_click_list (False)
3029     end
3030 manus 26913 else
3031 manus 50607 if changed then
3032     -- user has already chosen not to save the file
3033     -- do not ask again
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 61081 if cluster_st /= Void then
3193     properties_tool.add_stone (cluster_st)
3194     if cluster_st.is_cluster then
3195 manus 50607 --| FIXME XR: Really manage cluster display in the main editor
3196 patrickr 61081 if not during_synchronization then
3197     view_points_combo.set_conf_group (cluster_st.group)
3198     end
3199     formatted_context_for_cluster (cluster_st.cluster_i, cluster_st.path)
3200     if cluster_st.position > 0 then
3201     editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
3202     end
3203     --| END FIXME
3204 tedf 60107 end
3205 manus 50607 end
3206 neilc 49534 end
3207 alexk 51083 if class_text_exists then
3208     if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
3209     conv_ferrst ?= feature_stone
3210     if conv_ferrst /= Void then
3211     error_line := conv_ferrst.line_number
3212     else
3213     -- if a feature_stone has been dropped
3214     -- scroll to the corresponding feature in the basic text format
3215     if not during_synchronization then
3216     scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
3217     end
3218     end
3219 manus 50607 else
3220 alexk 51083 cl_syntax_stone ?= a_stone
3221     if cl_syntax_stone /= Void then
3222     error_line := cl_syntax_stone.line
3223 manus 50607 end
3224 manus 26913 end
3225 alexk 51083 if error_line > 0 then
3226     -- Scroll to the line of the error.
3227 tedf 59708 if not during_synchronization then
3228     if not managed_main_formatters.first.selected then
3229     managed_main_formatters.first.execute
3230     check
3231     new_class_stone_not_void: new_class_stone /= Void
3232     end
3233     if new_class_stone.class_i.is_read_only then
3234     editor_tool.text_area.set_read_only (true)
3235     end
3236     end
3237     editor_tool.text_area.display_line_when_ready (error_line, True)
3238     end
3239 alexk 51083 end
3240 manus 26913 end
3241 manus 50607 -- Update the title of the window
3242     if a_stone /= Void then
3243     if changed then
3244     str := a_stone.header.twin
3245     str.prepend ("* ")
3246     set_title (str)
3247     else
3248     set_title (a_stone.header)
3249     end
3250 neilc 49534 else
3251 manus 51111 set_title (Interface_names.t_empty_development_window)
3252 manus 26913 end
3253 manus 50607
3254     -- Refresh the tools.
3255     features_tool.set_stone (a_stone)
3256     cluster_tool.set_stone (a_stone)
3257     -- Update the context tool.
3258     if unified_stone then
3259     context_tool.set_stone (a_stone)
3260     end
3261    
3262 neilc 49534 end
3263 manus 50607 if
3264     stone /= Void and then
3265     not unified_stone
3266     then
3267     send_stone_to_context_cmd.enable_sensitive
3268 manus 26913 else
3269 manus 50607 send_stone_to_context_cmd.disable_sensitive
3270 manus 26913 end
3271 manus 50607 if cur_wid = Void then
3272     --| Do nothing.
3273 manus