/[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 49729 - (hide annotations)
Fri Apr 1 23:24:13 2005 UTC (14 years, 10 months ago) by neilc
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 100946 byte(s)
Removed eac browser reference, not used

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