/[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 61590 - (show annotations)
Mon Jul 24 22:01:40 2006 UTC (13 years, 7 months ago) by tedf
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 142980 byte(s)
Removed accelerator ESC for show/hide editor tool.
Removed "Search last" which was to search the previous keyword as it is rarely used.
Changed search behaviors with Find next and Find selection. Being clearer, Find Next, Find Previous, Find Next Selection and Find Previous Selection remain.

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