/[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 57792 - (show annotations)
Mon Mar 27 22:23:59 2006 UTC (13 years, 10 months ago) by patrickr
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 129068 byte(s)
Commented out code that is broken from the new configuration system, added conf_todo and conf_todo_msg statements

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