/[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 58520 - (show annotations)
Thu Apr 27 20:54:45 2006 UTC (13 years, 10 months ago) by manus
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 130190 byte(s)
Updated `formatted_context_for_cluster' to new configuration file library.
  Added new description from config file rather than from indexing clauses.

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