/[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 54985 - (hide annotations)
Fri Oct 7 01:22:05 2005 UTC (14 years, 4 months ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 114881 byte(s)
Made features tool and address bar change according to current cursor location in the editor.

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