/[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 61820 - (hide annotations)
Sat Jul 29 05:27:23 2006 UTC (13 years, 7 months ago) by manus
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 141906 byte(s)
Removed non-used locals.

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