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