/[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 48452 - (hide annotations)
Mon Feb 14 11:24:54 2005 UTC (15 years ago) by jfiat
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 100086 byte(s)
- Slightly changed the current design
to "attach" an EB_TOOL to a tool container (ie EB_EXPLORER_BAR)
- Now we have an EB_EXPLORER_BAR_ATTACHABLE which describe the attachement to an
 explorer bar.
- Separate creation of mini toolbar
- a few feature renaming to better describe the action

Those modifications do not change EiffelStudio's behavior, but following this "ATTACHABLE" design
it will be easy to add new EB_TOOL container, such as a NOTEBOOK and so on.

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

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23