/[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 55756 - (show annotations)
Wed Nov 16 19:03:23 2005 UTC (14 years, 3 months ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 121796 byte(s)
Added a timer that makes feature tree and addressing reflecting perform only at 0.1s after last cursor movement.

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