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