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