/[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 60208 - (hide annotations)
Thu Jun 22 23:29:05 2006 UTC (13 years, 8 months ago) by manus
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 140080 byte(s)
Added EB_SHORTCUTS_DATA a common parent to EB_EXTERNAL_COMMAND_DATA and EB_EDITOR_DATA
  for loading shortcuts.
Moved external commands preferences from EB_MISC_DATA to EB_EXTERNAL_COMMAND_DATA.
Removed `show_search_options' preference since not used anymore with new search panel.
Ensured that when starting and closing EiffelStudio for the first time, only a minimal set
  of preferences are saved.

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