/[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 56410 - (show annotations)
Wed Dec 28 21:34:54 2005 UTC (14 years, 1 month ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 124264 byte(s)
Fixed, on Unix, feature tree scrolls to the located item.

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