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