/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60107 - (show annotations)
Wed Jun 21 23:44:16 2006 UTC (13 years, 8 months ago) by tedf
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 140231 byte(s)
1. Added viewpoint selector beside main formatters.
2. Modified some code for documentation generation so that it is not viewpoint based. We generate original name based texts for any classes.
3. Fixed some small problems/bugs of doc generation.
1 indexing
2 description : "Window holding a project tool"
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date : "$Date$"
6 revision : "$Revision$"
7 author : "$Author$"
8
9 class
10 EB_DEVELOPMENT_WINDOW
11
12 inherit
13 EB_TOOL_MANAGER
14 redefine
15 make,
16 init_size_and_position,
17 window_displayed,
18 init_commands,
19 build_menu_bar,
20 build_menus,
21 build_file_menu,
22 build_edit_menu,
23 build_view_menu,
24 build_tools_menu,
25 build_favorites_menu,
26 refresh,
27 recycle,
28 destroy_imp,
29 destroy,
30 position,
31 pos_container
32 end
33
34 EB_FILEABLE
35 export {NONE}
36 set_position,
37 set_pos_container
38 redefine
39 set_stone,
40 reset,
41 stone,
42 on_text_saved,
43 perform_check_before_save,
44 check_passed,
45 update_save_symbol,
46 position,
47 pos_container
48 select
49 set_stone
50 end
51
52 EB_FILEABLE
53 rename
54 set_stone as old_set_stone
55 export {NONE}
56 old_set_stone,
57 set_position,
58 set_pos_container
59 redefine
60 reset,
61 stone,
62 on_text_saved,
63 perform_check_before_save,
64 check_passed,
65 update_save_symbol,
66 position,
67 pos_container
68 end
69
70
71 -- Shared tools & contexts
72
73 SHARED_EIFFEL_PROJECT
74
75 PROJECT_CONTEXT
76
77 EB_SHARED_MANAGERS
78
79 EB_SHARED_GRAPHICAL_COMMANDS
80
81 EB_SHARED_PREFERENCES
82 export
83 {NONE} all
84 end
85
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 on_text_back_to_its_last_saved_state,
97 on_text_fully_loaded, on_cursor_moved
98 end
99
100 EV_KEY_CONSTANTS
101 export
102 {NONE} All
103 end
104
105 EIFFEL_ENV
106 export
107 {NONE} All
108 end
109
110 SHARED_TEXT_ITEMS
111 export
112 {NONE} All
113 end
114
115 create {EB_WINDOW_MANAGER}
116 make,
117 make_with_session_data,
118 make_as_context_tool,
119 make_as_editor
120
121 feature {NONE} -- Initialization
122
123 make_as_context_tool is
124 -- Create a new development window and expand the context tool.
125 do
126 make
127 -- Perform window setting from `show_actions', as the
128 -- resizing executed as a result only works correctly
129 -- while the window is displayed.
130 window.show_actions.extend (agent set_context_mode)
131 end
132
133 set_context_mode is
134 -- Set `current' into context mode, that is the context tool
135 -- maximized, and the non editor panel is hidden.
136 do
137 if not context_tool.shown then
138 context_tool.show
139 end
140 if not unified_stone then
141 toggle_stone_cmd.execute
142 end
143 context_tool.explorer_bar_item.maximize
144 close_all_bars_except (right_panel)
145 end
146
147 make_as_editor is
148 -- Create a new development window and expand the editor tool.
149 do
150 make
151 -- Perform window setting from `show_actions', as the resizing executed
152 -- must be performed after `current' is displayed.
153 window.show_actions.extend (agent (editor_tool.explorer_bar_item).maximize)
154 window.show_actions.extend (agent close_all_bars_except (right_panel))
155 end
156
157 make_with_session_data (a_session_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA) is
158 -- Recreate a previously existing development window using `a_session_data'.
159 local
160 l_class_i: CLASS_I
161 l_class_c_stone: CLASSC_STONE
162 l_cluster_string, l_class_string, l_feature_string: STRING
163 do
164 internal_development_window_data := a_session_data
165 make
166 -- Attempt to reload last edited class of `Current'.
167 if a_session_data.file_name /= Void then
168 conf_todo
169 -- l_class_i := eiffel_universe.class_with_file_name (a_session_data.file_name)
170 if l_class_i /= Void and then l_class_i.compiled then
171 -- Create compiled class stone and target `Current' to it.
172 create l_class_c_stone.make (l_class_i.compiled_class)
173 set_stone_after_check (l_class_c_stone)
174 if a_session_data.editor_position > 0 then
175 editor_tool.text_area.display_line_when_ready (a_session_data.editor_position, False)
176 end
177 end
178 end
179 if context_tool /= Void then
180 -- Presumption is made that if the strings are not void then they represent
181 -- valid entities in the project.
182 l_cluster_string := a_session_data.context_cluster_string
183 l_class_string := a_session_data.context_class_string
184 l_feature_string := a_session_data.context_feature_string
185 if l_feature_string /= Void then
186 context_tool.address_manager.feature_address.set_text (l_feature_string)
187 context_tool.address_manager.class_address.set_text (l_class_string)
188 context_tool.address_manager.execute_with_feature
189 elseif l_class_string /= Void then
190 context_tool.address_manager.class_address.set_text (l_class_string)
191 context_tool.address_manager.execute_with_class
192 elseif l_cluster_string /= Void then
193 context_tool.address_manager.cluster_address.set_text (l_cluster_string)
194 context_tool.address_manager.execute_with_cluster
195 end
196 -- Set the appropriate notebook tab
197 context_tool.notebook.select_item (context_tool.notebook.i_th (a_session_data.context_tab_index))
198 end
199 end
200
201 make is
202 -- Create a new development window.
203 do
204 unified_stone := preferences.development_window_data.context_unified_stone
205 -- Build the history manager, the address manager, ...
206 create history_manager.make (Current)
207 create address_manager.make (Current, False)
208 build_viewpoints
209 build_formatters
210 address_manager.set_formatters (managed_main_formatters)
211 address_manager.set_viewpoints (view_points_widget)
212
213
214 -- Init commands, build interface, build menus, ...
215 Precursor
216
217 initialized := False -- Reset the flag since initialization is not yet complete.
218 set_up_accelerators
219
220 window.focus_in_actions.extend(agent on_focus)
221
222 -- Create the toolbars.
223 build_toolbars_area
224 container.put_front (toolbars_area)
225 container.disable_item_expand (toolbars_area)
226
227 -- Update widgets visibilities
228 window.show_actions.extend (agent update)
229 status_bar.remove_cursor_position
230 address_manager.set_output_line (status_bar.label)
231
232 -- Finish initializing the main editor formatters
233 end_build_formatters
234
235 address_manager.disable_formatters
236 if Eiffel_project.manager.is_project_loaded then
237 on_project_created
238 on_project_loaded
239 elseif Eiffel_project.manager.is_created then
240 on_project_unloaded
241 on_project_created
242 else
243 on_project_unloaded
244 end
245
246 -- Create feature position table
247 create feature_positions.make (1)
248 feature_positions.compare_objects
249
250 window.move_actions.force_extend (agent window_moved)
251
252 initialized := True
253 is_destroying := False
254 end
255
256 init_size_and_position is
257 -- Initialize window size.
258 local
259 screen: EB_STUDIO_SCREEN
260 l_x, l_y: INTEGER
261 do
262 create screen
263 window.set_size (
264 development_window_data.width.min (screen.width),
265 development_window_data.height.min (screen.height))
266 l_x := development_window_data.x_position
267 if l_x < screen.virtual_left or l_x > screen.virtual_right then
268 -- Somehow screens have changed, reset it to 0
269 l_x := 0
270 end
271 l_y := development_window_data.y_position
272 if l_y < screen.virtual_top or l_y > screen.virtual_bottom then
273 -- Somehow screens have changed, reset it to 0
274 l_y := 0
275 end
276 window.set_position (l_x, l_y)
277 end
278
279 window_displayed is
280 -- `Current' has been displayed on screen.
281 do
282 -- Minimize or Maximize window if needed.
283 if development_window_data.is_maximized then
284 window.maximize
285 elseif development_window_data.is_minimized then
286 window.minimize
287 end
288 end
289
290 init_commands is
291 -- Initialize commands.
292 local
293 accel: EV_ACCELERATOR
294 do
295 Precursor
296 create toolbarable_commands.make (15)
297
298 -- Open, save, ...
299 toolbarable_commands.extend (new_editor_cmd)
300
301 toolbarable_commands.extend (new_context_tool_cmd)
302
303 create open_cmd.make (Current)
304 toolbarable_commands.extend (open_cmd)
305
306 create save_cmd.make (Current)
307 toolbarable_commands.extend (save_cmd)
308
309 create save_as_cmd.make (Current)
310 if editor_tool = Void or else editor_tool.text_area.is_empty then
311 save_as_cmd.disable_sensitive
312 else
313 save_as_cmd.enable_sensitive
314 end
315
316 create shell_cmd.make (Current)
317 toolbarable_commands.extend (shell_cmd)
318
319 create print_cmd.make (Current)
320 if is_empty then
321 print_cmd.disable_sensitive
322 else
323 print_cmd.enable_sensitive
324 end
325 toolbarable_commands.extend (print_cmd)
326
327 -- Compilation
328 create c_workbench_compilation_cmd.make_workbench (Current)
329 create c_finalized_compilation_cmd.make_finalized (Current)
330 if has_dll_generation then
331 create show_dynamic_lib_tool.make
332 show_dynamic_lib_tool.set_menu_name (Interface_names.m_new_dynamic_lib)
333 show_dynamic_lib_tool.add_agent (agent show_dynamic_library_dialog)
334 end
335 if has_profiler then
336 create show_profiler
337 end
338
339 -- Undo/redo, cut, copy, paste.
340 create undo_cmd.make (Current)
341 toolbarable_commands.extend (undo_cmd)
342
343 create redo_cmd.make (Current)
344 toolbarable_commands.extend (redo_cmd)
345
346 create editor_paste_cmd.make (Current)
347 toolbarable_commands.extend (editor_paste_cmd)
348
349 create new_cluster_cmd.make (Current)
350 toolbarable_commands.extend (new_cluster_cmd)
351
352 create new_class_cmd.make (Current)
353 toolbarable_commands.extend (new_class_cmd)
354
355 create delete_class_cluster_cmd.make (Current)
356 toolbarable_commands.extend (delete_class_cluster_cmd)
357
358 create new_feature_cmd.make (Current)
359 toolbarable_commands.extend (new_feature_cmd)
360
361 create toggle_feature_alias_cmd.make (Current)
362 toolbarable_commands.extend (toggle_feature_alias_cmd)
363
364 create toggle_feature_signature_cmd.make (Current)
365 toolbarable_commands.extend (toggle_feature_signature_cmd)
366
367 create toggle_feature_assigner_cmd.make (Current)
368 toolbarable_commands.extend (toggle_feature_assigner_cmd)
369
370 create toggle_stone_cmd.make (Current)
371 toolbarable_commands.extend (toggle_stone_cmd)
372
373 create send_stone_to_context_cmd.make
374 send_stone_to_context_cmd.set_pixmap (pixmaps.icon_pixmaps.context_sync_icon)
375 send_stone_to_context_cmd.set_tooltip (Interface_names.e_send_stone_to_context)
376 send_stone_to_context_cmd.set_menu_name (Interface_names.m_send_stone_to_context)
377 send_stone_to_context_cmd.set_name ("Send_to_context")
378 send_stone_to_context_cmd.set_tooltext (Interface_names.b_send_stone_to_context)
379 send_stone_to_context_cmd.add_agent (agent send_stone_to_context)
380 create accel.make_with_key_combination (
381 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_down), False, True, False
382 )
383 accel.actions.extend (agent send_stone_to_context)
384 send_stone_to_context_cmd.set_accelerator (accel)
385 send_stone_to_context_cmd.disable_sensitive
386 toolbarable_commands.extend (send_stone_to_context_cmd)
387
388 toolbarable_commands.extend (window_manager.minimize_all_cmd)
389 window_manager.minimize_all_cmd.enable_sensitive
390 toolbarable_commands.extend (window_manager.raise_all_cmd)
391 window_manager.raise_all_cmd.enable_sensitive
392
393 toolbarable_commands.extend (New_development_window_cmd)
394 -- Show tool/toolbar commands (will be filled when tools will
395 -- be created)
396 create show_tool_commands.make (7)
397 create show_toolbar_commands.make (3)
398
399 new_feature_cmd.disable_sensitive
400 toggle_feature_alias_cmd.disable_sensitive
401 toggle_feature_signature_cmd.disable_sensitive
402 toggle_feature_assigner_cmd.disable_sensitive
403
404 create editors.make (5)
405 end
406
407 set_up_accelerators is
408 -- Fill the accelerator of `window' with the accelerators of the `toolbarable_commands'.
409 local
410 cmds: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
411 i: INTEGER
412 do
413 --| Accelerators related to toolbarable_commands
414 from
415 cmds := toolbarable_commands
416 cmds.start
417 until
418 cmds.after
419 loop
420 if cmds.item.accelerator /= Void then
421 window.accelerators.extend (cmds.item.accelerator)
422 end
423 cmds.forth
424 end
425
426 --| Accelerators related to debugging toolbarable_commands
427 from
428 cmds := Eb_debugger_manager.toolbarable_commands
429 cmds.start
430 until
431 cmds.after
432 loop
433 if
434 cmds.item.accelerator /= Void
435 then
436 window.accelerators.extend (cmds.item.accelerator)
437 end
438 cmds.forth
439 end
440
441 --| Accelerators related to external commands
442 from
443 i := 0
444 until
445 i > 9
446 loop
447 window.accelerators.extend (edit_external_commands_cmd.accelerators.item (i))
448 i := i + 1
449 end
450 end
451
452 build_formatters is
453 -- Build all formatters used.
454 local
455 form: EB_CLASS_TEXT_FORMATTER
456 accel: EV_ACCELERATOR
457 do
458 create managed_class_formatters.make (17)
459 managed_class_formatters.extend (create {EB_CLICKABLE_FORMATTER}.make (Current))
460 managed_class_formatters.extend (create {EB_FLAT_FORMATTER}.make (Current))
461 managed_class_formatters.extend (create {EB_SHORT_FORMATTER}.make (Current))
462 managed_class_formatters.extend (create {EB_FLAT_SHORT_FORMATTER}.make (Current))
463 managed_class_formatters.extend (Void)
464 managed_class_formatters.extend (create {EB_ANCESTORS_FORMATTER}.make (Current))
465 managed_class_formatters.extend (create {EB_DESCENDANTS_FORMATTER}.make (Current))
466 managed_class_formatters.extend (create {EB_CLIENTS_FORMATTER}.make (Current))
467 managed_class_formatters.extend (create {EB_SUPPLIERS_FORMATTER}.make (Current))
468 managed_class_formatters.extend (Void)
469 managed_class_formatters.extend (create {EB_ATTRIBUTES_FORMATTER}.make (Current))
470 managed_class_formatters.extend (create {EB_ROUTINES_FORMATTER}.make (Current))
471 managed_class_formatters.extend (create {EB_INVARIANTS_FORMATTER}.make (Current))
472 managed_class_formatters.extend (create {EB_CREATORS_FORMATTER}.make (Current))
473 managed_class_formatters.extend (create {EB_DEFERREDS_FORMATTER}.make (Current))
474 managed_class_formatters.extend (create {EB_ONCES_FORMATTER}.make (Current))
475 managed_class_formatters.extend (create {EB_EXTERNALS_FORMATTER}.make (Current))
476 managed_class_formatters.extend (create {EB_EXPORTED_FORMATTER}.make (Current))
477
478 create managed_feature_formatters.make (12)
479 managed_feature_formatters.extend (create {EB_BASIC_FEATURE_FORMATTER}.make (Current))
480 managed_feature_formatters.extend (create {EB_ROUTINE_FLAT_FORMATTER}.make (Current))
481 managed_feature_formatters.extend (Void)
482 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current, 0))
483 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
484 {DEPEND_UNIT}.is_in_assignment_flag))
485 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
486 {DEPEND_UNIT}.is_in_creation_flag))
487 managed_feature_formatters.extend (Void)
488
489 managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current, 0))
490 managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current,
491 {DEPEND_UNIT}.is_in_assignment_flag))
492 managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current,
493 {DEPEND_UNIT}.is_in_creation_flag))
494 managed_feature_formatters.extend (Void)
495
496 managed_feature_formatters.extend (create {EB_IMPLEMENTERS_FORMATTER}.make (Current))
497 managed_feature_formatters.extend (create {EB_ROUTINE_ANCESTORS_FORMATTER}.make (Current))
498 managed_feature_formatters.extend (create {EB_ROUTINE_DESCENDANTS_FORMATTER}.make (Current))
499 managed_feature_formatters.extend (Void)
500 managed_feature_formatters.extend (create {EB_HOMONYMS_FORMATTER}.make (Current))
501
502
503 create managed_main_formatters.make (6)
504
505 create {EB_BASIC_TEXT_FORMATTER} form.make (Current)
506 create accel.make_with_key_combination (
507 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_t),
508 True, False, True)
509 accel.actions.extend (agent form.execute)
510 form.set_accelerator (accel)
511 form.set_viewpoints (view_points_combo)
512 form.post_execution_action.extend (agent update_viewpoints)
513 managed_main_formatters.extend (form)
514
515 create {EB_CLICKABLE_FORMATTER} form.make (Current)
516 create accel.make_with_key_combination (
517 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_c),
518 True, False, True)
519 accel.actions.extend (agent form.execute)
520 form.set_accelerator (accel)
521 form.set_viewpoints (view_points_combo)
522 form.post_execution_action.extend (agent update_viewpoints)
523 managed_main_formatters.extend (form)
524
525 create {EB_FLAT_FORMATTER} form.make (Current)
526 create accel.make_with_key_combination (
527 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_f),
528 True, False, True)
529 accel.actions.extend (agent form.execute)
530 form.set_accelerator (accel)
531 form.set_viewpoints (view_points_combo)
532 form.post_execution_action.extend (agent update_viewpoints)
533 managed_main_formatters.extend (form)
534
535 create {EB_SHORT_FORMATTER} form.make (Current)
536 create accel.make_with_key_combination (
537 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_o),
538 True, False, True)
539 accel.actions.extend (agent form.execute)
540 form.set_accelerator (accel)
541 form.set_viewpoints (view_points_combo)
542 form.post_execution_action.extend (agent update_viewpoints)
543 managed_main_formatters.extend (form)
544
545 create {EB_FLAT_SHORT_FORMATTER} form.make (Current)
546 create accel.make_with_key_combination (
547 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_i),
548 True, False, True)
549 accel.actions.extend (agent form.execute)
550 form.set_accelerator (accel)
551 form.set_viewpoints (view_points_combo)
552 form.post_execution_action.extend (agent update_viewpoints)
553 managed_main_formatters.extend (form)
554 end
555
556 end_build_formatters is
557 -- Finish initialization of formatters (associate them with editor
558 -- and select a formatter).
559 local
560 f_ind: INTEGER
561 do
562 from
563 managed_class_formatters.start
564 until
565 managed_class_formatters.after
566 loop
567 if managed_class_formatters.item /= Void then
568 managed_class_formatters.item.set_manager (context_tool)
569 end
570 managed_class_formatters.forth
571 end
572 from
573 managed_feature_formatters.start
574 until
575 managed_feature_formatters.after
576 loop
577 if managed_feature_formatters.item /= Void then
578 managed_feature_formatters.item.set_manager (context_tool)
579 end
580 managed_feature_formatters.forth
581 end
582 from
583 managed_main_formatters.start
584 until
585 managed_main_formatters.after
586 loop
587 managed_main_formatters.item.set_editor (editor_tool.text_area)
588 managed_main_formatters.item.on_shown
589 if managed_main_formatters.item.accelerator /= Void then
590 window.accelerators.extend (managed_main_formatters.item.accelerator)
591 end
592 managed_main_formatters.forth
593 end
594
595 (managed_main_formatters @ 1).enable_select;
596
597 -- We now select the correct class formatter.
598 f_ind := preferences.context_tool_data.default_class_formatter_index
599 --| This takes the formatter separators in consideration.
600 if f_ind > 4 then
601 f_ind := f_ind + 1
602 end
603 if f_ind > 8 then
604 f_ind := f_ind + 1
605 end
606 if f_ind < 1 or f_ind > managed_class_formatters.count then
607 f_ind := 6
608 end
609 (managed_class_formatters @ f_ind).enable_select;
610 -- We now select the correct feature formatter.
611 f_ind := preferences.context_tool_data.default_feature_formatter_index
612 if f_ind > 2 then
613 f_ind := f_ind + 1
614 end
615 if f_ind < 1 or f_ind > managed_feature_formatters.count then
616 f_ind := 2
617 end
618 managed_class_formatters.i_th (f_ind).enable_select
619 end
620
621 build_tools is
622 -- Build all tools that can take place in this window and put them
623 -- in `left_tools' or `bottom_tools'.
624 local
625 show_cmd: EB_SHOW_TOOL_COMMAND
626 l_accel: EV_ACCELERATOR
627 l_shortcut_preference: SHORTCUT_PREFERENCE
628 do
629 lock_update
630 -- Build the features tool
631 create features_tool.make (Current)
632 features_tool.attach_to_explorer_bar (left_panel)
633 left_tools.extend (features_tool.explorer_bar_item)
634 create show_cmd.make (Current, features_tool.explorer_bar_item)
635 show_tool_commands.extend (show_cmd)
636 toolbarable_commands.extend (show_cmd)
637 add_recyclable (features_tool)
638
639 -- Build the breakpoints tool
640 create breakpoints_tool.make (Current)
641 breakpoints_tool.attach_to_explorer_bar (left_panel)
642 left_tools.extend (breakpoints_tool.explorer_bar_item)
643 create show_cmd.make (Current, breakpoints_tool.explorer_bar_item)
644 show_tool_commands.extend (show_cmd)
645 toolbarable_commands.extend (show_cmd)
646 add_recyclable (breakpoints_tool)
647
648 -- Build the cluster tool
649 create cluster_tool.make (Current, Current)
650 cluster_tool.attach_to_explorer_bar (left_panel)
651 left_tools.extend (cluster_tool.explorer_bar_item)
652 create show_cmd.make (Current, cluster_tool.explorer_bar_item)
653 show_tool_commands.extend (show_cmd)
654 toolbarable_commands.extend (show_cmd)
655 add_recyclable (cluster_tool)
656
657 -- Build the favorites tool
658 create favorites_tool.make (Current, favorites_manager)
659 favorites_tool.attach_to_explorer_bar (left_panel)
660 left_tools.extend (favorites_tool.explorer_bar_item)
661 create show_cmd.make (Current, favorites_tool.explorer_bar_item)
662 show_tool_commands.extend (show_cmd)
663 toolbarable_commands.extend (show_cmd)
664 add_recyclable (favorites_tool)
665
666 -- Build the windows tool (formerly known as Selector tool)
667 create windows_tool.make (Current)
668 windows_tool.attach_to_explorer_bar (left_panel)
669 left_tools.extend (windows_tool.explorer_bar_item)
670 create show_cmd.make (Current, windows_tool.explorer_bar_item)
671 show_tool_commands.extend (show_cmd)
672 toolbarable_commands.extend (show_cmd)
673 add_recyclable (windows_tool)
674
675 -- Build the search tool
676 create search_tool.make (Current)
677 search_tool.attach_to_explorer_bar (right_panel)
678 bottom_tools.extend (search_tool.explorer_bar_item)
679 create show_cmd.make (Current, search_tool.explorer_bar_item)
680 l_shortcut_preference := preferences.editor_data.shortcuts.item ("show_search_panel")
681 create l_accel.make_with_key_combination (l_shortcut_preference.key, l_shortcut_preference.is_ctrl, l_shortcut_preference.is_alt, l_shortcut_preference.is_shift)
682 l_accel.actions.extend (agent search_tool.prepare_search)
683 show_cmd.set_accelerator (l_accel)
684 show_tool_commands.extend (show_cmd)
685 toolbarable_commands.extend (show_cmd)
686 add_recyclable (search_tool)
687
688 -- Build the editor tool
689 create editor_tool.make (Current)
690 editor_tool.attach_to_explorer_bar (right_panel)
691 bottom_tools.extend (editor_tool.explorer_bar_item)
692 editor_tool.text_area.add_edition_observer(save_cmd)
693 editor_tool.text_area.add_edition_observer(save_as_cmd)
694 editor_tool.text_area.add_edition_observer(print_cmd)
695 editor_tool.text_area.add_edition_observer(Current)
696 editor_tool.text_area.add_edition_observer(search_tool)
697 editor_tool.text_area.drop_actions.set_veto_pebble_function (agent can_drop)
698 editor_tool.text_area.add_cursor_observer (Current)
699 create show_cmd.make(Current, editor_tool.explorer_bar_item)
700 show_tool_commands.extend (show_cmd)
701 toolbarable_commands.extend (show_cmd)
702
703 -- The minimim height masks a bug on windows to do with the sizing of the editors
704 -- scroll bars, which were affecting the resizing although they should not have done so.
705 -- Having a default minimum height on the editor is perfectly reasonable.
706 editor_tool.widget.set_minimum_height (20)
707 add_recyclable (editor_tool)
708
709 -- Build the context tool
710 create context_tool.make (Current)
711 context_tool.attach_to_explorer_bar (right_panel)
712 bottom_tools.extend (context_tool.explorer_bar_item)
713 create show_cmd.make (Current, context_tool.explorer_bar_item)
714 show_tool_commands.extend (show_cmd)
715 toolbarable_commands.extend (show_cmd)
716 add_recyclable (context_tool)
717
718 -- Build the refactoring tools
719 toolbarable_commands.extend (refactoring_manager.pull_command)
720 toolbarable_commands.extend (refactoring_manager.rename_command)
721 toolbarable_commands.extend (refactoring_manager.undo_command)
722 toolbarable_commands.extend (refactoring_manager.redo_command)
723
724 -- Set the flag "Tools initialized"
725 tools_initialized := True
726
727 -- Initialize undo / redo accelerators
728 create undo_accelerator.make_with_key_combination (
729 create {EV_KEY}.make_with_code (Key_z), True, False, False)
730 if has_case then
731 undo_accelerator.actions.extend (agent (context_tool.editor.undo_cmd).on_ctrl_z)
732 end
733 undo_accelerator.actions.extend (agent undo_cmd.accelerator_execute)
734 create redo_accelerator.make_with_key_combination (
735 create {EV_KEY}.make_with_code (Key_y), True, False, False)
736 if has_case then
737 redo_accelerator.actions.extend (agent (context_tool.editor.redo_cmd).on_ctrl_y)
738 end
739 redo_accelerator.actions.extend (agent redo_cmd.accelerator_execute)
740 window.accelerators.extend (undo_accelerator)
741 window.accelerators.extend (redo_accelerator)
742 unlock_update
743 end
744
745 build_viewpoints is
746 -- Build viewpoint selection list
747 local
748 l_label: EV_LABEL
749 do
750 create view_points_widget
751 create l_label.make_with_text (interface_names.l_viewpoints)
752 view_points_widget.extend (l_label)
753 view_points_widget.disable_item_expand (l_label)
754
755 create view_points_combo
756 view_points_combo.disable_sensitive
757 view_points_combo.select_actions.extend (agent on_viewpoint_changed)
758 view_points_combo.disable_edit
759 view_points_combo.set_minimum_width (120)
760
761 view_points_widget.extend (view_points_combo)
762 view_points_widget.disable_item_expand (view_points_combo)
763 end
764
765 feature -- Access
766
767 group: CONF_GROUP is
768 -- Group of current class. Void if none.
769 local
770 classi_stone: CLASSI_STONE
771 cluster_stone: CLUSTER_STONE
772 do
773 classi_stone ?= stone
774 if classi_stone /= Void then
775 Result := classi_stone.group
776 end
777 cluster_stone ?= stone
778 if cluster_stone /= Void then
779 Result := cluster_stone.group
780 end
781 end
782
783 class_name: STRING is
784 -- Name of the current class, Void if none.
785 local
786 class_stone: CLASSI_STONE
787 do
788 class_stone ?= stone
789 if class_stone /= Void then
790 Result := class_stone.class_name
791 end
792 end
793
794 feature_name: STRING is
795 -- Name of the current feature, Void if none.
796 local
797 feature_stone: FEATURE_STONE
798 do
799 feature_stone ?= stone
800 if feature_stone /= Void then
801 Result := feature_stone.feature_name
802 end
803 end
804
805 feature -- Status setting
806
807 disable_sensitive is
808 -- Disable sensitivity of all widgets.
809 do
810 window.disable_sensitive
811 end
812
813 enable_sensitive is
814 -- Enable sensitivity of all widgets.
815 do
816 window.enable_sensitive
817 end
818
819 feature -- Window Settings
820
821 set_initialized is
822 -- Set `initialized' to True.
823 do
824 initialized := True
825 end
826
827 set_text (a_text: STRING) is
828 -- Assign `a_text' to `text'.
829 require
830 a_text_not_void: a_text /= Void
831 do
832 editor_tool.text_area.set_editor_text (a_text)
833 ensure
834 --| FIXME This needs to work: text_assigned: text.is_equal (a_text)
835 --| FIXME changed_flag_set: changed
836 end
837
838 feature -- Window Properties
839
840 changed: BOOLEAN is
841 -- Has something been changed and not yet been saved?
842 do
843 Result := editor_tool.changed
844 end
845
846 is_empty: BOOLEAN is
847 -- Does `Current's text is empty?
848 do
849 Result := editor_tool = Void or else editor_tool.text_area.is_empty
850 end
851
852 text: STRING is
853 -- Text representing Current
854 do
855 Result := editor_tool.text_area.text
856 end
857
858 pixmap: EV_PIXMAP is
859 -- Pixmap representing Current window.
860 do
861 Result := Pixmaps.Icon_development_window
862 end
863
864 feature -- Pulldown Menus
865
866 metric_menu: EV_MENU
867 -- Menu for entries of metric tool.
868
869 format_menu: EV_MENU
870 -- ID Menu for formats.
871 -- Only used during debugging
872
873 compile_menu: EV_MENU
874 -- Compile ID menu.
875
876 debug_menu: EV_MENU
877 -- Debug ID menu.
878
879 debugging_tools_menu: EV_MENU
880 -- Debugging tools menu item
881
882 active_menus (erase: BOOLEAN) is
883 -- Enable all the menus and if `erase' clean
884 -- the content of the Project tool.
885 do
886 compile_menu.enable_sensitive
887 if erase then
888 output_manager.clear
889 end
890 end
891
892 disable_menus is
893 -- Disable all the menus.
894 do
895 compile_menu.disable_sensitive
896 end
897
898 update_debug_menu is
899 -- Update debug menu
900 do
901 Eb_debugger_manager.update_debugging_tools_menu_from (Current)
902 end
903
904 feature -- Modifiable menus
905
906 melt_menu_item: EV_MENU_ITEM
907 -- Melt menu entry
908
909 freeze_menu_item: EV_MENU_ITEM
910 -- Freeze menu entry
911
912 finalize_menu_item: EV_MENU_ITEM
913 -- Finalize menu entry
914
915 feature -- Update
916
917 synchronize is
918 -- Synchronize stones.
919 local
920 st: STONE
921 l_text_area: EB_SMART_EDITOR
922 do
923 during_synchronization := True
924 favorites_manager.refresh
925 context_tool.synchronize
926 cluster_tool.synchronize
927 history_manager.synchronize
928 features_tool.synchronize
929 breakpoints_tool.synchronize
930 -- Update main views
931 managed_main_formatters.i_th (2).invalidate
932 managed_main_formatters.i_th (3).invalidate
933 managed_main_formatters.i_th (4).invalidate
934 managed_main_formatters.i_th (5).invalidate
935 if stone /= Void then
936 st := stone.synchronized_stone
937 end
938 l_text_area := editor_tool.text_area
939 l_text_area.update_click_list (False)
940 if l_text_area.file_loaded then
941 editor_tool.text_area.check_document_modifications_and_reload
942 end
943 set_stone (st)
944 update_save_symbol
945 address_manager.refresh
946 during_synchronization := False
947 search_tool.rebuild_scope_list
948 end
949
950 synchronize_routine_tool_to_default is
951 -- Synchronize the editor tool to the debug format.
952 do
953 --| FIXME ARNAUD: To be implemented
954 end
955
956 clear_object_tool is
957 -- Clear the contents of the object tool if shown.
958 do
959 --| FIXME ARNAUD: To be implemented
960 end
961
962 build_menus is
963 -- Build all menus displayed in the development window.
964 do
965 -- Build each menu
966 build_file_menu
967 build_edit_menu
968 build_view_menu
969 build_favorites_menu
970 build_project_menu
971 build_debug_menu
972 build_tools_menu
973 build_window_menu
974 build_help_menu
975 -- Build the menu bar.
976 build_menu_bar
977 end
978
979 build_debug_menu is
980 -- Build the `Debug' menu through the debugger_manager.
981 local
982 conv_mit: EB_COMMAND_MENU_ITEM
983 do
984 debug_menu := Eb_debugger_manager.new_debug_menu
985 from
986 debug_menu.start
987 until
988 debug_menu.after
989 loop
990 conv_mit ?= debug_menu.item
991 if conv_mit /= Void then
992 add_recyclable (conv_mit)
993 end
994 debug_menu.forth
995 end
996 --| Debugging tools menu
997 debugging_tools_menu := Eb_debugger_manager.new_debugging_tools_menu
998 debug_menu.extend (create {EV_MENU_SEPARATOR})
999 debug_menu.extend (debugging_tools_menu)
1000 update_debug_menu
1001 end
1002
1003 build_menu_bar is
1004 -- Build the menu bar
1005 local
1006 mb: EV_MENU_BAR
1007 do
1008 check
1009 window.menu_bar /= Void implies not window.menu_bar.is_empty
1010 -- If a menu bar was already present, it shouldn't be empty.
1011 end
1012 if window.menu_bar /= Void then
1013 mb := window.menu_bar
1014 from
1015 mb.start
1016 mb.forth
1017 until
1018 mb.after
1019 loop
1020 mb.remove
1021 end
1022 else
1023 create mb
1024 window.set_menu_bar (mb)
1025 mb.extend (file_menu)
1026 end
1027
1028 if Eiffel_project.manager.is_created then
1029 mb.extend (edit_menu)
1030 mb.extend (view_menu)
1031 mb.extend (favorites_menu)
1032 mb.extend (project_menu)
1033 mb.extend (debug_menu)
1034 else
1035 mb.extend (view_menu)
1036 end
1037 mb.extend (tools_menu)
1038 mb.extend (window_menu)
1039 mb.extend (help_menu)
1040
1041 estudio_debug_cmd.attach_window (window)
1042 end
1043
1044 feature -- Graphical Interface
1045
1046 build_general_toolbar is
1047 -- Set up the general toolbar (New, Save, Search, Shell, Undo, Redo, ...)
1048 local
1049 cell: EV_CELL
1050 hsep: EV_HORIZONTAL_SEPARATOR
1051 hbox: EV_HORIZONTAL_BOX
1052 do
1053 -- Create the toolbar.
1054 create general_toolbar
1055 general_customizable_toolbar := development_window_data.retrieve_general_toolbar (toolbarable_commands)
1056 if development_window_data.show_text_in_general_toolbar then
1057 general_customizable_toolbar.enable_important_text
1058 elseif development_window_data.show_all_text_in_general_toolbar then
1059 general_customizable_toolbar.enable_text_displayed
1060 end
1061
1062 create hbox
1063 hbox.extend (general_customizable_toolbar.widget)
1064 hbox.disable_item_expand (general_customizable_toolbar.widget)
1065
1066 -- Generate the toolbar.
1067 general_customizable_toolbar.update_toolbar
1068
1069 -- Cell to fill in empty space and receive the right click menu holder.
1070 create cell
1071 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1072 hbox.extend (cell)
1073
1074 -- Create the vertical layout (separator + toolbar)
1075 create hsep
1076 general_toolbar.set_padding (2)
1077 general_toolbar.extend (hsep)
1078 general_toolbar.disable_item_expand (hsep)
1079 general_toolbar.extend (hbox)
1080
1081 -- Create the command to show/hide this toolbar.
1082 create show_general_toolbar_command.make (general_toolbar, Interface_names.m_general_toolbar)
1083 show_toolbar_commands.extend (show_general_toolbar_command)
1084 if development_window_data.show_general_toolbar then
1085 show_general_toolbar_command.enable_visible
1086 else
1087 show_general_toolbar_command.disable_visible
1088 end
1089
1090 end
1091
1092 build_address_toolbar is
1093 -- Set up the address toolbar (Back, Forward, Current, Class name, feature name, ...)
1094 local
1095 tb: EV_TOOL_BAR
1096 -- address_bar: EV_HORIZONTAL_BOX -- Contains "Class" + Combobox + "Feature" + Combobox + "Format" + Combobox
1097 hsep: EV_HORIZONTAL_SEPARATOR
1098 hbox: EV_HORIZONTAL_BOX -- Contains HistoryToolbar (back, forth, current) + `address_bar'
1099 cell: EV_CELL
1100 accel: EV_ACCELERATOR
1101 do
1102 -- Create the toolbar
1103 create address_toolbar
1104 create hsep
1105 create hbox
1106 -- create address_bar
1107 create tb
1108 address_toolbar.set_padding (2)
1109 address_toolbar.extend (hsep)
1110 address_toolbar.disable_item_expand (hsep)
1111 address_toolbar.extend (hbox)
1112
1113 hbox.extend (tb)
1114 hbox.disable_item_expand (tb)
1115 -- hbox.extend (address_bar)
1116 -- hbox.disable_item_expand (address_bar)
1117
1118 -- Back icon
1119 tb.extend (history_manager.back_command.new_toolbar_item (False))
1120
1121 -- Forward icon
1122 tb.extend (history_manager.forth_command.new_toolbar_item (False))
1123
1124 -- Set up the accelerators.
1125 create accel.make_with_key_combination (
1126 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_right), False, True, False
1127 )
1128 accel.actions.extend (agent on_forth)
1129 window.accelerators.extend (accel)
1130
1131 create accel.make_with_key_combination (
1132 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_left), False, True, False
1133 )
1134 accel.actions.extend (agent on_back)
1135 window.accelerators.extend (accel)
1136
1137 ------------------------------------------
1138 -- Address bar (Class name & feature name)
1139 ------------------------------------------
1140 hbox.extend (address_manager.widget)
1141 -- editor_tool.text_area.add_cursor_observer (address_manager)
1142
1143 -- Create the command to show/hide this toolbar.
1144 create show_address_toolbar_command.make (address_toolbar, Interface_names.m_address_toolbar)
1145 show_toolbar_commands.extend (show_address_toolbar_command)
1146
1147 if development_window_data.show_address_toolbar then
1148 show_address_toolbar_command.enable_visible
1149 else
1150 show_address_toolbar_command.disable_visible
1151 end
1152
1153 -- Cell to fill in empty space and receive the right click menu holder.
1154 create cell
1155 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1156 hbox.extend (cell)
1157 end
1158
1159 build_project_toolbar is
1160 -- Build toolbar corresponding to the project options bar
1161 local
1162 cell: EV_CELL
1163 hsep: EV_HORIZONTAL_SEPARATOR
1164 hbox: EV_HORIZONTAL_BOX
1165 do
1166 create project_toolbar
1167 create hsep
1168 project_toolbar.extend (hsep)
1169 project_toolbar.disable_item_expand (hsep)
1170
1171 -- Generate the toolbar.
1172 create hbox
1173 project_customizable_toolbar := Eb_debugger_manager.new_toolbar
1174 hbox.extend (project_customizable_toolbar.widget)
1175 hbox.disable_item_expand (project_customizable_toolbar.widget)
1176
1177 project_customizable_toolbar.update_toolbar
1178
1179 -- Create the command to show/hide this toolbar.
1180 create show_project_toolbar_command.make (project_toolbar, Interface_names.m_project_toolbar)
1181 show_toolbar_commands.extend (show_project_toolbar_command)
1182 if development_window_data.show_project_toolbar then
1183 show_project_toolbar_command.enable_visible
1184 else
1185 show_project_toolbar_command.disable_visible
1186 end
1187
1188 -- Cell to fill in empty space and receive the right click menu holder.
1189 create cell
1190 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1191 hbox.extend (cell)
1192 project_toolbar.extend (hbox)
1193 end
1194
1195 build_refactoring_toolbar is
1196 -- Build refactoring toolbar.
1197 local
1198 cell: EV_CELL
1199 hsep: EV_HORIZONTAL_SEPARATOR
1200 hbox: EV_HORIZONTAL_BOX
1201 do
1202 -- Create the toolbar.
1203 create refactoring_toolbar
1204 refactoring_customizable_toolbar := development_window_data.retrieve_refactoring_toolbar (toolbarable_commands)
1205 if development_window_data.show_text_in_refactoring_toolbar then
1206 refactoring_customizable_toolbar.enable_important_text
1207 elseif development_window_data.show_all_text_in_refactoring_toolbar then
1208 refactoring_customizable_toolbar.enable_text_displayed
1209 end
1210
1211 create hbox
1212 hbox.extend (refactoring_customizable_toolbar.widget)
1213 hbox.disable_item_expand (refactoring_customizable_toolbar.widget)
1214
1215 -- Generate the toolbar.
1216 refactoring_customizable_toolbar.update_toolbar
1217
1218 -- Cell to fill in empty space and receive the right click menu holder.
1219 create cell
1220 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1221 hbox.extend (cell)
1222
1223 -- Create the vertical layout (separator + toolbar)
1224 create hsep
1225 refactoring_toolbar.set_padding (2)
1226 refactoring_toolbar.extend (hsep)
1227 refactoring_toolbar.disable_item_expand (hsep)
1228 refactoring_toolbar.extend (hbox)
1229
1230 -- Create the command to show/hide this toolbar.
1231 create show_refactoring_toolbar_command.make (refactoring_toolbar, Interface_names.m_refactoring_toolbar)
1232 show_toolbar_commands.extend (show_refactoring_toolbar_command)
1233 if development_window_data.show_refactoring_toolbar then
1234 show_refactoring_toolbar_command.enable_visible
1235 else
1236 show_refactoring_toolbar_command.disable_visible
1237 end
1238 end
1239
1240
1241 feature {NONE} -- Menu Building
1242
1243 build_file_menu is
1244 -- Build the file menu.
1245 local
1246 new_project_cmd: EB_NEW_PROJECT_COMMAND
1247 open_project_cmd: EB_OPEN_PROJECT_COMMAND
1248 send_to_menu: EV_MENU
1249 menu_item: EV_MENU_ITEM
1250 command_menu_item: EB_COMMAND_MENU_ITEM
1251 do
1252 create file_menu.make_with_text (Interface_names.m_file)
1253
1254 -- New
1255 command_menu_item := New_development_window_cmd.new_menu_item
1256 add_recyclable (command_menu_item)
1257 file_menu.extend (command_menu_item)
1258
1259 -- New editor
1260 command_menu_item := New_editor_cmd.new_menu_item
1261 add_recyclable (command_menu_item)
1262 file_menu.extend (command_menu_item)
1263
1264 -- New context tool
1265 command_menu_item := New_context_tool_cmd.new_menu_item
1266 add_recyclable (command_menu_item)
1267 file_menu.extend (command_menu_item)
1268
1269 -- Open
1270 command_menu_item := open_cmd.new_menu_item
1271 add_recyclable (command_menu_item)
1272 file_menu.extend (command_menu_item)
1273
1274 -- Close
1275 create menu_item.make_with_text (Interface_names.m_close)
1276 menu_item.select_actions.extend (agent destroy)
1277 file_menu.extend (menu_item)
1278
1279 -- Separator --------------------------------------
1280 file_menu.extend (create {EV_MENU_SEPARATOR})
1281
1282 -- Save
1283 command_menu_item := save_cmd.new_menu_item
1284 add_recyclable (command_menu_item)
1285 file_menu.extend (command_menu_item)
1286
1287 -- Save as
1288 command_menu_item := save_as_cmd.new_menu_item
1289 add_recyclable (command_menu_item)
1290 file_menu.extend (command_menu_item)
1291
1292 -- Sent to
1293 create send_to_menu.make_with_text (Interface_names.m_send_to)
1294 -- External editor
1295 command_menu_item := shell_cmd.new_menu_item
1296 add_recyclable (command_menu_item)
1297 send_to_menu.extend (command_menu_item)
1298 file_menu.extend (send_to_menu)
1299
1300 -- Separator --------------------------------------
1301 file_menu.extend (create {EV_MENU_SEPARATOR})
1302 command_menu_item := print_cmd.new_menu_item
1303 add_recyclable (command_menu_item)
1304 file_menu.extend (command_menu_item)
1305
1306 -- Separator --------------------------------------
1307 file_menu.extend (create {EV_MENU_SEPARATOR})
1308
1309 -- New Project
1310 create new_project_cmd.make_with_parent (window)
1311 create menu_item.make_with_text (Interface_names.m_new_project)
1312 menu_item.select_actions.extend (agent new_project_cmd.execute)
1313 file_menu.extend (menu_item)
1314
1315 -- Open Project
1316 create open_project_cmd.make_with_parent (window)
1317 create menu_item.make_with_text (Interface_names.m_open_project)
1318 menu_item.select_actions.extend (agent open_project_cmd.execute)
1319 file_menu.extend (menu_item)
1320
1321 -- Recent Projects
1322 recent_projects_menu := recent_projects_manager.new_menu
1323 add_recyclable (recent_projects_menu)
1324 file_menu.extend (recent_projects_menu)
1325
1326 -- Separator --------------------------------------
1327 file_menu.extend (create {EV_MENU_SEPARATOR})
1328
1329 -- Exit
1330 command_menu_item := Exit_application_cmd.new_menu_item
1331 add_recyclable (Command_menu_item)
1332 file_menu.extend (command_menu_item)
1333 end
1334
1335 build_class_info_menu: EV_MENU is
1336 -- Build the class format sub-menu.
1337 local
1338 form: EB_CLASS_INFO_FORMATTER
1339 empty_menu: EV_MENU_ITEM
1340 i: INTEGER
1341 do
1342 create Result.make_with_text (Interface_names.m_class_info)
1343 i := 1
1344
1345 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1346 i := i + 1
1347 empty_menu.disable_sensitive
1348 Result.extend (empty_menu)
1349 from
1350 managed_class_formatters.start
1351 until
1352 managed_class_formatters.after
1353 loop
1354 form := managed_class_formatters.item
1355 if form /= Void then
1356 Result.extend (form.new_menu_item)
1357 else
1358 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1359 i := i + 1
1360 empty_menu.disable_sensitive
1361 Result.extend (empty_menu)
1362 end
1363 managed_class_formatters.forth
1364 end
1365 end
1366
1367 build_feature_info_menu: EV_MENU is
1368 -- Build the feature format sub-menu.
1369 local
1370 form: EB_FEATURE_INFO_FORMATTER
1371 do
1372 create Result.make_with_text (Interface_names.m_feature_info)
1373 from
1374 managed_feature_formatters.start
1375 until
1376 managed_feature_formatters.after
1377 loop
1378 form := managed_feature_formatters.item
1379 if form /= Void then
1380 Result.extend (form.new_menu_item)
1381 end
1382 managed_feature_formatters.forth
1383 end
1384 end
1385
1386 build_edit_menu is
1387 -- Create and build `edit_menu'
1388 local
1389 command_menu_item: EB_COMMAND_MENU_ITEM
1390 sub_menu: EV_MENU
1391 cmd: EB_EDITOR_COMMAND
1392 os_cmd: EB_ON_SELECTION_COMMAND
1393 editor: EB_SMART_EDITOR
1394 ln_cmd: EB_TOGGLE_LINE_NUMBERS_COMMAND
1395 do
1396 editor := editor_tool.text_area
1397 create command_controller.make
1398
1399 create edit_menu.make_with_text (Interface_names.m_edit)
1400
1401 -- Undo
1402 command_menu_item := undo_cmd.new_menu_item
1403 add_recyclable (command_menu_item)
1404 edit_menu.extend (command_menu_item)
1405
1406 -- Redo
1407 command_menu_item := redo_cmd.new_menu_item
1408 add_recyclable (command_menu_item)
1409 edit_menu.extend (command_menu_item)
1410
1411 -- Separator --------------------------------------
1412 edit_menu.extend (create {EV_MENU_SEPARATOR})
1413
1414 -- Cut
1415 create os_cmd.make (Current)
1416 os_cmd.set_menu_name (Interface_names.M_cut)
1417 os_cmd.set_pixmap (pixmaps.icon_pixmaps.general_cut_icon)
1418 os_cmd.set_name ("Editor_cut")
1419 os_cmd.set_tooltip (interface_names.f_cut)
1420 os_cmd.add_agent (agent cut_selection)
1421 os_cmd.set_tooltext (Interface_names.b_cut)
1422 toolbarable_commands.extend (os_cmd)
1423 os_cmd.set_needs_editable (True)
1424 command_controller.add_selection_command (os_cmd)
1425 command_menu_item := os_cmd.new_menu_item
1426 add_recyclable (command_menu_item)
1427 edit_menu.extend (command_menu_item)
1428
1429 -- Copy
1430 create os_cmd.make (Current)
1431 os_cmd.set_menu_name (Interface_names.M_copy)
1432 os_cmd.set_pixmap (pixmaps.icon_pixmaps.general_copy_icon)
1433 os_cmd.set_name ("Editor_copy")
1434 os_cmd.set_tooltip (interface_names.f_copy)
1435 os_cmd.set_tooltext (Interface_names.b_copy)
1436 os_cmd.add_agent (agent copy_selection)
1437 toolbarable_commands.extend (os_cmd)
1438 os_cmd.set_needs_editable (False)
1439 command_controller.add_selection_command (os_cmd)
1440 command_menu_item := os_cmd.new_menu_item
1441 add_recyclable (command_menu_item)
1442 edit_menu.extend (command_menu_item)
1443
1444 -- Paste
1445 command_menu_item := editor_paste_cmd.new_menu_item
1446 add_recyclable (command_menu_item)
1447 edit_menu.extend (command_menu_item)
1448
1449 -- Separator --------------------------------------
1450 edit_menu.extend (create {EV_MENU_SEPARATOR})
1451
1452 -- Select all
1453 create cmd.make
1454 cmd.set_menu_name (Interface_names.m_select_all)
1455 cmd.add_agent (agent select_all)
1456 command_menu_item := cmd.new_menu_item
1457 command_controller.add_edition_command (cmd)
1458 add_recyclable (command_menu_item)
1459 edit_menu.extend (command_menu_item)
1460
1461 -- Separator --------------------------------------
1462 edit_menu.extend (create {EV_MENU_SEPARATOR})
1463
1464 -- Line numbers
1465 create ln_cmd.make
1466 command_menu_item := ln_cmd.new_menu_item
1467 add_recyclable (command_menu_item)
1468 edit_menu.extend (command_menu_item)
1469 window.accelerators.extend (ln_cmd.accelerator)
1470
1471
1472 -- Separator --------------------------------------
1473 edit_menu.extend (create {EV_MENU_SEPARATOR})
1474
1475 -- Search
1476 create cmd.make
1477 cmd.set_menu_name (Interface_names.m_search + "%T" + preferences.editor_data.shortcuts.item ("show_search_panel").display_string)
1478 cmd.add_agent (agent search)
1479 command_menu_item := cmd.new_menu_item
1480 command_controller.add_edition_command (cmd)
1481 add_recyclable (command_menu_item)
1482 edit_menu.extend (command_menu_item)
1483
1484 -- Go to
1485 create cmd.make
1486 cmd.set_menu_name (Interface_names.m_go_to)
1487 cmd.add_agent (agent goto)
1488 cmd.set_needs_editable (True)
1489 command_menu_item := cmd.new_menu_item
1490 command_controller.add_edition_command (cmd)
1491 add_recyclable (command_menu_item)
1492 edit_menu.extend (command_menu_item)
1493
1494 -- Replace
1495 create cmd.make
1496 cmd.set_menu_name (Interface_names.m_replace + "%T" + preferences.editor_data.shortcuts.item ("show_search_and_replace_panel").display_string)
1497 cmd.add_agent (agent editor.replace)
1498 cmd.set_needs_editable (True)
1499 command_menu_item := cmd.new_menu_item
1500 command_controller.add_edition_command (cmd)
1501 add_recyclable (command_menu_item)
1502 edit_menu.extend (command_menu_item)
1503
1504 -- Find sub menu
1505
1506 create sub_menu.make_with_text (Interface_names.m_find)
1507
1508 -- Find next
1509 create cmd.make
1510 cmd.set_menu_name (Interface_names.m_find_next + "%T" + preferences.editor_data.shortcuts.item ("search_last").display_string)
1511 cmd.add_agent (agent find_next)
1512 command_menu_item := cmd.new_menu_item
1513 command_controller.add_edition_command (cmd)
1514 add_recyclable (command_menu_item)
1515 sub_menu.extend (command_menu_item)
1516
1517 -- Find previous
1518 create cmd.make
1519 cmd.set_menu_name (Interface_names.m_find_previous + "%T" + preferences.editor_data.shortcuts.item ("search_backward").display_string)
1520 cmd.add_agent (agent find_previous)
1521 command_menu_item := cmd.new_menu_item
1522 command_controller.add_edition_command (cmd)
1523 add_recyclable (command_menu_item)
1524 sub_menu.extend (command_menu_item)
1525
1526 -- Find selection
1527 create os_cmd.make (Current)
1528 os_cmd.set_menu_name (Interface_names.m_find_selection + "%T" + preferences.editor_data.shortcuts.item ("search_selection").display_string)
1529 os_cmd.add_agent (agent find_selection)
1530 command_menu_item := os_cmd.new_menu_item
1531 command_controller.add_selection_command (os_cmd)
1532 add_recyclable (command_menu_item)
1533 sub_menu.extend (command_menu_item)
1534
1535 edit_menu.extend (sub_menu)
1536
1537
1538 -- Separator --------------------------------------
1539 edit_menu.extend (create {EV_MENU_SEPARATOR})
1540
1541 create sub_menu.make_with_text (Interface_names.m_advanced)
1542
1543 create os_cmd.make (Current)
1544 os_cmd.set_needs_editable (True)
1545 command_controller.add_selection_command (os_cmd)
1546 os_cmd.set_menu_name (Interface_names.m_indent)
1547 os_cmd.add_agent (agent editor.indent_selection)
1548 command_menu_item := os_cmd.new_menu_item
1549 add_recyclable (command_menu_item)
1550 sub_menu.extend (command_menu_item)
1551
1552 create os_cmd.make (Current)
1553 os_cmd.set_needs_editable (True)
1554 command_controller.add_selection_command (os_cmd)
1555 os_cmd.set_menu_name (Interface_names.m_unindent)
1556 os_cmd.add_agent (agent editor.unindent_selection)
1557 command_menu_item := os_cmd.new_menu_item
1558 add_recyclable (command_menu_item)
1559 sub_menu.extend (command_menu_item)
1560
1561 create os_cmd.make (Current)
1562 os_cmd.set_needs_editable (True)
1563 command_controller.add_selection_command (os_cmd)
1564 os_cmd.set_menu_name (Interface_names.m_to_lower)
1565 os_cmd.add_agent (agent editor.set_selection_case (True))
1566 command_menu_item := os_cmd.new_menu_item
1567 add_recyclable (command_menu_item)
1568 sub_menu.extend (command_menu_item)
1569
1570 create os_cmd.make (Current)
1571 os_cmd.set_needs_editable (True)
1572 command_controller.add_selection_command (os_cmd)
1573 os_cmd.set_menu_name (Interface_names.m_to_upper)
1574 os_cmd.add_agent (agent editor.set_selection_case (False))
1575 command_menu_item := os_cmd.new_menu_item
1576 add_recyclable (command_menu_item)
1577 sub_menu.extend (command_menu_item)
1578
1579 create cmd.make
1580 cmd.set_needs_editable (True)
1581 cmd.set_menu_name (Interface_names.m_comment)
1582 cmd.add_agent (agent editor.comment_selection)
1583 command_menu_item := cmd.new_menu_item
1584 command_controller.add_edition_command (cmd)
1585 add_recyclable (command_menu_item)
1586 sub_menu.extend (command_menu_item)
1587
1588 create cmd.make
1589 cmd.set_needs_editable (True)
1590 cmd.set_menu_name (Interface_names.m_uncomment)
1591 cmd.add_agent (agent editor.uncomment_selection)
1592 command_menu_item := cmd.new_menu_item
1593 command_controller.add_edition_command (cmd)
1594 add_recyclable (command_menu_item)
1595 sub_menu.extend (command_menu_item)
1596
1597 -- Separator --------------------------------------
1598 sub_menu.extend (create {EV_MENU_SEPARATOR})
1599
1600 -- Insert if block
1601 create cmd.make
1602 cmd.set_needs_editable (True)
1603 cmd.set_menu_name (Interface_names.m_if_block)
1604 cmd.add_agent (agent editor.embed_in_block("if then", 3))
1605 command_menu_item := cmd.new_menu_item
1606 command_controller.add_edition_command (cmd)
1607 add_recyclable (command_menu_item)
1608 sub_menu.extend (command_menu_item)
1609
1610 -- Insert debug block
1611 create cmd.make
1612 cmd.set_needs_editable (True)
1613 cmd.set_menu_name (Interface_names.m_debug_block)
1614 cmd.add_agent (agent editor.embed_in_block("debug", 5))
1615 command_menu_item := cmd.new_menu_item
1616 command_controller.add_edition_command (cmd)
1617 add_recyclable (command_menu_item)
1618 sub_menu.extend (command_menu_item)
1619
1620
1621 -- Separator --------------------------------------
1622 sub_menu.extend (create {EV_MENU_SEPARATOR})
1623
1624 -- Complete word
1625 create cmd.make
1626 cmd.set_needs_editable (True)
1627 cmd.set_menu_name (Interface_names.m_complete_word + "%T" + preferences.editor_data.shortcuts.item ("autocomplete").display_string)
1628 command_menu_item := cmd.new_menu_item
1629 command_controller.add_edition_command (cmd)
1630 cmd.add_agent (agent editor.complete_feature_name)
1631
1632 add_recyclable (command_menu_item)
1633 sub_menu.extend (command_menu_item)
1634
1635 -- Complete class name
1636 create cmd.make
1637 cmd.set_needs_editable (True)
1638 cmd.set_menu_name (Interface_names.m_complete_class_name + "%T" + preferences.editor_data.shortcuts.item ("class_autocomplete").display_string)
1639 command_menu_item := cmd.new_menu_item
1640 command_controller.add_edition_command (cmd)
1641 cmd.add_agent (agent editor.complete_class_name)
1642
1643 add_recyclable (command_menu_item)
1644 sub_menu.extend (command_menu_item)
1645
1646 sub_menu.extend (create {EV_MENU_SEPARATOR})
1647
1648 -- show/hide formatting marks.
1649 create cmd.make
1650 if editor_tool.text_area.view_invisible_symbols then
1651 cmd.set_menu_name (Interface_names.m_hide_formatting_marks)
1652 else
1653 cmd.set_menu_name (Interface_names.m_show_formatting_marks)
1654 end
1655 formatting_marks_command_menu_item := cmd.new_menu_item
1656 command_controller.add_edition_command (cmd)
1657 cmd.add_agent (agent toggle_formatting_marks)
1658
1659 add_recyclable (formatting_marks_command_menu_item)
1660 sub_menu.extend (formatting_marks_command_menu_item)
1661
1662 edit_menu.extend (sub_menu)
1663 end
1664
1665 build_view_menu is
1666 -- Build the view menu.
1667 local
1668 form: EB_CLASS_INFO_FORMATTER
1669 new_menu_item: EB_COMMAND_MENU_ITEM
1670 new_basic_item: EV_MENU_ITEM
1671 do
1672 Precursor
1673
1674 new_menu_item := toggle_stone_cmd.new_menu_item
1675 view_menu.extend (new_menu_item)
1676 add_recyclable (new_menu_item)
1677
1678 new_menu_item := send_stone_to_context_cmd.new_menu_item
1679 view_menu.extend (new_menu_item)
1680 add_recyclable (new_menu_item)
1681 -- Go to menu
1682 new_basic_item := history_manager.new_menu
1683 view_menu.extend (new_basic_item)
1684
1685 -- Separator --------------------------------------
1686 view_menu.extend (create {EV_MENU_SEPARATOR})
1687 view_menu.extend (build_class_info_menu)
1688 view_menu.extend (build_feature_info_menu)
1689
1690 -- Separator --------------------------------------
1691 view_menu.extend (create {EV_MENU_SEPARATOR})
1692
1693 from
1694 managed_main_formatters.start
1695 until
1696 managed_main_formatters.after
1697 loop
1698 form := managed_main_formatters.item
1699 new_basic_item := form.new_menu_item
1700 new_basic_item.select_actions.put_front (agent form.invalidate)
1701 view_menu.extend (new_basic_item)
1702 --add_recyclable (new_basic_item)
1703 managed_main_formatters.forth
1704 end
1705 end
1706
1707 build_favorites_menu is
1708 -- Build the favorites menu
1709 do
1710 Precursor {EB_TOOL_MANAGER}
1711
1712 create show_favorites_menu_item
1713 update_show_favorites_menu_item
1714 show_favorites_menu_item.select_actions.extend (agent execute_show_favorites)
1715
1716 favorites_menu.start
1717 favorites_menu.put_right (show_favorites_menu_item)
1718 favorites_menu.select_actions.extend (agent update_show_favorites_menu_item)
1719 end
1720
1721 -- Jason Wei modified the following on Aug 31 2005
1722 build_project_menu is
1723 -- Build the project menu.
1724 local
1725 command_menu_item: EB_COMMAND_MENU_ITEM
1726 do
1727 create project_menu.make_with_text (Interface_names.m_project)
1728
1729 -- Melt
1730 command_menu_item := Melt_project_cmd.new_menu_item
1731 add_recyclable (command_menu_item)
1732 project_menu.extend (command_menu_item)
1733
1734 -- Quick melt
1735 command_menu_item := Quick_melt_project_cmd.new_menu_item
1736 add_recyclable (command_menu_item)
1737 project_menu.extend (command_menu_item)
1738
1739 -- Freeze
1740 command_menu_item := Freeze_project_cmd.new_menu_item
1741 add_recyclable (command_menu_item)
1742 project_menu.extend (command_menu_item)
1743
1744 -- Finalize
1745 command_menu_item := Finalize_project_cmd.new_menu_item
1746 add_recyclable (command_menu_item)
1747 project_menu.extend (command_menu_item)
1748
1749 -- Precompile
1750 command_menu_item := precompilation_cmd.new_menu_item
1751 add_recyclable (command_menu_item)
1752 project_menu.extend (command_menu_item)
1753
1754 -- Cancel
1755 command_menu_item := project_cancel_cmd.new_menu_item
1756 add_recyclable (command_menu_item)
1757 project_menu.extend (command_menu_item)
1758
1759 -- Separator -------------------------------------------------
1760 project_menu.extend (create {EV_MENU_SEPARATOR})
1761
1762 -- Compile Workbench C code
1763 command_menu_item := c_workbench_compilation_cmd.new_menu_item
1764 add_recyclable (command_menu_item)
1765 project_menu.extend (command_menu_item)
1766
1767 -- Compile Finalized C code
1768 command_menu_item := c_finalized_compilation_cmd.new_menu_item
1769 add_recyclable (command_menu_item)
1770 project_menu.extend (command_menu_item)
1771
1772 -- Jason Wei
1773 -- Terminate C compilation
1774 command_menu_item := Terminate_c_compilation_cmd.new_menu_item
1775 add_recyclable (command_menu_item)
1776 project_menu.extend (command_menu_item)
1777 -- Jason Wei
1778
1779 -- Execute Finalized code
1780 command_menu_item := run_finalized_cmd.new_menu_item
1781 add_recyclable (command_menu_item)
1782 project_menu.extend (command_menu_item)
1783
1784 -- Separator -------------------------------------------------
1785 project_menu.extend (create {EV_MENU_SEPARATOR})
1786
1787 -- System Tool window
1788 command_menu_item := system_cmd.new_menu_item
1789 add_recyclable (command_menu_item)
1790 project_menu.extend (command_menu_item)
1791
1792 -- System information
1793 command_menu_item := system_info_cmd.new_menu_item
1794 add_recyclable (command_menu_item)
1795 project_menu.extend (command_menu_item)
1796
1797 -- Error information
1798 command_menu_item := display_error_help_cmd.new_menu_item
1799 add_recyclable (command_menu_item)
1800 project_menu.extend (command_menu_item)
1801
1802 if has_documentation_generation or has_xmi_generation then
1803 -- Separator -------------------------------------------------
1804 project_menu.extend (create {EV_MENU_SEPARATOR})
1805 end
1806
1807 if has_documentation_generation then
1808 -- Generate Documentation
1809 command_menu_item := document_cmd.new_menu_item
1810 add_recyclable (command_menu_item)
1811 project_menu.extend (command_menu_item)
1812 end
1813
1814 if has_xmi_generation then
1815 -- Export XMI
1816 command_menu_item := export_cmd.new_menu_item
1817 add_recyclable (command_menu_item)
1818 project_menu.extend (command_menu_item)
1819 end
1820 end
1821
1822 ------- This is the original version
1823 -- build_project_menu is
1824 -- -- Build the project menu.
1825 -- local
1826 -- command_menu_item: EB_COMMAND_MENU_ITEM
1827 -- do
1828 -- create project_menu.make_with_text (Interface_names.m_project)
1829 --
1830 -- -- Melt
1831 -- command_menu_item := Melt_project_cmd.new_menu_item
1832 -- add_recyclable (command_menu_item)
1833 -- project_menu.extend (command_menu_item)
1834 --
1835 -- -- Quick melt
1836 -- command_menu_item := Quick_melt_project_cmd.new_menu_item
1837 -- add_recyclable (command_menu_item)
1838 -- project_menu.extend (command_menu_item)
1839 --
1840 -- -- Freeze
1841 -- command_menu_item := Freeze_project_cmd.new_menu_item
1842 -- add_recyclable (command_menu_item)
1843 -- project_menu.extend (command_menu_item)
1844 --
1845 -- -- Finalize
1846 -- command_menu_item := Finalize_project_cmd.new_menu_item
1847 -- add_recyclable (command_menu_item)
1848 -- project_menu.extend (command_menu_item)
1849 --
1850 -- -- Precompile
1851 -- command_menu_item := precompilation_cmd.new_menu_item
1852 -- add_recyclable (command_menu_item)
1853 -- project_menu.extend (command_menu_item)
1854 --
1855 -- -- Separator -------------------------------------------------
1856 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1857 --
1858 -- -- Compile Workbench C code
1859 -- command_menu_item := c_workbench_compilation_cmd.new_menu_item
1860 -- add_recyclable (command_menu_item)
1861 -- project_menu.extend (command_menu_item)
1862 --
1863 -- -- Compile Finalized C code
1864 -- command_menu_item := c_finalized_compilation_cmd.new_menu_item
1865 -- add_recyclable (command_menu_item)
1866 -- project_menu.extend (command_menu_item)
1867 --
1868 -- -- Execute Finalized code
1869 -- command_menu_item := run_finalized_cmd.new_menu_item
1870 -- add_recyclable (command_menu_item)
1871 -- project_menu.extend (command_menu_item)
1872 --
1873 -- -- Separator -------------------------------------------------
1874 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1875 --
1876 -- -- System Tool window
1877 -- command_menu_item := system_cmd.new_menu_item
1878 -- add_recyclable (command_menu_item)
1879 -- project_menu.extend (command_menu_item)
1880 --
1881 -- -- System information
1882 -- command_menu_item := system_info_cmd.new_menu_item
1883 -- add_recyclable (command_menu_item)
1884 -- project_menu.extend (command_menu_item)
1885 --
1886 -- -- Error information
1887 -- command_menu_item := display_error_help_cmd.new_menu_item
1888 -- add_recyclable (command_menu_item)
1889 -- project_menu.extend (command_menu_item)
1890 --
1891 -- if has_documentation_generation or has_xmi_generation then
1892 -- -- Separator -------------------------------------------------
1893 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1894 -- end
1895 --
1896 -- if has_documentation_generation then
1897 -- -- Generate Documentation
1898 -- command_menu_item := document_cmd.new_menu_item
1899 -- add_recyclable (command_menu_item)
1900 -- project_menu.extend (command_menu_item)
1901 -- end
1902 --
1903 -- if has_xmi_generation then
1904 -- -- Export XMI
1905 -- command_menu_item := export_cmd.new_menu_item
1906 -- add_recyclable (command_menu_item)
1907 -- project_menu.extend (command_menu_item)
1908 -- end
1909 -- end
1910 -- Jason Wei modified the above on Aug 31 2005
1911
1912 build_tools_menu is
1913 -- Create and build `tools_menu'
1914 local
1915 command_menu_item: EB_COMMAND_MENU_ITEM
1916 menu_item: EV_MENU_ITEM
1917 do
1918 create tools_menu.make_with_text (Interface_names.m_tools)
1919
1920 -- New Cluster command.
1921 command_menu_item := new_cluster_cmd.new_menu_item
1922 add_recyclable (command_menu_item)
1923 tools_menu.extend (command_menu_item)
1924
1925 -- New Class command.
1926 command_menu_item := new_class_cmd.new_menu_item
1927 add_recyclable (command_menu_item)
1928 tools_menu.extend (command_menu_item)
1929
1930 -- New Feature command.
1931 command_menu_item := new_feature_cmd.new_menu_item
1932 add_recyclable (command_menu_item)
1933 tools_menu.extend (command_menu_item)
1934
1935 -- Delete class/cluster command.
1936 command_menu_item := delete_class_cluster_cmd.new_menu_item
1937 add_recyclable (command_menu_item)
1938 tools_menu.extend (command_menu_item)
1939
1940 -- Separator --------------------------------------
1941 tools_menu.extend (create {EV_MENU_SEPARATOR})
1942
1943
1944 if has_metrics then
1945 -- Metric tool
1946 create metric_menu.make_with_text (interface_names.metric_metrics)
1947 create menu_item.make_with_text (interface_names.metric_calculate)
1948 metric_menu.extend (menu_item)
1949 create menu_item.make_with_text (interface_names.metric_add)
1950 metric_menu.extend (menu_item)
1951 create menu_item.make_with_text (interface_names.metric_delete)
1952 metric_menu.extend (menu_item)
1953 create menu_item.make_with_text (interface_names.metric_details)
1954 metric_menu.extend (menu_item)
1955 create menu_item.make_with_text (interface_names.metric_new_metrics)
1956 metric_menu.extend (menu_item)
1957 create menu_item.make_with_text (interface_names.metric_management)
1958 metric_menu.extend (menu_item)
1959 create menu_item.make_with_text (interface_names.metric_archive)
1960 metric_menu.extend (menu_item)
1961 metric_menu.disable_sensitive
1962 tools_menu.extend (metric_menu)
1963 end
1964
1965 if has_profiler then
1966 -- Profiler Window
1967 command_menu_item := show_profiler.new_menu_item
1968 add_recyclable (command_menu_item)
1969 tools_menu.extend (command_menu_item)
1970 end
1971
1972 -- Precompile Wizard
1973 command_menu_item := wizard_precompile_cmd.new_menu_item
1974 add_recyclable (command_menu_item)
1975 tools_menu.extend (command_menu_item)
1976
1977 if has_dll_generation then
1978 -- Dynamic Library Window
1979 command_menu_item := show_dynamic_lib_tool.new_menu_item
1980 add_recyclable (command_menu_item)
1981 tools_menu.extend (command_menu_item)
1982 end
1983
1984 -- Separator -------------------------------------------------
1985 tools_menu.extend (create {EV_MENU_SEPARATOR})
1986
1987 -- Preferences
1988 command_menu_item := Show_preferences_cmd.new_menu_item
1989 add_recyclable (command_menu_item)
1990 tools_menu.extend (command_menu_item)
1991
1992 -- External commands editor
1993 command_menu_item := Edit_external_commands_cmd.new_menu_item
1994 add_recyclable (command_menu_item)
1995 tools_menu.extend (command_menu_item)
1996
1997 rebuild_tools_menu
1998 end
1999
2000 feature -- Stone process
2001
2002 stone: STONE
2003 -- Current stone
2004
2005 toggle_unified_stone is
2006 -- Change the stone management mode.
2007 do
2008 unified_stone := not unified_stone
2009 if unified_stone then
2010 send_stone_to_context
2011 send_stone_to_context_cmd.disable_sensitive
2012 context_tool.link_to_development_window
2013 else
2014 if stone /= Void then
2015 send_stone_to_context_cmd.enable_sensitive
2016 end
2017 context_tool.cut_from_development_window
2018 end
2019 end
2020
2021 set_stone (a_stone: STONE) is
2022 -- Change the currently focused stone.
2023 local
2024 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
2025 cv_cst: CLASSI_STONE
2026 ef_stone: EXTERNAL_FILE_STONE
2027 l: LIST [EB_DEVELOPMENT_WINDOW]
2028 l_filename: STRING
2029 do
2030 cv_cst ?= a_stone
2031 if cv_cst /= Void then
2032 l_filename := cv_cst.class_i.name
2033 else
2034 ef_stone ?= a_stone
2035 if ef_stone /= Void then
2036 l_filename := ef_stone.file_name.string
2037 end
2038 end
2039
2040 if cv_cst /= Void or ef_stone /= Void then
2041 l := Window_manager.development_windows_with_class (l_filename)
2042 if l.is_empty or else l.has (Current) then
2043 -- We're not editing the class in another window.
2044 set_stone_after_first_check (a_stone)
2045 else
2046 create cd.make_initialized (2,
2047 preferences.dialog_data.already_editing_class_string,
2048 warning_messages.w_class_already_edited,
2049 Interface_names.l_do_not_show_again,
2050 preferences.preferences)
2051 cd.set_ok_action (agent set_stone_after_first_check (a_stone))
2052 cd.show_modal_to_window (window)
2053 end
2054 else
2055 set_stone_after_first_check (a_stone)
2056 end
2057 end
2058
2059 set_stone_after_first_check (a_stone: STONE) is
2060 -- Display text associated with `a_stone', if any and if possible
2061 local
2062 feature_stone: FEATURE_STONE
2063 old_class_stone: CLASSI_STONE
2064 test_stone: CLASSI_STONE
2065 same_class: BOOLEAN
2066 conv_ferrst: FEATURE_ERROR_STONE
2067 ef_stone: EXTERNAL_FILE_STONE
2068 cluster_st: CLUSTER_STONE
2069 new_class_stone: CLASSI_STONE
2070 conv_ace: ACE_SYNTAX_STONE
2071 conv_errst: ERROR_STONE
2072 conv_brkstone: BREAKABLE_STONE
2073 do
2074 old_class_stone ?= stone
2075 feature_stone ?= a_stone
2076 ef_stone ?= a_stone
2077 new_class_stone ?= a_stone
2078 cluster_st ?= a_stone
2079
2080 -- Update the history.
2081 conv_brkstone ?= a_stone
2082 conv_errst ?= a_stone
2083 conv_ace ?= a_stone
2084 if
2085 conv_brkstone = Void and
2086 conv_errst = Void and
2087 conv_ace = Void and
2088 ef_stone = Void
2089 then
2090 if
2091 new_class_stone /= Void
2092 then
2093 history_manager.extend (new_class_stone)
2094 elseif
2095 cluster_st /= Void
2096 then
2097 history_manager.extend (cluster_st)
2098 end
2099 end
2100
2101 if old_class_stone /= Void then
2102 create test_stone.make (old_class_stone.class_i)
2103 same_class := test_stone.same_as (a_stone)
2104 -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
2105 -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
2106 -- we have a CLASSI_STONE.
2107 if same_class and then feature_stone /= Void then
2108 same_class := False
2109 -- if the stone corresponding to a feature of currently opened class is dropped
2110 -- we attempt to scroll to the feature without asking to save the file
2111 -- except if it is during a resynchronization, in which case we do not scroll at all.
2112 if editor_tool.text_area.text_is_fully_loaded then
2113 if not during_synchronization then
2114 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
2115 feature_stone_already_processed := True
2116 else
2117 feature_stone_already_processed := True
2118 end
2119 conv_ferrst ?= feature_stone
2120 if feature_stone_already_processed and conv_ferrst /= Void then
2121 -- Scroll to the line of the error.
2122 if not during_synchronization then
2123 editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2124 end
2125 end
2126 end
2127 end
2128 elseif ef_stone /= Void then
2129 end
2130
2131 -- first, let's check if there is already something in this window
2132 -- if there's nothing, there's no need to save anything...
2133 if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
2134 set_stone_after_check (a_stone)
2135 feature_stone_already_processed := False
2136 else
2137 -- there is something to be saved
2138 -- if user chooses to save, current file will be parsed
2139 -- if there is a syntax_error, new file is not loaded
2140 save_and (agent set_stone_after_check (a_stone))
2141 if text_saved and then not syntax_is_correct then
2142 text_saved := False
2143 during_synchronization := True
2144 set_stone_after_check (stone)
2145 during_synchronization := False
2146 address_manager.refresh
2147 end
2148 end
2149 if not editor_tool.text_area.has_focus then
2150 ev_application.idle_actions.extend_kamikaze (agent editor_tool.set_focus)
2151 end
2152 end
2153
2154 force_stone (s: STONE) is
2155 -- make `s' the new value of `stone', and
2156 -- change the display accordingly. Try to
2157 -- extract a class from `s' whenever possible.
2158 do
2159 if s.is_storable then
2160 set_stone (s)
2161 if not unified_stone then
2162 context_tool.advanced_set_stone (s)
2163 end
2164 end
2165 end
2166
2167 process_class (s: CLASSI_STONE) is
2168 -- Process class stone
2169 do
2170 set_stone (s)
2171 end
2172
2173 process_feature_error (s: FEATURE_ERROR_STONE) is
2174 -- Process feature error stone.
2175 local
2176 cl_stone: CLASSC_STONE
2177 e_class: CLASS_C
2178 do
2179 set_default_format
2180 e_class := s.e_feature.written_class
2181 create cl_stone.make (e_class)
2182 set_stone (cl_stone)
2183 editor_tool.text_area.deselect_all
2184 if s.line_number > 0 then
2185 editor_tool.text_area.highlight_selected (s.line_number, s.line_number)
2186 end
2187 end
2188
2189
2190 process_class_syntax (s: CL_SYNTAX_STONE) is
2191 -- Process class syntax.
2192 local
2193 cl_stone: CLASSC_STONE
2194 do
2195 -- call set_stone to ensure the proper class is displayed
2196 create cl_stone.make (s.e_class)
2197 set_stone (cl_stone)
2198 editor_tool.text_area.deselect_all
2199 editor_tool.text_area.highlight_when_ready (s.line, s.line)
2200 end
2201
2202 refresh is
2203 -- Synchronize clickable elements with text, if possible.
2204 do
2205 --| FIXME ARNAUD
2206 -- synchronise_stone
2207 --| END FIXME
2208 --| FIXME XR: Refresh current display in the editor.
2209 editor_tool.text_area.update_click_list (False)
2210 update_save_symbol
2211 address_manager.refresh
2212 -- The cluster manager should already be refreshed by the window manager.
2213 -- cluster_manager.refresh
2214 -- context_tool.refresh
2215 end
2216
2217 quick_refresh_editors is
2218 -- Redraw editors' drawing area.
2219 do
2220 editor_tool.text_area.refresh
2221 context_tool.quick_refresh_editors
2222 end
2223
2224 quick_refresh_margins is
2225 -- Redraw the main editor's drawing area.
2226 do
2227 editor_tool.text_area.margin.refresh
2228 context_tool.quick_refresh_margins
2229 end
2230
2231 set_default_format is
2232 -- Default format of windows.
2233 --| FIXME ARNAUD: To be implemented.
2234 -- local
2235 -- f: EB_FORMATTER
2236 do
2237 -- if stone /= Void then
2238 -- if stone.class_i.hide_implementation then
2239 -- f := format_list.precompiled_default_format
2240 -- else
2241 -- f := format_list.default_format
2242 -- end
2243 -- else
2244 -- f := format_list.default_format
2245 -- end
2246 -- set_last_format (f)
2247 --| END FIXME
2248 end
2249
2250 feature -- Position provider
2251
2252 position: like position_internal is
2253 -- Currently shown text position in the editor
2254 do
2255 Result := editor_tool.text_area.first_line_displayed
2256 end
2257
2258 pos_container: like pos_container_internal is
2259 -- Current selected formatter
2260 do
2261 Result := selected_formatter
2262 end
2263
2264 feature -- Resource Update
2265
2266 update is
2267 -- Update Current with the registered resources.
2268 do
2269 lock_update
2270 -- Show/hide general toolbar
2271 if development_window_data.show_general_toolbar then
2272 show_general_toolbar_command.enable_visible
2273 else
2274 show_general_toolbar_command.disable_visible
2275 end
2276
2277 -- Show/hide address toolbar
2278 if development_window_data.show_address_toolbar then
2279 show_address_toolbar_command.enable_visible
2280 else
2281 show_address_toolbar_command.disable_visible
2282 end
2283
2284 -- Show/hide project toolbar
2285 if development_window_data.show_project_toolbar then
2286 show_project_toolbar_command.enable_visible
2287 else
2288 show_project_toolbar_command.disable_visible
2289 end
2290
2291 -- Show/hide refactoring toolbar
2292 if development_window_data.show_refactoring_toolbar then
2293 show_refactoring_toolbar_command.enable_visible
2294 else
2295 show_refactoring_toolbar_command.disable_visible
2296 end
2297
2298 left_panel.load_from_resource (development_window_data.left_panel_layout)
2299 right_panel.load_from_resource (development_window_data.right_panel_layout)
2300 splitter_position := development_window_data.left_panel_width
2301 update_splitters
2302 unlock_update
2303 end
2304
2305 update_splitters is
2306 -- Refresh the position of the splitter on screen according to
2307 -- our internal values.
2308 do
2309 -- Set the interior layout
2310 if panel.full then
2311 panel.set_split_position (splitter_position.max (panel.minimum_split_position))
2312 end
2313 end
2314
2315 register is
2316 -- Register to preferences we want notification of.
2317 do
2318 end
2319
2320 unregister is
2321 -- unregister to preferences we want notification of.
2322 do
2323 end
2324
2325 reset is
2326 -- Reset the window contents
2327 do
2328 Precursor
2329 address_manager.reset
2330
2331 --| FIXME ARNAUD, multiformat not yet implemented.
2332 -- format_list.enable_imp_formats_sensitive
2333 --| END FIXME
2334 end
2335
2336 rebuild_tools_menu is
2337 -- Refresh the list of external commands.
2338 local
2339 ms: LIST [EB_COMMAND_MENU_ITEM]
2340 l_sep: EV_MENU_SEPARATOR
2341 do
2342 -- Remove all the external commands, which are at the end of the menu.
2343 from
2344 tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
2345 until
2346 tools_menu.after
2347 loop
2348 tools_menu.remove
2349 end
2350 ms := Edit_external_commands_cmd.menus
2351 number_of_displayed_external_commands := ms.count
2352
2353 if not ms.is_empty and not tools_menu.is_empty then
2354 l_sep ?= tools_menu.last
2355 if l_sep = Void then
2356 create l_sep
2357 tools_menu.extend (l_sep)
2358 number_of_displayed_external_commands := number_of_displayed_external_commands + 1
2359 end
2360 end
2361
2362 from
2363 ms.start
2364 until
2365 ms.after
2366 loop
2367 tools_menu.extend (ms.item)
2368 add_recyclable (ms.item)
2369 ms.forth
2370 end
2371 end
2372
2373 syntax_is_correct: BOOLEAN is
2374 -- file was successfully parsed.
2375 do
2376 Result := editor_tool.text_area.syntax_is_correct
2377 end
2378
2379 on_project_created is
2380 -- Inform tools that the current project has been loaded or re-loaded.
2381 do
2382 build_menu_bar
2383 enable_commands_on_project_created
2384 context_tool.on_project_created
2385 address_manager.on_project_created
2386 if has_dll_generation then
2387 show_dynamic_lib_tool.enable_sensitive
2388 end
2389 if has_profiler then
2390 show_profiler.enable_sensitive
2391 end
2392 end
2393
2394 on_project_loaded is
2395 -- Inform tools that the current project has been loaded or re-loaded.
2396 do
2397 -- cluster_manager.on_project_loaded
2398 enable_commands_on_project_loaded
2399 cluster_tool.on_project_loaded
2400 context_tool.on_project_loaded
2401 breakpoints_tool.on_project_loaded
2402 end
2403
2404 on_project_unloaded is
2405 -- Inform tools that the current project will soon been unloaded.
2406 do
2407 -- cluster_manager.on_project_unloaded
2408 disable_commands_on_project_unloaded
2409 cluster_tool.on_project_unloaded
2410 context_tool.on_project_unloaded
2411 address_manager.on_project_unloaded
2412 build_menu_bar
2413 if has_dll_generation then
2414 show_dynamic_lib_tool.disable_sensitive
2415 end
2416 if has_profiler then
2417 show_profiler.disable_sensitive
2418 end
2419 end
2420
2421 on_c_compilation_starts is
2422 -- Enable commands when freezing or finalizing starts.
2423 do
2424 c_workbench_compilation_cmd.disable_sensitive
2425 c_finalized_compilation_cmd.disable_sensitive
2426 end
2427
2428 on_c_compilation_stops is
2429 -- Disable commands when freezing or finalizing stops.
2430 do
2431 c_workbench_compilation_cmd.enable_sensitive
2432 c_finalized_compilation_cmd.enable_sensitive
2433 end
2434
2435 save_before_compiling is
2436 -- save the text but do not update clickable positions
2437 do
2438 save_only := True
2439 save_text
2440 end
2441
2442 perform_check_before_save is
2443 -- Perform any pre-save operations/checks
2444 local
2445 dial: EV_CONFIRMATION_DIALOG
2446 do
2447 -- Remove trailing blanks.
2448 if preferences.editor_data.auto_remove_trailing_blank_when_saving then
2449 editor_tool.text_area.text_displayed.remove_trailing_blanks
2450 else
2451 editor_tool.text_area.text_displayed.remove_trailing_fake_blanks
2452 end
2453 editor_tool.text_area.refresh_now
2454
2455 if editor_tool.text_area.open_backup then
2456 create dial.make_with_text(Warning_messages.w_save_backup)
2457 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<agent continue_save, agent cancel_save>>)
2458 dial.set_default_push_button(dial.button("Continue"))
2459 dial.set_default_cancel_button(dial.button("Cancel"))
2460 dial.set_title ("Save Backup")
2461 dial.show_modal_to_window (window)
2462 else
2463 check_passed := True
2464 end
2465 end
2466
2467 continue_save is
2468 -- continue saving
2469 do
2470 check_passed := True
2471 end
2472
2473 cancel_save is
2474 -- cancel saving
2475 do
2476 check_passed := False
2477 end
2478
2479 process is
2480 -- process the user entry in the address bar
2481 local
2482 l_class_stone: CLASSI_STONE
2483 l_multi_search_tool: EB_MULTI_SEARCH_TOOL
2484 do
2485 save_canceled := False
2486 l_class_stone ?= stone
2487 if l_class_stone /= Void then
2488 l_multi_search_tool ?= search_tool
2489 if l_multi_search_tool /= Void then
2490 l_multi_search_tool.class_changed (l_class_stone.class_i)
2491 end
2492 end
2493 end
2494
2495 on_text_saved is
2496 -- Notify the editor that the text has been saved
2497 local
2498 str: STRING
2499 do
2500 Precursor
2501 editor_tool.on_text_saved
2502 text_saved := True
2503 if not save_only then
2504 editor_tool.text_area.update_click_list (True)
2505 end
2506 save_only := False
2507 str := title.twin
2508 if str @ 1 = '*' then
2509 str.keep_tail (str.count - 2)
2510 set_title (str)
2511 end
2512 update_formatters
2513 lock_update
2514 features_tool.synchronize
2515 refresh_cursor_position
2516 refresh_context_info
2517 unlock_update
2518 if editor_tool.text_area.syntax_is_correct then
2519 status_bar.display_message ("")
2520 else
2521 status_bar.display_message (Interface_names.L_syntax_error)
2522 end
2523 text_edited := False
2524 end
2525
2526 on_focus is
2527 -- Focus gained
2528 local
2529 editor: TEXT_PANEL
2530 do
2531 editor ?= editor_tool.text_area
2532 if editor /= Void then
2533 editor.on_focus
2534 end
2535 end
2536
2537 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2538 local
2539 save_dialog: EB_CONFIRM_SAVE_DIALOG
2540 do
2541 save_canceled := True
2542 text_saved := False
2543 create save_dialog.make_and_launch (Current,Current)
2544 if not save_canceled and then syntax_is_correct then
2545 an_action.call(Void)
2546 end
2547 end
2548
2549 update_viewpoints is
2550 -- Update viewpoints
2551 local
2552 l_formatter: EB_FORMATTER
2553 l_end_loop: BOOLEAN
2554 l_index: INTEGER
2555 do
2556 view_points_combo.disable_sensitive
2557 if view_points_combo.has_renamed_view_point then
2558 l_index := managed_main_formatters.index
2559 from
2560 managed_main_formatters.start
2561 managed_main_formatters.forth
2562 until
2563 managed_main_formatters.after or l_end_loop
2564 loop
2565 l_formatter := managed_main_formatters.item
2566 if l_formatter.selected and l_formatter.button.is_sensitive then
2567 l_end_loop := True
2568 view_points_combo.enable_sensitive
2569 end
2570 managed_main_formatters.forth
2571 end
2572 managed_main_formatters.go_i_th (l_index)
2573 end
2574 end
2575
2576 feature -- Window management
2577
2578 show_window is
2579 -- Show the window
2580 do
2581 show
2582 end
2583
2584 raise_window is
2585 -- Show the window and set the focus to it.
2586 do
2587 show
2588 --| FIXME, set the focus.
2589 end
2590
2591 hide_window is
2592 -- Hide the window
2593 do
2594 hide
2595 end
2596
2597 destroy_window is
2598 -- Destroy the window.
2599 do
2600 destroy
2601 end
2602
2603 give_focus is
2604 -- Give the focus to the address manager.
2605 do
2606 address_manager.set_focus
2607 end
2608
2609 save_layout is
2610 -- Store layout of `current'.
2611 do
2612 save_layout_to_window_data (development_window_data)
2613 -- Commit saves
2614 preferences.preferences.save_preferences
2615 end
2616
2617 save_layout_to_session (a_session: ES_SESSION) is
2618 -- Save session data of `Current' to session object `a_session'.
2619 local
2620 a_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA
2621 a_class_i: CLASSI_STONE
2622 do
2623 create a_window_data.make_from_window_data (preferences.development_window_data)
2624
2625 a_class_i ?= stone
2626 if a_class_i /= Void then
2627 a_window_data.save_filename (a_class_i.file_name)
2628 a_window_data.save_editor_position (editor_tool.text_area.current_cursor_position)
2629 end
2630
2631 if context_tool /= Void then
2632 a_window_data.save_context_data (
2633 context_tool.address_manager.cluster_label_text,
2634 context_tool.address_manager.class_label_text,
2635 context_tool.address_manager.feature_label_text,
2636 context_tool.notebook.selected_item_index
2637 )
2638 end
2639
2640 save_layout_to_window_data (a_window_data)
2641
2642 -- Add the session data of `Current' to the session object.
2643 a_session.window_session_data.extend (a_window_data)
2644 end
2645
2646 save_layout_to_window_data (a_window_data: EB_DEVELOPMENT_WINDOW_DATA) is
2647 -- Store window data of `Current' in `a_window_data'.
2648 require
2649 a_window_data_not_void: a_window_data /= Void
2650 do
2651 -- Now save the windows's layout, but only if the
2652 -- debugger is not displayed in `Current'. By saving the layout,
2653 -- we ensure that future windows may use exactly the same layout.
2654 -- If the debugger is displayed, the previous layout is already saved,
2655 -- and this is the one that must be used, as only one debugger is ever displayed.
2656 if
2657 (Eb_debugger_manager.application_is_executing and Eb_debugger_manager.debugging_window /= Current)
2658 or not Eb_debugger_manager.application_is_executing
2659 then
2660 a_window_data.save_left_panel_layout (left_panel.save_to_resource)
2661 a_window_data.save_right_panel_layout (right_panel.save_to_resource)
2662 a_window_data.save_left_panel_width (panel.split_position)
2663 -- Save width & height.
2664 a_window_data.save_size (window.width, window.height)
2665 a_window_data.save_window_state (window.is_minimized, window.is_maximized)
2666 a_window_data.save_position (window.x_position, window.y_position)
2667 end
2668 a_window_data.save_show_search_options (search_tool.options_shown)
2669 end
2670
2671
2672 feature -- Tools & Controls
2673
2674 editor_tool: EB_EDITOR_TOOL
2675
2676 favorites_tool: EB_FAVORITES_TOOL
2677
2678 cluster_tool: EB_CLUSTER_TOOL
2679
2680 search_tool: EB_MULTI_SEARCH_TOOL
2681
2682 features_tool: EB_FEATURES_TOOL
2683
2684 breakpoints_tool: ES_BREAKPOINTS_TOOL
2685
2686 windows_tool: EB_WINDOWS_TOOL
2687
2688 context_tool: EB_CONTEXT_TOOL
2689 -- Context explorer for current class and system.
2690
2691 address_manager: EB_ADDRESS_MANAGER
2692 -- Text field in the toolbar
2693 -- Allow user to enter the name
2694 -- of the class he wants to edit.
2695
2696 project_manager: EB_PROJECT_MANAGER is
2697 -- Project manager associated to the project the user is working on.
2698 do
2699 Result := Eiffel_project.manager
2700 end
2701
2702 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2703 -- All formatters that operate on a class.
2704
2705 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2706 -- All formatters that operate on a class.
2707
2708 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2709 -- All formatters that can be displayed in the main editor frame.
2710
2711 view_points_combo: EB_VIEWPOINT_COMBO_BOX
2712 -- Combo box used to a select viewpoints
2713
2714 view_points_widget: EV_HORIZONTAL_BOX
2715 -- Widget to contain viewpoints box
2716
2717 unified_stone: BOOLEAN
2718 -- Is the stone common with the context tool or not?
2719
2720 arguments_dialog: EB_ARGUMENT_DIALOG
2721 -- The arguments dialog for current, if any
2722
2723 goto_dialog: EB_GOTO_DIALOG
2724 -- The goto dialog for line number access
2725
2726 feature -- Multiple editor management
2727
2728 add_editor_to_list (an_editor: EB_EDITOR) is
2729 -- adds `an_editor' to `editors'
2730 do
2731 editors.extend (an_editor)
2732 end
2733
2734 current_editor: EB_EDITOR is
2735 -- current editor, if none, main editor
2736 do
2737 if current_editor_index /= 0 then
2738 Result := editors @ current_editor_index
2739 else
2740 Result := editors.first
2741 end
2742 end
2743
2744 set_current_editor (an_editor: EB_EDITOR) is
2745 -- set `an_editor' as main editor
2746 local
2747 old_index: INTEGER
2748 new_index: INTEGER
2749 do
2750 old_index := current_editor_index
2751 new_index := editors.index_of (an_editor, 1)
2752 if
2753 editors.valid_index (new_index) and
2754 old_index /= new_index
2755 then
2756 current_editor_index := new_index
2757 update_paste_cmd
2758 -- Last thing, update the menu entry for the formatting marks.
2759 if current_editor.view_invisible_symbols then
2760 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2761 else
2762 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2763 end
2764 command_controller.set_current_editor (an_editor)
2765 end
2766 end
2767
2768 update_paste_cmd is
2769 -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2770 do
2771 if
2772 not current_editor.is_empty and then
2773 current_editor.is_editable and then
2774 current_editor.clipboard.has_text
2775 then
2776 editor_paste_cmd.enable_sensitive
2777 else
2778 editor_paste_cmd.disable_sensitive
2779 end
2780 end
2781
2782 feature {NONE} -- Multiple editor management
2783
2784 editors: ARRAYED_LIST [EB_EDITOR]
2785 -- editor contained in `Current'
2786
2787 current_editor_index: INTEGER
2788 -- Index in `editors' of the editor that has the focus.
2789
2790 feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS} -- Feature Clauses
2791
2792 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2793 -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2794 -- type pertinent to 'a_features'.
2795 require
2796 a_features_not_void: a_features /= Void
2797 do
2798 if feature_clauses = Void then
2799 create feature_clauses.make (5)
2800 end
2801 feature_clauses.put (a_features, a_type)
2802 end
2803
2804 set_feature_locating (a_locating: BOOLEAN) is
2805 -- Set `feature_locating' with `a_locating'.
2806 do
2807 feature_locating := a_locating
2808 end
2809
2810 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2811 -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2812 require
2813 a_type_not_void: a_type /= Void
2814 has_type_clauses: feature_clauses.has (a_type)
2815 do
2816 Result := feature_clauses.item (a_type)
2817 ensure
2818 result_not_void: Result /= Void
2819 end
2820
2821 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2822 -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2823
2824 feature_positions: HASH_TABLE [INTEGER, E_FEATURE]
2825 -- Features indexed by line position in class text (for .NET features).
2826
2827 feature_locating: BOOLEAN
2828 -- Is feature tool locating a feature?
2829
2830 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2831
2832 destroy_imp is
2833 -- Destroy window.
2834 do
2835 -- To avoid reentrance
2836 if not is_destroying then
2837 is_destroying := True
2838 -- If a launched application is still running, kill it.
2839 if
2840 Eb_debugger_manager.application_is_executing
2841 and then Eb_debugger_manager.debugging_window = Current
2842 then
2843 Eb_debugger_manager.Application.kill
2844 else
2845 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2846 development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2847 end
2848 development_window_data.save_left_panel_width (panel.split_position)
2849 -- Save width & height.
2850 development_window_data.save_size (window.width, window.height)
2851 development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2852 development_window_data.save_position (window.x_position, window.y_position)
2853 development_window_data.save_show_search_options (search_tool.options_shown)
2854 hide
2855
2856 -- Commit saves
2857 preferences.preferences.save_preferences
2858
2859 estudio_debug_cmd.unattach_window (window)
2860 toolbars_area.wipe_out
2861 address_manager.recycle
2862 project_customizable_toolbar.recycle
2863 refactoring_customizable_toolbar.recycle
2864 Precursor {EB_TOOL_MANAGER}
2865 left_panel.recycle
2866 right_panel.recycle
2867 managed_class_formatters.wipe_out
2868 managed_feature_formatters.wipe_out
2869 managed_main_formatters.wipe_out
2870 toolbarable_commands.wipe_out
2871 editors.wipe_out
2872 editors := Void
2873 stone := Void
2874 end
2875 end
2876
2877 feature -- C output pixmap management
2878
2879 start_c_output_pixmap_timer is
2880 -- Start timer to draw c output pixmap.
2881 do
2882 if context_tool /= Void then
2883 context_tool.start_c_output_pixmap_timer
2884 end
2885 end
2886
2887 stop_c_output_pixmap_timer is
2888 -- Stop timer to draw c output pixmap.
2889 do
2890 if context_tool /= Void then
2891 context_tool.stop_c_output_pixmap_timer
2892 end
2893 end
2894
2895 feature {NONE} -- Implementation
2896
2897 set_stone_after_check (a_stone: STONE) is
2898 local
2899 old_stone: STONE
2900 new_class_stone: CLASSI_STONE
2901 old_class_stone: CLASSI_STONE
2902 conv_classc: CLASSC_STONE
2903 conv_brkstone: BREAKABLE_STONE
2904 cluster_st: CLUSTER_STONE
2905 old_cluster_st: CLUSTER_STONE
2906 feature_stone: FEATURE_STONE
2907 conv_ferrst: FEATURE_ERROR_STONE
2908
2909 ef_stone: EXTERNAL_FILE_STONE
2910 f: FILE
2911
2912 conv_errst: ERROR_STONE
2913 cl_syntax_stone: CL_SYNTAX_STONE
2914 error_line: INTEGER
2915 class_file: RAW_FILE
2916 class_text_exists: BOOLEAN
2917 same_class: BOOLEAN
2918 test_stone: CLASSI_STONE
2919 conv_ace: ACE_SYNTAX_STONE
2920 externali: EXTERNAL_CLASS_I
2921 external_cons: CONSUMED_TYPE
2922 str: STRING
2923 dotnet_class: BOOLEAN
2924 l_short_formatter: EB_SHORT_FORMATTER
2925 l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2926 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2927 app_exec: APPLICATION_EXECUTION
2928 do
2929 -- the text does not change if the text was saved with syntax errors
2930 cur_wid := window
2931 if cur_wid = Void then
2932 --| Do nothing.
2933 else
2934 if old_cur = Void then
2935 old_cur := cur_wid.pointer_style
2936 end
2937 -- cur_wid.enable_capture
2938 cur_wid.set_pointer_style (Wait_cursor)
2939 end
2940
2941 conv_brkstone ?= a_stone
2942 conv_errst ?= a_stone
2943 conv_ace ?= a_stone
2944 ef_stone ?= a_stone
2945 if conv_brkstone /= Void then
2946 app_exec := Debugger_manager.application
2947 if app_exec.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2948 app_exec.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2949 else
2950 app_exec.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2951 end
2952 Debugger_manager.notify_breakpoints_changes
2953 elseif conv_errst /= Void then
2954 display_error_help_cmd.execute_with_stone (conv_errst)
2955 elseif conv_ace /= Void then
2956 --| FIXME XR: What should we do?!
2957 elseif ef_stone /= Void then
2958 f := ef_stone.file
2959 f.make_open_read (f.name)
2960 f.read_stream (f.count)
2961 f.close
2962 editor_tool.text_area.set_stone (a_stone)
2963 editor_tool.text_area.load_text (f.last_string)
2964 else
2965 -- Remember previous stone.
2966 old_stone := stone
2967 old_class_stone ?= stone
2968 old_cluster_st ?= stone
2969
2970 -- New stone properties
2971 new_class_stone ?= a_stone
2972
2973 -- Set the stone.
2974 old_set_stone (a_stone)
2975 cluster_st ?= a_stone
2976
2977 new_feature_cmd.disable_sensitive
2978 toggle_feature_alias_cmd.disable_sensitive
2979 toggle_feature_signature_cmd.disable_sensitive
2980 toggle_feature_assigner_cmd.disable_sensitive
2981
2982 -- We update the state of the `Add to Favorites' command.
2983 if new_class_stone /= Void then
2984 favorites_menu.first.enable_sensitive
2985 else
2986 favorites_menu.first.disable_sensitive
2987 end
2988
2989 -- Update the address manager if needed.
2990 address_manager.refresh
2991 if new_class_stone /= Void then
2992 if not during_synchronization then
2993 view_points_combo.set_conf_class (new_class_stone.class_i.config_class)
2994 end
2995 -- Text is now editable.
2996 editor_tool.text_area.set_read_only (False)
2997
2998 -- class stone was dropped
2999 create class_file.make (new_class_stone.class_i.file_name)
3000 class_text_exists := class_file.exists
3001 feature_stone ?= a_stone
3002 --| We have to create a classi_stone to check whether the stones are really similar.
3003 --| Otherwise a redefinition of same_as may be called.
3004 create test_stone.make (new_class_stone.class_i)
3005 if test_stone.same_as (old_class_stone) then
3006 same_class := True
3007 end
3008 if not feature_stone_already_processed then
3009 if same_class and then text_saved then
3010 -- nothing changed in the editor
3011 -- we only have to update click_list
3012 if editor_tool.text_area.is_editable then
3013 editor_tool.text_area.update_click_list (False)
3014 end
3015 else
3016 if changed then
3017 -- user has already chosen not to save the file
3018 -- do not ask again
3019 Feature_positions.wipe_out
3020 editor_tool.text_area.no_save_before_next_load
3021 end
3022 end
3023 end
3024
3025 conv_classc ?= new_class_stone
3026
3027 -- First choose possible formatter
3028 l_main_formatter ?= new_class_stone.pos_container
3029 if l_main_formatter /= Void and not during_synchronization then
3030 if
3031 not (conv_classc /= Void and class_text_exists and (not changed or not same_class))
3032 then
3033 l_main_formatter.enable_select
3034 elseif feature_stone = Void then
3035 if l_main_formatter /= pos_container then
3036 l_main_formatter.enable_select
3037 end
3038 if new_class_stone.position > 0 then
3039 editor_tool.text_area.display_line_at_top_when_ready (new_class_stone.position)
3040 end
3041 end
3042 end
3043
3044 if conv_classc = Void or else
3045 conv_classc.e_class.is_external or else
3046 feature_stone /= Void and not
3047 feature_stone_already_processed and not
3048 (same_class and context_tool.sending_stone) then
3049 -- If a classi_stone or a feature_stone or a external call
3050 -- has been dropped, check to see if a .NET class.
3051 if class_text_exists then
3052 if new_class_stone.class_i.is_external_class then
3053 externali ?= new_class_stone.class_i
3054 check
3055 externali_not_void: externali /= Void
3056 end
3057 external_cons := externali.external_consumed_type
3058 if external_cons /= Void then
3059 -- A .NET class.
3060 dotnet_class := True
3061 l_short_formatter ?= managed_main_formatters.i_th (4)
3062 l_flat_formatter ?= managed_main_formatters.i_th (5)
3063 if l_short_formatter /= Void then
3064 l_short_formatter.set_dotnet_mode (True)
3065 end
3066 if l_flat_formatter /= Void then
3067 l_flat_formatter.set_dotnet_mode (True)
3068 end
3069 end
3070 elseif feature_stone /= Void then
3071 from
3072 managed_main_formatters.start
3073 until
3074 managed_main_formatters.after
3075 loop
3076 managed_main_formatters.item.set_stone (new_class_stone)
3077 managed_main_formatters.forth
3078 end
3079 else
3080 managed_main_formatters.first.set_stone (new_class_stone)
3081 managed_main_formatters.first.execute
3082 end
3083 else
3084 editor_tool.text_area.clear_window
3085 editor_tool.text_area.display_message (
3086 Warning_messages.w_file_not_exist (
3087 new_class_stone.class_i.file_name))
3088 end
3089 end
3090 if conv_classc = Void then
3091 --| The dropped class is not compiled.
3092 --| Display only the textual formatter.
3093 if dotnet_class then
3094 managed_main_formatters.i_th (4).set_stone (new_class_stone)
3095 managed_main_formatters.i_th (5).set_stone (new_class_stone)
3096 managed_main_formatters.i_th (4).execute
3097 end
3098 address_manager.disable_formatters
3099 else
3100 --| We have a compiled class.
3101 if
3102 class_text_exists and then
3103 Eiffel_project.Workbench.last_reached_degree <= 2
3104 then
3105 new_feature_cmd.enable_sensitive
3106 toggle_feature_alias_cmd.enable_sensitive
3107 toggle_feature_signature_cmd.enable_sensitive
3108 toggle_feature_assigner_cmd.enable_sensitive
3109 end
3110
3111 --address_manager.enable_formatters
3112 update_formatters
3113 if not class_text_exists then
3114 --| Disable the textual formatter.
3115 managed_main_formatters.first.disable_sensitive
3116 from
3117 managed_main_formatters.start
3118 until
3119 managed_main_formatters.after
3120 loop
3121 managed_main_formatters.item.set_stone (new_class_stone)
3122 managed_main_formatters.forth
3123 end
3124 if not is_stone_external then
3125 managed_main_formatters.i_th (2).execute
3126 end
3127 else
3128 if not changed or not same_class then
3129 --| Enable all formatters.
3130 if
3131 (not feature_stone_already_processed or
3132 not managed_main_formatters.first.selected) and
3133 feature_stone = Void
3134 then
3135 from
3136 managed_main_formatters.start
3137 until
3138 managed_main_formatters.after
3139 loop
3140 managed_main_formatters.item.set_stone (new_class_stone)
3141 managed_main_formatters.forth
3142 end
3143 end
3144 else
3145 if not feature_stone_already_processed then
3146 address_manager.disable_formatters
3147 from
3148 managed_main_formatters.start
3149 until
3150 managed_main_formatters.after
3151 loop
3152 managed_main_formatters.item.set_stone (new_class_stone)
3153 managed_main_formatters.forth
3154 end
3155 end
3156 end
3157 end
3158 end
3159 if not managed_main_formatters.first.selected then
3160 editor_tool.text_area.set_read_only (true)
3161 elseif new_class_stone /= Void and then new_class_stone.class_i.is_read_only then
3162 editor_tool.text_area.set_read_only (true)
3163 end
3164 else
3165 -- not a class text : cannot be edited
3166 editor_tool.text_area.set_read_only (True)
3167 address_manager.disable_formatters
3168
3169 --| Disable all formatters.
3170 from
3171 managed_main_formatters.start
3172 until
3173 managed_main_formatters.after
3174 loop
3175 managed_main_formatters.item.set_stone (Void)
3176 managed_main_formatters.forth
3177 end
3178 if cluster_st /= Void and then cluster_st.is_cluster then
3179 --| FIXME XR: Really manage cluster display in the main editor
3180 if not during_synchronization then
3181 view_points_combo.set_conf_group (cluster_st.group)
3182 end
3183 formatted_context_for_cluster (cluster_st.cluster_i, cluster_st.path)
3184 if cluster_st.position > 0 then
3185 editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
3186 end
3187 --| END FIXME
3188 end
3189 end
3190 if class_text_exists then
3191 if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
3192 conv_ferrst ?= feature_stone
3193 if conv_ferrst /= Void then
3194 error_line := conv_ferrst.line_number
3195 else
3196 -- if a feature_stone has been dropped
3197 -- scroll to the corresponding feature in the basic text format
3198 if not during_synchronization then
3199 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
3200 end
3201 end
3202 else
3203 cl_syntax_stone ?= a_stone
3204 if cl_syntax_stone /= Void then
3205 error_line := cl_syntax_stone.line
3206 end
3207 end
3208 if error_line > 0 then
3209 -- Scroll to the line of the error.
3210 if not during_synchronization then
3211 if not managed_main_formatters.first.selected then
3212 managed_main_formatters.first.execute
3213 check
3214 new_class_stone_not_void: new_class_stone /= Void
3215 end
3216 if new_class_stone.class_i.is_read_only then
3217 editor_tool.text_area.set_read_only (true)
3218 end
3219 end
3220 editor_tool.text_area.display_line_when_ready (error_line, True)
3221 end
3222 end
3223 end
3224 -- Update the title of the window
3225 if a_stone /= Void then
3226 if changed then
3227 str := a_stone.header.twin
3228 str.prepend ("* ")
3229 set_title (str)
3230 else
3231 set_title (a_stone.header)
3232 end
3233 else
3234 set_title (Interface_names.t_empty_development_window)
3235 end
3236
3237 -- Refresh the tools.
3238 features_tool.set_stone (a_stone)
3239 cluster_tool.set_stone (a_stone)
3240 -- Update the context tool.
3241 if unified_stone then
3242 context_tool.set_stone (a_stone)
3243 end
3244
3245 end
3246 if
3247 stone /= Void and then
3248 not unified_stone
3249 then
3250 send_stone_to_context_cmd.enable_sensitive
3251 else
3252 send_stone_to_context_cmd.disable_sensitive
3253 end
3254 if cur_wid = Void then
3255 --| Do nothing.
3256 else
3257 cur_wid.set_pointer_style (old_cur)
3258 old_cur := Void
3259 -- cur_wid.disable_capture
3260 cur_wid := Void
3261 end
3262 update_viewpoints
3263 end
3264
3265 formatted_context_for_cluster (a_cluster: CLUSTER_I; a_path: STRING) is
3266 -- Formatted context representing the list of classes inside `a_cluster'.
3267 require
3268 a_cluster_not_void: a_cluster /= Void
3269 a_path_not_void: a_path /= Void
3270 local
3271 l_assembly: ASSEMBLY_I
3272 l_sorted_cluster: EB_SORTED_CLUSTER
3273 l_classes: DS_ARRAYED_LIST [CLASS_I]
3274 l_in_classes: DS_ARRAYED_LIST [CLASS_I]
3275 l_out_classes: DS_ARRAYED_LIST [CLASS_I]
3276 l_over_classes: DS_ARRAYED_LIST [CLASS_I]
3277 l_subclu: DS_LIST [EB_SORTED_CLUSTER]
3278 l_cl_i, l_overridden_class: CLASS_I
3279 l_cluster: CLUSTER_I
3280 l_assert_level: ASSERTION_I
3281 l_format_context: TEXT_FORMATTER_DECORATOR
3282 l_description: STRING
3283 do
3284 create l_format_context.make_for_case (editor_tool.text_area.text_displayed)
3285 editor_tool.text_area.handle_before_processing (False)
3286 l_format_context.process_keyword_text (ti_indexing_keyword, Void)
3287 l_format_context.put_new_line
3288 l_format_context.indent
3289 if a_cluster.is_assembly then
3290 l_assembly ?= a_cluster
3291 check l_assembly /= Void end
3292 l_format_context.process_indexing_tag_text ("assembly_name")
3293 l_format_context.set_without_tabs
3294 l_format_context.process_symbol_text (ti_colon)
3295 l_format_context.put_space
3296 l_format_context.put_quoted_string_item (l_assembly.assembly_name)
3297 l_format_context.put_new_line
3298 l_format_context.process_indexing_tag_text ("assembly_path")
3299 l_format_context.set_without_tabs
3300 l_format_context.process_symbol_text (ti_colon)
3301 l_format_context.put_space
3302 l_format_context.put_quoted_string_item (l_assembly.location.evaluated_path)
3303 l_format_context.put_new_line
3304
3305 end
3306 l_format_context.process_indexing_tag_text ("cluster")
3307 l_format_context.set_without_tabs
3308 l_format_context.process_symbol_text (ti_colon)
3309 l_format_context.put_space
3310 l_format_context.add_group (a_cluster, a_cluster.cluster_name)
3311
3312 l_format_context.put_new_line
3313 l_format_context.process_indexing_tag_text ("cluster_path")
3314 l_format_context.set_without_tabs
3315 l_format_context.process_symbol_text (ti_colon)
3316 l_format_context.put_space
3317 l_format_context.put_quoted_string_item (a_cluster.path)
3318
3319 if a_path /= Void and then not a_path.is_empty then
3320 l_format_context.put_space
3321 l_format_context.set_without_tabs
3322 l_format_context.process_symbol_text (ti_l_parenthesis)
3323 l_format_context.put_quoted_string_item (a_path)
3324 l_format_context.set_without_tabs
3325 l_format_context.process_symbol_text (ti_r_parenthesis)
3326 end
3327 l_format_context.put_new_line
3328
3329 -- Now try to get the description of the cluster, and if not
3330 -- we take the one from its target.
3331 if a_cluster.description /= Void then
3332 l_description := a_cluster.description
3333 elseif a_cluster.target.description /= Void then
3334 l_description := a_cluster.target.description
3335 end
3336 if l_description /= Void then
3337 l_format_context.process_indexing_tag_text ("description")
3338 l_format_context.set_without_tabs
3339 l_format_context.process_symbol_text (ti_colon)
3340 l_format_context.put_space
3341 l_format_context.set_in_indexing_clause (True)
3342 l_format_context.process_symbol_text (ti_double_quote)
3343 l_format_context.process_symbol_text (ti_l_bracket)
3344 l_format_context.put_new_line
3345 if l_description.has ('%N') then
3346 -- Indenting looks strange below because
3347 -- `add_multiline_string' does not take into accounts
3348 -- how many indents already exists.
3349 l_format_context.exdent
3350 l_format_context.add_multiline_string (l_description, 3)
3351 l_format_context.indent
3352 else
3353 l_format_context.indent
3354 l_format_context.indent
3355 l_format_context.add_string (l_description)
3356 l_format_context.exdent
3357 l_format_context.exdent
3358 end
3359 l_format_context.put_new_line
3360 l_format_context.indent
3361 l_format_context.process_symbol_text (ti_r_bracket)
3362 l_format_context.process_symbol_text (ti_double_quote)
3363 l_format_context.exdent
3364 l_format_context.put_new_line
3365 end
3366
3367 if a_cluster.parent_cluster /= Void then
3368 l_format_context.process_indexing_tag_text ("parent cluster")
3369 l_format_context.set_without_tabs
3370 l_format_context.process_symbol_text (ti_colon)
3371 l_format_context.put_new_line
3372 l_format_context.indent
3373 l_format_context.put_manifest_string (" - ")
3374
3375 l_format_context.add_group (a_cluster.parent_cluster, a_cluster.parent_cluster.cluster_name)
3376 l_format_context.put_new_line
3377 l_format_context.exdent
3378 end
3379
3380 create l_sorted_cluster.make (a_cluster)
3381 l_sorted_cluster.initialize
3382
3383 if not l_sorted_cluster.clusters.is_empty then
3384 l_format_context.process_indexing_tag_text ("sub cluster(s)")
3385 l_format_context.set_without_tabs
3386 l_format_context.process_symbol_text (ti_colon)
3387 l_format_context.put_new_line
3388 l_format_context.indent
3389 from
3390 l_subclu := l_sorted_cluster.clusters
3391 l_subclu.start
3392 until
3393 l_subclu.after
3394 loop
3395 l_cluster := l_subclu.item_for_iteration.actual_cluster
3396 l_format_context.put_manifest_string (" - ")
3397 l_format_context.add_group (l_cluster, l_cluster.cluster_name)
3398 l_format_context.put_space
3399 l_format_context.set_without_tabs
3400 l_format_context.process_symbol_text (ti_L_parenthesis)
3401 l_format_context.process_comment_text (l_cluster.classes.count.out, Void)
3402 l_format_context.set_without_tabs
3403 l_format_context.process_symbol_text (ti_R_parenthesis)
3404 l_format_context.put_new_line
3405 l_subclu.forth
3406 end
3407 l_format_context.exdent
3408 end
3409
3410 if not l_sorted_cluster.classes.is_empty then
3411 l_classes := l_sorted_cluster.classes
3412 from
3413 l_classes.start
3414 create l_in_classes.make (l_classes.count)
3415 create l_out_classes.make (l_classes.count)
3416 create l_over_classes.make (l_classes.count)
3417 until
3418 l_classes.after
3419 loop
3420 l_cl_i := l_classes.item_for_iteration
3421 if
3422 a_path.is_empty
3423 or else is_string_started_by (l_cl_i.path, a_path)
3424 then
3425 if l_cl_i.compiled then
3426 l_in_classes.put_last (l_cl_i)
3427 if l_cl_i.config_class.is_overriden then
3428 l_over_classes.put_last (l_cl_i)
3429 end
3430 else
3431 l_out_classes.put_last (l_cl_i)
3432 end
3433 end
3434 l_classes.forth
3435 end
3436 l_classes := Void
3437
3438 if l_in_classes.count > 0 then
3439 l_format_context.put_new_line
3440 l_format_context.process_indexing_tag_text (l_in_classes.count.out + " compiled class(es)")
3441 l_format_context.set_without_tabs
3442 l_format_context.process_symbol_text (ti_colon)
3443 l_format_context.put_new_line
3444 l_format_context.indent
3445
3446 from
3447 l_in_classes.start
3448 until
3449 l_in_classes.after
3450 loop
3451 l_cl_i := l_in_classes.item_for_iteration
3452 check compiled: l_cl_i.compiled end
3453
3454 l_assert_level := l_cl_i.assertion_level
3455 l_format_context.put_manifest_string (" - ")
3456 l_format_context.put_classi (l_cl_i)
3457 l_format_context.set_without_tabs
3458 l_format_context.process_symbol_text (ti_colon)
3459 if l_assert_level.check_all then
3460 l_format_context.put_space
3461 l_format_context.set_without_tabs
3462 l_format_context.process_keyword_text (ti_All_keyword, Void)
3463 elseif l_assert_level.level = 0 then
3464 l_format_context.put_space
3465 l_format_context.process_comment_text (once "None", Void)
3466 else
3467 if l_assert_level.check_precond then
3468 l_format_context.put_space
3469 l_format_context.set_without_tabs
3470 l_format_context.process_keyword_text (ti_Require_keyword, Void)
3471 end
3472 if l_assert_level.check_postcond then
3473 l_format_context.put_space
3474 l_format_context.set_without_tabs
3475 l_format_context.process_keyword_text (ti_Ensure_keyword, Void)
3476 end
3477 if l_assert_level.check_check then
3478 l_format_context.put_space
3479 l_format_context.set_without_tabs
3480 l_format_context.process_keyword_text (ti_Check_keyword, Void)
3481 end
3482 if l_assert_level.check_loop then
3483 l_format_context.put_space
3484 l_format_context.set_without_tabs
3485 l_format_context.process_keyword_text (ti_Loop_keyword, Void)
3486 end
3487 if l_assert_level.check_invariant then
3488 l_format_context.put_space
3489 l_format_context.set_without_tabs
3490 l_format_context.process_keyword_text (ti_Invariant_keyword, Void)
3491 end
3492 end
3493 l_format_context.put_new_line
3494 l_in_classes.forth
3495 end
3496 l_format_context.exdent
3497 end
3498 l_in_classes := Void
3499
3500 if l_out_classes.count > 0 then
3501 l_format_context.put_new_line
3502 l_format_context.process_indexing_tag_text (l_out_classes.count.out + " class(es) not in system")
3503 l_format_context.set_without_tabs
3504 l_format_context.process_symbol_text (ti_colon)
3505 l_format_context.put_new_line
3506 l_format_context.indent
3507 from
3508 l_out_classes.start
3509 until
3510 l_out_classes.after
3511 loop
3512 l_cl_i := l_out_classes.item_for_iteration
3513 check not_in_system: not l_cl_i.compiled end
3514 l_format_context.put_manifest_string (" - ")
3515 l_format_context.put_classi (l_cl_i)
3516 l_format_context.put_new_line
3517 l_out_classes.forth
3518 end
3519 l_format_context.exdent
3520 end
3521 l_out_classes := Void
3522
3523 if
3524 l_over_classes.count > 0 and then
3525 a_cluster.overriders /= Void and then not a_cluster.overriders.is_empty
3526 then
3527 l_format_context.put_new_line
3528 l_format_context.process_indexing_tag_text ("Overriden")
3529 l_format_context.set_without_tabs
3530 l_format_context.process_symbol_text (ti_colon)
3531 l_format_context.put_new_line
3532 l_format_context.indent
3533 from
3534 l_over_classes.start
3535 until
3536 l_over_classes.after
3537 loop
3538 l_cl_i := l_over_classes.item_for_iteration
3539 check is_overriden_class: l_cl_i.config_class.is_overriden end
3540
3541 l_format_context.put_manifest_string (" - ")
3542 l_format_context.put_classi (l_cl_i)
3543 l_format_context.process_comment_text (" overriden by", Void)
3544 l_format_context.process_symbol_text (ti_colon)
3545 l_format_context.put_space
3546
3547 l_overridden_class ?= l_cl_i.config_class.overriden_by
3548 if l_overridden_class /= Void then
3549 l_format_context.put_classi (l_overridden_class)
3550 l_format_context.put_manifest_string (" in ")
3551 l_format_context.add_group (l_cl_i.config_class.overriden_by.group, l_cl_i.config_class.overriden_by.group.name)
3552 l_format_context.put_new_line
3553 end
3554 l_over_classes.forth
3555 end
3556 l_format_context.exdent
3557 l_format_context.put_new_line
3558 end
3559 l_over_classes := Void
3560 end
3561
3562 l_format_context.exdent
3563 l_format_context.put_new_line
3564 editor_tool.text_area.handle_after_processing
3565 end
3566
3567 scroll_to_feature (feat_as: E_FEATURE; displayed_class: CLASS_I) is
3568 -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
3569 require
3570 class_is_not_void: displayed_class /= Void
3571 feat_as_is_not_void: feat_as /= Void
3572 local
3573 begin_index, offset: INTEGER
3574 tmp_text: STRING
3575 do
3576 if not feat_as.is_il_external then
3577 if not managed_main_formatters.first.selected then
3578 if feat_as.ast /= Void then
3579 editor_tool.text_area.find_feature_named (feat_as.name)
3580 end
3581 else
3582 if feat_as.ast /= Void then
3583 begin_index := feat_as.ast.start_position
3584 tmp_text := displayed_class.text.substring (1, begin_index)
3585 offset := tmp_text.occurrences('%R')
3586 editor_tool.text_area.scroll_to_when_ready (begin_index.item - offset)
3587 end
3588 end
3589 else
3590 if not managed_main_formatters.first.selected then
3591 managed_main_formatters.first.execute
3592 end
3593 -- FIXME NC: Doesn't work properly for .NET features
3594 -- .NET formatted feature.
3595 begin_index := feature_positions.item (feat_as)
3596 if platform_constants.is_windows then
3597 tmp_text := displayed_class.text.substring (1, begin_index)
3598 offset := tmp_text.occurrences('%N')
3599 end
3600 editor_tool.text_area.scroll_to_when_ready (begin_index // 2) -- - offset)
3601 end
3602 end
3603
3604 check_passed: BOOLEAN
3605
3606 save_canceled: BOOLEAN
3607 -- did user cancel save ?
3608
3609 save_only: BOOLEAN
3610 -- skip parse and update after save ?
3611
3612 text_saved: BOOLEAN
3613 -- has the user chosen to save the file
3614
3615 is_destroying: BOOLEAN
3616 -- Is `current' being currently destroyed?
3617
3618 feature_stone_already_processed: BOOLEAN
3619 -- Is the processed stone a feature stone and has it
3620 -- been already processed by the editor ?
3621
3622 feature {NONE} -- Implementation
3623
3624 update_save_symbol is
3625 do
3626 Precursor {EB_FILEABLE}
3627 if changed then
3628 save_cmd.enable_sensitive
3629 address_manager.disable_formatters
3630 else
3631 save_cmd.disable_sensitive
3632 update_formatters
3633 end
3634 if is_empty then
3635 print_cmd.disable_sensitive
3636 save_as_cmd.disable_sensitive
3637 else
3638 print_cmd.enable_sensitive
3639 save_as_cmd.enable_sensitive
3640 end
3641 end
3642
3643 is_stone_external: BOOLEAN
3644 -- Does 'stone' contain a .NET consumed type?
3645
3646 update_formatters is
3647 -- Give a correct sensitivity to formatters.
3648 local
3649 cist: CLASSI_STONE
3650 cst: CLASSC_STONE
3651 type_changed: BOOLEAN
3652 do
3653 cst ?= stone
3654 cist ?= stone
3655 -- Check to if formatting context has changed.
3656 if cst /= Void then
3657 type_changed := (cst.e_class.is_true_external and not is_stone_external) or
3658 (not cst.e_class.is_true_external and is_stone_external)
3659 elseif cist /= Void then
3660 type_changed := (cist.class_i.is_external_class and not is_stone_external) or
3661 (not cist.class_i.is_external_class and is_stone_external)
3662 end
3663
3664 if type_changed then
3665 -- Toggle stone flag.
3666 is_stone_external := not is_stone_external
3667 end
3668
3669 if cst /= Void then
3670 address_manager.enable_formatters
3671 if is_stone_external then
3672 -- Change formatters to .NET sensitivity (from normal).
3673 enable_dotnet_formatters
3674 if type_changed then
3675 managed_main_formatters.i_th (4).enable_select
3676 end
3677 else
3678 if changed then
3679 address_manager.disable_formatters
3680 else
3681 --managed_main_formatters.first.disable_sensitive
3682 end
3683 end
3684 elseif cist /= Void and is_stone_external then
3685 -- Change formatters to .NET sensitivity (from normal).
3686 enable_dotnet_formatters
3687 if type_changed then
3688 managed_main_formatters.i_th (4).enable_select
3689 end
3690 else
3691 address_manager.disable_formatters
3692 if cist /= stone then
3693 managed_main_formatters.first.execute
3694 end
3695 end
3696 end
3697
3698 enable_dotnet_formatters is
3699 -- Enable only the .NET class text formatters.
3700 local
3701 l_formatters: like managed_main_formatters
3702 do
3703 l_formatters := managed_main_formatters.twin
3704 from
3705 l_formatters.start
3706 until
3707 l_formatters.after
3708 loop
3709 if l_formatters.item.is_dotnet_formatter then
3710 l_formatters.item.enable_sensitive
3711 else
3712 l_formatters.item.disable_sensitive
3713 end
3714 l_formatters.forth
3715 end
3716 end
3717
3718 on_text_reset is
3719 -- The main editor has just been wiped out
3720 -- before loading a new file.
3721 local
3722 str: STRING
3723 do
3724 str := title.twin
3725 if str @ 1 = '*' then
3726 str.keep_tail (str.count - 2)
3727 set_title (str)
3728 end
3729 address_manager.disable_formatters
3730 status_bar.reset
3731 status_bar.remove_cursor_position
3732 text_edited := False
3733 end
3734
3735 on_cursor_moved is
3736 -- The cursor has moved, reflect the change in the status bar.
3737 -- And reflect location editing in the text in features tool and address bar.
3738 do
3739 refresh_cursor_position
3740 if context_refreshing_timer = Void then
3741 create context_refreshing_timer.make_with_interval (100)
3742 context_refreshing_timer.actions.extend (agent refresh_context_info)
3743 end
3744 if feature_locating then
3745 context_refreshing_timer.set_interval (0)
3746 else
3747 context_refreshing_timer.set_interval (100)
3748 end
3749
3750 end
3751
3752 on_text_fully_loaded is
3753 -- The main editor has just been reloaded.
3754 do
3755 update_paste_cmd
3756 update_formatters
3757 if editor_tool.text_area.syntax_is_correct then
3758 status_bar.reset
3759 else
3760 status_bar.display_message (Interface_names.L_syntax_error)
3761 end
3762 refresh_cursor_position
3763 text_edited := False
3764 end
3765
3766 on_text_back_to_its_last_saved_state is
3767 local
3768 str: STRING
3769 do
3770 str := title.twin
3771 if str @ 1 = '*' then
3772 str.keep_tail (str.count - 2)
3773 set_title (str)
3774 end
3775 update_formatters
3776 text_edited := False
3777 end
3778
3779 text_edited: BOOLEAN
3780 -- Do we know that the text was edited?
3781 -- If so, no need to update the display each time it is edited.
3782
3783 on_text_edited (unused: BOOLEAN) is
3784 -- The text in the editor is modified, add the '*' in the title.
3785 -- Gray out the formatters.
3786 local
3787 str: STRING
3788 cst: CLASSI_STONE
3789 do
3790 if not text_edited then
3791 str := title.twin
3792 if str @ 1 /= '*' then
3793 str.prepend ("* ")
3794 set_title (str)
3795 end
3796 address_manager.disable_formatters
3797 cst ?= stone
3798 if cst /= Void then
3799 Eiffel_project.Manager.class_is_edited (cst.class_i)
3800 end
3801 text_edited := True
3802 end
3803 if not status_bar.message.is_equal (interface_names.e_c_compilation_running) then
3804 -- We don't want the "Background C compilation in progress" message flash every time
3805 -- user presses a key.
3806 status_bar.display_message ("")
3807 end
3808 end
3809
3810 on_back is
3811 -- User pressed Alt+left.
3812 -- Go back in the history (or the context history).
3813 do
3814 if context_tool_has_focus then
3815 if context_tool.history_manager.is_back_possible then
3816 context_tool.history_manager.back_command.execute
3817 end
3818 elseif history_manager.is_back_possible then
3819 history_manager.back_command.execute
3820 end
3821 end
3822
3823 on_forth is
3824 -- User pressed Alt+right.
3825 -- Go forth in the history (or the context history).
3826 do
3827 if context_tool_has_focus then
3828 if context_tool.history_manager.is_forth_possible then
3829 context_tool.history_manager.forth_command.execute
3830 end
3831 elseif history_manager.is_forth_possible then
3832 history_manager.forth_command.execute
3833 end
3834 end
3835
3836 context_tool_has_focus: BOOLEAN is
3837 -- Does the context tool or one of its children has the focus?
3838 local
3839 fw: EV_WIDGET
3840 cont: EV_CONTAINER
3841 wid: EV_WIDGET
3842 do
3843 fw := (create {EV_ENVIRONMENT}).application.focused_widget
3844 wid := context_tool.explorer_bar_item.widget
3845 if wid = fw then
3846 Result := True
3847 elseif fw = Void then
3848 Result := False
3849 else
3850 from
3851 cont := fw.parent
3852 until
3853 cont = wid or cont = Void
3854 loop
3855 cont := cont.parent
3856 end
3857 if cont = wid then
3858 Result := True
3859 end
3860 end
3861 end
3862
3863 saved_cursor: CURSOR
3864 -- Saved cursor position for displaying the stack.
3865
3866 can_drop (st: ANY): BOOLEAN is
3867 -- Can the user drop the stone `st'?
3868 local
3869 conv_ace: ACE_SYNTAX_STONE
3870 do
3871 conv_ace ?= st
3872 Result := conv_ace = Void
3873 end
3874
3875 send_stone_to_context is
3876 -- Send current stone to the context tool.
3877 -- Used by `send_stone_to_context_cmd'.
3878 do
3879 if stone /= Void then
3880 context_tool.set_stone (stone)
3881 end
3882 end
3883
3884 destroy is
3885 -- check if current text has been saved and destroy
3886 local
3887 dialog_w: EV_WARNING_DIALOG
3888 do
3889 if Window_manager.development_windows_count > 1 and then process_manager.is_external_command_running and then Current = external_output_manager.target_development_window then
3890 process_manager.confirm_external_command_termination (agent terminate_external_command_and_destroy, agent do_nothing, window)
3891 else
3892 if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
3893 if Window_manager.development_windows_count > 1 then
3894 create dialog_w.make_with_text (Warning_messages.w_save_before_closing)
3895 dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<agent save_and_destroy, agent force_destroy, agent do_nothing>>)
3896 dialog_w.set_default_push_button (dialog_w.button("Yes"))
3897 dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
3898 dialog_w.show_modal_to_window (window)
3899 else
3900 -- We let the window manager handle the saving, along with other windows
3901 -- (not development windows)
3902 force_destroy
3903 end
3904 else
3905 Precursor {EB_TOOL_MANAGER}
3906 if context_refreshing_timer /= Void then
3907 context_refreshing_timer.destroy
3908 context_refreshing_timer := Void
3909 end
3910 end
3911 end
3912 end
3913
3914 terminate_external_command_and_destroy is
3915 -- Terminate running external command and destroy.
3916 do
3917 process_manager.terminate_external_command
3918 destroy
3919 ensure
3920 external_command_not_running: not process_manager.is_external_command_running
3921 end
3922
3923 save_and_destroy is
3924 do
3925 save_text
3926 destroy
3927 end
3928
3929 force_destroy is
3930 -- Destroy without asking.
3931 do
3932 confirmed := True
3933 destroy
3934 confirmed := False
3935 end
3936
3937 confirmed: BOOLEAN
3938 -- Did the user say he wanted to exit?
3939
3940 show_dynamic_library_dialog is
3941 -- Create a new dynamic library window and display it.
3942 do
3943 Window_manager.create_dynamic_lib_window
3944 end
3945
3946 context_refreshing_timer: EV_TIMEOUT
3947 -- Timer to refresh feature tree address bar.
3948
3949 on_viewpoint_changed is
3950 -- Switch viewpoint.
3951 local
3952 l_formatter: EB_CLASS_TEXT_FORMATTER
3953 l_line: INTEGER
3954 do
3955 l_formatter := selected_formatter
3956 if l_formatter.button.is_sensitive and then l_formatter /= managed_main_formatters.first then
3957 l_line := editor_tool.text_area.first_line_displayed
3958 l_formatter.execute
3959 editor_tool.text_area.display_line_at_top_when_ready (l_line)
3960 end
3961 end
3962
3963 selected_formatter: EB_CLASS_TEXT_FORMATTER is
3964 -- Current selected formatter
3965 local
3966 l_end : BOOLEAN
3967 l_index: INTEGER
3968 l_formatter: like managed_main_formatters
3969 do
3970 l_formatter := managed_main_formatters
3971 l_index := l_formatter.index
3972 from
3973 l_formatter.start
3974 until
3975 l_formatter.after or l_end
3976 loop
3977 if l_formatter.item.selected then
3978 l_end := true
3979 Result := l_formatter.item
3980 end
3981 l_formatter.forth
3982 end
3983 l_formatter.go_i_th (l_index)
3984 end
3985
3986 feature -- Recycle
3987
3988 recycle is
3989 -- Call the precursors.
3990 do
3991 recycle_command
3992 recycle_formatters
3993 recycle_menu
3994 Precursor {EB_TOOL_MANAGER}
3995 save_as_cmd.recycle
3996 open_cmd.recycle
3997 save_cmd.recycle
3998 save_as_cmd := Void
3999 open_cmd := Void
4000 save_cmd := Void
4001 command_controller.recycle
4002 if refactoring_manager /= Void then
4003 refactoring_manager.destroy
4004 end
4005 editor_tool := Void
4006 favorites_tool := Void
4007 history_manager := Void
4008 features_tool := Void
4009 breakpoints_tool := Void
4010 favorites_manager := Void
4011 cluster_manager := Void
4012 search_tool := Void
4013 editors.wipe_out
4014 end
4015
4016 recycle_command is
4017 -- Recycle command
4018 local
4019 os_cmd: EB_ON_SELECTION_COMMAND
4020 do
4021 c_finalized_compilation_cmd.recycle
4022 c_workbench_compilation_cmd.recycle
4023 editor_paste_cmd.recycle
4024 new_class_cmd.recycle
4025 new_cluster_cmd.recycle
4026 new_feature_cmd.recycle
4027 shell_cmd.recycle
4028 toggle_feature_alias_cmd.recycle
4029 toggle_feature_assigner_cmd.recycle
4030 toggle_feature_signature_cmd.recycle
4031 undo_cmd.recycle
4032 redo_cmd.recycle
4033 toggle_stone_cmd.recycle
4034 delete_class_cluster_cmd.recycle
4035 print_cmd.recycle
4036 from
4037 show_tool_commands.start
4038 until
4039 show_tool_commands.after
4040 loop
4041 show_tool_commands.item.recycle
4042 show_tool_commands.forth
4043 end
4044 show_tool_commands.wipe_out
4045 show_tool_commands := Void
4046
4047 from
4048 toolbarable_commands.start
4049 until
4050 toolbarable_commands.after
4051 loop
4052 os_cmd ?= toolbarable_commands.item
4053 if os_cmd /= Void then
4054 os_cmd.recycle
4055 end
4056 toolbarable_commands.forth
4057 end
4058
4059 c_finalized_compilation_cmd := Void
4060 c_finalized_compilation_cmd := Void
4061 new_class_cmd := Void
4062 new_cluster_cmd := Void
4063 new_feature_cmd := Void
4064 shell_cmd := Void
4065 toggle_feature_alias_cmd := Void
4066 toggle_feature_assigner_cmd := Void
4067 toggle_feature_signature_cmd := Void
4068 undo_cmd := Void
4069 redo_cmd := Void
4070 toggle_stone_cmd := Void
4071 delete_class_cluster_cmd := Void
4072 print_cmd := Void
4073 end
4074
4075 recycle_formatters is
4076 -- Recycle formatters
4077 do
4078 from
4079 managed_class_formatters.start
4080 until
4081 managed_class_formatters.after
4082 loop
4083 if managed_class_formatters.item /= Void then
4084 managed_class_formatters.item.recycle
4085 end
4086 managed_class_formatters.forth
4087 end
4088
4089 from
4090 managed_feature_formatters.start
4091 until
4092 managed_feature_formatters.after
4093 loop
4094 if managed_feature_formatters.item /= Void then
4095 managed_feature_formatters.item.recycle
4096 end
4097 managed_feature_formatters.forth
4098 end
4099
4100 from
4101 managed_main_formatters.start
4102 until
4103 managed_main_formatters.after
4104 loop
4105 if managed_main_formatters.item /= Void then
4106 managed_main_formatters.item.recycle
4107 end
4108 managed_main_formatters.forth
4109 end
4110 end
4111
4112 recycle_menu is
4113 --
4114 do
4115 tools_menu.destroy
4116 window_menu.destroy
4117 metric_menu.destroy
4118 -- compile_menu.destroy
4119 debug_menu.destroy
4120 debugging_tools_menu.destroy
4121 favorites_menu.destroy
4122 view_menu.destroy
4123
4124 tools_menu := Void
4125 window_menu := Void
4126 metric_menu := Void
4127 format_menu := Void
4128 compile_menu := Void
4129 debug_menu := Void
4130 debugging_tools_menu := Void
4131 favorites_menu := Void
4132 view_menu := Void
4133 end
4134
4135
4136 feature {NONE} -- Implementation: Editor commands
4137
4138 refresh_cursor_position is
4139 -- Display the current cursor position in the status bar.
4140 require
4141 text_loaded: not is_empty
4142 local
4143 l, c, v: INTEGER
4144 do
4145 l := editor_tool.text_area.cursor_y_position
4146 c := editor_tool.text_area.cursor_x_position
4147 v := editor_tool.text_area.cursor_visible_x_position
4148 status_bar.set_cursor_position (l, c, v)
4149 end
4150
4151 refresh_context_info is
4152 -- Refresh address bar and features tool to relect
4153 -- where in the code the cursor is located.
4154 local
4155 l_feature: FEATURE_AS
4156 l_classc_stone: CLASSC_STONE
4157 do
4158 context_refreshing_timer.set_interval (0)
4159 l_classc_stone ?= stone
4160 if l_classc_stone /= Void then
4161 l_feature := editor_tool.text_area.text_displayed.current_feature_containing
4162 if l_feature /= Void then
4163 set_editing_location_by_feature (l_feature)
4164 else
4165 set_editing_location_by_feature (Void)
4166 end
4167 end
4168 end
4169
4170 set_editing_location_by_feature (a_feature: FEATURE_AS) is
4171 -- Set editing location, feature tool and combo box changes according to `a_feature'.
4172 local
4173 l_efeature: E_FEATURE
4174 l_class_i: CLASS_I
4175 l_classc: CLASS_C
4176 do
4177 if a_feature /= Void then
4178 address_manager.set_feature_text_simply (a_feature.feature_names.first.internal_name)
4179 l_class_i := eiffel_universe.safe_class_named (class_name, group)
4180 if l_class_i /= Void and then l_class_i.is_compiled then
4181 l_classc := l_class_i.compiled_class
4182 if l_classc.has_feature_table then
4183 l_efeature := l_classc.feature_with_name (a_feature.feature_names.first.internal_name)
4184 if l_efeature /= Void and then l_efeature.written_in /= l_classc.class_id then
4185 l_efeature := Void
4186 end
4187 end
4188 end
4189 if l_efeature /= Void then
4190 seek_item_in_feature_tool (l_efeature)
4191 else
4192 features_tool.seek_ast_item_in_feature_tool (a_feature.feature_names.first.internal_name)
4193 end
4194 else
4195 address_manager.set_feature_text_simply (once "")
4196 seek_item_in_feature_tool (Void)
4197 end
4198 end
4199
4200 seek_item_in_feature_tool (a_feature: E_FEATURE) is
4201 -- Seek and select item contains data of `a_feature' in features tool.
4202 -- If `a_feature' is void, deselect item in features tool.
4203 do
4204 features_tool.seek_item_in_feature_tool (a_feature)
4205 end
4206
4207 select_all is
4208 -- Select the whole text in the focused editor.
4209 do
4210 current_editor.select_all
4211 end
4212
4213 search is
4214 -- Search some text in the focused editor.
4215 local
4216 cv_ced: EB_CLICKABLE_EDITOR
4217 do
4218 cv_ced ?= current_editor
4219 if cv_ced /= Void then
4220 cv_ced.search
4221 end
4222 end
4223
4224 goto is
4225 -- Display a dialog to select a line to go to in the editor.
4226 local
4227 ed: EB_EDITOR
4228 do
4229 ed ?= current_editor
4230 if ed /= Void then
4231 create goto_dialog.make (ed)
4232 goto_dialog.show_modal_to_window (Current.window)
4233 end
4234 end
4235
4236 toggle_line_number_display is
4237 -- Toggle line number display on/off in editor
4238 do
4239 preferences.editor_data.show_line_numbers_preference.set_value (not preferences.editor_data.show_line_numbers)
4240 end
4241
4242 find_next is
4243 -- Find the next occurrence of the search text.
4244 local
4245 cv_ced: EB_CLICKABLE_EDITOR
4246 do
4247 if search_tool.currently_searched /= Void then
4248 cv_ced ?= current_editor
4249 if cv_ced /= Void then
4250 cv_ced.find_next
4251 end
4252 else
4253 search_tool.show_and_set_focus
4254 end
4255 end
4256
4257 find_previous is
4258 -- Find the previous occurrence of the search text.
4259 local
4260 cv_ced: EB_CLICKABLE_EDITOR
4261 do
4262 if search_tool.currently_searched /= Void then
4263 cv_ced ?= current_editor
4264 if cv_ced /= Void then
4265 cv_ced.find_previous
4266 end
4267 else
4268 search_tool.show_and_set_focus
4269 end
4270 end
4271
4272 find_selection is
4273 -- Find the next occurrence of the selection.
4274 local
4275 cv_ced: EB_CLICKABLE_EDITOR
4276 do
4277 cv_ced ?= current_editor
4278 if cv_ced /= Void then
4279 cv_ced.find_selection
4280 end
4281 end
4282
4283 cut_selection is
4284 -- Cut the selection in the current editor.
4285 do
4286 current_editor.cut_selection
4287 end
4288
4289 copy_selection is
4290 -- Cut the selection in the current editor.
4291 do
4292 current_editor.copy_selection
4293 end
4294
4295 toggle_formatting_marks is
4296 -- Show/Hide formatting marks in the editor and update related menu item.
4297 do
4298 current_editor.toggle_view_invisible_symbols
4299 if current_editor.view_invisible_symbols then
4300 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
4301 else
4302 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
4303 end
4304 end
4305
4306 feature {NONE} -- Implementation / Menus
4307
4308 number_of_displayed_external_commands: INTEGER
4309 -- Number of external commands in the tools menu.
4310
4311 old_cur: EV_CURSOR
4312 -- Cursor saved while displaying the hourglass cursor.
4313
4314 cur_wid: EV_WIDGET
4315 -- Widget on which the hourglass cursor was set.
4316
4317 project_menu: EV_MENU
4318 -- Menu for entries relative to the Project.
4319
4320 recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
4321 -- SubMenu for recent projects.
4322
4323 during_synchronization: BOOLEAN
4324 -- Are we during a resynchronization?
4325
4326 formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
4327 -- Menu item used to shw/hide formatting marks.
4328
4329 undo_accelerator: EV_ACCELERATOR
4330 -- Accelerator for Ctrl+Z
4331
4332 redo_accelerator: EV_ACCELERATOR
4333 -- Accelerator for Ctrl+Y
4334
4335 feature {EB_TOOL} -- Implementation / Commands
4336
4337 shell_cmd: EB_OPEN_SHELL_COMMAND
4338 -- Command to use an external editor.
4339
4340 undo_cmd: EB_UNDO_COMMAND
4341 -- Command to undo in the editor.
4342
4343 redo_cmd: EB_REDO_COMMAND
4344 -- Command to redo in the editor.
4345
4346 editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
4347 -- Command to paste text in the editor.
4348
4349 melt_cmd: EB_MELT_PROJECT_COMMAND
4350 -- Command to start compilation.
4351
4352 feature{EB_TOOL, EB_C_COMPILER_LAUNCHER}
4353
4354 c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
4355 -- Command to compile the workbench C code.
4356
4357 c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
4358 -- Command to compile the finalized C code.
4359
4360 feature{EB_TOOL}
4361
4362 new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
4363 -- Command to create a new cluster.
4364
4365 new_class_cmd: EB_NEW_CLASS_COMMAND
4366 -- Command to create a new class.
4367
4368 new_feature_cmd: EB_NEW_FEATURE_COMMAND
4369 -- Command to execute the feature wizard.
4370
4371 toggle_feature_alias_cmd: EB_TOGGLE_FEATURE_ALIAS_COMMAND
4372 -- Show/Hide alias name of feature node in eb_feature_tool
4373
4374 toggle_feature_signature_cmd: EB_TOGGLE_FEATURE_SIGNATURE_COMMAND
4375 -- Show/Hide signature of feature node in eb_feature_tool
4376
4377 toggle_feature_assigner_cmd: EB_TOGGLE_FEATURE_ASSIGNER_COMMAND
4378 -- Show/Hide assigner name of feature node in eb_feature_tool
4379
4380 toggle_stone_cmd: EB_UNIFY_STONE_CMD
4381 -- Command to toggle between the stone management modes.
4382
4383 delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
4384 -- Command to remove a class or a cluster from the system
4385 -- (permanent deletion).
4386
4387 show_profiler: EB_SHOW_PROFILE_TOOL
4388 -- What allows us to display the profiler window.
4389
4390 toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
4391 -- All commands that can be put in a toolbar.
4392
4393 command_controller: EB_EDITOR_COMMAND_CONTROLLER
4394 -- Object that takes care of updating the sensitivity of all editor commands.
4395
4396 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
4397 -- Command to save a class with a different file name.
4398
4399 feature{EB_TOOL, EB_EXTERNAL_OUTPUT_TOOL}
4400
4401 Edit_external_commands_cmd: EB_EXTERNAL_COMMANDS_EDITOR is
4402 -- Command that lets the user add new external commands to the tools menu.
4403 once
4404 create Result.make
4405 Result.enable_sensitive
4406 end
4407
4408 feature{EB_TOOL}
4409
4410 system_info_cmd: EB_STANDARD_CMD is
4411 -- Command to display information about the system (root class,...)
4412 do
4413 Result := Eb_debugger_manager.system_info_cmd
4414 end
4415
4416 display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
4417 -- Command to pop up a dialog giving help on compilation errors.
4418 do
4419 Result := Eb_debugger_manager.display_error_help_cmd
4420 end
4421
4422 send_stone_to_context_cmd: EB_STANDARD_CMD
4423 -- Command to send the current stone to the context tool.
4424
4425 print_cmd: EB_PRINT_COMMAND
4426 -- Command to print the content of editor with focus
4427
4428 eac_browser_cmd: EB_OPEN_EAC_BROWSER_CMD is
4429 -- Command to display the eac browser
4430 do
4431 Result := Eb_debugger_manager.eac_browser_cmd
4432 end
4433
4434 show_favorites_menu_item: EV_MENU_ITEM
4435 -- Show/Hide favorites menu item.
4436
4437 update_show_favorites_menu_item is
4438 -- Update `show_favorites_menu_item' menu label.
4439 do
4440 if favorites_tool.shown then
4441 show_favorites_menu_item.set_text (Interface_names.m_hide_favorites)
4442 else
4443 show_favorites_menu_item.set_text (Interface_names.m_show_favorites)
4444 end
4445 end
4446
4447 execute_show_favorites is
4448 -- Show `favorites_tool' if it is closed, close
4449 -- it in the opposite case.
4450 do
4451 update_show_favorites_menu_item
4452 if favorites_tool.shown then
4453 favorites_tool.close
4454 else
4455 favorites_tool.show
4456 end
4457 end
4458
4459 feature {EB_TOOL_WINDOW, EB_EXPLORER_BAR, EB_DEBUGGER_MANAGER} -- Floating tool handling
4460
4461 all_tool_windows: ARRAYED_LIST [EB_TOOL_WINDOW]
4462 -- All tool windows under the control of `Current'.
4463
4464 add_tool_window (a_tool_window: EB_TOOL_WINDOW) is
4465 -- Add `a_tool_window' to `all_tool_windows', ensuring it is
4466 -- then under the control of `Current'.
4467 require
4468 a_tool_window_not_void: a_tool_window /= Void
4469 do
4470 if all_tool_windows = Void then
4471 create all_tool_windows.make (2)
4472 end
4473 all_tool_windows.extend (a_tool_window)
4474 ensure
4475 extended: all_tool_windows.has (a_tool_window)
4476 end
4477
4478 remove_tool_window (a_widget: EV_WIDGET) is
4479 -- Remove tool window associate with `a_widget'.
4480 require
4481 a_widget_not_void: a_widget /= Void
4482 do
4483 if all_tool_windows /= Void then
4484 from
4485 all_tool_windows.start
4486 until
4487 all_tool_windows.off
4488 loop
4489 if all_tool_windows.item.tool = a_widget then
4490 all_tool_windows.remove
4491 all_tool_windows.finish
4492 end
4493 all_tool_windows.forth
4494 end
4495 end
4496 end
4497
4498 remove_all_tool_windows is
4499 -- Ensure `all_tool_windows' is empty if non Void.
4500 do
4501 if all_tool_windows /= Void then
4502 all_tool_windows.wipe_out
4503 end
4504 ensure
4505 tool_windows_empty: all_tool_windows /= Void implies all_tool_windows.is_empty
4506 end
4507
4508 window_moved (x_pos, y_pos: INTEGER) is
4509 -- `Current' has been moved, so move all associated tool windows within `all_tool_windows'.
4510 local
4511 tool_window: EB_TOOL_WINDOW
4512 do
4513 if all_tool_windows /= Void then
4514 from
4515 all_tool_windows.start
4516 until
4517 all_tool_windows.off
4518 loop
4519 tool_window := all_tool_windows.item
4520 check
4521 not_destroyed: not tool_window.window.is_destroyed
4522 end
4523 if preferences.development_window_data.dock_tracking then
4524 tool_window.window.move_actions.block
4525 tool_window.window.set_x_position (x_pos + tool_window.x_position)
4526 tool_window.window.set_y_position (y_pos + tool_window.y_position)
4527 tool_window.window.move_actions.resume
4528 else
4529 -- If we are not performing dock tracking, we must update the relative position
4530 -- of the tool window, so that if dock tracking is enabled, the relative
4531 -- positions are correct.
4532 tool_window.set_x_position ( tool_window.window.screen_x - x_pos)
4533 tool_window.set_y_position ( tool_window.window.screen_y - y_pos)
4534 end
4535 all_tool_windows.forth
4536 end
4537 end
4538 end
4539
4540 feature {NONE} -- Execution
4541
4542 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
4543 -- Action called when the user right-click in the toolbar.
4544 -- Display a popup menu to show/hide toolbars and customize the general toolbar.
4545 local
4546 popup_menu: EV_MENU
4547 do
4548 if a_button = 3 then
4549 popup_menu := build_toolbar_menu
4550 popup_menu.show
4551 end
4552 end
4553
4554 enable_commands_on_project_created is
4555 -- Enable commands when a new project has been created (not yet compiled)
4556 do
4557 system_info_cmd.enable_sensitive
4558 if
4559 stone /= Void and then
4560 not unified_stone
4561 then
4562 send_stone_to_context_cmd.enable_sensitive
4563 end
4564 end
4565
4566 enable_commands_on_project_loaded is
4567 -- Enable commands when a new project has been created and compiled
4568 do
4569 if has_profiler then
4570 show_profiler.enable_sensitive
4571 end
4572 if has_dll_generation then
4573 show_dynamic_lib_tool.enable_sensitive
4574 end
4575 open_cmd.enable_sensitive
4576 new_class_cmd.enable_sensitive
4577 new_cluster_cmd.enable_sensitive
4578 system_info_cmd.enable_sensitive
4579 if unified_stone then
4580 send_stone_to_context_cmd.disable_sensitive
4581 elseif stone /= Void then
4582 send_stone_to_context_cmd.enable_sensitive
4583 end
4584 new_class_cmd.enable_sensitive
4585 new_cluster_cmd.enable_sensitive
4586 delete_class_cluster_cmd.enable_sensitive
4587 c_workbench_compilation_cmd.enable_sensitive
4588 c_finalized_compilation_cmd.enable_sensitive
4589 refactoring_manager.enable_sensitive
4590 end
4591
4592 disable_commands_on_project_unloaded is
4593 -- Enable commands when a project has been closed.
4594 do
4595 if has_dll_generation then
4596 show_dynamic_lib_tool.disable_sensitive
4597 end
4598 if has_profiler then
4599 show_profiler.disable_sensitive
4600 end
4601 open_cmd.disable_sensitive
4602 new_class_cmd.disable_sensitive
4603 new_cluster_cmd.disable_sensitive
4604 if not project_manager.is_created then
4605 system_info_cmd.disable_sensitive
4606 send_stone_to_context_cmd.disable_sensitive
4607 end
4608 delete_class_cluster_cmd.disable_sensitive
4609 c_workbench_compilation_cmd.disable_sensitive
4610 c_finalized_compilation_cmd.disable_sensitive
4611 refactoring_manager.disable_sensitive
4612 refactoring_manager.forget_undo_redo
4613 end
4614
4615 feature {NONE} -- Access
4616
4617 development_window_data: EB_DEVELOPMENT_WINDOW_DATA is
4618 -- Meta data describing `Current'.
4619 do
4620 if internal_development_window_data /= Void then
4621 Result := internal_development_window_data
4622 else
4623 Result := preferences.development_window_data
4624 end
4625 end
4626
4627 internal_development_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA;
4628 -- Internal custom meta data for `Current'.
4629
4630 feature {NONE} -- Implementation
4631
4632 is_string_started_by (s1, s2: STRING_GENERAL): BOOLEAN is
4633 -- Is `s1' starting by `s2' characters
4634 require
4635 s2_not_void: s2 /= Void
4636 local
4637 i: INTEGER
4638 do
4639 if s1 /= Void and then s1.count >= s2.count then
4640 from
4641 i := 1
4642 Result := True
4643 until
4644 i > s2.count or not Result
4645 loop
4646 Result := s1.code (i) = s2.code (i)
4647 i := i + 1
4648 end
4649 end
4650 end
4651
4652 indexing
4653 copyright: "Copyright (c) 1984-2006, Eiffel Software"
4654 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
4655 licensing_options: "http://www.eiffel.com/licensing"
4656 copying: "[
4657 This file is part of Eiffel Software's Eiffel Development Environment.
4658
4659 Eiffel Software's Eiffel Development Environment is free
4660 software; you can redistribute it and/or modify it under
4661 the terms of the GNU General Public License as published
4662 by the Free Software Foundation, version 2 of the License
4663 (available at the URL listed under "license" above).
4664
4665 Eiffel Software's Eiffel Development Environment is
4666 distributed in the hope that it will be useful, but
4667 WITHOUT ANY WARRANTY; without even the implied warranty
4668 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4669 See the GNU General Public License for more details.
4670
4671 You should have received a copy of the GNU General Public
4672 License along with Eiffel Software's Eiffel Development
4673 Environment; if not, write to the Free Software Foundation,
4674 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
4675 ]"
4676 source: "[
4677 Eiffel Software
4678 356 Storke Road, Goleta, CA 93117 USA
4679 Telephone 805-685-1006, Fax 805-685-6869
4680 Website http://www.eiffel.com
4681 Customer support http://support.eiffel.com
4682 ]"
4683
4684 end -- class EB_DEVELOPMENT_WINDOW

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23